Repository navigation
fix: guest commands fail during workspace checkpoints - #172137
Conversation
|
ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment |
|
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR makes managed-workspace shell calls and exec preparation wait for active checkpoints while preserving shell cancellation. Example: A guest submits git status while a successful background test run is checkpointing its Docker workspace.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a current managed-workspace command failure, and no introduced correctness or security defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe sandbox binding connects guest filesystem and exec requests to Docker or Podman backends; the workspace projection owner serializes those requests with checkpoint pause, reconciliation, and resume. flowchart TD
A[Guest command] --> B[Sandbox binding]
B --> C[Existing reconciliation lease]
D[Workspace checkpoint] --> C
C --> E[Current authority checks]
E --> F[Container backend]
F --> G[Command result]
Technical reviewBest possible solution: Use the existing reconciliation lease for command admission, release exec preparation custody before process lifetime, and retain current-authority checks. Do we have a high-confidence way to reproduce the issue? Current main allows shell and exec preparation to overlap checkpoint-owned container pauses; the linked report and supplied base-failing regression establish the concrete trigger without executing target code during this review. Is this the best way to solve the issue? The repair belongs at the shared sandbox binding and reuses the authoritative reconciliation lease without adding retries, competing state, or a new configuration surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3d9637ef6301. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +11, Tests +159, Docs +2. Total +172 across 6 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
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 HistoryReviewed October 14, 2026, 10:57 AM ET / 14:57 UTC (Revision 3). |
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
|
Fixed: guest command preparation waits for active workspace checkpoints. |
Guest shell calls and execution preparation wait for managed-workspace checkpoints while retaining cancellation and execution authority. Fixes openclaw#172106.
Fixes #172106
What Problem This Solves
Guest commands in a managed project can fail while an earlier background command is checkpointing the workspace. Checkpointing pauses the sandbox container to reconcile its private checkout; a follow-up command previously checked authority and proceeded directly into that paused runtime, even after the earlier command had exited successfully.
User Impact
Shell calls and exec preparation now wait for the active workspace checkpoint to release its lease before proceeding. Guests can continue development work after a background command without an avoidable paused-container failure. A cancelled shell request stops waiting without dispatching a command or interrupting the checkpoint that holds the lease.
Why This Change Was Made
The sandbox binding uses the managed workspace's existing reconciliation lease for shell calls and command preparation. Exec preparation releases custody before the background process lifetime begins. Current-authority checks remain at preparation and deferred execution, and prepared backend resources are finalized if authority closes before preparation returns. The shell request's optional abort signal reaches the existing lease acquisition owner.
This is an internal lifecycle correction with no new retry service, configuration, schema, or permission change. The workspace documentation explains the wait.
Evidence
The original regression starts shell and exec preparation while the real checkpoint owner holds the projection lease and has paused the runtime. Both attempts fail on the base and succeed with the fix. The test retains the production store, lease, checkpoint, binding, and resume path with synthetic container I/O, and verifies that preparation releases custody before exec finalization.
A stronger cancellation case rejects the waiting shell request while the checkpoint is still held, then verifies that the checkpoint settles and ordinary commands proceed. It fails against the earlier implementation and passes with abort-signal propagation. Outer filesystem mutations still perform their required final checkpoint; this does not claim prompt cancellation of that settlement.
Live Docker verification submitted a follow-up Git-status command once while a successful 13-test guest run was still checkpointing. Native events show a natural pause, resume, then follow-up exec and exit 0, without retry or manual pause. That result remains applicable to the unchanged non-cancelled path after the signal-forwarding correction.
Native Docker event record from the live run on
b62f7640d45f0504362d8d699cf458e1087dbcfe(UTC, October 14):The follow-up was submitted once after 13 passing tests were visible while the preceding process registry still reported
running; its tool duration was 23589 ms and exit code was 0. The current correction only forwards the shell abort signal; the non-cancelled path exercised here is unchanged.Validation: changed-file formatting/lint, all 34 selected type graphs, and 66 related tests pass on the correction. The nine-file native test batch took 160.08 seconds including prerequisites; the strengthened checkpoint case separately passed in 2.883 seconds. The original two-file
pnpm test src/agents/sandbox/local-workspace.test.ts src/gateway/worker-environments/local-workspace-projection.test.ts --maxWorkers=1run took 95.53 seconds. Independent engineering review is clean on the current head. The selected CI jobs completed. Initial job durations totaled 15,898 cumulative seconds; the successful hosted retry job ran for 452 seconds. The node-worker and sandbox-isolation lane passed all three cases on the unchanged head after a bounded execution retry; the earlier smaller-runner stall is retained as an execution limitation, not claimed as a source fix. The existing deferred-exec authority group passed all nine cases; the correction does not change that path. The opt-in live Podman case was not run.Two existing baseline failures remain red and are attributed separately:
TypeError:prefix. The same assertion fails on clean main88008af9a97be20f39161d060af74adaa72a5367; the recovery/formatting path is untouched here. Failing CI assertion.87f5924e81059e45fced239602fbc1aacb6dc4cf, selecting its existing commit/tree pack—one of the original fixture's permitted choices—reproduces the sameexpected 2, received 3failure while preserving every assertion and production file. Both worktrees report unavailable Git metadata, followed by the checksum-maintenance failure. A payload-pack choice instead yields the expected two failures and one deferral. This test-input instability is outside command admission; no worktree is deleted. Failing CI assertion.