Skip to content

feat(codex): run the auto-review classifier like Codex's own reviewer (low effort, guardian cache key) - #183

Draft
Butanium wants to merge 2 commits into
raine:mainfrom
Butanium:auto-review-codex-reviewer-defaults
Draft

Butanium wants to merge 2 commits into
raine:mainfrom
Butanium:auto-review-codex-reviewer-defaults

Conversation

@Butanium

Copy link
Copy Markdown

⚠️ Drafted by Claude (Opus 5.5) in Claude Code at @Butanium's request; not reviewed by a human. We hit this in real use, and he asked for it to be fixed and sent upstream. Whether to AI-review, merge, adapt or close it is up to you.

Closes #181. On the Codex provider, Claude Code's auto-mode classifier now runs the way Codex runs its own approval reviewer: at Low reasoning effort, with a reviewer-scoped prompt_cache_key of guardian:<session id>. Before this, it ran at the model's default effort and shared the main conversation's cache key.

Change. This applies only to requests the auto-review route already detects on Codex:

  • output_config.effort defaults to low. An effort already set on the request still wins.
  • prompt_cache_key is guardian:<session id>.
  • No reasoning summary or encrypted reasoning content is requested. Setting an effort would otherwise turn both on, and the classifier reads only its text verdict.

Normal requests are unchanged. This copies Codex: select_review_model picks Low when the review model supports it, and prompt_cache_key_override_for_review_session uses guardian:{parent_thread_id}.

Not done

  • Model choice is unchanged. Under ChatGPT auth Codex reviews with codex-auto-review, while the proxy keeps gpt-6-luna.
  • A global CCP_CODEX_EFFORT / codex.effort override still applies to the classifier, as it does to every request.
  • feat(auto-review): add opt-in classifier effort override #93 proposed an opt-in effort setting for this route and was closed without comment. This PR changes the default instead.
Details for reviewers and agents: implementation, tests, live check

Implementation

  • src/server.rs: apply_codex_auto_review_defaults runs when bypass_provider_model_override is set, i.e. on the auto-review route on Codex. It inserts output_config.effort = "low" if absent, sets prompt_cache_key_override = guardian:<session id>, and sets omit_reasoning_artifacts.
  • src/anthropic/schema.rs: two new #[serde(skip)] fields on MessagesRequest, so clients can't set them.
  • src/providers/codex/translate/request.rs: the override replaces the session-id cache key. omit_reasoning_artifacts skips the reasoning summary and include: ["reasoning.encrypted_content"].

Edge case. If the incoming request has no session id, the cache key is left unset, as before.

Tests

  • New: codex_classifier_gets_low_effort_and_guardian_cache_key and codex_classifier_keeps_explicit_effort.
  • cargo fmt --all -- --check: clean.
  • cargo clippy --all-targets --locked: no diagnostics.
  • cargo test --all-targets --locked: 1121 passed, 0 failed.

Live check. Against real Codex, through our running build (this change applied on v0.1.44):

  • The captured stage-1 classifier request from a Claude Code 2.1.293 session, 55,084 input tokens, was sent twice with the same session id. Both returned <severity>0</severity> as a single text block with no reasoning block. The second read 54,016 input tokens from the cache.
  • In a real auto-mode session, the classifier fired once for a network command and answered in 1.5 s.

Review. One automated review pass with a separate Claude agent found no correctness bug. It pointed out that setting an effort turns on reasoning artifacts the classifier doesn't use, and those are now omitted.


Drafted by Claude Opus 5.5 in Claude Code on behalf of @Butanium; not reviewed by a human.

https://claude.ai/code/session_01Xmx9RE7u4ZLBzSUjpjqyBM

Butanium and others added 2 commits October 15, 2026 13:04
…ewer

On the auto-review route, default the classifier to Low reasoning effort and
give it a reviewer-scoped prompt_cache_key (guardian:{session}), the two
settings Codex uses for its approval reviewer
(ext/guardian-reviewer/src/model.rs, core/src/guardian/review_session.rs).
An explicit output_config.effort on the request still wins.

Setting an effort turns on the reasoning summary and encrypted reasoning
content. The classifier reads only its text verdict, so the route omits both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xmx9RE7u4ZLBzSUjpjqyBM
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Codex: auto-review classifier runs at default effort and shares the main session's prompt_cache_key

1 participant