Skip to content

Guardian silently omits auto_review.extra_policy with the current codex-auto-review catalog template #50309

Closed

Description

@aofei

What version of Codex CLI is running?

codex-cli 0.160.0

What subscription do you have?

ChatGPT Pro 200

Which model were you using?

gpt-6.1-sol

What platform is your computer?

Darwin 27.0.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

Ghostty

Codex doctor report

What issue are you seeing?

A nonblank [auto_review].extra_policy is accepted, but its text is silently omitted from the synchronous Guardian reviewer's base instructions when the selected codex-auto-review catalog entry supplies a policy template without {{ extra_policy }}. [auto_review].policy and experimental_policy_template are unset.

The configuration reference describes extra_policy as additional policy included alongside the main policy. The current catalog template prevents that insertion. The renderer provides no missing-placeholder diagnostic. The catalog's base security policy is retained, but the configured additional rules are absent.

Observed evidence:

  • A fresh catalog fetched by the official 0.160.0 binary at 2026-10-02T06:06:03.097223Z has zero {{ extra_policy }} placeholders in the codex-auto-review template
  • Executing the 0.160.0 Rust renderer body with that fresh template and a neutral extra-policy sentinel produces zero sentinel occurrences. The bundled-template control produces one occurrence. Both preserve the full base policy

Verification establishes omitted prompt input. Action enforcement outcomes were not tested. Catalog contents may vary by account or server rollout. These observations concern the catalog served to this account.

What steps can reproduce the bug?

  1. Configure automatic review with a nonblank additional policy in a test Codex home:

    model = "gpt-6.1-sol"
    approval_policy = "on-request"
    approvals_reviewer = "auto_review"
    sandbox_mode = "workspace-write"
    
    [auto_review]
    extra_policy = "EXTRA_POLICY_SENTINEL: Require explicit confirmation before writing guardian-policy-probe.txt."

    Leave auto_review.policy and auto_review.experimental_policy_template unset.

  2. Sign in normally and fetch the model catalog:

    codex --version
    codex debug models > catalog.json

    For a fresh server fetch, use a test Codex home with no existing models_cache.json. In 0.160.0, debug models uses OnlineIfUncached, so an existing cache can otherwise be reused.

  3. Inspect the actual selected catalog template and reproduce its rendering with this source-equivalent checker:

    uv run --offline --no-project python - catalog.json <<'PY'
    import json
    import sys
    
    with open(sys.argv[1]) as file:
        models = json.load(file)["models"]
    model = next(model for model in models if model["slug"] == "codex-auto-review")
    messages = model["model_messages"]["auto_review"]
    template = messages["policy_template"]
    policy = messages["policy"]
    extra = "EXTRA_POLICY_SENTINEL: Require explicit confirmation before writing guardian-policy-probe.txt."
    prompt = policy.strip().join(
        part.replace("{{ extra_policy }}", extra.strip())
        for part in template.rstrip().split("{{ tenant_policy_config }}")
    )
    rendered = f"{prompt}\n\nReview contract.\n"
    print("extra_policy placeholders:", template.count("{{ extra_policy }}"))
    print("extra_policy sentinel occurrences:", rendered.count("EXTRA_POLICY_SENTINEL"))
    print("full base policy present:", policy.strip() in rendered)
    PY

    Observed output:

    extra_policy placeholders: 0
    extra_policy sentinel occurrences: 0
    full base policy present: True
    

    This checker mirrors GuardianPolicyInstructions::body in 0.160.0. It is a deterministic rendering reproduction, independent of model behavior. I also executed the original Rust renderer body in an isolated harness with the same results. Substituting the release's bundled policy_template.md changes the sentinel count to 1.

  4. For optional end-to-end confirmation, start a new CLI session with that configuration and request a harmless read-only command that requires approval review, such as pwd through exec_command with sandbox_permissions = "require_escalated". Confirm a Guardian rollout was created and inspect its session_meta.payload.base_instructions.text for EXTRA_POLICY_SENTINEL.

    This inference-based confirmation has not been performed. The verified reproduction above uses the fresh catalog and the release renderer with the neutral sentinel.

What is the expected behavior?

