Skip to content

Allow guardian bare allow output#18797

Merged
dylan-hurd-oai merged 5 commits intomainfrom
codex/guardian-bare-allow-output
Apr 21, 2026
Merged

Allow guardian bare allow output#18797
dylan-hurd-oai merged 5 commits intomainfrom
codex/guardian-bare-allow-output

Conversation

@maja-openai
Copy link
Copy Markdown
Contributor

@maja-openai maja-openai commented Apr 21, 2026

Summary

Allow guardian to skip other fields and output only {"outcome":"allow"} when the command is low risk.
This change lets guardian reviews use a non-strict text format while keeping the JSON schema itself as plain user-visible schema data, so transport strictness is carried out-of-band instead of through a schema marker key.

What changed

  • Add an explicit output_schema_strict flag to model prompts and pass it into codex-api text formatting.
  • Set guardian reviewer prompts to non-strict schema validation while preserving strict-by-default behavior for normal callers.
  • Update the guardian output contract so definitely-low-risk decisions may return only {"outcome":"allow"}.
  • Treat bare allow responses as low-risk approvals in the guardian parser.
  • Add tests and snapshots covering the non-strict guardian request and optional guardian output fields.

Verification

  • cargo test -p codex-core guardian::tests::guardian
  • cargo test -p codex-core guardian::tests::
  • cargo test -p codex-core client_common::tests::
  • cargo test -p codex-protocol user_input_serialization_includes_final_output_json_schema
  • cargo test -p codex-api
  • git diff --check

Note: cargo test -p codex-core was also attempted, but this desktop environment injects ambient config/proxy state that causes unrelated config/session tests expecting pristine defaults to fail.

@dylan-hurd-oai dylan-hurd-oai marked this pull request as ready for review April 21, 2026 03:45
@dylan-hurd-oai dylan-hurd-oai requested a review from a team as a code owner April 21, 2026 03:45
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: a04b390dbf

ℹ️ 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".

Comment on lines +537 to +539
risk_level: Option<GuardianRiskLevel>,
user_authorization: Option<GuardianUserAuthorization>,
outcome: super::GuardianAssessmentOutcome,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Fail closed when guardian omits structured risk fields

The parser now accepts payloads where only outcome is present because risk_level and user_authorization are optional. That means malformed/partially formatted allow responses (e.g., missing or misspelled risk fields) are treated as valid approvals instead of parse failures, weakening the previous fail-closed behavior for malformed guardian output.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

not sure if this is a super big concern. if a field is misspelled or mangled, it changes the reported risk level, not the outcome.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

agree!

Comment thread codex-rs/core/src/guardian/policy_template.md Outdated
dylan-hurd-oai and others added 2 commits April 20, 2026 21:13
This reverts commit a04b390.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@dylan-hurd-oai dylan-hurd-oai enabled auto-merge (squash) April 21, 2026 05:17
@dylan-hurd-oai dylan-hurd-oai disabled auto-merge April 21, 2026 22:37
@dylan-hurd-oai dylan-hurd-oai merged commit ef00014 into main Apr 21, 2026
24 of 25 checks passed
@dylan-hurd-oai dylan-hurd-oai deleted the codex/guardian-bare-allow-output branch April 21, 2026 22:37
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants