Skip to content

fix(tooling): join canceled artifact ownership waits - #160057

Merged
vincentkoc merged 6 commits into
mainfrom
fix/semantic-artifact-cancellation
Sep 28, 2026
Merged

vincentkoc merged 6 commits into
mainfrom
fix/semantic-artifact-cancellation

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Related: #160010

What Problem This Solves

A canceled tooling command could remain queued for checkout artifact ownership. The lock dependency has no AbortSignal API; abandoning an acquisition promise would let canceled work acquire ownership later.

User Impact

Cancellable artifact waits join each bounded acquisition attempt and release ownership if cancellation races acquisition. A command-level signal owner remains installed through cleanup and lock release, then returns the normal signal exit code. Filesystem and unjoined-process failures stay failures.

Published updaters use the existing two-argument API without a signal. They retain the original single native acquisition with an infinite wait. Only signal-bearing callers use bounded polling.

Why This Change Was Made

Acquisition and release remain with the artifact lock owner. The shared cancellation helper owns termination through queueing and cleanup; it does not start a second leaf grace timer or activate compiler memory limits. Fail-closed stale-owner policy and unjoined-work retention remain intact.

Direct and wrapped acquisition now both join release when cancellation races success. Release errors remain visible. This addresses the earlier P2 and rank-up move.

Evidence

  • Blacksmith Testbox run 36373544266: 51 cancellation/artifact tests passed; strict script/root test types, typed lint, formatting and whitespace passed. Seven lock cases took 513 ms, 14 command cases 5 ms, and 30 existing ownership regressions 17.895 s.
  • Run 36375334343: verified source and frozen dependency hashes; all eight final lock cases passed in 527 ms (wrapper 2.03 s), including preservation of the published caller's native wait. Strict script/root test types, typed lint, formatting and whitespace passed.
  • Published-driver × candidate cell on the same Testbox: installed integrity-verified [email protected], invoked its unchanged CLI through update --yes --json --no-restart in a private synthetic Git installation, and imported the candidate ownership implementation with its actual fs-safe 0.21.1 dependency. A separate process held checkout ownership through 1,100 ms of observed contention. Preparation stayed blocked until release, then preparation/cleanup each ran once; CLI exited 0, result status was ok, lock was removed, both process trees joined, and published driver bytes stayed unchanged. Corrected fixture placement and stale fixture output before the successful 8.052-second cell. This proves updater lock handoff and continuation, not artifact publication or a full upgrade.
  • Published driver SHA-256 (package metadata, entry point, and dist): 02f998cb3df3950e3ce5e2632cacd2e830bbe4b1348168add271ed4de94a46d2. Registry integrity: sha512-TCO/ImVLh5HkF4tdfo7iriIa7kT6iYkIr/jR5ZOkePGFGhUx5Oe7DE716Y1DzzG2teRAVDdCjgJDu1A24Yta7w==.
  • Independent review found no remaining P0–P2 defect. Coverage includes all termination signals, direct/wrapped acquisition races, release failure, real same-process contention, and error precedence.
  • Production/tooling +118/-33; tests +362/-6. Added capability: cancellation across existing artifact ownership and a shared command signal lifetime.

Shared baseline repairs

Adopted baseline 57f1abecc191ea0a54a9af93a6ccb97e6eb87700. Shared CI fixture repairs include existing helper files in isolated checkouts. The Vitest preload now activates only for actual Vitest 5 workers, preserving ordinary child IPC and inherited runtime flags; the worker-specific preload workaround was removed.

Same-source proof: 57 affected process/package tests plus forks and threads jsdom tests, 40 lint fixture tests and strict root types, and 11 tests under pinned CI Bun passed. Bun printed a directory-mismatch diagnostic after passing; exit was 0. Optional vmForks assertions passed but teardown failed in unchanged shared setup; recorded follow-up: release shared test setup before VM realm disposal. No configured VM pool lane was found.

