Repository navigation
Conversation
The bridge capped an input line at 8,192 bytes and exited on a longer one, so the agent lost every Proofline tool for the rest of its session. A full-length ask_codebase question (4,000 characters) in a CJK script is 12,000 bytes, so a call the server accepts never reached it. Raise the limit to 1 MiB, the same limit the CLI's bridge proposes for prooflinedev/cli#144. Past the limit nothing changes: the null-id error and the exit stay as designed. Collect a line's chunks and join them once at its newline. At 8 KiB the per-chunk copy didn't matter; at 1 MiB a line arriving in small chunks would be copied once per chunk. The test server now decodes the request body after joining its bytes, so multi-byte characters split across chunks stay intact.
Review follow-up for the three findings on this pull request. frames() kept a view of every input chunk in a list until the line ended, and yielded the joined line before clearing that list. A finely split line held one view, and its parent chunk, per piece, and the list stayed alive for the whole HTTP request. Each piece is now copied into a buffer the bridge owns, grown by doubling so the copying stays linear, and the line is detached before it is yielded. The README and the limit's comment said 1 MiB fits any schema-valid call. It fits the longest bounded string, but a call with several large fields or an unbounded one can exceed it. Both now describe a raw-byte limit. Add a test that runs the bridge in-process on input split into pieces of a fixed size: 7-byte pieces that cut multi-byte characters are reassembled exactly, and an over-limit line in 8 KiB pieces is refused before any of it reaches the server. Unlike the stdio tests, it doesn't depend on how the pipe happens to chunk input.
The in-process test imported bridge.js beside PROOFLINE_MCP_TEST_BIN as given. When that path is a symlink, such as node_modules/.bin/proofline-mcp on macOS and Linux, it looked in the link's folder and the whole suite failed to load. Spawning the binary had always followed the link, so this was a regression from the previous commit. Resolve the path first.
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.
Problem
The bridge caps an input line at 8,192 bytes. A longer line gets a null-id error and the bridge exits, so the coding agent loses every Proofline tool for the rest of its session until someone restarts it.
That cap is smaller than what the server accepts.
ask_codebaseallows a 4,000-character question; in a CJK script (3 bytes per character) that is 12,000 bytes, so a question the server would answer never reaches it. The CLI's bridge has the same limit, reported in prooflinedev/cli#144; this npm bridge has it too.Fix
REQUEST_LIMITis 1 MiB of raw bytes per line, the limit proposed for the CLI's bridge in Raise the MCP bridge's input limit to fit the server's tool schemas cli#145. It fits the longest bounded string in the tool schemas (65,536 characters, at most 768 KiB escaped) with room for the envelope. A call with several large fields, or an unbounded field, can still exceed it, and the README and the constant's comment say so.inputerror and the exit stay as designed, matching the CLI's choice.frames()copies each piece into a buffer it owns. At 1 MiB, the old copy-on-every-chunk loop would copy a finely split line once per chunk. Collecting views of the chunks instead would keep every chunk alive. An owned buffer grown by doubling keeps copying linear and keeps no input chunk alive, and the line is detached before it is yielded, so nothing extra is held while its request is in flight.Tests
a full-length question in a CJK script is relayed and the session continues(new)main: the bridge exits.an input line is bounded at 1 MiB(new)inputerror, exit 1, and never reaches the server.a line split into small pieces is relayed whole, and the limit counts the whole line(new)invalid frames and lifecycle never reach the server(updated)The test server now joins request bytes before decoding them, so multi-byte characters split across chunks stay intact.
Verification
mainand pass on this branch.endinstead ofsize + end) fails the split-input test; not resetting the size between lines fails 14 tests.npm run checkandnpm testpass, 16/16, on Windows 11 with Node 24.16.0.PROOFLINE_MCP_TEST_BIN, since Windows needs Developer Mode for file symlinks. The resolution was checked through a directory junction.npm run test:packagefails on Windows onmainas well (spawnSync npm.cmd EINVAL). #13 addresses that, so it isn't changed here.How I worked
I used Claude Code throughout. I chose this repository because it was the least contested, read the whole bridge, and noticed it shared the 8 KiB limit already reported against the CLI (prooflinedev/cli#144). I reproduced the failure before writing the fix and wrote tests that fail on
main. I asked Gemini for an independent security review and tested its claims: three reproduced, but they were low impact, and I left them out of this change. I ran Proofline and CodeRabbit on a review PR in my fork, plus a planted-bug PR scored against an answer key I wrote beforehand. Both caught the planted bug. On the real change they found four valid issues, one of them a regression from my own fix, and I fixed all four.Proofline review log
Fork review PR: bablamon#1. CodeRabbit reviewed the same PR as a second opinion.
frames()yielded before clearing its fragment list, holding them through the HTTP requestyieldOverlap with open PRs
#12, #13 and #14 edit the same files, so they will conflict textually. None of them changes the input limit. #13 also edits
frames()to skip blank lines. Whichever lands first, I'll rebase this onto it.