Skip to content

refactor(policy): share sandbox bind parsing - #140696

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

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

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Policy duplicated core's Docker bind-string parsing. Its Windows container-drive handling differs from the default runtime grammar, so simply replacing the parser would change existing posture evidence.

Why This Change Was Made

Policy consumes core splitSandboxBindSpec through the existing public openclaw/plugin-sdk/agent-harness-runtime entrypoint. The allowWindowsContainerPath parser argument preserves Policy's existing Windows grammar; other core callers retain default parsing. Policy keeps read-only classification and evidence construction locally.

Adding one helper is offset by retiring the unused deprecated infra-runtime.resolveExecModePolicy export. No public entrypoint or SDK budget is added. Canonical counts/max: 152/152 entrypoints, 4445/4445 exports, 2627/2627 callable exports, 1132/1138 deprecated exports, 50/50 wildcards. Production -35 lines; tests +18; documentation +10.

User Impact

No intended behavior change. Policy preserves Windows container-drive paths, mixed-case read-only options, inheritance and evidence ordering. Core Docker/Podman validation keeps its existing grammar. The helper splits text; it does not authorize mounts or add a configuration option.

Evidence

  • Rebased onto main 841694048e1124530fe9d6555e34f78a06311f99, including worker-transfer repair fix(node-host): honor umask in Git transfer mode assertions #140771, Telegram test-size repair fix(telegram): unblock PR lint checks for progress-update tests #141148, and the landed exec algebra refactor(codex): reuse core exec policy algebra #140636. Reviewed head: 058e949250cf52f166dcd228aef26348ddb54416.
  • node scripts/run-vitest.mjs extensions/policy src/agents/sandbox/bind-spec src/plugins/doctor-contract-closure-guard.test.ts: all 459 tests passed (448 Policy, seven parser, four closure guards), in 31.02s.
  • Canonical SDK export synchronization, export check, surface report and surface check passed without changing budgets or hand-editing generated files.
  • Fresh independent Codex branch autoreview is clean through P2. MDX and formatting checks pass for both edited SDK docs.
  • Prior pnpm build passed in 7m08.1s, including 91 plugins and packaged declarations. This rebase preserves the runtime patch; conflict resolution only reconciles retired SDK exports and migration documentation.
  • node scripts/check-changed.mjs passed all four typecheck lanes, SDK/ratchet guards, closure checks, dead-export scans and core lint, then reached only the expressly allowed nested-worktree extension-lint Declaration input escapes checkout limitation. Hosted exact-head CI https://github.com/openclaw/openclaw/actions/runs/34122950529 passed on attempt 1. Native preparation accepted the evidence without changing the head; native merge landed as 4bd1d6e305e5d0566838e0adcc5f0e83c600551c, verified ancestor of fetched main. No test retry was needed.

Compatibility audit

Repository searches and the completed global/organization consumer audit found no actual consumer of the retired deprecated export. Ambiguous source candidates import their own core implementations. This unused-export retirement is maintainer-approved under that audit requirement. Indexed searches cannot establish absence of private or unindexed consumers.

The typed replacement is now execPolicy.resolveExecModePolicy from the existing public agent-harness-runtime, landed in #140636. The private exec-approvals-runtime facade and its callers remain intact. The public infra-runtime subpath and retention record remain unchanged.

The previous CI attempt was blocked by the unrelated Telegram max-lines failure fixed in #141148. The maintainer authorized fresh proof after that repair, ten-minute infrastructure startup retries, and one failed-job retry for an unrelated flaky test. No assertion, timeout, baseline, or required check is 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts agents Agent runtime and tooling extensions: policy 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:54 AM ET / 12:54 UTC.

ClawSweeper review

What this changes

Policy shares core sandbox bind parsing while preserving its Windows-path grammar, adds parser coverage and SDK documentation, and retires a deprecated resolver export.

Merge readiness

⛔ Blocked before merge - 1 item remains

The refactor remains useful on current main, and no actionable correctness defect was found. The previous migration concern is resolved; the recorded acceptance of residual export compatibility risk does not require another approval cycle.

