Review P3-1: a "No such file or directory" line from another program
(cat, ls) no longer counts. Only bash's "line N:", dash's "N:" and env's
quoted form do.
P3-2: a name with a run of 16 letters and digits looks like a key, so it
stays in the run's private stderr instead of the reply.
P3-3: a 16 KiB stderr window that starts mid-file drops its partial first
line, so a cut name ("aude") isn't reported.
P3-4: CRLF lines read the same as LF lines.
P3-5: tests for the name check (tokens without spaces, key-shaped names),
for a cat line, and for the window boundary through the runner.
A claude-code turn on a Console started without MOSAIC_CLAUDE_BIN failed
with a bare "adapter exited 127". The sandbox binds /usr, so the wrapper
/usr/bin/claude is visible, but its exec target /opt/claude-code/bin/claude
isn't bound, and the shell exits 127.
On exit 127 the runner now reads the tail of the turn's stderr, finds the
shell's "not found" line (bash, dash, env) and adds the program's basename:
"adapter exited 127 (command not found: claude)". It never shows a host
path or anything that isn't a plain program name; a 127 without such a
line keeps the bare reason.
The deploy side (MOSAIC_CLAUDE_BIN on the Console unit) is a Lead-owned
script change, written up in the lane report.
2026-11-14 21:07:14 -06:00
2 changed files with 133 additions and 4 deletions
returnresolve({ok:false,emptyLength:true,reason:"output limit reached while thinking before any answer or tool call"});
}
if(code===127){
constmissing=missingCommand(stderrTail(errPath));
returnresolve({ok:false,reason:`adapter exited 127${missing?` (command not found: ${missing})`:""}`});
}
if(code!==0)returnresolve({ok:false,reason:signal?`adapter killed by ${signal}`:`adapter exited ${code}`});
// A "marker" harness (row 65: the module's turnEnd()) writes the marker when its turn ends.
if(session.turnEnd==="marker"&&!existsSync(marker))returnresolve({ok:false,reason:`${session.harness} exited before the turn ended (no turn marker)`});
"The turn failed: adapter exited 127 (command not found: mosaic-r127-no-such-harness)",
"The turn failed: adapter exited 127",
]);
r.child.kill("SIGTERM");awaitr.exited;
});
test("r127 missingCommand reads the shells' not-found lines and gives a safe basename only",()=>{
assert.equal(missingCommand("/usr/bin/claude: line 4: /opt/claude-code/bin/claude: No such file or directory\nclaude adapter: invalid or incomplete model stream\n"),"claude");
assert.equal(missingCommand("/usr/bin/claude: 4: exec: /opt/claude-code/bin/claude: not found\n"),"claude");
assert.equal(missingCommand("/x/adapters/pi/adapter.sh: 140: exec: pi: not found\n"),"pi");
assert.equal(missingCommand("/x/adapter.sh: line 9: exec: pi: not found\n"),"pi");
assert.equal(missingCommand("sh: line 1: pi: command not found\n"),"pi");
assert.equal(missingCommand("/usr/bin/env: 'node': No such file or directory\n"),"node");
assert.equal(missingCommand("/usr/bin/env: ‘node’: No such file or directory\n"),"node");
// The last such line is the one nearest the exit.
assert.equal(missingCommand("a: 1: exec: first: not found\nb: 2: exec: second: not found\n"),"second");
assert.equal(missingCommand(""),null);
assert.equal(missingCommand("error: model refused\n"),null);
// A name that isn't a plain program name is left out, never echoed.
assert.equal(missingCommand("a: 1: exec: $(rm -rf x): not found\n"),null);
assert.equal(missingCommand(`a: 1: exec: ${"x".repeat(80)}: not found\n`),null);
// Review r127 P3-5: tokens without spaces reach the name check, and it refuses them.
assert.equal(missingCommand("a: 1: exec: $(id): not found\n"),null);
assert.equal(missingCommand("a: line 2: x;id: command not found\n"),null);
assert.equal(missingCommand("a: line 2: `id`: command not found\n"),null);
// P3-2: a long run of letters and digits looks like a key, not a program; it stays in stderr.
assert.equal(missingCommand("adapter.sh: line 3: sk-proj-abcDEF1234567890xyz: command not found\n"),null);
assert.equal(missingCommand("adapter.sh: line 3: 0123456789abcdef0123: command not found\n"),null);
// P3-1: only a shell's or env's own line counts; other programs' missing files don't.
assert.equal(missingCommand("cat: /nope/file: No such file or directory\n"),null);
assert.equal(missingCommand("w.sh: line 1: /opt/x/claude: No such file or directory\ncat: /run/state.json: No such file or directory\n"),"claude");
// P3-4: CRLF lines read the same.
assert.equal(missingCommand("sh: line 1: pi: command not found\r\n"),"pi");
});
test("r127 a not-found line cut by the 16 KiB stderr window is not read as a name",asynct=>{
// Claude's private stream reader owns model activity; final result stdout alone
// (even a synthetic success) must not cancel the model watchdog. Other adapters
// still need the stdout fallback when no streaming producer is installed.
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.