Repository navigation
Raise the MCP bridge's input limit to fit the server's tool schemas - #145
Open
ammartahamohamedy wants to merge 1 commit into
Open
ammartahamohamedy wants to merge 1 commit into
ammartahamohamedy wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Fixes #144
Problem
The bridge caps an input line at 8,192 bytes. A longer one gets a null-id error, and the bridge exits, taking every Proofline tool away from the agent. A full-length
ask_codebasequestion in a CJK script is about 12 KB, andreview_rule.createaccepts 65,536 characters. The native commands share the cap, soproofline askfails on the same question.Fix
FRAME_LIMITis 1 MiB. The largest bounded schema string is 65,536 characters. Escaped in full, that's 384 KiB at six bytes per\uXXXX, or 768 KiB at worst, when every character is outside the BMP and takes a twelve-byte surrogate pair. Either way 1 MiB leaves room for the envelope. Fields with no schema limit (finishing_recipe.create'sinstructions) still stop at the limit. The bridge stays bounded and serial.read_framegrows its buffer as the line arrives, and stdin uses the defaultBufReadercapacity. Otherwise the new limit would cost 1 MiB per bridge and per message.MCP input exceeds {FRAME_LIMIT} bytes).Tests (written first; the new and updated tests failed before the change)
a_full_length_question_in_a_cjk_script_is_relayed_and_the_session_continues(new,tests/mcp.rs)ask_codebasequestion (more than 12,000 bytes) is relayed under its own id, and apingafter it still works. Before: the bridge exiteda_native_call_carries_a_full_length_question_in_a_cjk_script(new,src/mcp.rsunit)mcp::call, whichproofline askuses, sends the same question through. Before:TooLarge. The existing native test's stand-in server moved into a shared helperbounded_frames_serial_backpressure_and_broken_stdout_release_the_actual_process(updated)FRAME_LIMITbytes is relayed, and one byte more is refused with the null-id error and an exitconfig_input_and_credential_failures_make_no_tool_call(updated,tests/http.rs)config proposeinput is still refused before any tool call, now at 1 MiB (MCP input exceeds 1048576 bytes)Mutation checks: a limit of 16 KiB fails the bounded-frames test, and restoring 8,192 fails all four.
End to end, offline, with the built binary: the issue's 3,600-character case now gets an answer under id 7, the ping is answered, and the exit code is 0.
Checks
cargo fmt --check: ✅cargo clippy --locked -- -D warnings: clean on the lib, the bins and every integration test.--all-targetsstops at the 2 errorsmainalready has on Windows (src/agent/tests.rs).cargo test --locked: the changed tests pass.tests/mcp.rscan't run on Windows: the harness starts the bridge withenv_clear(), which dropsSystemRoot, so every test in it times out, onmaintoo. With a temporary, uncommittedSystemRootpass-through (what fix(windows): unblock cargo clippy and Windows integration tests #103 proposes), all 8 pass on Windows. Apart from that file, the same Windows failures as onmain.cargo deny check: no dependency changes.checkandwindowsgreen on ammar-taha-dev/proofline-cli#4 (commite20bb99; rebased onto22c86caas8e7da22, which touches none of these files). The Linuxcheckjob runstests/mcp.rs, including the new test.Proofline review log
Fork review PR: ammar-taha-dev/proofline-cli#4. Rounds capped at 2.
The prompt below is the one that drove this implementation; the investigation, reproduction and fix scope were done before it and aren't included.