Repository navigation
Require an explicit grant for native Codex delegation and bound child attempts - #6138
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (2)
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 1df5a86ade
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
There was a problem hiding this comment.
Approved after comprehensive static review and two independent reviews. Reviewed Python declarations, native configuration checks, pinned Core role overlays, exact V1 model selection, concurrency/depth enforcement, per-request manager and in-memory store isolation, cross-request resume rejection, and role-file lifetime through tree shutdown. Built-in roles preserve the effective parent restrictions; custom roles add instructions only. No actionable correctness or isolation findings.
Rechecked the cumulative budget advisory. Its mechanics are real: concurrency and depth do not bound cumulative requests, cost, or native internal turns. The API explicitly documents this limitation, and existing Core internal tool loops already span multiple requests within a Runner turn. This approval does not claim a cost budget or restrict selection to declared roles. A cumulative budget is separate hardening rather than a demonstrated violation of this API contract.
Hosted CI is complete: 33 passed and 4 skipped; no failures. Static review only; no candidate code or local tests executed.
There was a problem hiding this comment.
Approved after static re-review and an independent second review. The new tree-wide delegation-attempt budget addresses repeated spawn/close replacement: atomic admission is shared by siblings and descendants, failed calls consume budget, and closing a child does not refund it. Verified the pinned Core interceptor ordering and inherited registry place admission before tool dispatch. Unsupported call forms fail closed, and child-limit errors propagate after joined cleanup even when the parent finishes normally. Reviewed concurrent sibling, failed-call, repeated-ID, no-refund, fresh-tree, and depth regressions. No actionable findings in this increment.
This is a delegation-attempt limit, not a hard model-request or cost limit: waits, model continuations, and transport retries can still issue requests, as the documentation explicitly states.
Hosted CI is complete: 33 checks passed and 4 skipped; no failures. Static review only; no candidate code, local tests, or native builds executed.
Retain native tracing and exclude child runs from workspace approval recovery.
There was a problem hiding this comment.
🛡️ Codex Security Review · Automatically triggered
Here are some automated security review suggestions for this pull request.
Reviewed commit: 9b7a06e3c9
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
There was a problem hiding this comment.
Approved after static re-review of the base merge, with independent Python and native integration reviews. Rechecked delegation isolation alongside native approvals: saved workspace approvals are rejected before startup, recovery is disabled with children, and unexpected approval events fail closed. Tree-wide delegation budgets and role-directory lifetime remain intact through joined cleanup. No actionable findings.
Hosted CI snapshot: {"skipped": 2, "success": 17, "in_progress": 7}. Unfinished checks remain tracked. Static review only; no candidate code or local tests executed.
Hosted CI complete at 9b7a06e3c97f318fefd38ceb91bc1ffcbdb15dd7: 33 checks passed, 4 skipped. No pending or failed checks. Static review only; no local tests executed.
There was a problem hiding this comment.
Approved after static re-review and two independent reviews of the four-file increment. The separate wait/close allowance is shared across the tree, charged atomically before dispatch, and limited to twice max_delegations. Failed and repeated calls consume allowance; each new invocation gets fresh counters. Checked overflow propagates before manager creation. The regression coverage addresses repeated failed waits/closes, fresh-run reset, and parent/child consumption. This addresses the repeated wait/close concern in #6138 (comment). The documentation correctly retains that these are not overall request, token, or cost limits. No actionable findings.
Hosted CI snapshot: {"skipped": 2, "success": 17, "in_progress": 7}. Unfinished checks remain tracked. Static review only; no candidate code or local tests executed.
Hosted CI complete at 29aaa337590a9acdc657024e9880ee1a02ccc804: 33 checks passed, 4 skipped. No pending or failed checks. Static review only; no local tests executed.
Update feat/bounded-native-children against feat/simple-codex.
There was a problem hiding this comment.
Re-reviewed current commit 9ba4de1b37ba5ca2ab981df4778ac7748a2ef4cc, including changes since the prior approval and refreshed base. The refreshed cleanup integration checks delegation failure after joining child cleanup and clears the completed response before closing observations. It preserves the original failure and prevents publishing success after a child exceeds its budget. Shared atomic tree budgets and pre-dispatch charging remain unchanged; no actionable regression found.
Hosted CI: {'SUCCESS': 9, 'IN_PROGRESS': 15}. Unfinished checks remain pending follow-up. Static review only; no candidate code or local tests executed.
Hosted CI follow-up (2026-11-22 22:00 UTC): Windows Python 3.10 failed in test_logical_model_retry_parity[metadata-run-openai]: the timestamp-order assertion differs by 136 ns. Static inspection attributes this to the existing test helper converting datetime.timestamp() through float to nanoseconds; the test file is identical to the base, and this failing OpenAI-provider path is outside the native-children changes. The job otherwise recorded 11,922 passed and 372 skipped. Approval remains; this is not a clean CI result. Remaining checks and failed-check status remain pending follow-up. No local tests executed.
Hosted CI follow-up (2026-11-22 22:15 UTC): current commit 9ba4de1b37ba5ca2ab981df4778ac7748a2ef4cc completed with 33 successful checks and 4 skipped checks. The previously failed Windows Python 3.10 check passed on rerun attempt 2, completed at 22:15:42 UTC. The earlier failure is historical; current CI is clean. Static review only; no local tests executed.
Update feat/bounded-native-children against feat/simple-codex.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Approved after static re-review of 6177f1dbdc33d8383ac2de18fa223d36235b3ef3 and an independent review. List-based role declarations are snapshotted into an immutable tuple. Both Runner modes pass the effective model configuration to approval validation, so a bounded Codex provider rejects incompatible workspace approval recovery before claiming the saved session. Dispatch retains its second guard. Rechecked integration with hook-aware native approvals, input hashes, child recovery restrictions, and joined cleanup; no actionable findings.
Hosted CI at publication: {'SUCCESS': 18, 'IN_PROGRESS': 6}. Unfinished checks remain tracked. Static review only; no candidate code, local tests, or native builds executed.
Update feat/bounded-native-children against feat/simple-codex.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Approved after static re-review and independent review. The max_delegation_attempts rename is consistent across Python and native configuration. Typed child-limit errors originate from fixed interceptor tags, survive protected error handling without request data, and trigger the retry abort veto before application policy, preventing a retry from granting a fresh allowance. Shared atomic delegation and wait/close counters and joined cleanup checks remain intact, including child denial after the parent finishes.
Reviewed the updated tests for both limits and both Runner modes, protected diagnostics, and retry-policy exclusion. No actionable findings. The documentation correctly distinguishes attempt limits from request, token, or cost caps.
Hosted CI: 21 passed and 3 running at review time; no failures observed. Static review only; no candidate code, local tests, or native builds executed.
Update feat/bounded-native-children against feat/simple-codex.
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Approved after independent static re-review of the refreshed base and test changes. The child-limit runtime, typed redacted errors, retry veto, and native restore validation remain intact. Both resume paths preserve restore_config while forwarding the merged function-availability policy before claiming a checkpoint.
The isolation test now accepts only the precise optional late completion notification for each child, verifies the unchanged history prefix and exact completed status, and still requires two finished waits plus foreign-tree denial. No actionable regression found.
Hosted CI: 16 passed and 8 running at the latest observation. Static review only; no candidate code or local tests executed.
|
CI recovered on the same commit Previous observation: Hosted CI follow-up for This matches the shutdown failure signature seen on other branches; the logs do not establish that this PR introduced it. The code-review approval stands, but this wheel verification is not passing and requires investigation or a successful rerun. At the latest check observation, 31 checks passed, 2 were skipped, and this job failed. Hosted logs only; no candidate code or local tests were executed. |
Update feat/bounded-native-children against feat/simple-codex.
There was a problem hiding this comment.
Approved after static re-review and an independent review of this refresh. The shared error message consistently covers missing, unknown, and non-V1 models; the catalog-selection example uses the exact slug and closes the provider in finally. Existing delegation budgets, narrowed catalog capabilities, retry veto, and workspace-approval restrictions remain intact. No new actionable findings.
Hosted CI currently has 15 successful checks and 9 running. Static review only; no candidate code or tests were executed.
Hosted CI update (2026-11-23 22:51 UTC): all 33 executed checks passed and 2 were skipped at this reviewed commit. No local tests were run.
Update feat/bounded-native-children against feat/simple-codex.
There was a problem hiding this comment.
Re-reviewed 673be3b against the previously reviewed revision, with an independent static review. The catalog-selection example matches the visibility/V1 requirements, and the specialist example correctly distinguishes native inherited permissions from Agent.as_tool configuration. Rechecked relevant run-loop integration. No new actionable findings.
Hosted CI at the latest check: 18 successful, 6 in progress; completion remains pending. Static review only; no candidate code or local tests were executed.
Hosted CI follow-up (2026-11-24 03:32 UTC): all checks at this reviewed commit are complete: 33 passed and 2 skipped, with no failures. The pending CI follow-up is resolved. Static review only; no candidate code or local tests executed.
There was a problem hiding this comment.
Approved after static re-review and an independent second review. Static native-child conflicts are rejected before a fresh checkpoint claim, while dynamic eligibility and declaration callbacks stay in the normal claimed-run path. Model overrides and settings precedence are respected, and existing final validation remains authoritative. Checked run_config propagation through all session entry points and native restore, built-in-only role configuration with mandatory positive limits, and the explicit update_plan conflict. Tests cover checkpoint preservation, withheld functions, dynamic callbacks, and both Runner modes. No actionable findings.
Hosted CI at review: 13 checks passed and 11 running, with no failures. Remaining checks require follow-up. Static review only; no candidate code or local tests executed.
Hosted CI follow-up (2026-11-24 06:27 UTC): all checks at this reviewed commit are complete: 33 passed and 2 skipped, with no failures. The pending CI follow-up is resolved. Static review only; no candidate code or local tests executed.
Update feat/bounded-native-children against feat/simple-codex.
There was a problem hiding this comment.
Approved after static re-review and an independent review of the refreshed base and native-child reasoning-effort changes. The effective parent effort is applied before catalog construction, retained for same-model spawns, and checked against refreshed thread policy; conflicting subagent defaults and unsupported effort overrides are rejected. Reviewed configuration ordering, per-invocation services, tests, and existing feedback. Hosted CI at review: 5 passed, 19 still running. No candidate code or local tests were run.
Hosted CI update (2026-11-24 07:47 UTC): 19 passed, 2 skipped, 4 running, 1 failed. Windows 3.10 job failed test_logical_model_retry_parity[default-run-openai]: its floating-point timestamp conversion puts the span end 152 ns after the tool-start timestamp (1 failed, 12,554 passed, 384 skipped). The test file is byte-identical to base and this is the OpenAI adapter case, not native children. Static evidence points to timestamp precision in the existing assertion; no rerun has verified that inference. Approval remains unchanged; CI is not green. No local tests were run.
Hosted CI follow-up (2026-11-24 08:02 UTC): all checks at this reviewed commit are complete: 33 passed and 4 skipped, with no failures. The pending CI follow-up is resolved. Static review only; no candidate code or local tests executed.
There was a problem hiding this comment.
Approved after static re-review and an independent second review. Without an explicit children profile, both native delegation mechanisms are disabled after caller overrides, and effective thread configuration is checked again before execution. The enforced overrides persist through configuration refresh; explicit bounded delegation remains unchanged. Reviewed V1/V2 denial coverage in both Runner modes, preservation of Python Agent.as_tool calls, documentation, and existing feedback. No actionable findings.
Hosted CI at review: 17 checks passed and 7 running, with no failures observed. Remaining checks require follow-up. Static review only; no candidate code, local tests, or native builds were executed.
Hosted CI follow-up (2026-11-24 16:42 UTC): all checks at this reviewed commit are complete: 33 passed and 2 skipped, with no failures. The pending CI follow-up is resolved. No local tests were run.
Summary
Native delegation now requires an explicit grant on each
CodexProvider. Previously, a model could start a child even when the provider didn't advertise a delegation tool. The SDK now disables native children by default and checks the effective policy before starting a thread.If your application relies on implicit delegation, opt in with a limit. No change is needed for ordinary workspace tools or Python
Agent.as_tool().Use
provider.get_model(slug)with a listed, accessible V1 model. Close the provider withawait provider.aclose(). The provider docstring shows a complete example and how to find candidate slugs. V2 models can still run without native children. Local settings and model defaults cannot grant delegation.What the limit counts
Each native model invocation starts a separate tree. The parent and descendants share the following allowances when
max_delegation_attempts=N.spawn_agent,resume_agent,send_inputand unknown functionsNcombinedwait_agentandclose_agent2 × NcombinedWith the example above, the model can make two delegation attempts, keep up to two children open, and wait or close up to four times. Failed and repeated calls count. Closing a child restores neither allowance. Depth defaults to one generation. These limits do not cap model calls, tokens or spend.
Exceeding an allowance raises
CodexChildLimitErrorfromagents.models.codexafter cleanup. Catch it aroundRunner.run()or while consumingstream_events(). Itslimitis"delegation_attempts"or"wait_close_attempts". A retry cannot reset the allowance after a refusal. Already admitted calls may finish.Specialists
To add instructions for a named specialist, pass
roles=[CodexRole("editor", "Review drafts.", "Suggest a concise edit.")]toCodexChildren. ImportCodexRolefromagents.models.codex. Native children share the parent's model, reasoning effort and permissions. The SDK refuses conflicting overrides.For a specialist with different tools or a different model, use Python
Agent.as_tool()without the native grant. The bounded V1 profile excludes workspace tools, plan updates, MCP servers, SDK tools, handoffs and native hooks. Core can still read local context. Resume a paused workspace approval with the original provider configuration.Test plan
Checks