Skip to content

fix(llm): keep claude_cli and codex_cli tasks independent of ambient instructions - #683

Merged
piekstra merged 1 commit into
mainfrom
piekstra/reviewer-instruction-isolation
Oct 22, 2026
Merged

piekstra merged 1 commit into
mainfrom
piekstra/reviewer-instruction-isolation

Conversation

@piekstra

Copy link
Copy Markdown
Member

Summary

Keeps claude_cli and codex_cli tasks from picking up instruction files that are neither in the PR's trusted base branch nor in the agent catalog, matching what #656 did for Pi.

  • Claude: every invocation (background, foreground, resume) passes --safe-mode, which leaves out the operator's CLAUDE.md, skills, plugins, hooks and MCP servers while subscription auth, models, built-in tools and permission modes keep working. validateArgs rejects a Claude argv without it.
  • Codex: every exec and exec resume passes -c project_doc_max_bytes=0, so the PR head's AGENTS.md no longer becomes instructions for its own review. validateArgs requires it.
  • README: states what each adapter isolates, the remaining Codex gap ($CODEX_HOME/AGENTS.md has no flag, and cr does not move CODEX_HOME because it holds auth), and that repository guidance reaches reviewers through agent prompts.

Evidence

Before the change, with the adapters' own argv and marker files:

  • Claude (-p, and --bg from the cache workdir with the checkout on --add-dir) received the operator's ~/.claude/CLAUDE.md, and did not receive the checkout's CLAUDE.md or AGENTS.md.
  • Codex's rollout file contained both the checkout's AGENTS.md and $CODEX_HOME/AGENTS.md.