@vincentkoc vincentkoc self-assigned this Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@vincentkoc
vincentkoc marked this pull request as ready for review September 28, 2026 03:08
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 28, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head 0eee925c83258e8e450177d8661adfda6235e1d7. This is the cancellation and artifact-ownership slice of the lint-memory repair. The PR body records 49 focused cases, strict types, and typed lint proof. Verify cancellation never abandons acquisition, releases only joined ownership, and preserves filesystem/unjoined cleanup failures.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 28, 2026, 12:03 AM ET / 04:03 UTC (Revision 3).

ClawSweeper review

What this changes

The branch adds cancellable checkout artifact-lock acquisition and a command signal helper, preserves the installed updater's existing wait, and adds lock-race and test-worker coverage.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this PR open. Current main lacks the signal-aware artifact wait, and the branch provides a coherent slice of the staged tooling repair. The prior cancellation-race finding is addressed; no new code defect was established.

Priority: P2
Reviewed head: df58009db3b5305e9960cbef4c69f28412c987bd

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The owner-level repair and race coverage are solid; the published-updater result remains to be checked against its retained trace.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The contributor proof gate does not apply to this member-authored PR. The body records an installed-updater CLI cell using the candidate lock owner under contention, followed by successful cleanup; the linked run's canceled status and inaccessible logs limit independent verification. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The contributor proof gate does not apply to this member-authored PR. The body records an installed-updater CLI cell using the candidate lock owner under contention, followed by successful cleanup; the linked run's canceled status and inaccessible logs limit independent verification. No stored-data contract changes.
Evidence reviewed 8 items Introduced lock behavior: The pinned PR diff adds bounded acquisition only for signal-bearing callers and releases a lock won after cancellation; the existing no-signal path retains one infinite native wait.
Prior finding resolved at the owner: Direct acquisition now awaits release before rejecting a late win; the new test matrix covers direct and wrapped acquisition with successful and failed release.
Current-main comparison: Fetched main still calls the lock dependency with an infinite wait and has no signal parameter, so it does not contain this PR's cancellation behavior.
Findings None None.
Security None None.

How this fits together

Build, lint, and source-update commands use a checkout lock before working with generated artifacts. The lock owner admits one operation, waits through contention, and releases ownership after work and cleanup finish.

flowchart LR
A[Tooling or update command] --> B[Artifact ownership request]
B --> C{Cancellation signal supplied?}
C -->|Yes| D[Bounded lock attempts]
C -->|No| E[Native lock wait]
D --> F[Owned artifact work]
E --> F
F --> G[Release ownership]
Loading

Before merge

  • Resolve merge risk (P1) - A maintainer should verify the recorded published-updater lock-handoff cell from retained Testbox evidence before merge: its linked workflow ended canceled, and this reviewer could not access the raw logs.
  • Complete next step (P2) - A maintainer with Testbox log access should verify the recorded published-driver × candidate lock-handoff cell before merge.
Agent review details

Security

None.

PR surface

Tests +366, Other +85. Total +451 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 8 371 5 +366
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 118 33 +85
Total 11 489 38 +451

Review metrics

Metric Value Why it matters
Production and test growth tooling +118/-33 lines; test and preload +371/-5 lines The production growth supplies cancellation ownership, while the larger test change covers lock races and inherited worker preloads.

Merge-risk options

Maintainer options:

  1. Verify retained updater trace (recommended)
    Inspect the recorded published-driver × candidate cell for contention, one preparation and cleanup, and lock release at the pinned head.

Technical review

Best possible solution:

Keep artifact acquisition and late-cancellation release in the lock owner, preserve the installed updater's two-argument wait, and have later tooling slices pass signals when their commands become cancellable.

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

No high-confidence end-to-end current-main reproduction was run. Source shows an infinite lock wait without a signal, and the PR's focused tests exercise the cancellation race at the lock owner.

Is this the best way to solve the issue?

