fix(mcp): drop redundant events[] from wait_for_chat response#93
Merged
Conversation
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.
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
wait_for_chatpreviously 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 witheventCount: numberfor 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.response.events; the field exists purely for the MCP client (Claude).Test plan
pnpm typecheckcleanpnpm test— 984 / 984 passwait_for_chat, confirm result is now <2KB andeventCountreflects actual event count