Repository navigation
Add native specialist roles and delegation limits to CodexProvider - #6138
markstuart-oai wants to merge 2 commits into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (1)
ℹ️ 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.
Summary
This pull request adds optional specialist roles and a cumulative delegation limit to
CodexProvider. A limit on open threads alone lets the model close a child and reuse its slot.Select an exact V1 catalog entry with
provider.get_model(name). Close the provider withawait provider.aclose()when finished. Roles supply instructions. Core's built-in roles remain available, and the model can skip delegation.Each native model invocation gets a private, ephemeral tree. The root and all descendants share the required
max_delegationsbudget. Before dispatch, the SDK charges each attempt to spawn, resume or send input, including failed calls and repeated IDs. Only the exact V1 wait and close functions are exempt. Closing a child never restores an allowance.max_depthdefaults to one generation.An overrun stops the calling thread before dispatch. The SDK raises
RuntimeErrorafter cleanup even if the parent finishes without waiting for that child. Earlier admitted calls can still run.Neither limit caps model requests or cost. Waiting, model continuations, transport sends and retries can incur additional requests. For a hard request limit, use
Agent.as_toolwith separate parent and child turn limits and enforce a shared quota before each send and retry.Children inherit the parent's model and permissions. The profile disables workspace tools and MCP servers. Core can still read local context. SDK tools, handoffs, native tool hooks, V2 and conflicting settings fail before generation. Omitting
childrenpreserves ordinary settings, including any delegation already enabled in Core.Test plan
Checks
.agents/skills/code-change-verification/scripts/run.sh