Repository navigation
Commit 39b18b9
fix(server): a missing agent binary no longer reads as a wrapper kill
The Linux cgroup wrapper reserves 125 for "could not start the target" and
produces it with `trap 'exit 125' 0`. That trap does not cover a failed
`exec`: dash runs the EXIT trap, bash does not. Where `/bin/sh` is bash —
Arch and its derivatives — a missing agent binary exits 127 instead, and the
session reports the wrapper as having killed the agent rather than never
having launched it.
Test the target before the `exec`. The caller always hands the wrapper an
absolute path — `spawnCommand.command` when it is already absolute, otherwise
`resolveLinuxCgroupTargetCommand`'s result — so `[ -f ] && [ -x ]` is the
whole check, and it mirrors the `statSync`/`X_OK` pair that resolver already
applies on the Node side. No shell option or PATH parsing is involved, so the
documented 125 holds whichever shell `/bin/sh` is.
The expected behaviour is already pinned by the missing-target assertion in
AcpSessionRuntime.processTree.test.ts, which fails with "expected 127 to be
125" on a bash-as-/bin/sh host without this.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>1 parent 71dbaf1 commit 39b18b9
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
285 | 292 | | |
286 | 293 | | |
287 | 294 | | |
| |||
0 commit comments