Repository navigation
feat(codex): enforce Gateway tool policy for model callbacks - #174565
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
…enlee/codex-gateway-tool-policy-p0
|
Codex review: needs real behavior proof before merge. What this changesApplies the shared Gateway tool policy to Codex tool catalogs and retained callbacks, including hook-adjusted MCP calls. Example: The policy permits managed_task with action read, then changes to an empty allowlist during the turn.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open: it provides distinct Codex policy integration, and the earlier descriptor-quarantine finding is fixed; no new actionable code defect was identified. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe Codex adapter projects Gateway tools into native declarations and translates model callbacks into shared host-tool execution, where hooks, policy checks, and argument validation precede implementation dispatch. flowchart LR
A[Gateway tools and policy] --> B[Codex catalog projection]
B --> C[Codex app server]
C --> D[Retained callback bridge]
D --> E[Hooks and final argument checks]
E --> F[Shared policy assertion]
F --> G[Tool implementation]
Technical reviewBest possible solution: Keep the adapter on the shared policy owner and qualify permitted, prohibited, and revoked callbacks through the real Codex execution path. Do we have a high-confidence way to reproduce the issue? This is a feature integration; source inspection establishes the added enforcement path, while the submitted tests use controlled fixtures and no target code was executed during review. Is this the best way to solve the issue? Reusing the shared policy projector and assertion is the appropriate design, and the patch preserves native catalog identity and MCP-owned schema validation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1ea376e41648. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: Source inspection found no concrete bypass, but the changed authorization boundary still requires final-effect qualification. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +66, Tests +432, Docs +13. Total +511 across 11 files. Added test files: 2. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 16, 2026, 10:48 PM ET / October 17, 2026, 02:48 UTC (Revision 2). |
|
Codex: resolved the conflicts in The adapter now follows the deployment contract: capture policy when constructing tools; activate changes through Gateway restart/replacement after affected old work ends. Final post-hook action authorization remains enforced, including MCP callbacks. Live-update test expectations were replaced with reconstruction coverage, including construction without a hook context. The focused adapter suites cover 86 cases; extension production/test types, scoped lint, formatting, line-cap/assertion-safety and config-baseline checks pass. The max-lines-suppression check reports three unchanged UI files already in main, documented in the description. Fresh independent source review found no material issue. Earlier deployed proof remains attributed to its pinned runtime; it is not claimed for this updated head. CI and updated-head deployment qualification remain pending. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex: the failed test on
Both fail The focused local command reproduces that exact duplicate: The automatic classifier labels the job new because main's job with the same shard number passed and its log lookup was unavailable. Shard contents differ: the identical failed test is in main's shard 40. The linked logs establish attribution independently of that job-name comparison. The shared routing repair should leave the memory test with one owner. This evidence is also recorded in the PR description. |
…w#174565) * feat(gateway): enforce required model tool and action policy * fix(gateway): accept unvalidated tool descriptors in policy helpers * test(gateway): qualify tool policy fixtures and config schema * feat(codex): enforce Gateway tool policy for model callbacks * test(gateway): type the action rewrite fixture * refactor(agents): keep final tool policy assembly together * feat: restrict model automation administration through Gateway policy * fix(codex): retain genuine discovery controls in restored catalogs * fix(worker): retain prepared prompt report in turn results * fix(gateway): admit caller-owned automation mutations * fix(codex): quarantine unreadable tools before policy filtering * fix: backport managed Gateway compatibility repairs Retain the reviewed caller-scoped automation admission and Codex descriptor quarantine repairs on the pinned runtime source. Sources: 2f1333a and ba2c7ce. * fix(cron): avoid host auth capture for required workers * fix(cron): avoid host auth capture for required workers * fix(worker): preserve Gateway tool errors across proxy calls * fix(worker): preserve Gateway tool errors across proxy calls * fix(cron): use selected Harness authentication for schedules * fix(cron): use selected Harness authentication for schedules --------- Co-authored-by: stevenlee-oai <[email protected]>
Implements RFC-0021 item 5 and the Codex callback portion of item 8 (RFC), building on the merged #174547 and #174580.
What Problem This Solves
Gateway-supplied tools and callbacks in Codex must obey the deployment's Gateway tool policy.
User Impact
When
tools.gatewayPolicyis configured, Codex receives only permitted Gateway tools and actions, and callbacks reject prohibited actions before execution. Codex-native tools and direct human Gateway administration retain their existing permissions. Behavior without the policy is preserved.The policy is captured when tools are constructed. Changes require Gateway restart or replacement after affected old work ends. Saved native declarations keep their fingerprints; reconstructed callbacks can therefore deny an older advertised call.
Why This Change Was Made
The adapter reuses the shared Gateway policy for catalog projection and final argument validation after preparation and hooks, including MCP callbacks. Ordinary tool restrictions and supplemental exclusions can narrow access further.
Unreadable descriptors are quarantined before policy filtering, preserving healthy tools and genuine discovery controls. Invalid policy configuration still fails explicitly. This PR changes the Codex adapter, not native Codex or OCE's runtime pin.
Evidence
e9981073bdd; those files and the baseline are unchanged by this PR.These checks use controlled adapter fixtures. Earlier isolated OCE qualification used pinned runtime
c2976c807b7with Codex0.163.0-alpha.2; it does not qualify the updated head. Updated-head deployment qualification, CI and human review remain incomplete.