Repository navigation
fix: honor sandbox requirements for native forks - #155358
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: needs maintainer review before merge. Reviewed September 22, 2026, 12:28 AM ET / 04:28 UTC (Revision 4). ClawSweeper reviewWhat this changesThe PR checks sandbox requirements before native session forks, expires fork authority after completion, and preserves guarded cleanup of unfinished children. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main. The prior compatibility, rollback, and authority-lifetime findings are addressed, and the new production-client evidence satisfies the remaining scoped proof requirement. No blocking patch defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway receives session-fork requests and delegates native conversation creation to an agent plugin. Its runtime policy and initialization owners control whether the plugin may create a native thread and whether an unfinished child may be removed. flowchart TD
A[Session fork request] --> B[Current caller and source checks]
B --> C{Runtime policy permits fork?}
C -->|No| D[Runtime restriction response]
C -->|Yes| E[Native plugin fork]
E --> F[Authority check before write]
F --> G[Publish child or guarded rollback]
G --> H[Expire fork authority]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +209, Tests +140. Total +349 across 16 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep native forks under the shared runtime-policy owner, with operation-scoped write authority and independently fenced rollback. Do we have a high-confidence way to reproduce the issue? Yes, source establishes a required-sandbox session reaching native fork delegation on current main without the shared runtime-policy check; this read-only review did not execute the failing path. Is this the best way to solve the issue? Yes, the patch reuses existing policy and lifecycle owners, preserves the legacy SDK contract, and now checks retained authority through the production client. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 58e27e0fedc4. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
Fixed: Native session forks now honor required runtime policy before creating a child. |
Native session forks now apply OpenClaw's required runtime policy before native execution, while preserving shipped plugin compatibility and initializer-owned cleanup.
What Problem This Solves
Fixes: a native session branch could begin materialization before OpenClaw applied the session's required runtime policy.
User Impact
User impact: sandbox-required sessions now return the existing native-runtime restriction before a fork is created. Existing unrestricted forks require no configuration or migration.
Why This Change Was Made
The authority-bearing
sessionForkV2capability can declare an operation-specific execution environment. The shipped legacysessionForkparameter shape remains source-compatible through its deprecation window, including dual registration where current hosts prefer V2, while its existing harness-level host execution descriptor still applies to the pre-call restriction. The Gateway evaluates the prospective child through the existing runtime-restriction owner, retains the source's isolation floor, and carries current caller/source/harness authority to native write boundaries across imported and canonical forks. That forward authority closes when the fork call settles. Forward policy and rollback ownership are separate: policy or requester access changes stop initialization, while the captured initializer can still remove only its unchanged pending child and verified native fork.Evidence
AGENT_RUNTIME_RESTRICTEDbefore legacy, V2, or dual host-only invocation, and dual registration selects V2 when unrestricted.thread/forkrequest, while the unrestricted compatibility case still creates its child.thread/forkafter either settlement is rejected at its physical pre-write check and adds no nativethread/forkoutput.a85710edd2d1ebab2f1bc0e84b0fd39535340874(cf5a04baaee9b6a76016e4631ec90e7e7406b3d9target plus the reviewed production head): four registered Gateway and four real Codex authority/lifecycle cases passed in 1 minute 58 seconds.39f3663219025e897c31a2ba142847e82b9c6c7d; its two settlement cases pass locally in 14.6 seconds and its three source-successor rollback cases pass in 32.8 seconds.