The shell guard refuses heredocs that contain a /** comment #264

Closed
opened 2026-10-27 18:38:11 -04:00 by cmoriarty · 2 comments
Owner

What happens
In the #260 re-run, 10 shell calls were refused with:

Refused: /**: another process's environment, working directory and open files are out of bounds.

Every one wrote a file through a heredoc (cat > src/physics/vec.ts <<'E', python3 - <<'E'), and the file's text had a doc comment opening with /**. The guard (#201) reads heredoc text for absolute paths, takes /** for a pattern that could reach /proc/*/environ, and refuses. Each refusal costs the agent a turn and a rewrite. Runs 122, 123, 124 and 125 all hit it.

Fix

  • A shell never expands a glob inside a heredoc, so read a heredoc's text for literal paths only (skip words with *, ? or [). In src/osf/agent/path_guard.js, checkCommand scans the whole text, and procPrivate reads a leading ** as /proc.
  • When a real search over / is refused, say that, not "another process's environment".

Done when
cat > a.ts <<'E' with a /** … */ comment runs, and cat /proc/1/environ is still refused. The guard's tests cover both.

**What happens** In the #260 re-run, 10 shell calls were refused with: `Refused: /**: another process's environment, working directory and open files are out of bounds.` Every one wrote a file through a heredoc (`cat > src/physics/vec.ts <<'E'`, `python3 - <<'E'`), and the file's text had a doc comment opening with `/**`. The guard (#201) reads heredoc text for absolute paths, takes `/**` for a pattern that could reach `/proc/*/environ`, and refuses. Each refusal costs the agent a turn and a rewrite. Runs 122, 123, 124 and 125 all hit it. **Fix** - A shell never expands a glob inside a heredoc, so read a heredoc's text for literal paths only (skip words with `*`, `?` or `[`). In `src/osf/agent/path_guard.js`, `checkCommand` scans the whole text, and `procPrivate` reads a leading `**` as `/proc`. - When a real search over `/` is refused, say that, not "another process's environment". **Done when** `cat > a.ts <<'E'` with a `/** … */` comment runs, and `cat /proc/1/environ` is still refused. The guard's tests cover both.
Author
Owner

Still happening, final count for the #260 re-run: 15 refusals in 9 of its 12 runs (122–129 and 131).

  • Run 126: cat > src/game/highscores.ts <<'E'
  • Run 127: a multi-line command starting with sed -i …. The agent gave up on the shell and used the write tool instead.
  • Run 128: cat > src/table/theme.ts <<'E'
  • Runs 129 and 131: the same, in their apply steps.

Each costs a turn and a rewrite. In run 125 it cost a step: the refused command also wrote .osf/test/unit.command, so the apply failed its check and ran again.

**Still happening, final count for the #260 re-run:** 15 refusals in 9 of its 12 runs (122–129 and 131). - Run 126: `cat > src/game/highscores.ts <<'E'` - Run 127: a multi-line command starting with `sed -i …`. The agent gave up on the shell and used the `write` tool instead. - Run 128: `cat > src/table/theme.ts <<'E'` - Runs 129 and 131: the same, in their apply steps. Each costs a turn and a rewrite. In run 125 it cost a step: the refused command also wrote `.osf/test/unit.command`, so the apply failed its check and ran again.
Author
Owner

No refusal of any kind in run 136, the only run since the 8c527d6 deploy. I scanned every step's tool calls: three commands contained /*, all of them globs, and all ran. A doc comment in a heredoc didn't come up in that run, so the evidence for this case is the test: tests/agent/test_path_guard.py runs the shipped path_guard.js under node on the command from this issue, and it passes. Reopen if a refusal like this shows up again.

No refusal of any kind in run 136, the only run since the 8c527d6 deploy. I scanned every step's tool calls: three commands contained `/*`, all of them globs, and all ran. A doc comment in a heredoc didn't come up in that run, so the evidence for this case is the test: `tests/agent/test_path_guard.py` runs the shipped `path_guard.js` under node on the command from this issue, and it passes. Reopen if a refusal like this shows up again.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cmoriarty/braid#264
No description provided.