Priority: P3
Reviewed head: 058e949250cf52f166dcd228aef26348ddb54416

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused consolidation with useful boundary coverage, accurate migration guidance, and an explicitly accepted compatibility tradeoff.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary contributor-proof gate does not apply to this maintainer-authored refactor. Reported parser and Policy tests are supplemental validation; the diff does not materially change authority.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor-proof gate does not apply to this maintainer-authored refactor. Reported parser and Policy tests are supplemental validation; the diff does not materially change authority.
Evidence reviewed 7 items Parser equivalence: The shared parser preserves the original separator algorithm. Policy explicitly enables Windows container-drive handling and retains the same trimmed, case-insensitive read-only classification.
Current main still duplicates parsing: Fetched main retains splitPolicyBindSpec and both local separator helpers, so the central consolidation is not already implemented.
Runtime boundary remains unchanged: Security validation, filesystem mapping, workspace mounts, and Podman callers retain default parser invocation. The added parser cases protect default behavior and opt-in Windows destinations; existing Policy coverage checks read-only Windows binds through health findings.
Findings None None.
Security None None.

How this fits together

Policy examines configured sandbox mounts and produces posture evidence for health checks. Core runtime callers use the same text parser before applying their own mount validation and filesystem rules.

flowchart TD
  A[Configured sandbox binds] --> B[Shared bind parser]
  B --> C[Policy Windows grammar]
  B --> D[Default runtime grammar]
  C --> E[Mount posture and health findings]
  D --> F[Mount validation and filesystem mapping]
Loading

Before merge

  • Resolve merge risk (P1) - Accepted residual compatibility risk: private or unindexed plugins importing infra-runtime.resolveExecModePolicy can fail to load after upgrade and must migrate to execPolicy.resolveExecModePolicy; indexed audits cannot exclude those consumers.
Agent review details

Security

None.

PR surface

Source -35, Tests +18, Docs +10. Total -7 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 19 54 -35
Tests 1 18 0 +18
Docs 2 13 3 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 50 57 -7

Review metrics

Metric Value Why it matters
Public SDK contract 1 helper exposed, 1 deprecated export retired, 0 new subpaths An unchanged export total still contains an intentional consumer-facing API removal.

Merge-risk options

Maintainer options:

  1. Honor the recorded retirement decision (recommended)
    Proceed under the documented consumer audit and accepted private-consumer risk, retaining the typed migration guidance.

Technical review

Best possible solution:

Keep one lexical parser with explicit grammar selection and the documented typed resolver migration under the recorded retirement approval.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this is a behavior-preserving refactor; source comparison and existing boundary coverage establish the relevant parsing contracts.

Is this the best way to solve the issue?

Yes: sharing lexical parsing while keeping Policy classification local preserves the implementation boundary, and the retired resolver has a documented typed replacement.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 5990c8b8396c.

Labels

Label justifications:

  • P3: This is bounded consolidation with no intended runtime behavior change.
  • merge-risk: 🚨 compatibility: Retiring the resolver export can break unindexed external consumers despite the accepted audit results.
  • 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 ordinary contributor-proof gate does not apply to this maintainer-authored refactor. Reported parser and Policy tests are supplemental validation; the diff does not materially change authority.

Evidence

What I checked:

  • Parser equivalence: The shared parser preserves the original separator algorithm. Policy explicitly enables Windows container-drive handling and retains the same trimmed, case-insensitive read-only classification. (extensions/policy/src/policy-state-sandbox.ts:140, 058e949250cf)
  • Current main still duplicates parsing: Fetched main retains splitPolicyBindSpec and both local separator helpers, so the central consolidation is not already implemented. (extensions/policy/src/policy-state-sandbox.ts, 5990c8b8396c)
  • Runtime boundary remains unchanged: Security validation, filesystem mapping, workspace mounts, and Podman callers retain default parser invocation. The added parser cases protect default behavior and opt-in Windows destinations; existing Policy coverage checks read-only Windows binds through health findings. (src/agents/sandbox/bind-spec.test.ts:33, 058e949250cf)
  • Typed migration exists: The public execPolicy object exposes the unchanged core resolver on both the reviewed head and fetched main. The migration documentation names this typed replacement. This patch depends on OpenClaw's core implementation, not a Codex runtime or protocol contract. (src/plugin-sdk/agent-harness-runtime.ts:57, 5990c8b8396c)
  • Prior review disposition: The captured PR body reports maintainer-approved retirement following repository and indexed consumer audits. The completed review at the same head has no findings and explicitly records accepted residual compatibility risk. Earlier migration concerns are addressed by the typed replacement from refactor(codex): reuse core exec policy algebra #140636. (058e949250cf)
  • Merged related work and routing: The supplied GitHub context verifies the exec-policy consolidation as merged. Local history identifies Peter Steinberger on that adjacent SDK work; it supplies the replacement API but does not supersede this parser refactor. (src/plugin-sdk/agent-harness-runtime.ts:57, 864e4b406861)

