Skip to content

Commit 1d1a8e5

Browse files
only21milclaude
andauthored
fix(provider-acp): name the rejected agent path on stderr and test the bash path (pingdotgg#18489)
Co-authored-by: Victor Vogel <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 05d6055 commit 1d1a8e5

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎apps/server/src/provider/acp/AcpSessionRuntime.processTree.test.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,15 @@ describe("terminatePosixOwnedProcessTree", () => {
306306
},
307307
);
308308
expect(missingTargetResult.status, missingTargetResult.stderr).toBe(125);
309+
// CI's /bin/sh is dash, which runs the EXIT trap after a failed exec. Bash does not,
310+
// so run the same wrapper under bash too.
311+
const missingTargetBash = NodeChildProcess.spawnSync("bash", missingTarget.args, {
312+
encoding: "utf8",
313+
});
314+
if ((missingTargetBash.error as NodeJS.ErrnoException | undefined)?.code !== "ENOENT") {
315+
expect(missingTargetBash.status, missingTargetBash.stderr).toBe(125);
316+
expect(missingTargetBash.stderr).toContain("/nonexistent-t3-probe");
317+
}
309318
} finally {
310319
packagedExecPath.mockRestore();
311320
NodeFS.rmSync(scratch, { recursive: true, force: true });

‎packages/provider-acp/src/server/AcpSessionRuntime.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,9 @@ export function wrapCommandForLinuxCgroup(
284284
// trap, so a missing agent binary reported "killed by the wrapper"
285285
// instead of "never launched". The caller always hands us an absolute
286286
// target, so test it as an executable file rather than asking the
287-
// shell to resolve it.
288-
'[ -f "$1" ] && [ -x "$1" ] || exit 125',
287+
// shell to resolve it. Name the target before exiting: exit 125 alone
288+
// does not say which path was rejected.
289+
'[ -f "$1" ] && [ -x "$1" ] || { printf "%s: %s: not an executable file\\n" "$0" "$1" >&2; exit 125; }',
289290
'exec "$@"',
290291
].join("\n"),
291292
"t3-acp-cgroup-wrapper",

0 commit comments

Comments
 (0)