Repository navigation
fix: a turn whose tool server never started fails and says why - #69
Merged
Merged
Conversation
…68) Root cause, measured on Windows 11 under sbx (native, network allow): sbx's write-restricted token runs the command as the user, and a named pipe created with default security grants write only to SYSTEM, Administrators and the creating user, not to the token's restricting SIDs. Node creates such pipes for a child's piped stdio, so `child_process.spawn` with stdio 'pipe' fails with EPERM ('ignore' and 'inherit' work). Claude Code therefore starts no MCP server: its init line reports incode's server as "failed", the model runs with none of incode's tools, writes tool calls out as plain text that nothing runs, and incode reported the turn as success (or it ran on until the wall clock). That sandbox limit is sbx's to lift (the #38 design). This change makes incode stop treating such a turn as a result: - tool_bridge: the bridge records when the tool server asks, with the turn's token, for the tools (`Bridge::tools_listed`); `require_tools` and `no_tools` give the one refusal; the server half now traces its start, a failed start and a failed connect, and the parent traces the list request, so INCODE_TRACE names which half broke. - Claude route: an init line naming incode's server "failed" ends the turn at once; a turn that produced a result without the list request is refused at the end. `finish` now kills the CLI's tree on any error, not only on cancel, as the codex route does, so a stopped turn leaves nothing running. - `drive`'s line handler may end the turn with an error (`LineHandler`). - The codex route is not held to the list check: whether codex always lists before the model runs is not yet measured (#19). Tests: the stand-in CLIs now ask for the tools as a real one does; new tests for a toolless turn, a reported server failure (stopped within 5 s, and on Unix the CLI no longer running), the init-line reader, and run_bridged directly. The bridged codex flow test now runs on Windows too. Each new check fails with its fix taken out.
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 #68.
Root cause (measured, Windows 11, sbx native, network allow)
sbx's write-restricted token runs the command as your own user. A named pipe created with default security grants write only to SYSTEM, Administrators and the creating user:
D:(A;;FR;;;WD)(A;;FR;;;AN)(A;;FA;;;SY)(A;;FA;;;BA)(A;;FA;;;<user>)The restricting SIDs (run SID, Everyone, logon) are never granted write, so every write-open of such a pipe is refused.
Node creates exactly such pipes for a child's stdio:
child_process.spawnwithstdio: 'pipe'fails withEPERM;'ignore'and'inherit'work.{"name":"incode","status":"failed"}, the model runs with none of incode's tools, and it writes tool calls out as text.is_error: false, or the turn ran on to the wall clock.The step-by-step probes are on #68: plain vs
CLAUDE_CONFIG_DIRonly vs sbx, a bare Node spawn per stdio mode, and the pipe SDDL.Lifting the sandbox limit itself is sbx work, the same direction as #38. This PR makes incode stop calling such a turn a result.
Change
failednow ends the turn at once, with the reason.INCODE_TRACEnames which half broke.Verified
marker-91c2, 11 s).is_error: truein 35 s with the reason. Before: fake success, or a kill at the wall after 281 s.run_bridgeddirectly.-D warningsclean; 2340 lib + 59 bin tests passed.