Skip to content

Commit beaf562

Browse files
authored
fix: let a sandboxed session read the agent list, which silently truncates (#642)
1 parent e30c07c commit beaf562

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

.claude/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"allowWrite": [
1717
".",
1818
"~/GitHub/bess-manager",
19+
"~/.claude/jobs",
1920
"~/Library/Caches/ms-playwright",
2021
"~/.cache/ms-playwright",
2122
"~/.npm"

CLAUDE.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,38 @@ redundant:
598598
one from outside. `verify-sandbox.sh` skips its symlink check outside a
599599
linked worktree rather than reporting a PASS that proves nothing.
600600

601+
- **`filesystem.allowWrite: "~/.claude/jobs"`**`claude agents --json` reads
602+
the session list from there, and a sandboxed call does not fail, it silently
603+
**TRUNCATES**. Measured in one session, seconds apart: **sandboxed returns 1
604+
agent, unsandboxed returns 14, of which 7 are live sessions sitting in
605+
worktrees.** All seven read as dead.
606+
607+
That is not cosmetic. `backlog-rhythm.sh` keys `resume_implementation` off
608+
"worktree on disk, no live session", so with a truncated listing it told the
609+
maintainer to re-enter a worktree a live session was actively working — a
610+
second session on one branch, against commits the advice itself calls the
611+
only copy. `implement-issue` Step 0 reads the same list before touching a
612+
resumed branch, and both skills already carry a warning to run it
613+
unsandboxed. This makes the warning unnecessary rather than merely repeated.
614+
615+
**An under-count, not an error, is the dangerous shape**: nothing about a
616+
short list looks wrong, so the wrong answer is acted on with full confidence.
617+
618+
**`allowWrite`, not `allowRead`, and that is measured rather than assumed**
619+
the obvious objection is that `claude agents --json` only *reads* the list.
620+
Two probes in a sandboxed session settle it:
621+
622+
```
623+
ls ~/.claude/jobs -> 16 entries # read: ALLOWED
624+
touch ~/.claude/jobs/.probe -> Operation not permitted # write: DENIED
625+
```
626+
627+
Reads were never blocked; the read policy denies only `~/.claude/ide`.
628+
Enumeration needs to WRITE, and a dropped entry rather than an error is what
629+
produces the truncation. Same lesson as the podman entry below, where
630+
`filesystem.allowRead` was tried and disproved: read the actual error instead
631+
of reasoning about what ought to be blocked.
632+
601633
- **`filesystem.allowWrite`: the two user-level caches `worktree-setup.sh`
602634
writes**`~/Library/Caches/ms-playwright` (plus its Linux spelling
603635
`~/.cache/ms-playwright`) and `~/.npm`. Setup runs `npm install` when a

0 commit comments

Comments
 (0)