Repository navigation
refactor(codex): reuse core exec policy algebra - #140636
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. |
|
Codex review: blocked before merge. Reviewed September 7, 2026, 8:27 AM ET / 12:27 UTC. ClawSweeper reviewWhat this changesThe Codex plugin reuses core execution-policy calculations through a typed SDK object, removes two deprecated comparator exports, and documents their replacement. Merge readiness⛔ Blocked before merge - 3 items remain The consolidation remains useful on current main, and source inspection found no introduced execution-policy defect. Keep this protected, maintainer-authored PR open; the remaining choice concerns retirement of the deprecated SDK exports. Priority: P2 Review scores
Verification
How this fits togetherThe Codex plugin combines OpenClaw execution settings and host approval floors before selecting Codex sandbox and approval behavior. The SDK supplies shared policy calculations while the plugin retains validation and native policy translation. flowchart TD
A[Execution settings] --> C[Codex policy adapter]
B[Host approval floors] --> C
C --> D[Shared core policy calculations]
D --> E[Effective execution policy]
E --> F[Codex sandbox and approval settings]
Decision needed
Why: The removal is deliberate and documented, but the captured material does not explicitly reconcile this PR's exception with the retained SDK window; that acceptance belongs to the SDK owner. Before merge
Agent review detailsSecurityNone. PR surfaceSource -32, Docs +7, Other +2. Total -23 across 5 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the shared policy algebra and typed migration path, with an explicit SDK-owner disposition for the two export removals under the retained compatibility window. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving consolidation, and no concrete runtime defect is reported or found; existing policy cases were inspected without executing tests. Is this the best way to solve the issue? Yes for the consolidation: it removes duplicate calculations while preserving plugin-owned validation and native translation. The accompanying SDK retirement needs an explicit compatibility disposition. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d1c811bdfe16. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
02be3e7 to
ba3a0bf
Compare
ba3a0bf to
0b70747
Compare
Keep strict readers, provider projection, and approval-floor layering in the Codex adapter; core owns mode mappings and ordering. Proof: 172 Codex configuration tests and 78 core approval tests; independent review clean.
Reuse the existing mode resolver and move ordering helpers off the deprecated barrel. Proof: 250 focused tests and SDK export/surface checks pass; autoreview clean.
Keep native policy projection in the Codex adapter while the existing public harness SDK owns a typed execPolicy object. Retire the two unused deprecated comparators; no public entrypoint is added. Shrink the exact SDK export cap from 4446 to 4445 and the callable cap from 2629 to 2627, matching canonical surface output after rebasing over the landed tool policy consolidation. This lane retains a -1/-2 reduction; no budget grows relative to main. Proof: 250 focused tests, 10 SDK surface-report tests, canonical SDK checks, and the local build pass. Changed checks pass through core lint and hit only the approved nested-worktree extension declaration boundary. Fresh staged Codex review is clean through P2 after cap conflict resolution.
0b70747 to
3c2e5d4
Compare
|
Merged via squash.
|
* refactor(codex): reuse core exec policy algebra Keep strict readers, provider projection, and approval-floor layering in the Codex adapter; core owns mode mappings and ordering. Proof: 172 Codex configuration tests and 78 core approval tests; independent review clean. * refactor(codex): keep exec SDK exports budget neutral Reuse the existing mode resolver and move ordering helpers off the deprecated barrel. Proof: 250 focused tests and SDK export/surface checks pass; autoreview clean. * refactor(codex): expose exec algebra as one public SDK object Keep native policy projection in the Codex adapter while the existing public harness SDK owns a typed execPolicy object. Retire the two unused deprecated comparators; no public entrypoint is added. Shrink the exact SDK export cap from 4446 to 4445 and the callable cap from 2629 to 2627, matching canonical surface output after rebasing over the landed tool policy consolidation. This lane retains a -1/-2 reduction; no budget grows relative to main. Proof: 250 focused tests, 10 SDK surface-report tests, canonical SDK checks, and the local build pass. Changed checks pass through core lint and hit only the approved nested-worktree extension declaration boundary. Fresh staged Codex review is clean through P2 after cap conflict resolution.
What Problem This Solves
Codex's OpenClaw exec-policy adapter copied core's mode mappings and security/ask ordering, allowing harness policy to drift from execution-host approvals.
Why This Change Was Made
Reuse core's algebra through one typed
execPolicyobject on the existing publicopenclaw/plugin-sdk/agent-harness-runtimeentrypoint. The plugin retains strict readers, layer ordering, explicit full-session handling, approval floors, touched-state preservation, and native Codex sandbox/approval projection. It selects security/ask explicitly so core's auto-review field does not leak into its result.The object replaces the unused deprecated
infra-runtime.minSecurityandinfra-runtime.maxAskexports. Repository and indexed global/org consumer audits found no OpenClaw SDK consumers of those exports; independent same-name implementations and warning shims are not consumers. Unindexed/private consumers remain outside that evidence. No entrypoint is added. Canonical counts/caps are 152/152 entrypoints, 4445/4445 exports, 2627/2627 callable exports, 1133/1138 deprecated exports, and 50/50 wildcard exports. Export/callable caps shrink by 1/2 relative to current main, preserving the earlier tool-policy consolidation's reduction. Production -32 lines; tooling +2; documentation +7; tests unchanged.User Impact
No intended behavior change. Plugin developers can migrate to the typed
execPolicymembers. The runtime migration guide also points the retired mode projections to this public typed replacement. Core implementations remain unchanged.Evidence
766cfd92b72eaef5121d506511c6ca08e8155997, including worker-transfer repair fix(node-host): honor umask in Git transfer mode assertions #140771 and Telegram test-size repair fix(telegram): unblock PR lint checks for progress-update tests #141148. Preserved the split SDK runtime guide and the landed tool-policy object.node scripts/run-vitest.mjs extensions/codex/src/app-server/config.test.ts src/infra/exec-approvals-policy.test.ts test/scripts/plugin-sdk-surface-report.test.ts: all 260 tests passed (172 Codex, 78 core, 10 SDK budget).pnpm plugin-sdk:sync-exports,pnpm plugin-sdk:surface,pnpm plugin-sdk:check-exports, andpnpm plugin-sdk:surface:checkpassed. No generated output was hand-edited.pnpm buildpassed in 10m39.4s, including 91 plugins, 53 control-plane loads, and packaged declarations. This rebase preserved runtime patch bytes; only cap arithmetic and migration documentation changed.node scripts/check-changed.mjspassed all five typecheck lanes, SDK/ratchet guards, closure tests, dead-export scans and core lint, then reached only the explicitly allowed nested-worktree extension-lintDeclaration input escapes checkoutlimitation. Hosted exact-head CI must cover that boundary.864e4b406861b0c8d98bb347613c4e60bfc2c3ee, verified ancestor of fetched main. No test rerun was needed.The earlier
startup_failurerun never executed tests. The maintainer authorized a fresh attempt after the main fixes, infrastructure retries after ten minutes, and one failed-job retry for an unrelated test flake. No checks, timeouts, assertions, or budgets are weakened.