Repository navigation
Conversation
…bash The Linux cgroup wrapper reserves 125 for "the target could not start" and produces it with `trap 'exit 125' 0`, but bash skips the EXIT trap after a failed `exec`. Where /bin/sh is bash, a missing target exits 127, and a directory or non-executable target exits 126, the code the wrapper reserves for a cgroup mismatch. CI's dash /bin/sh runs the trap, so CI never sees it. Test the target as an executable file before the `exec`, as pingdotgg#15344 does. The caller always passes an absolute path, so for a missing or non-executable target the 125 holds whichever shell /bin/sh is. A target that passes the check and still fails `execve`, such as a script whose shebang interpreter is missing, behaves as before. Two additions go beyond pingdotgg#15344. The guard prints a one-line reason on stderr, because the shell's own `exec` error no longer appears. The process-tree test also runs the missing-target wrapper under bash when bash is on PATH, so CI on dash fails if the guard is removed. Carries forward pingdotgg#15344 by @Moinax, which no longer applies after pingdotgg#17354 moved the file. Co-authored-by: Jérôme Poskin <jerome@moinax.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped Linux cgroup wrapper bug fix that standardizes missing-target handling across shells and adds focused regression coverage. Existing valid-agent execution remains unchanged, with no schema, default, security, or deployment impact. Notes:
You can add or adjust custom eligibility rules. Learn more. |
macroscopeapp
Bot
dismissed
their stale review
October 11, 2026 06:07
Dismissing prior approval to re-evaluate fc50387
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 Linux cgroup wrapper in
wrapCommandForLinuxCgroupreserves exit 125 for "the target could not start". Where/bin/shis bash it exits 127 for a missing agent binary, and 126 for a directory or non-executable target, which is the code the wrapper reserves for a cgroup mismatch. The missing-target assertion inAcpSessionRuntime.processTree.test.tspins 125 and fails on such hosts withexpected 127 to be 125.The wrapper sets
trap 'exit 125' 0and then runsexec "$@". Whether the EXIT trap runs after a failedexecdepends on the shell:/bin/shtrap 'exit 125' 0; exec /nonexistent-t3-probeexits--posixCI runs on Ubuntu, whose
/bin/shis dash, so with only the existing assertion CI passes with or without a fix.#15344 by @Moinax fixes this with one line, but it no longer applies because #17354 moved
AcpSessionRuntime.tsfromapps/servertopackages/provider-acp.Change
#15344's check and comment, applied at the new path; the comment is #15344's, kept verbatim. Before the
exec, the wrapper checks[ -f "$1" ] && [ -x "$1" ]and exits 125 if either test fails. The caller always passes an absolute target, and the check matches thestatSync/X_OKtestresolveLinuxCgroupTargetCommandalready does in Node. For an executable that exists, the line changes nothing on any shell.For a missing or non-executable target, the 125 now holds whichever shell
/bin/shis. A target that passes the check and still failsexecve, such as a script whose shebang interpreter is missing, behaves as before: 126 on bash, 125 on dash.Two additions go beyond #15344:
t3-acp-cgroup-wrapper: <target>: not an executable fileon stderr before exiting. The shell's ownexecerror no longer appears, and that stderr reaches the user through theAcpProcessExitedErrormessage.bashexplicitly whenbashis on PATH and expects 125. Without it, CI's dash passes the test with or without the guard.On dash the exit code does not change. The stderr text does:
exec: <target>: not foundbecomes the line above.Scope and approval
Submitted under the small, focused fix exception. The wrapper gains one guard line, and the intended 125 is already pinned by a test in this repo that is red today wherever
/bin/shis bash. With the new assertion, CI also fails if the guard is removed.This carries forward #15344 by @Moinax, credited as co-author on the commit. I'm happy to close this if #15344 is rebased onto the new path instead; the two additions can move there.
Verification
vp test run src/provider/acp/AcpSessionRuntime.processTree.test.tsinapps/server, same machine and checkout, changing/bin/sh(see below for howbashstays bash). "Before" is the old wrapper with the new test./bin/sh/bin/shexpected 127 to be 125)expected 127 to be 125)Without the new assertion, the old wrapper passes 23 of 23 with dash as
/bin/sh, as on CI.For the dash runs I bind-mounted a dash binary over
/bin/shinside a private user and mount namespace (unshare --user --map-root-user --mount), so the machine's own/bin/shwas never changed./bin/shis a symlink to bash there, so the bind also covers bash itself. I bind-mounted the real bash to a scratch path first and put it first on PATH, and checked$BASH_VERSIONinside the namespace.Shell probe of the new guard line under bash and dash:
t3-acp-cgroup-wrapper: /nonexistent-t3-probe: not an executable file/bin/trueThe old tail returned 127, 126 and 126 on bash for the first three, and 125 on dash.
Also ran targeted
vp linton both files,tsc --noEmitforpackages/provider-acpandapps/server(no errors), andvp fmt --check.Not checked:
bash --posixwith the new guard. The table above is from the old wrapper.Made with Claude Opus 5.5 in T3 Code (Claude Code harness).