When auto_review.extra_policy is nonblank, normal automatic-review prompt construction should include it alongside the resolved base policy, including when codex-auto-review supplies the template through the model catalog.

If a selected template cannot include the configured policy, the CLI should surface that incompatibility instead of silently proceeding with the policy omitted. Users should be able to keep auto_review.policy unset and retain the catalog's base policy while adding local rules through the documented setting.

Additional information

The failure occurs at the boundary between the client renderer and the catalog-provided template:

  1. Configuration loading resolves nonblank extra_policy into guardian_extra_policy, with managed precedence
  2. Catalog message resolution prefers the supplied catalog template over the bundled template
  3. Reviewer setup passes the resolved extra policy and selected template to GuardianPolicyInstructions
  4. The renderer inserts additional policy only by replacing {{ extra_policy }}. A missing placeholder discards that input

The fetched catalog template differs from the release's bundled template only by the missing extra-policy slot:

Catalog:
# Security Policy
{{ tenant_policy_config }}

# Investigation Guidelines

Bundled:
# Security Policy
{{ tenant_policy_config }}

{{ extra_policy }}

# Investigation Guidelines

PR #47125, merged on 2026-09-21, explicitly added extra policy to both Guardian reviewer templates and Guardian v2 classification. Its implementation is not limited to a particular reviewer model. The reviewer path therefore already has support intended to compose this input. The missing catalog placeholder prevents that support from taking effect in the observed codex-auto-review configuration.

Two details explain the existing test coverage:

  • Integration scenario explicitly overrides the reviewer template with the bundled one
  • Renderer unit test explicitly expects omission when a nonblank extra policy is passed to a template without its slot

These tests cover insertion into a compatible template and the renderer's behavior with an incompatible one. They do not establish that the normal catalog-selected template includes the additional policy.

PR #47287, merged on 2026-09-22, subsequently updated only this scenario's snapshot for retained user instructions. It did not change the template-selection or extra-policy rendering code.

A fix should align the served codex-auto-review template with the additional-policy contract and add coverage through catalog-template selection without forcing the bundled override. Client-side validation or a defined insertion fallback would also prevent this class of silent omission from recurring with an older or incompatible catalog template.

The scope here is synchronous reviewer prompt composition. The Guardian v2 classifier path concatenates the base and extra policy before classifier rendering and truncation. It does not depend on this reviewer template's extra-policy placeholder.

Issue #38316 discusses local auto_review.policy replacing the base policy. This report uses extra_policy with policy unset. PR #47125 does not link #38316 as a closing issue or state that it was the reason for introducing the new field.

I searched public open and closed issues and PRs on 2026-10-02 for extra_policy, guardian_extra_policy, extra-policy with template, Guardian with template, and codex-auto-review with policy. I found #47125 and related policy/template discussions, but no report specifically describing the missing extra-policy placeholder in the served codex-auto-review template. This is a bounded public search.

