Repository navigation
mcp(fix): Preserve outcomes and cursors at the frame limit - #194
Merged
Merged
Conversation
This was referenced Dec 5, 2026
why: A retained workspace journal could fit in memory but exceed the JSON-RPC response limit. Polling then lost the operation outcome. what: - Size the tool response including its encoded request ID and newline. - Retain the outcome with a journal error when the frame would exceed the limit. - Poll an oversized result over STDIO with two valid request IDs.
why: Up to sixteen escaped pane titles could overflow one JSON-RPC frame. The adapter discarded the previous cursor before encoding the page, trapping callers partway through an immutable observation. what: - Send the largest ordered prefix that fits the response budget. - Replace the cursor when its successor and encoded reply are ready. - Identify display fields omitted at the existing per-field limit. - Traverse quote-heavy titles and verify cursor scope and replay.
tony
force-pushed
the
mcp-response-budget
branch
from
December 6, 2026 01:08
f72df74 to
89df3c4
Compare
tony
added a commit
that referenced
this pull request
Dec 6, 2026
why: A tmux hook could add output to a pane or option read. A large MCP reply could hide an operation outcome or advance a cursor before the client received the page. what: - Fit the Program listener to the server socket path, wake waiters on exit, and retry pane removal after a lost reply (#191, #192, #193). - Keep MCP operation outcomes readable and size pages before advancing their cursors. Show the STDIO client reading a result (#194, #195). - Keep hook output out of pane captures and option reads. Use `Pane.wait_for_text/4` in the notebook (#196, #197). - Check root exit separately from trace delivery in cold-start tests (#198). - Document checkout dependencies, inherited sockets and capability APIs (#199, #200, #201).
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.
Closes #180.
Closes #181.
What changed, and why
A retained journal or a page of escaped display fields can exceed the JSON-RPC wire limit. The encoder accounts for the request ID, envelope and newline. A large journal keeps its operation outcome and reports the journal limit. Pagination prepares an encodable response and successor before consuming the cursor. The two issues meet in the frame-size calculation.
Checks run
The STDIO suites ran on pristine tmux 3.3 and upstream 3.8. They poll large journals with distinct request IDs and walk pages whose values expand during JSON encoding.
Review evidence
The MCP encoder owns the complete response frame, including the request ID. Both operation polling and pane pagination consult it before dropping evidence or consuming a cursor.
With the topic tests and the runtime code from
178ab420b, the focused check failed. Both the oversized journal and the escaped pane page returned a JSON-RPCResponse limit exceedederror. The table gives the running time of each complete command on Linux.89df3c4baMerge stack
This PR follows #193 in the tested merge order. The comparison shows this PR’s own changes. Stack #206 · Changes in this PR
All six required Linux jobs passed on
89df3c4ba. GitHub records the stack merge at15b285de9. CI run · Merged commitTool use
Codex extracted this change from #169 and ran the checks above on the topic branch. A separate Codex reviewer checked the component boundaries and the two corrected test fixtures.