After:

  • Claude with --safe-mode, through both transports and with --enable-auto-mode --permission-mode auto, reported no marker and no user-level instructions, and Read, Write and Bash still worked (it read the checkout's AGENTS.md as a file and ran git log through Bash). --settings '{"fastMode":true}' is still accepted.
  • Codex with -c project_doc_max_bytes=0: the rollout no longer contains the checkout marker; the user-level file is still present, as documented.

Tests: TestSubprocessClaudeIgnoresAmbientInstructionFiles and TestSubprocessCodexIgnoresProjectInstructionFiles cover background, resumed and foreground argv, with and without a reviewer workspace, and that validation rejects each argv without its control. The offline-reviewer test now removes only the network config pairs, so it still exercises the network check rather than the new one.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Repo scaffolding / maintenance

Checklist

  • I have read the contributing guide
  • My change follows the project structure and conventions
  • make tidy passes
  • make lint passes
  • make test passes
  • make build passes

Related Issues

Closes #681

Model: Claude Opus 5.5 (1M context, xhigh effort) in Claude Code.

…instructions

Claude tasks now pass --safe-mode, so the operator's CLAUDE.md, skills, plugins, hooks and MCP servers no longer reach review tasks; validateArgs rejects a Claude argv without it. Codex tasks pass -c project_doc_max_bytes=0, so the PR head's AGENTS.md no longer becomes instructions for its own review; validateArgs requires it on exec and exec resume. Codex has no flag for the user-level CODEX_HOME AGENTS.md, which the README now documents.

Closes #681

Twapp-Session: 46c432b9-3bb2-438f-843f-10e4cd5050d7

@monit-reviewer monit-reviewer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated PR Review

Reviewed commit: 2d7c6a39da17
Profile: claude-monit-reviewer - Posting as: monit-reviewer

Summary

Reviewer Findings
go:implementation-tests 0
harness-engineering:repo-health 0
documentation:docs 0
policies:conventions 0
security:code-auditor 0

Reviewer Coverage

Complete coverage details are retained in the local coverage.json artifact.

  • go:implementation-tests — complete (broad); scope: 2 files; examples: internal/llmadapters/subprocess.go, internal/llmadapters/subprocess_test.go; body-inspected: 2 files; examples: internal/llmadapters/subprocess.go, internal/llmadapters/subprocess_test.go; skipped: none; constraints: Tests were not executed; review was static, from the diff and nearby validateArgs code.
  • harness-engineering:repo-health — complete (constrained); scope: 2 files; examples: internal/llmadapters/subprocess.go, internal/llmadapters/subprocess_test.go; body-inspected: 2 files; examples: internal/llmadapters/subprocess.go, internal/llmadapters/subprocess_test.go; skipped: none; constraints: Reviewed the subprocess.go diff in full; subprocess_test.go and README.md were not read in detail (test file inspected only via PR description and diffstat). Tests were read statically; not executed.
  • documentation:docs — complete (broad); scope: 1 file; examples: README.md; body-inspected: 1 file; examples: README.md; skipped: none; context (not coverage): 2 files; examples: docs/review-guidance.md, internal/llmadapters/subprocess.go; constraints: Verified README claims against internal/llmadapters/subprocess.go (--safe-mode, project_doc_max_bytes=0, validateArgs); did not run the adapters or Codex/Claude CLIs.
  • policies:conventions — complete (broad); scope: 1 file; examples: README.md; body-inspected: 1 file; examples: README.md; skipped: none; context (not coverage): 2 files; examples: docs/review-guidance.md, internal/llmadapters/subprocess.go; constraints: Checked README claims against internal/llmadapters/subprocess.go and confirmed docs/review-guidance.md exists; did not run tests or verify CLI flag behavior.
  • security:code-auditor — complete (broad); scope: 2 files; examples: internal/llmadapters/subprocess.go, internal/llmadapters/subprocess_test.go; body-inspected: 2 files; examples: internal/llmadapters/subprocess.go, internal/llmadapters/subprocess_test.go; skipped: none; constraints: Could not verify that the installed claude CLI supports --safe-mode as described; review relied on the PR description and the argv/validation diff. Remaining Codex gap ($CODEX_HOME/AGENTS.md) is documented in the PR and not treated as a regression.

0 PR discussion threads considered. 0 summarized; 0 resolved.


Completed in 3m 36s | ~$2.33 (est.) | claude-sonnet-5-5 | cr 0.10.344
Field Value
Model claude-sonnet-5-5
Reviewers go:implementation-tests, harness-engineering:repo-health, documentation:docs, policies:conventions, security:code-auditor
Engine claude_cli · claude-sonnet-5-5
Reviewed by cr · monit-reviewer
Duration 3m 36s wall · 7m 24s compute
Cost ~$2.33 (est.)
Pricing basis baseline-2026-10-02/pricing
Tokens 74 in / 9.9k out

Per-workstream usage

  • orchestrator-selection — claude-sonnet-5-5
    • In: 6
    • Out: 1.4k
    • Cache read: 60.1k
    • Cache create: 52.4k
    • Cost: ~$0.24 (est.)
    • Duration: 39s
  • go:implementation-tests — claude-sonnet-5-5
    • In: 10
    • Out: 1.5k
    • Cache read: 170.4k
    • Cache create: 58.4k
    • Cost: ~$0.28 (est.)
    • Duration: 1m 03s
  • harness-engineering:repo-health — claude-sonnet-5-5
    • In: 18
    • Out: 2.2k
    • Cache read: 401.3k
    • Cache create: 141.4k
    • Cost: ~$0.67 (est.)
    • Duration: 1m 46s
  • documentation:docs — claude-sonnet-5-5
    • In: 10
    • Out: 1.3k
    • Cache read: 162.1k
    • Cache create: 53.5k
    • Cost: ~$0.26 (est.)
    • Duration: 1m 02s
  • policies:conventions — claude-sonnet-5-5
    • In: 12
    • Out: 1.4k
    • Cache read: 208.5k
    • Cache create: 53.1k
    • Cost: ~$0.27 (est.)
    • Duration: 1m 19s
  • security:code-auditor — claude-sonnet-5-5
    • In: 10
    • Out: 1.3k
    • Cache read: 164.3k
    • Cache create: 54.8k
    • Cost: ~$0.27 (est.)
    • Duration: 1m 04s
  • orchestrator-rollup — claude-sonnet-5-5
    • In: 8
    • Out: 773
    • Cache read: 214.9k
    • Cache create: 75.9k
    • Cost: ~$0.35 (est.)
    • Duration: 28s

@piekstra
piekstra marked this pull request as ready for review October 21, 2026 22:34
@piekstra
piekstra merged commit 6c0fc1f into main Oct 22, 2026
12 checks passed
@piekstra
piekstra deleted the piekstra/reviewer-instruction-isolation branch October 22, 2026 00:19
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.

Keep claude_cli and codex_cli reviewer sessions independent of ambient instruction files

2 participants