feat(harness): standardize websocket event contract - #131
Merged
07prajwal2000 merged 2 commits intoJul 28, 2026
Merged
Conversation
Every harness update now travels as one event shape instead of five overlapping ones. `phase`/`node`/`status`/`stepId`/`warning` are replaced by `currentNode`, `nodeId`, `nodeStatus` (started|running|ended), `executionType` (agent|tool), `toolName` and `plainTextMessage`. `nodeId` (`blockBuilder:task-7`) is the client's key: sub-agents run several instances of the same node concurrently, which `stepId` could not express and `currentNode` collides on. Tool calls are no longer a silent gap inside an agent. The tool loop in models/base.ts dispatches a `tool_call` custom event around every invocation; HarnessCallbacks renders it as an `executionType: tool` event on the parent's nodeId, with a result summary (found 3 routes). Sub-agents pass `agentId` so those events stay attributable. Runs are now bookended on a synthetic `run` node: an opening event emitted before the AI-provider probe (so even a dead-provider run has a full log), and a closing event carrying the complete result -- final markdown, artifactId and error -- for completed, awaiting_hitl, failed, interrupted and rejected alike. That closing event is the only termination signal; a terminal `runStatus` on its own no longer implies one. Redis already queued events per run and replayed them as `full_state` on connect; the cap moves 200 -> 500 since tool pairs double the volume. Documented in apps/ai-gateway/src/harness/harness_events.md, which replaces harness-client-implementation-guide.md (it described the old contract in full and would have misled the UI work). The portal store is migrated to the new contract and its reducer tests rewritten; the AI components are only patched to compile -- nothing yet renders tool progress, per-instance sub-agent rows, or run.result. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ons list Unify harness websocket event contract across model providers, add a shared jsonbColumn helper for db schema, expose integrations basic-list API, and add a status accordion UI for harness runs. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
jsonbColumnhelper for Drizzle schema definitions and applies it inagent-harness-schema.ts/schema.ts.HarnessStatusAccordionUI to surface per-node/tool run status in the conversation view.BaseAgentWrapper(ai-gateway) to extract the tool-execution loop and pure JSON-handling helpers intojsonUtils.ts, reducing complexity while preserving behavior.toolNameset instead of clearing it.Test plan
bun x tsgo --noEmit(ai-gateway) passesbun test— 340 tests pass across 74 files