Skip to content

fix: cancel guest workspace preparation while waiting - #188957

Merged
shakkernerd merged 1 commit into
mainfrom
guest-preparation-wait-cancellation
Oct 31, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
guest-preparation-wait-cancellation

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #188923.

What Problem This Solves

Guest workspace preparation can remain queued behind another reconciliation operation after its run is cancelled. Execution admission is closed, but setup waits for the current holder to release the workspace.

User Impact

Cancellation now reaches queued initial preparation while the independent holder finishes normally. Ordinary release still permits preparation to succeed. Accepted command and file-write cleanup keeps its existing workspace lifetime.

Why This Change Was Made

The sandbox context and reconciliation owners already accept cancellation. The attempt caller omitted its existing run abort signal. Forwarding that signal completes the path while preserving warm-workspace reuse.

Evidence

  • On base 9f14244, a registered guest and real reconciliation holder reproduced cancellation remaining pending for 2,001 ms, then rejecting with its original reason after release. The normal-release control passed; both operations joined and checked file contents were preserved. Container provisioning is substituted in this focused fixture.
  • The two committed cases require cancellation to settle before holder release and preserve ordinary preparation. All 11 related files passed: 200 tests passed, one skipped. Changed-file formatting/lint, seven selected type groups, and hosted CI passed.
  • A runtime containing this change and its prerequisites passed actual guest preparation/read and retained-work controls. The single natural file-first attempt exposed no attributable initial reconciliation wait before settlement, so no Stop/retry was issued. Live queued cancellation remains unexercised; the native held-lease test proves that boundary.

The following capture shows the ordinary guest preparation/read control, not queued cancellation. Identities and model details are redacted.

Ordinary guest preparation and README read

r8-ordinary-file-first.mp4

@clawsweeper

clawsweeper Bot commented Oct 31, 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 gateway Gateway runtime agents Agent runtime and tooling size: M labels Oct 31, 2026
@github-actions

github-actions Bot commented Oct 31, 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: d08e7d30d294eab16145fa18db47a2cae143e240
  • Maintainer: @shakkernerd
  • Repository role: maintain

These security sensitive changes were made:

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

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 31, 2026
@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR forwards the run abort signal into guest sandbox preparation so queued reconciliation can stop promptly.

Example: A guest run preparing source.txt is cancelled while another operation holds its workspace reconciliation lease.

  • Before: Preparation remains pending until the independent holder releases the lease.
  • After: Preparation rejects with the original cancellation reason before holder release, while the holder completes normally.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-consistent, with meaningful integration coverage and passing current-head gates; supplied proof remains at the in-process harness boundary.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Cancelling a guest run can leave workspace setup waiting behind another reconciliation operation.
Reason: The maintainer-authored repair restores cancellation through existing owners with no new configuration, API, state, or default.

Merge readiness

✅ Ready for maintainer review

This PR fixes a concrete cancellation defect with a minimal production change. No introduced correctness defect was found, and the earlier merge-conflict concern is resolved.

Priority: P2
Reviewed head: d08e7d30d294eab16145fa18db47a2cae143e240

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The prior requested live scenario remains uncovered: Stop a guest run through an isolated Gateway while initial preparation is blocked by reconciliation, and observe settlement before holder release.
Agent review details

How this fits together

Agent attempt setup resolves sandbox context, which prepares a managed workspace through the existing reconciliation lease owner and returns workspace roots and cleanup ownership.

flowchart TD
  A[Agent run cancellation] --> B[Attempt workspace setup]
  B --> C[Sandbox context]
  C --> D[Local workspace preparation]
  D --> E[Reconciliation lease]
  E --> F[Prepared workspace or cancellation]
Loading

Technical review

Best possible solution:

Retain the one-line signal forwarding and the two owner-level regression controls without changing workspace reuse or accepted-effect settlement.

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

Source confirms that the attempt caller omits the signal consumed by cancellable lease acquisition, and the linked report records a deterministic failing integration case with a successful release control; this review ran no target code.

Is this the best way to solve the issue?

Forwarding the existing signal repairs the missing caller connection at its source, reuses established cancellation machinery, and leaves checkpoint settlement independent of run cancellation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9902334873c1.

Provenance checked

  • Attempt sandbox preparation keeps the original intent (bc60cd9: The existing caller composition prepares worker-owned currentness facts and validates live authority at effects; this identifies the surrounding implementation, not the defect’s introduction.)
  • Warm workspace reuse keeps the original intent (5566a3d: Unchanged workspaces reuse the existing reconciliation owner without pausing their runtime, while cancellation and failed authority continue to propagate.)
  • Accepted command and file-write settlement keeps the original intent (fe60f48: Accepted output retains workspace custody after Stop closes execution admission; operator and Gateway revocation still reject later effects.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit bc60cd9 adds src/agents/workspace-sandbox.ts:128 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bc60cd94b485; files: src/agents/workspace-sandbox.ts)

PR surface

Source +1, Tests +167, Other +2. Total +170 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 1 0 +1
Tests 2 169 2 +167
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 4 172 2 +170

Review metrics

Metric Value Why it matters
Production versus test growth Production +1/-0; tests/support +169/-2 The integration fixture uses existing guest, admission, and lease owners to distinguish prompt cancellation from ordinary holder release; no production scaffolding is added.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Cancellation can remain delayed behind workspace reconciliation, with no demonstrated data loss, authorization bypass, or process outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Provide the live preparation-wait cancellation evidence described in realBehaviorProof.

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 (1 earlier review cycle)
  • reviewed 2026-10-31T02:10:37.586Z sha 2301827969f8911e94b890f938e9f06597b446dc :: needs changes before merge. :: none

Reviewed October 31, 2026, 12:32 AM ET / 04:32 UTC (Revision 2).

@shakkernerd
shakkernerd force-pushed the guest-preparation-wait-cancellation branch from 2301827 to d08e7d3 Compare October 31, 2026 04:16
@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 31, 2026
@shakkernerd shakkernerd self-assigned this Oct 31, 2026
@shakkernerd
shakkernerd merged commit 94ae988 into main Oct 31, 2026
171 checks passed
@shakkernerd
shakkernerd deleted the guest-preparation-wait-cancellation branch October 31, 2026 05:59
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: cancelled guest workspace preparation settles without waiting for the reconciliation holder to release.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 1, 2026
Forward run cancellation to guest workspace preparation so queued setup settles without waiting for the reconciliation holder.

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

Labels

agents Agent runtime and tooling gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed 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.

Cancelling guest workspace preparation waits for reconciliation holder release

1 participant