Fix flaky bundle verifier: stop parsing partial stdout lines - #15
Merged
Conversation
The isolated-bundle MCP check polls the accumulated stdout buffer every 50 ms and ran JSON.parse over every split segment -- including the trailing PARTIAL line while a response was still streaming. tools/list grew to 50 tools in v1.2 (hundreds of KB, always split across several pipe chunks), so a poll landing between two data events saw an incomplete JSON fragment, called it "non-JSON on stdout", and flaked the mandatory self-containment step on slow runners (post-merge main run, macOS node 20; the identical step passed minutes earlier on the PR). Only complete lines are protocol: the verifier now parses every line up to the last newline and leaves an in-flight fragment for the next poll. A COMPLETE non-JSON line still fails hard, so the stdout-purity guarantee is unchanged.
7 tasks
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
The post-merge
mainrun flaked on macOS/node 20 in "Verify the isolated plugin bundle" (failing job) with an uncaughtnon-JSON on stdouterror right after a successful MCP handshake. The bundle is fine — the verifier script has a latent parsing race that v1.2 made much more likely to fire.waitForpolls the accumulated stdout buffer every 50 ms and ranJSON.parseover everysplit('\n')segment — including the trailing partial line while a response is still streaming.tools/listgrew to 50 tools in v1.2, a payload of hundreds of KB that always arrives across several pipe chunks; a poll landing between twodataevents saw an incomplete JSON fragment and rejected it as a stdout-purity violation. That is why the identical step passed on the PR run minutes earlier and on three of four platforms in the failing run: it is a timing race, and the larger payload widened the window.The fix parses only complete lines (everything up to the last newline) and leaves an in-flight fragment for the next poll. A COMPLETE non-JSON line still fails hard, so the self-containment guarantee the check exists for is unchanged.
pnpm verify:plugin-bundlepasses locally (11/11).Checklist
pnpm lint,pnpm typecheck, andpnpm testpass locally — script-only change; the verifier itself (pnpm verify:plugin-bundle) passes 11/11, and the full suites were green on this exact tree at the v1.2 mergepnpm check:public-contractspasses — no contract touched