Skip to content

codex-companion: task --write runs Codex's Auto preset (guardian-reviewed escalation) - #57

Merged
SSFSKIM merged 3 commits into
mainfrom
amigo-auto-review
Aug 11, 2026
Merged

SSFSKIM merged 3 commits into
mainfrom
amigo-auto-review

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Aug 11, 2026

Copy link
Copy Markdown
Owner

What problem are you trying to solve?

The amigo task verb's headless client rejects every server-initiated RPC with -32601, so the only viable approval policy was "never"": a --write` task that legitimately needed to cross the sandbox (network, files outside the workspace) simply failed there, with no escalation path.

Codex's native auto-review guardian (approvals_reviewer = "auto_review", stable in codex-cli 0.146.0) removes that constraint: boundary-crossing approval requests are judged by a server-side reviewer subagent and never reach the client.

What does this PR change?

--write now runs Codex's Auto preset: workspace-write sandbox plus approvalPolicy "on-request" and approvalsReviewer "auto_review" on both thread/start and thread/resume. Read-only tasks keep "never". Guardian review only costs when an escalation is actually requested, so in-sandbox work is unaffected — which is why it's the writer default rather than a separate flag (a --auto flag was built first, then collapsed on that reasoning).

Review history

An independent gpt-5.6-sol review of the first cut caught a real bug: the reviewer was passed as a -c process config override, but thread/resume restores the reviewer persisted at thread creation, which beats process config — upgrading a plain-created thread routed approval RPCs to the reject-everything client. Reproduced live under a scratch CODEX_HOME with the default (user) reviewer, fixed by carrying the reviewer in the thread params, re-verified live (guardian rollout sessions show the risk-framework policy and {"outcome":"allow"}). Second review round: clean.

Verification

  • Live against codex-cli 0.146.0: fresh-write and read-only→write resume both escalate an out-of-workspace file write through a real guardian session.
  • tests/codex-companion/test-task-auto.mjs pins the wire params for all three lanes against the mock app-server's own records; asserts fail against the parent commit.
  • Full suites green: runtime node:test (108) + workflow e2e.

🤖 Generated with Claude Code

https://claude.ai/code/session_014L9o6WePUkWGrtbHMeLwLa

The amigo task verb's headless default (approvalPolicy "never") was the
only option: the vendored app-server client rejects every server-initiated
request with -32601, so an interactive approval policy would have denied
every escalation at the wire. Codex's native auto-review guardian removes
that constraint — with approvals_reviewer=auto_review, boundary-crossing
approval requests are judged by a server-side reviewer subagent and never
reach the client.

--auto wires that up: workspace-write sandbox (implies --write),
approvalPolicy "on-request" on thread/start AND thread/resume, and a
task-owned app-server spawn carrying -c approvals_reviewer=auto_review
(the reviewer is config-level, not a thread param, so the auto lane cannot
share a broker's server).

Verified live against codex-cli 0.146.0: an out-of-workspace write under
--auto triggered a real guardian session (rollout shows the risk-framework
policy and its {"outcome":"allow"} verdict) and the escalated command
ran; the plain --write lane still sends approvalPolicy "never" with an
untouched argv, pinned by tests/codex-companion/test-task-auto.mjs against
the mock app-server's own records.
…s config

Independent review (gpt-5.6-sol) caught the gap: thread/resume restores
the approvals reviewer persisted at thread creation, which beats the
process-level -c override — so upgrading a plain-created thread with
--auto --resume-last left reviewer "user", and the approval RPC landed
on this client's reject-everything handleServerRequest. Reproduced live
under a scratch CODEX_HOME with the default reviewer: the escalated
command was refused exactly as predicted.

Fix: send approvalsReviewer ("auto_review" when --auto, null otherwise)
in both thread/start and thread/resume params. The wire field exists in
codex-cli 0.146.0 next to approvalPolicy. With the reviewer on the thread
itself, the config override and the private app-server spawn it forced
are unnecessary — the auto lane now shares transports like every other
task. Re-verified live under the scratch home: fresh --auto and
plain-to-auto resume both escalate through a real guardian session
(three reviewer rollouts recorded); the mock-level test now pins the
plain-to-auto resume params as the regression case.
… --auto flag

Human call: guardian review only costs when an escalation is actually
requested (in-sandbox work never triggers it), so a separate opt-in flag
guarded nothing worth guarding. --write now selects workspace-write plus
approvalPolicy "on-request" and approvalsReviewer "auto_review";
read-only tasks keep approvalPolicy "never". No caller depended on the
old never-policy write lane (grepped skills/ and tests/).

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 916ccb1d63

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

cwd,
model: options.model ?? null,
approvalPolicy: options.approvalPolicy ?? "never",
approvalsReviewer: options.approvalsReviewer ?? null,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the vendored runtime byte-identical

This edits a file covered by skills/codex-companion/runtime/VENDORED-FROM, which explicitly marks scripts/ as byte-identical vendor content and says behavior changes must remain at call sites or in skill documentation. The next refresh from the pinned upstream plugin will therefore overwrite this reviewer propagation and break the new --write behavior; implement the adaptation outside the vendored tree or update the vendor source/pin and provenance together.

Useful? React with 👍 / 👎.

@SSFSKIM
SSFSKIM merged commit 9424c36 into main Aug 11, 2026
@SSFSKIM
SSFSKIM deleted the amigo-auto-review branch August 11, 2026 09:07
SSFSKIM added a commit that referenced this pull request Oct 18, 2026
sminos plane: a DX4 chunk carries the bridge's stamp t (MAWS #57) (7.183.2)
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.

1 participant