Yes for this staged lock-owner slice: bounded dependency attempts are joined, late ownership is released, and the updater's published call shape is preserved. Signal-bearing command activation belongs to later tooling slices.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b9cd492ac60f.

Labels

Label changes:

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

Label justifications:

  • P2: This is a bounded tooling reliability repair with limited direct user impact.
  • merge-risk: 🚨 availability: The changed lock owner can affect build and source-update progress if contention or cancellation cleanup stalls.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 contributor proof gate does not apply to this member-authored PR. The body records an installed-updater CLI cell using the candidate lock owner under contention, followed by successful cleanup; the linked run's canceled status and inaccessible logs limit independent verification. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • Vincent Koc: 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 (2 earlier review cycles)
  • reviewed 2026-09-28T03:15:59.037Z sha 0eee925 :: blocked before merge. :: [P2] Release direct acquisitions that succeed after cancellation
  • reviewed 2026-09-28T03:34:27.495Z sha c700429 :: blocked before merge. :: none

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head c7004291de0297c7d12d7c921e0dbd4298969240. The direct-acquisition cancellation P2 is fixed at the lock owner; a four-case direct/wrapped and release-success/failure matrix addresses its rank-up move. All 51 focused/regression tests, script/root-test typechecks, typed lint, formatting, and whitespace passed. Main baseline and shared CI fixture repairs are incorporated; details and proof are in the PR body.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. labels Sep 28, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Exact head: df58009db3b5305e9960cbef4c69f28412c987bd.

The published-driver proof requested in the latest review now passes: integrity-verified [email protected] executes its unchanged updater CLI against candidate artifact ownership and fs-safe 0.21.1. It waits through 1,100 ms of real contention, then prepares and cleans up exactly once, exits 0 with status ok, removes the lock, and joins both child trees without changing driver bytes. Testbox run: https://github.com/openclaw/openclaw/actions/runs/36375334343. Scope is lock handoff/continuation, not artifact publication or a full upgrade.

The existing two-argument no-signal API now explicitly preserves its original single infinite native wait. All eight final lock tests, strict script/root types, typed lint and format pass. The shared preload fix addresses the previous CI failures. Updated PR body contains exact proof and limitations.

@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added 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 Sep 28, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

Verified the retained command trace for reviewed head df58009db3b5305e9960cbef4c69f28412c987bd; this resolves the review's evidence question. The source hash check matched the candidate lock module and frozen dependencies before the published-driver cell ran.

The Testbox host workflow is canceled because the warm lease was explicitly stopped after the command completed. The retained command result is exit 0, empty stderr, runStatus=succeeded, command time 8.052 seconds; the lease now reports completed. Those are separate outcomes.

Retained result:

{"publishedDriver":"2026.9.5","driverSha256":"02f998cb3df3950e3ce5e2632cacd2e830bbe4b1348168add271ed4de94a46d2","contentionMs":1100,"prepare":1,"cleanup":1,"publication":0,"status":"ok","lockRemoved":true,"childrenJoined":true,"driverUnchanged":true}

I checked the executed assertions: the unchanged published CLI waited on the candidate filesystem lock; the holder's bytes remained unchanged and no preparation/result occurred during contention; releasing it allowed exactly one preparation and cleanup, successful CLI continuation, removed ownership, and joined both process trees. The package integrity and driver digest were verified. The fixture intentionally requested no artifact publication; this proves the published updater's lock-handoff contract, not a full upgrade or publication.

No code changed after review. There are no remaining code findings or rank-up moves in the latest comment. Exact-head CI, dependency/security checks, and openclaw/ci-gate are green. Proceeding with the authorized squash merge.

@vincentkoc
vincentkoc merged commit f26303d into main Sep 28, 2026
192 checks passed
@vincentkoc
vincentkoc deleted the fix/semantic-artifact-cancellation branch September 28, 2026 04:08
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
Join signal-aware artifact waits and release ownership won after cancellation. Preserve the published updater native wait contract.

Validated cancellation races, published updater lock handoff, and exact-head CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L 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