Activity

  1. added
    bug
    on Oct 2, 2026
  2. added
    CLI
    config
    sandbox
    on Oct 2, 2026
  3. jan-aisi commented on Oct 2, 2026

    @jan-aisi

    I can reproduce this on main (84d5437). A few more details:

    • gpt-5.6-luna has the same template with no {{ extra_policy }} slot. It's the default reviewer for API-key login (provider.rs#L126), so API-key users hit this too, not just ChatGPT login.
    • The bundled models-manager/models.json is also missing the slot for both models (gpt-5.6-luna, codex-auto-review). Updating only the served catalog wouldn't fix clients that use the bundled one.
    • The managed guardian_extra_policy from requirements.toml goes through the same slot (config/mod.rs#L4029-L4038), so it gets dropped as well.

    My agents checked this by rendering both the bundled catalog and a freshly fetched one through ResolvedModelMessages::from_model + GuardianPolicyInstructions. The extra policy is missing for codex-auto-review and gpt-5.6-luna. It shows up for the bundled fallback and for models without their own template, like gpt-6-luna.

  4. n0rpan123 commented on Oct 13, 2026

    @n0rpan123

    Additional desktop evidence on a newer build, observed 2026-10-13:

    • macOS: Darwin 27.0.0 arm64 arm.
    • Desktop app: 26.1007.30912 build 20156 (bundle named ChatGPT.app).
    • Bundled CLI: 0.162.0-alpha.17.2.
    • Full desktop restart confirmed at 2026-10-13 16:23:25 Europe/Stockholm.
    • A fresh, read-only process of that bundled app-server returns the exact nonblank auto_review.extra_policy through config/read for the project and child worktree. No replacement auto_review.policy is configured; configRequirements/read returns null requirements in that diagnostic process.
    • Six guardian sessions created after restart contain none of the supplement's distinctive text in recorded base instructions or message content. A sampled session reports originator Codex Desktop and the current bundled CLI version. At least one review completed with allow; this observation is not inferred from a denial.
    • Sample base instructions are 18,446 characters; SHA-256: f893abed23f18900cb5dd8fe34e2aa616634efcd1792ec38cd7241972dacfd8b.
    • The local model catalog cache, with fetched_at: 2026-10-13T16:34:08.201444Z, contains a codex-auto-review / model_messages.auto_review.policy_template with zero {{ extra_policy }} placeholders and one {{ tenant_policy_config }} placeholder.

    This strongly supports the missing-template-slot diagnosis described above and shows the symptom on the desktop's newer bundled version. Limits: the current cache was not bound to each individual review at invocation time; a separate diagnostic process does not prove the running desktop's effective config; saved traces do not prove the complete model request. We have not inspected or executed the renderer for this newer build and do not claim a definitive causal result beyond those observations.

    No main policy was replaced, no denied operations were replayed, and no synthetic review-triggering scenario was created. No credentials, full transcripts, hidden reasoning, private issue bodies, or account contact details are included. OpenAI web support directed this report to this tracker. Please include this as additional evidence when investigating catalog-template propagation and missing-placeholder diagnostics.

  5. SuperDuperDave commented on Oct 16, 2026

    @SuperDuperDave

    Still present at rust-v0.161.0 (9790114). In codex-rs/models-manager/models.json, both reviewer entries (codex-auto-review L1555, gpt-5.6-luna L1058) carry a policy_template equal to prompts/templates/guardian/policy_template.md with only the {{ extra_policy }} line and the blank line after it removed (9,734 vs 9,754 bytes). The model template takes precedence over that fallback, so auto_review.extra_policy is dropped for both.

    One reason it can slip through: the upstream extra-policy scenario pins the bundled fallback template explicitly, so it passes while the catalog entries stay stale. Coverage against the actual bundled reviewer entries, or a required-placeholder check before rendering, would catch it.

    Workaround that worked for us: set auto_review.experimental_policy_template to the fallback template, which restores the slot; the reviewer then cited the extra policy in its decisions.

  6. Oleksii-Rohalskyi commented on Oct 19, 2026

    @Oleksii-Rohalskyi

    Follow-up validation on 2026-10-19: the public upstream main snapshot at bb8f530 still has the mismatch in its bundled files. In codex-rs/models-manager/models.json, the codex-auto-review policy_template has 0 {{ extra_policy }} slots and 1 {{ tenant_policy_config }} slot; the bundled policy_template.md has 1 {{ extra_policy }} slot. This confirms the bundled-catalog case remains affected; it does not establish what any particular account's server currently serves.

    Coverage against the catalog-selected bundled reviewer entry (without forcing the fallback template), plus a diagnostic when nonblank extra_policy has no insertion slot, would catch this regression.

  7. NonTrivialLiu commented on Oct 22, 2026

    @NonTrivialLiu

    Beyond checking the missing template slot, please distinguish “configuration parsed” from “supplement included in the effective reviewer input.” Those are different assurances.

    A privacy-preserving status could report supplement present/absent, its supplying configuration layer, and a local comparison identifier without exposing policy text. Regression coverage should exercise both permissive and restrictive supplements while retaining the base policy: silently dropping either can undermine the intended boundary.

    This is proposed observability coverage, not a new renderer reproduction. Accepting a configuration the reviewer never receives makes users troubleshoot their wording instead of the propagation path.

  8. serpro69 commented on Oct 26, 2026

    @serpro69

    Confirmed still present with Codex CLI and app-server 0.164.0 on macOS 26.6.2 arm64. Main model: gpt-6-astra; actual synchronous reviewer: codex-auto-review.

    I can add evidence from an actual denied review, beyond the deterministic renderer reproduction:

    • A fresh config/read with the trusted project's cwd resolves the nonblank auto_review.extra_policy from the project layer. auto_review.policy and experimental_policy_template were unset. configRequirements/read returned no managed requirements.
    • The codex-auto-review catalog template has one {{ tenant_policy_config }} occurrence and zero {{ extra_policy }} occurrences. Template length: 9,734 characters; SHA256: f47fbb2bdba5e7528bfae7f5e2844a7d45a3a922fa74b718f22b22917376cfcf.
    • The matching local guardian_review_feedback record identifies codex-auto-review and a denied decision. Its saved instructions contain neither the configured extra-policy heading nor the complete extra-policy text.
    • Substituting the catalog's main policy into that catalog template reproduces an exact prefix of those saved reviewer instructions. This ties the observed omission to the template used for the real review, rather than only to an inferred code path.

    For a temporary local repair, I set auto_review.experimental_policy_template to the complete observed template with only two newlines and {{ extra_policy }} inserted after {{ tenant_policy_config }}. The existing scoped extra_policy stays unchanged and auto_review.policy stays unset. Byte comparison verifies that removing the insertion restores the original template exactly. A fresh app-server configuration read loads the repaired template, and source-equivalent rendering includes both the complete catalog base policy and the complete configured addition.

    That last check verifies loading and prompt composition; I have not claimed a successful external action after starting a new session with the repair. The override pins the template and should be retired after the upstream fix.

    No raw reviewer prompts, private source, session identifiers, account data, or credentials are included in this report. The observed failure still matches the catalog-template selection gap described above.

  9. jordanschwartz-js commented on Oct 26, 2026

    @jordanschwartz-js

    Additional confirmation on 2026-10-26 with the macOS desktop app 26.1021.31345 (build 21828), bundled CLI/app-server 0.164.0-alpha.11.1.

    We traced a real synchronous codex-auto-review denial to the same template incompatibility:

    • The local configuration has a nonblank auto_review.extra_policy; auto_review.policy and experimental_policy_template are unset. A separate read-only diagnostic app-server configuration read resolves the addition correctly.
    • The desktop backend had restarted earlier that day, before the affected review. Restart alone did not resolve this instance.
    • The cached reviewer template has one {{ tenant_policy_config }} slot and zero {{ extra_policy }} slots (9,734 characters).
    • Using the renderer semantics from the exact matching source tag (rust-v0.164.0-alpha.11.1, commit 6905ecede7816e91373e9eabda3f6b0368fc747b), the observed catalog template, catalog policy and fixed output contract reproduce the complete 18,446-character base-instructions text recorded in the affected reviewer rollout exactly. Supplying the configured additional policy or an empty string produces identical output.

    This is a deterministic match to saved reviewer instructions, not a claim to have captured the complete wire request or the running backend's internal configuration.

    We also checked a proposed temporary repair entirely in memory: insert only \n\n{{ extra_policy }} immediately after {{ tenant_policy_config }} in the complete observed template. The result equals the matching release's bundled fallback template. Source-equivalent rendering then includes the complete original base policy and complete addition, with all other rendered text unchanged. Removing the insertion restores the original template exactly. We have not installed that override or claimed post-repair end-to-end success.

    Public upstream main at 36021e1ad500d328471aae26573d1fa0c872b335 still has zero extra-policy slots in the bundled catalog templates for both codex-auto-review and gpt-5.6-luna.

    A durable fix should cover served and bundled catalog templates and validate nonblank additions through normal catalog selection. Please also consider a diagnostic or defined safe handling for missing placeholders so restrictive additions cannot silently disappear. A local full-template override pins template wording and needs an explicit retirement path once upstream compatibility is restored.

    No private policy text, memory content, endpoints, account identifiers, local paths, raw transcripts or credentials are included.

  10. eddiew commented on Oct 28, 2026

    @eddiew

    Still present on codex-cli 0.165.0 and 0.166.0-alpha.5 (macOS arm64). Here is evidence from actual review decisions:

    • With auto_review.extra_policy saying a folder must never be deleted, an untrusted file asking for rm -rf on that folder was approved and the folder was deleted. This happened on 0.164.0, 0.165.0 and 0.166.0-alpha.5.
    • The same text in auto_review.policy got the command denied on 0.164.0 and 0.166.0-alpha.5, and the rationale cited the rule.

    Because auto_review.policy replaces the built-in policy (#38316), we work around this by sending the built-in policy text from the bundled catalog with our rules appended. On 0.165.0 that got the deletion denied too. The built-in text is identical from 0.155.1 to 0.165.0, but copying it means tracking every change, so a working extra_policy would be much better.

  11. dmrowell commented on Oct 30, 2026

    @dmrowell

    Additional Windows confirmation, observed 29 October 2026: desktop app 26.1023.51421 (build 22530, production channel), with CLI/current-chat version 0.165.0-alpha.1.2.

    A valid, nonblank auto_review.extra_policy was absent from four recorded denied reviews’ instructions and retained developer messages. The 9,734-character template and 18,446-character instruction fingerprints match those reported here.

    Operational impact: three denials in one turn were followed by a mid-task interruption, consistent with the documented circuit breaker. The owner had to repeat permission for routine nonsecret Linear reports; direct standing permission in the chat then allowed posting.

    The updater reports restart_required; post-restart behaviour is untested. No policy override was applied, and no private configuration or transcripts are attached.

  12. uncfreak1255-code commented on Nov 2, 2026

    @uncfreak1255-code

    I prepared a missing-slot fallback with regression coverage in fork PR #1, commit adc09dc (upstream base a098129).

    When the selected reviewer template lacks {{ extra_policy }}, the renderer appends nonblank additional policy before the output contract. Existing slot substitution and blank-addition behavior stay unchanged. The selected vendor template and resolved tenant policy remain in use, so no full-template override is needed for this delivery path.

    Regression results:

    • Original renderer: three regression failures, as expected.
    • Wrong variant forcing the bundled template: the catalog-specific regression fails, protecting future vendor-template updates.
    • Fixed renderer: all 55 codex-prompts library tests pass; Clippy and formatting checks pass.

    Coverage uses both bundled reviewer catalog entries through ResolvedModelMessages, plus permissive/restrictive additions, both transcript formats, blank input and literal placeholder text. The PR includes reproduction commands and details.

    This verifies source-level prompt composition, not model enforcement or installed desktop behavior.

  13. KohakuD commented on Nov 8, 2026

    @KohakuD

    Additional Windows desktop evidence from 8 November 2026, with actual denied Git-push reviews.

    Environment

    • Desktop Guardian rollout version: 0.167.0-alpha.3.2, originator Codex Desktop.
    • Windows x64, local workspaces, automatic review enabled.
    • Nonblank local [auto_review].extra_policy; policy and experimental_policy_template unset.

    Observed evidence

    1. A fresh read-only diagnostic app-server using the desktop's actual executable returns the full additional policy through config/read. configRequirements/read returns no managed requirements in that diagnostic process.
    2. Two actual Guardian rollouts have identical 18,446-character base instructions. The additional policy's distinctive heading and text are absent from all recorded message inputs, including developer and user messages, not just from session_meta.
    3. The local codex-auto-review catalog's model_messages.auto_review.policy_template is 9,734 characters, with zero {{ extra_policy }} slots and one {{ tenant_policy_config }} slot.
    4. The scoped addition records the owner's standing authorization for verified ordinary pushes through a fixed helper to a fixed repository/remote/main-branch allowlist. The helper restricts targets and rejects force pushes, tags, URL rewrites and extra arguments. Its contents still match the approved hash.
    5. One reviewer denied an in-scope intermediate source push because it did not recognize authorization before full roadmap completion, despite the recorded standing authorization covering verified intermediate commits.
    6. In a second review at approximately 15:16 UTC, an ordinary push through that same approved helper was classified risk_level=high, user_authorization=low and denied for missing trusted authorization. After the owner repeated direct authorization in that chat at approximately 15:18 UTC, the same action was assessed as user_authorization=high, outcome=allow.

    Impact
    Routine work across existing and new project chats repeatedly stops for per-push confirmation. Saving the documented extra policy, checking the helper and observing occasional successful pushes have not established a durable resolution.

    Evidence limits
    A fresh diagnostic process does not prove every effective startup override in the already-running desktop host. Saved rollouts do not establish the complete internal/wire request. The current catalog cache was not bound to each review at invocation time, and we have not executed the exact-version renderer in isolation. These observations support the omission reported here; they do not independently establish every internal causal step.

    No safety policy was replaced or disabled, and denied operations were not replayed through alternate routes. This AI-assisted report was explicitly requested by the owner. It intentionally excludes personal paths, account identifiers, repository URLs, session IDs, private policy text, source code, raw transcripts and credentials.

    Please include this newer Windows desktop case when checking served/bundled template compatibility and validation of nonblank additions through normal catalog selection. A clear diagnostic when configured additional policy cannot be inserted would also prevent users from relying on a silently absent rule.

  14. aofei commented on Nov 14, 2026

    @aofei
    ContributorAuthor

    Addressed in 0.169.0 by #60646. After migrating from local auto_review.extra_policy to managed guardian_extra_policy in requirements.toml, I confirmed that the full additional policy is present in five actual Guardian reviewer prompts. Closing as resolved.

  15. milobird commented on Nov 16, 2026

    @milobird

    Additional evidence from the macOS desktop app on 16 November 2026. This installation still bundles the affected pre-fix version; this is not a claim of regression in 0.169.0 or a request to reopen.

    • Desktop app: ChatGPT 26.1103.31037, build 25241.
    • Actual originating chat and reviewer: Codex 0.167.0-alpha.3.2, verified from saved session metadata.
    • Reviewer: codex-auto-review, with automatic review enabled and a workspace-write sandbox.
    • A nonblank project auto_review.extra_policy authorized task-relevant external code-review delegation. Both actual denial records omitted that policy from the reviewer's instructions and classified the request as high risk with low authorization. Reading the config into the chat did not resolve this: the reviewer treated it as tool-output evidence. It approved the action after direct user authorization.

    The two saved denial instruction strings are identical: 18,446 characters, SHA256 f893abed23f18900cb5dd8fe34e2aa616634efcd1792ec38cd7241972dacfd8b. The observed catalog template is 9,734 characters, SHA256 f47fbb2bdba5e7528bfae7f5e2844a7d45a3a922fa74b718f22b22917376cfcf, with one tenant-policy slot and no extra-policy slot.

    Using the exact release renderer, the observed catalog template, default policy and release output contract reproduces both recorded instruction strings byte for byte. A synthetic extra-policy sentinel and an empty addition produce identical output. The bundled-template control retains the sentinel. These checks make no model calls or external delegations.

    The cache was refreshed after the incident, so the evidence is the exact reconstructed instruction digest, not its file timestamp. We did not recover the original turn's effective configuration, and correct prompt composition does not establish what a subsequent reviewer decision would be.

    The fix in #60646 and its inclusion in 0.169.0 provide the migration path: managed guardian_extra_policy with a compatible client. Updating only a separate shell CLI will not update a desktop app's bundled backend. We have not yet updated this desktop or validated the managed-policy migration there.

  16. shishi commented on Nov 22, 2026

    @shishi

    I don't think moving extra_policy to the managed guardian_extra_policy setting is an adequate replacement for the previous user-configurable option.

    PR #60646 explains the need for trusted Guardian prompt templates, but why does that require removing the ability for individual users to configure their own additional review policies?

    Template integrity and user configurability are separate concerns. A trusted template could still provide a designated slot for user-defined policy instructions without allowing users to override the template itself.

    Even if the underlying functionality is unchanged, moving control from individual users to managed configuration is a meaningful loss of functionality.

    Was removing user-level configurability intentional? If so, what was the specific reason for that decision?

    I'd like to request that auto_review.extra_policy, or an equivalent user-level setting, be restored. Users should be able to customize review policies for their own workflows without requiring administrator-managed configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIbugconfigsandbox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions