Skip to content

feat: add guardian network approval trigger context#18197

Merged
dylan-hurd-oai merged 9 commits intomainfrom
codex/viyatb/guardian-network-approval-context
Apr 22, 2026
Merged

feat: add guardian network approval trigger context#18197
dylan-hurd-oai merged 9 commits intomainfrom
codex/viyatb/guardian-network-approval-context

Conversation

@viyatb-oai
Copy link
Copy Markdown
Collaborator

@viyatb-oai viyatb-oai commented Apr 16, 2026

Summary

Give guardian network-access reviews the command context that triggered a managed-network approval. The prompt JSON now includes the originating tool call id, tool name, command argv, cwd, sandbox permissions, additional permissions, justification, and tty state when a single active tool call can be attributed.

The implementation keeps the trigger shape canonical by serializing GuardianNetworkAccessTrigger directly and lets each runtime build that trigger from its ToolCtx. Non-guardian approval prompts avoid cloning the full trigger payload.

UX changes

Guardian network-access reviews now include a trigger object that explains what command caused the network approval. Instead of seeing only the requested host, the guardian reviewer can also see the originating tool call, argv, working directory, sandbox mode, justification, and tty state.

Example payload the guardian reviewer can see:

{
  "tool": "network_access",
  "target": "https://api.github.com:443",
  "host": "api.github.com",
  "protocol": "https",
  "port": 443,
  "trigger": {
    "callId": "call_abc123",
    "toolName": "shell",
    "command": ["gh", "api", "/repos/openai/codex/pulls/18197"],
    "cwd": "/workspace/codex",
    "sandboxPermissions": "require_escalated",
    "justification": "Fetch PR metadata from GitHub.",
    "tty": false
  }
}

The network review itself remains scoped to the network decision: target_item_id stays null. trigger.callId is attribution context only, so clients can still distinguish network reviews from item-targeted command reviews.

Verification

  • Added coverage for serializing network trigger context in guardian approval JSON.
  • Added regression coverage that network guardian reviews do not reuse trigger.callId as target_item_id.

Co-authored-by: Codex noreply@openai.com
@viyatb-oai viyatb-oai changed the title [codex] Add guardian network approval trigger context feat: add guardian network approval trigger context Apr 16, 2026
@viyatb-oai viyatb-oai requested review from dylaan-oai, dylan-hurd-oai and won-openai and removed request for dylaan-oai April 16, 2026 21:47
@viyatb-oai viyatb-oai marked this pull request as ready for review April 16, 2026 21:47
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: fa8f0f6996

ℹ️ 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 thread codex-rs/core/src/guardian/approval_request.rs Outdated
Comment thread codex-rs/core/src/guardian/approval_request.rs Outdated
viyatb-oai and others added 3 commits April 16, 2026 15:27
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Copy link
Copy Markdown
Collaborator

@dylan-hurd-oai dylan-hurd-oai left a comment

Choose a reason for hiding this comment

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

couple small comments but overall looks reasonable

Comment thread codex-rs/core/src/guardian/approval_request.rs Outdated
Comment thread codex-rs/core/src/tools/network_approval_tests.rs Outdated
Comment thread codex-rs/core/src/guardian/approval_request.rs
Co-authored-by: Codex <noreply@openai.com>
@viyatb-oai viyatb-oai requested a review from a team as a code owner April 20, 2026 19:51
Comment thread codex-rs/core/src/tools/network_approval.rs Outdated
viyatb-oai and others added 3 commits April 21, 2026 16:26
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@dylan-hurd-oai dylan-hurd-oai merged commit 2d73bac into main Apr 22, 2026
25 checks passed
@dylan-hurd-oai dylan-hurd-oai deleted the codex/viyatb/guardian-network-approval-context branch April 22, 2026 21:00
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 22, 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.

2 participants