Likely related people:

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

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-07T06:00:11.379Z sha a00e55e :: blocked before merge. :: [P2] Clarify that the replacement is not a typed public SDK migration
  • reviewed 2026-09-07T06:27:40.652Z sha 28759dc :: blocked before merge. :: [P2] Clarify that the replacement is not a typed public SDK migration
  • reviewed 2026-09-07T06:36:45.476Z sha 28759dc :: blocked before merge. :: [P2] Clarify that the replacement is not a typed public SDK migration
  • reviewed 2026-09-07T07:10:02.756Z sha 4d8eace :: blocked before merge. :: none
  • reviewed 2026-09-07T07:20:41.000Z sha 4d8eace :: blocked before merge. :: none
  • reviewed 2026-09-07T10:16:43.450Z sha eed3877 :: blocked before merge. :: none
  • reviewed 2026-09-07T10:33:06.474Z sha eed3877 :: blocked before merge. :: none
  • reviewed 2026-09-07T12:44:25.611Z sha 058e949 :: blocked before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added plugin: file-transfer and removed scripts Repository scripts labels Sep 7, 2026
@steipete
steipete marked this pull request as ready for review September 7, 2026 04:03
@steipete
steipete requested a review from a team as a code owner September 7, 2026 04:03
@clawsweeper clawsweeper Bot added 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 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 force-pushed the steipete/dedup-policy-exec-0906-bind-spec branch from a00e55e to 28759dc Compare September 7, 2026 06:18
@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-bind-spec branch from 4d8eace to eed3877 Compare September 7, 2026 10:03
Core owns lexical bind parsing; Policy explicitly preserves Windows container drives while existing runtime callers keep their default grammar. Proof: 422 Policy tests and 7 bind-parser tests passed; independent review clean.
Preserve Windows bind grammar without growing the public SDK surface; retire the unused deprecated mode resolver re-export. Proof: 433 focused tests, SDK checks, and autoreview pass.
Keep the approved export retirement explicit about the private facade's missing packaged TypeScript declarations.
Proof: node scripts/check-changed.mjs -- docs/plugins/sdk-runtime.md.
@steipete
steipete force-pushed the steipete/dedup-policy-exec-0906-bind-spec branch from eed3877 to 058e949 Compare September 7, 2026 12:38
@steipete
steipete merged commit 4bd1d6e into main Sep 7, 2026
185 of 187 checks passed
@steipete
steipete deleted the steipete/dedup-policy-exec-0906-bind-spec branch September 7, 2026 13:03
@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(policy): share sandbox bind parsing

Core owns lexical bind parsing; Policy explicitly preserves Windows container drives while existing runtime callers keep their default grammar. Proof: 422 Policy tests and 7 bind-parser tests passed; independent review clean.

* refactor(policy): reuse existing SDK sandbox entrypoint

Preserve Windows bind grammar without growing the public SDK surface; retire the unused deprecated mode resolver re-export. Proof: 433 focused tests, SDK checks, and autoreview pass.

* docs(plugin-sdk): clarify exec runtime migration limits

Keep the approved export retirement explicit about the private facade's missing packaged TypeScript declarations.
Proof: node scripts/check-changed.mjs -- docs/plugins/sdk-runtime.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: policy maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: file-transfer rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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