Skip to content

feat(cli): add a --read-only mode restricting runs to non-mutating tools for safe parallel investigation (#234)#235

Merged
qwen-code-dev-bot merged 1 commit into
mainfrom
issue/234-readonly-investigation
Jul 23, 2026
Merged

feat(cli): add a --read-only mode restricting runs to non-mutating tools for safe parallel investigation (#234)#235
qwen-code-dev-bot merged 1 commit into
mainfrom
issue/234-readonly-investigation

Conversation

@qwen-code-dev-bot

Copy link
Copy Markdown
Owner

Summary

Adds an opt-in (--read-only) mode that restricts an unattended run to non-mutating tools, decomposed from roadmap #39 (isolated parallel agents).

Mutating parallel agents need isolated worktrees (#50) and safety guards (#41), but pure-investigation tasks never mutate and forcing them into isolation is unnecessary overhead, with no guarantee an investigation agent stays read-only. This mode provides that guarantee.

Design

  • src/agent.ts: a new read-only gate in executeToolCall (placed before folder-trust/approval) refuses any non-read tool fail-closed when readOnly is set — regardless of approval mode (even yolo) or folder-trust state. Threaded via AgentOptions.readOnly.
  • src/run-failure-taxonomy.ts: a new read_only_denied failure-taxonomy category so read-only refusals are categorized in the Run diagnostics: classify an unattended run's failures into a bounded, redacted failure taxonomy #222 report.
  • src/index.ts: opt-in --read-only wired into both headless -p paths.

This is what lets several investigators share one workspace safely without worktree isolation.

Testing

  • tests/unit/read-only-mode.test.ts (4 tests, via runAgent with a scripted provider): mutating write refused fail-closed in read-only mode, refused even under yolo (hard floor), read-only tool allowed, and mutating tool allowed when read-only is off (control).
  • tests/integration/read-only-mode.test.ts (3 tests): CLI refuses a write fail-closed in read-only mode (no file created), allows a read (returns content), and allows a write when read-only is off (control).

Gates: typecheck, build, unit (1658), integration (461 + desktop), smoke (51) all pass.

Closes #234

…ols for safe parallel investigation (#234)

Mutating parallel agents need isolated worktrees (#50) and safety guards (#41), but pure-investigation tasks never mutate and forcing them into isolation is unnecessary overhead, with no guarantee an investigation agent stays read-only. Add an opt-in --read-only mode that restricts an unattended run to read-only tools (list/glob/grep/read) and refuses any mutating tool fail-closed, regardless of approval mode (even yolo) or folder-trust state, so several investigators can share one workspace safely without isolation. The refusal is recorded as a new read_only_denied failure-taxonomy category.
@qwen-code-dev-bot

Copy link
Copy Markdown
Owner Author

E2E verification

  • Repository: qwen-code-dev-bot/oh-my-cli
  • Pull request: #235
  • Commit: 8f64be37bb8fa4f47b9122cbb14c8e23c5c2a136
  • Evidence mode: terminal
  • Result: PASS
Scenario Command Exit Duration
integration npm run test:integration 0 30.609s
smoke npm run smoke 0 3.269s

E2E evidence

Full immutable report

@qwen-code-dev-bot
qwen-code-dev-bot merged commit e5495cb into main Jul 23, 2026
2 checks passed
@qwen-code-dev-bot
qwen-code-dev-bot deleted the issue/234-readonly-investigation branch July 23, 2026 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parallel investigation: run a read-only investigation constrained to non-mutating tools so parallel investigators can safely share a workspace

1 participant