Skip to content

fix(mcp): drop redundant events[] from wait_for_chat response#93

Merged
chorus-codes merged 1 commit into
mainfrom
fix/mcp-wait-events-bloat
May 27, 2026
Merged

fix(mcp): drop redundant events[] from wait_for_chat response#93
chorus-codes merged 1 commit into
mainfrom
fix/mcp-wait-events-bloat

Conversation

@chorus-codes
Copy link
Copy Markdown
Owner

Summary

wait_for_chat previously embedded every captured progress event into the tool result. For an 8-reviewer chat this routinely produced 50KB+ payloads that exceeded the MCP client's per-result token budget — the client then spilled the whole blob to a file and forced a chunked re-read (the long-standing "results spill to file" issue noted in audit memory).

The events are already streamed live via notifications/progress (line 102), so the embedded copy was pure duplication. Replace with eventCount: number for debug visibility without the bloat.

Why this is safe

  • ChatResultSchema.parse() already strips the spread result down to 4 small fields (status, verdict, summary, blocked), so this PR only removes the events array.
  • No internal consumer reads response.events; the field exists purely for the MCP client (Claude).
  • Clients that relied on the live progress mechanism see no behaviour change.

Test plan

  • pnpm typecheck clean
  • pnpm test — 984 / 984 pass
  • Manual smoke: trigger a chat via MCP wait_for_chat, confirm result is now <2KB and eventCount reflects actual event count

The handler captured every progress event into an array and embedded
the whole thing into the tool result. An 8-reviewer chat routinely hit
50KB+, exceeding the MCP client's per-result token budget and forcing
the client to spill to file + chunked re-read.

The events are already streamed live via notifications/progress, so the
embedded copy was pure duplication. Replace with eventCount for debug.

Closes the long-standing "wait_for_chat results spill to file" issue
noted in reference_chorus_mcp_result_parsing memory.
@chorus-codes chorus-codes merged commit f40ab6b into main May 27, 2026
2 checks passed
@chorus-codes chorus-codes deleted the fix/mcp-wait-events-bloat branch May 27, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant