Skip to content

refactor(codex): reuse core exec policy algebra - #140636

Merged
steipete merged 3 commits into
mainfrom
steipete/dedup-policy-exec-0906-exec-mode
Sep 7, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/dedup-policy-exec-0906-exec-mode

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

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 execPolicy object on the existing public openclaw/plugin-sdk/agent-harness-runtime entrypoint. 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.minSecurity and infra-runtime.maxAsk exports. 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 execPolicy members. The runtime migration guide also points the retired mode projections to this public typed replacement. Core implementations remain unchanged.

Evidence

  • Rebased onto main 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).
  • Canonical pnpm plugin-sdk:sync-exports, pnpm plugin-sdk:surface, pnpm plugin-sdk:check-exports, and pnpm plugin-sdk:surface:check passed. No generated output was hand-edited.
  • Fresh independent Codex review is clean through P2 after conflict resolution. Lead and independent source inspection verified unchanged mode/security/ask behavior and native projection against sibling Codex protocol enums.
  • Prior pnpm build passed 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.mjs passed all five typecheck lanes, SDK/ratchet guards, closure tests, dead-export scans and core lint, then reached only the explicitly allowed nested-worktree extension-lint Declaration input escapes checkout limitation. Hosted exact-head CI must cover that boundary.
  • Exact-head CI https://github.com/openclaw/openclaw/actions/runs/34121440455 passed on attempt 1. Native preparation accepted that evidence without changing the reviewed head; native merge landed as 864e4b406861b0c8d98bb347613c4e60bfc2c3ee, verified ancestor of fetched main. No test rerun was needed.

The earlier startup_failure run 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.

@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 7, 2026 02:14
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex plugin: file-transfer size: S maintainer Maintainer-authored PR labels Sep 7, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 7, 2026, 8:27 AM ET / 12:27 UTC.

ClawSweeper review

What this changes

The 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
Reviewed head: 3c2e5d43a49edc1406224df2b6602f8c84ae969b
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable consolidation with no actionable correctness finding and a clearly bounded SDK retirement tradeoff.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored refactor is exempt from contributor runtime proof; inspected adapter/core mappings preserve behavior, and the reported focused tests and build are supplemental validation rather than a live Codex run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored refactor is exempt from contributor runtime proof; inspected adapter/core mappings preserve behavior, and the reported focused tests and build are supplemental validation rather than a live Codex run.
Evidence reviewed 9 items Verified introduced scope: The merge-base-to-head diff matches the five host-recorded files. Changes elsewhere in the endpoint comparison belong to base drift, not this PR.
Current main still contains the duplication: The fetched main revision retains the local mode projections and security/approval comparators. None of the supplied related merged PRs implements this consolidation. Inspection of the latest release file failed because its blob was unavailable locally and the remote could not be reached; no shipped-status claim is made.
Policy equivalence: Core's five explicit mode mappings and implicit display-mode projection match the removed implementations. Its comparators use the same ordering. The adapter selects only security and ask, preserving its result shape, strict readers, layer order, touched state, and explicit full-session handling.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Decision needed

Question Recommendation
Does the recorded consumer audit justify retiring infra-runtime.minSecurity and infra-runtime.maxAsk before the documented October 1 compatibility gate? Accept the narrow retirement: Record acceptance of these two audited removals and their typed replacement while retaining the rest of infra-runtime.

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

  • Resolve merge risk (P1) - An external plugin importing minSecurity or maxAsk from infra-runtime would stop loading after upgrade until migrated; the reported indexed-consumer audit cannot exclude private or unindexed consumers.
  • Complete next step (P2) - Record SDK-owner acceptance of the two audited export removals before the October 1 gate, or retain those exports until their approved retirement point.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source -32, Docs +7, Other +2. Total -23 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 19 51 -32
Tests 0 0 0 0
Docs 1 13 6 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 1 4 2 +2
Total 5 36 59 -23

Review metrics

Metric Value Why it matters
Public SDK contract 1 typed object added; 2 named exports retired; 0 entrypoints added The contract trades deprecated import names for a documented replacement without expanding the entrypoint surface.

Merge-risk options

Maintainer options:

  1. Accept the audited export retirement (recommended)
    The SDK owner can explicitly accept the residual external-consumer risk with the documented typed migration.
  2. Retain comparators through the compatibility window
    Preserve the two deprecated exports and adjust the SDK accounting while retaining the Codex consolidation.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This is a bounded policy consolidation with an external-plugin compatibility decision.
  • merge-risk: 🚨 compatibility: Removing the named comparator exports can break external plugin imports despite unchanged execution-policy calculations.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored refactor is exempt from contributor runtime proof; inspected adapter/core mappings preserve behavior, and the reported focused tests and build are supplemental validation rather than a live Codex run.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record the SDK owner's disposition of the two comparator removals under the documented compatibility window.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-07T02:53:42.840Z sha 82a1b12 :: blocked before merge. :: none
  • reviewed 2026-09-07T03:21:58.770Z sha 82a1b12 :: blocked before merge. :: none
  • reviewed 2026-09-07T04:01:27.312Z sha e77c7b5 :: blocked before merge. :: [P1] Preserve the comparators through the published compatibility window
  • reviewed 2026-09-07T04:17:11.588Z sha e77c7b5 :: blocked before merge. :: [P1] Preserve the comparators through the published compatibility window
  • reviewed 2026-09-07T06:21:44.169Z sha e77c7b5 :: blocked before merge. :: [P1] Preserve the comparators through the published compatibility window
  • reviewed 2026-09-07T07:25:28.588Z sha 02be3e7 :: blocked before merge. :: none
  • reviewed 2026-09-07T10:06:58.154Z sha 0b70747 :: blocked before merge. :: none
  • reviewed 2026-09-07T10:35:59.410Z sha 0b70747 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 7, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 7, 2026
@steipete
steipete marked this pull request as draft September 7, 2026 04:11
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 7, 2026
@steipete
steipete force-pushed the steipete/dedup-policy-exec-0906-exec-mode branch from 02be3e7 to ba3a0bf Compare September 7, 2026 09:22
@steipete
steipete marked this pull request as ready for review September 7, 2026 09:25
@steipete
steipete force-pushed the steipete/dedup-policy-exec-0906-exec-mode branch from ba3a0bf to 0b70747 Compare September 7, 2026 09:46
@openclaw-barnacle openclaw-barnacle Bot closed this Sep 7, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 7, 2026
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 7, 2026
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.
@steipete
steipete force-pushed the steipete/dedup-policy-exec-0906-exec-mode branch from 0b70747 to 3c2e5d4 Compare September 7, 2026 12:21
@steipete
steipete merged commit 864e4b4 into main Sep 7, 2026
176 of 177 checks passed
@steipete
steipete deleted the steipete/dedup-policy-exec-0906-exec-mode branch September 7, 2026 12:35
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 8, 2026
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: codex maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant