Skip to content

fix: guest commands fail during workspace checkpoints - #172137

Merged
shakkernerd merged 2 commits into
mainfrom
fix/guest-command-checkpoint
Oct 14, 2026
Merged

shakkernerd merged 2 commits into
mainfrom
fix/guest-command-checkpoint

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

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):

Time Event Result
13:04:43.938777Z exec_die exit 0
13:04:44.376341Z pause
13:05:06.610283Z unpause
13:05:07.074937Z exec_create
13:05:07.076860Z exec_start
13:05:07.715482Z exec_die exit 0

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=1 run 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:

  • Session recovery rejects a continuation correctly but formats its message with a TypeError: prefix. The same assertion fails on clean main 88008af9a97be20f39161d060af74adaa72a5367; the recovery/formatting path is untouched here. Failing CI assertion.
  • The worktree GC checksum fixture damages the first pack returned by directory enumeration. On main 87f5924e81059e45fced239602fbc1aacb6dc4cf, selecting its existing commit/tree pack—one of the original fixture's permitted choices—reproduces the same expected 2, received 3 failure 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.

@clawsweeper

clawsweeper Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment @clawsweeper review. Please avoid repeated requests while a review is queued or running; agents should not request reviews automatically.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime docker Docker and sandbox tooling agents Agent runtime and tooling size: M labels Oct 14, 2026
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 52f47555f1394dd3187fe33dcdf516b7b156a36c
  • Maintainer: @shakkernerd
  • Repository role: maintain

These security sensitive changes were made:

  • src/agents/sandbox/local-workspace.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 14, 2026
@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

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

  • Before: The follow-up command can fail because its container is paused.
  • After: The command waits for reconciliation and resume, then executes successfully.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful repair with supplied live Docker evidence and meaningful lifecycle regression coverage; no patch defect was identified.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): The supplied guest Docker event trace exercises the changed command path through natural checkpoint pause, resume, and successful follow-up execution; the current cancellation correction has a focused production-owner regression, and the non-cancelled live path is unchanged.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A guest's next development command can fail against a paused container after an earlier command succeeds.
Reason: The maintainer-authored direction restores expected command sequencing through the existing owner and preserves cancellation and authority.

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
Reviewed head: 52f47555f1394dd3187fe33dcdf516b7b156a36c

Before merge

None.

Findings

None.

Agent review details

How this fits together

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

Technical review

Best 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

  • Sandbox shell and exec binding keeps the original intent (28d8ee4: Private managed-workspace projections require captured live authority and cleanup ownership across filesystem and runtime preparation.)
  • Projection lease and worker persistence keeps the original intent (cd326f9: Move persistence off the Gateway thread while retaining one reconciliation owner through effects and settlement.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit cd326f9 adds src/gateway/worker-environments/local-workspace-store.ts:74 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cd326f915580; files: src/gateway/worker-environments/local-workspace-store.ts)
  • RoboClaw: Raw commit 28d8ee4 adds src/agents/sandbox/local-workspace.ts:69 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 28d8ee4f096b; files: src/agents/sandbox/local-workspace.ts)

PR surface

Source +11, Tests +159, Docs +2. Total +172 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 38 27 +11
Tests 2 160 1 +159
Docs 1 3 1 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 201 29 +172

Review metrics

Metric Value Why it matters
Production versus test LOC Production +38/-27; tests +160/-1 The small production change reuses existing custody; the larger regression exercises real checkpoint, store, lease, cancellation, and resume ownership.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: An intermittent command failure affects sandboxed managed-project development, with limited scope and no demonstrated data loss.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-14T13:06:07.214Z sha b62f764 :: needs changes before merge. :: [P2] Propagate shell cancellation into workspace lease acquisition
  • reviewed 2026-10-14T14:04:57.487Z sha 52f4755 :: needs maintainer review before merge. :: none

Reviewed October 14, 2026, 10:57 AM ET / 14:57 UTC (Revision 3).

@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 14, 2026
@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 14, 2026
@shakkernerd shakkernerd self-assigned this Oct 14, 2026
@shakkernerd
shakkernerd merged commit ebf89c9 into main Oct 14, 2026
246 of 255 checks passed
@shakkernerd
shakkernerd deleted the fix/guest-command-checkpoint branch October 14, 2026 15:53
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: guest command preparation waits for active workspace checkpoints.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
Guest shell calls and execution preparation wait for managed-workspace checkpoints while retaining cancellation and execution authority.

Fixes openclaw#172106.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docker Docker and sandbox tooling docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: M 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.

Guest commands can fail while the previous workspace checkpoint pauses the sandbox

1 participant