feat: add readonly mode with bash safety and spawn child filtering#7
feat: add readonly mode with bash safety and spawn child filtering#7ofriw wants to merge 87 commits into
Conversation
…acklist and git allowlist
…with TUI indicator
…and spawn child filtering
…only when no branch entries exist
…, and TUI warning
…ion, and redirect analysis
…ges, and CLI flag behavior
|
Summary: GH-2’s readonly-mode safety value is aligned, but concrete bash mutation bypasses and a no-UI toggle crash mean the PR should not merge as-is. Business / Product AssessmentVerdict: REQUEST CHANGES Strengths
In Scope Issues
Out of Scope Issues
Technical AssessmentVerdict: REQUEST CHANGES Input Boundary Shape Risk AssessmentStatus: Triggered Strengths
In Scope Issues
Out of Scope Issues
Reusability
review generated with CURe v. 0.7.3 · multi-stage - stages: 4 · sha 6540936 · model gpt-5.5/high · tok 8m/82k/8m · session agenticoding-pi-agenticoding-pr7-20260528-053241-21cc · 16m32s |
… temp-dir path checking
…dren, and watchdog throttling
Merge conflicts resolved:
- agenticoding.test.ts: accept main's deletion, port ~2000 lines
of readonly tests into tests/unit/ (6 new files, 198 tests)
- notebook/rehydration.ts: take main's typed approach, add null
guard for malformed branch entries
- package.json: union of both sides' devDependencies
- handoff.test.ts, watchdog.test.ts: update expectations for
readonly-aware pendingRequestedHandoff shape
Note: This PR was generated by an AI agent. If you would like to talk with other humans, drop by our Discord!
Readonly Mode: OS-Level Sandboxing with Token-Efficient Guardrails
What changed and why
This PR implements the readonly mode requested in issue #2, but significantly stronger than the original proposal. Instead of relying solely on command-pattern filtering – which models consistently escaped by spawning interpreters (python -c, node -e, etc.) or using indirect write mechanisms – we built a two-layer enforcement with an OS-level sandbox as the primary barrier.
On macOS, commands run through
sandbox-execwith a Seatbelt profile that denies all file-write operations except to the OS temp dir and /dev/null. On Linux, bubblewrap (bwrap) mounts the root filesystem read-only with a writable tmpfs overlay at the temp dir. On Windows (no native sandboxing), or when the OS tool is missing, we fall back to a comprehensively rewritten command-pattern classifier that understands shell pipelines, redirects, command substitutions, interpreter-cflags, xargs,sed -i, package manager mutations, and more.Beyond bash, the PR blocks write, edit, and handoff at the tool-call layer, with a cache-aware strategy: parent sessions keep these tools in the tool list (to avoid context-cache invalidation) and block at call time, while child spawn sessions remove them entirely since they start fresh. We also gated the /handoff command in readonly mode, added TUI indicators, watchdog nudges, and context-hook messages.
Also tuned the context primer for token efficiency: added a Plan-then-execute section, simplified primacy-zone guidance, and rephrased spawn section for directness.
Value and implications
For projects running token-cost-sensitive coding agents, this is a meaningful UX and cost optimization. The model keeps its entire tool list (maximizing cache hit rates) while being unable to mutate the filesystem outside a controlled scratch space. The OS sandbox is explicitly not a security boundary – it is an active guardrail that prevents accidental writes from agentic loops, interpreter injections, or misdirected redirects. The fallback classifier on Windows means the feature works cross-platform even without OS sandbox tooling.
Breaking changes
None. Readonly is off by default, toggled on demand via
/readonly, Ctrl+Shift+R, or the--readonlyCLI flag. Existing workflows are unaffected.Attached is an agent optimized description of the changes in this PR - AGENT_REVIEW.md