Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(provider-acp): a missing agent binary exits 125 where /bin/sh is bash #17949

Closedonly21mil(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/17949/headopened View on GitHub

Showing 2 changed files with 15 additions and 0 deletions.

x
0 of 2 viewed, 2 left
8 additions and 0 deletionsapps/server/src/provider/acp/AcpSessionRuntime.processTree.test.tsModified
View file
@@ -308,6 +308,14 @@
expect(missingTargetResult.status, missingTargetResult.stderr).toBe(125);
+ // CI's /bin/sh is dash, which runs the EXIT trap after a failed exec; bash does not.
+ const missingTargetBash = NodeChildProcess.spawnSync("bash", missingTarget.args, {
+ encoding: "utf8",
+ });
+ if (missingTargetBash.error === undefined) {
+ expect(missingTargetBash.status, missingTargetBash.stderr).toBe(125);
+ expect(missingTargetBash.stderr).toContain("/nonexistent-t3-probe");
+ }
} finally {
packagedExecPath.mockRestore();
NodeFS.rmSync(scratch, { recursive: true, force: true });
7 additions and 0 deletionspackages/provider-acp/src/server/AcpSessionRuntime.tsModified
View file
@@ -285,6 +285,13 @@
'[ "$actual" = "$expected" ] || exit 126',
"unset ELECTRON_RUN_AS_NODE T3_ACP_CGROUP_WRAPPER",
"trap 'exit 125' 0",
+ // The trap alone does not cover a failed `exec`: bash — which is
+ // /bin/sh on Arch derivatives — exits 127 without running the EXIT
+ // trap, so a missing agent binary reported "killed by the wrapper"
+ // instead of "never launched". The caller always hands us an absolute
+ // target, so test it as an executable file rather than asking the
+ // shell to resolve it.
+ '[ -f "$1" ] && [ -x "$1" ] || { printf "%s: %s: not an executable file\\n" "$0" "$1" >&2; exit 125; }',