Skip to content

fix(plugins): stop plugin updates from starving behind a renewing lifecycle lease - #186497

Draft
steipete wants to merge 5 commits into
mainfrom
upd/upd-l1924
Draft

steipete wants to merge 5 commits into
mainfrom
upd/upd-l1924

Conversation

@steipete

@steipete steipete commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes plugin updates repeatedly losing admission to later plugin lifecycle work while wait messages show only an opaque token.

Fixes #167050. Thanks @itanyplus for the incident evidence; this continues @steipete's implementation in #186497 and the accepted persisted FIFO design.

User Impact

A waiting command gets admission before later acquisitions after the active operation releases or expires. Wait messages identify the recorded purpose, PID, and host. Active installers retain exclusion through npm work and settlement. A crashed or stalled waiter loses its place after 30 seconds.

Why This Change Was Made

The existing lease owner records expiring FIFO intents in its existing table and grants admission in the same transaction. Polling preserves arrival order, and cancellation removes only the exact owner's intent. Holder diagnostics remain separate from reclaim authority. This cut adds no schema, protocol, dependency, or configuration change.

Evidence

  • Published candidate 71d5a7a8f6aec016a31b1c41d145b0b112125984 integrates main 92e1a1bb115f2ea646e0b57b21d7c5cfa6649ca7 through the native signed baseline owner. Original authorship and ancestry are retained.
  • 55 focused tests pass across acquisition, native cleanup, heartbeat lifetime, and lease ownership. Targeted state/logging types, scoped lint, and format pass with frozen dependencies and isolated state in a 4 CPU / 8 GiB rootless container.
  • Fresh independent canonical Codex P0–P2 review of the complete 92e1a1bb → 71d5a7a8 range and lease owner context: scoped-clean, no actionable findings. Simplification retains one store decision and existing cleanup ownership. Production +192/-69; tests +148/-1. The 147-line allocation covers ordering, expiry, renewal, cancellation, and diagnostics. Source has not changed since that review.
  • Retained installed compatibility PASS at a381c3d5: public 2026.10.9 CLI admission with real live/expired intents, canonical candidate build/pack, actual npm replacement, registered Doctor, and ordinary lifecycle mutation. All 17,156 packaged entries matched; existing install records and nested settings were preserved. Reused for unchanged waiter schema, ordering, TTL, and admission semantics. This covers offline npm replacement/Doctor/lifecycle, without a serving Gateway or service-handoff claim.
  • Bounded exact 81cf32d9 / 74ec4446 comparison: Decision reproduces the same deadline failure on both; Doctor canonicalization passes both. Corrected Doctor/Gateway maintenance response-capture cases fail at the same target assertion on both, with identical full error messages after replacing only private checkout paths. These are scoped baseline facts, not blanket CI clearance.
  • The canonical selected-Codex composition/dependency guard accepts real aligned root/plugin fs-safe versions on integrated base/head and retains the old exact-base mismatch rejection. This certifies the guard and metadata; complete package behavior remains CI-owned.
  • Exact-head CI remains terminal failure: run41174498580, attempt 3, exact reviewed head 71d5a7a8. Complete 95-job inventory: 67 passed, 5 failed, 1 cancelled, 22 skipped. Only the requested SDK-report and companion-focus jobs were actually rerun, once each. Three underlying failures retain specific main proof: missing WebKit executable, Windows tarball mode 493/438, and dependency export entries. The derived CI gate remains failed.

Companion-focus attribution: UNKNOWN. The single rerun repeated the original expectFocus false/true timeout in “focuses Side chat on open, reopen, and tab activation at 390 px”; 135 other files and 503 other tests passed. The exact 390px case passes on main 8993eba and retained main 10d93ef evidence. Node 24.22.1 and the test-file blob match; main used a Blacksmith 16 vCPU runner while the candidate used GitHub-hosted Ubuntu. This is not a controlled same-runner counterfactual. Neither inheritance nor PR causality is established. Source remains unchanged.

Public SDK semantic impact: UNKNOWN. The single SDK-report rerun was cancelled again after 30m21s: base render completed in 983,172ms, then head render was cancelled. Its comparison is main bcf23b2 versus merge c3ad1e5, whose second parent is reviewed 71d5a7a8. The terminal 9-artifact inventory contains no SDK report. Retained actual 92e/71d5 declarations for the two fallback units, four changed internal declaration units, and the prior Testbox analysis still lack complete public per-export/member reachability or exclusion. Testbox surface analysis exited 134; its lease is stopped/completed. No public equivalence/change verdict, acknowledgement, or reporter suppression is claimed.

Remains draft: companion-focus causality is unresolved and SDK semantics are UNKNOWN after the requested reruns. The parent decides next steps.

Work sessions

…ecycle lease

Queue contending state lease writers fairly without changing the SQLite schema, name lease holders, and retain exact-owner cleanup custody. Preserve active installer exclusion and release retained heartbeat context. Settle completed worktree byte debt on refused postchecks so concurrent lease consumers can progress without relaxing disk safety. Fixes #167050. Thanks @itanyplus for the report and follow-up.
@clawsweeper

clawsweeper Bot commented Oct 28, 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 docs Improvements or additions to documentation agents Agent runtime and tooling size: M labels Oct 28, 2026
@steipete
steipete marked this pull request as ready for review October 28, 2026 03:41
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T03:44:03.156308Z 340662f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@steipete
steipete marked this pull request as draft October 28, 2026 03:43
@steipete

Copy link
Copy Markdown
Contributor Author

Holding this as a draft pending maintainer acceptance; it is not landing yet.

The fair-admission change persists a new kind of row: waiter-intent rows in state_leases under a new core:state-lease-waiters scope. They carry FIFO ordering, a 30s position expiry, and acquisition-side cleanup. There's no schema bump, but that is still a material change to persisted concurrency semantics, and per docs/reference/database-schemas.md#review-checkpoint-for-material-changes it needs explicit maintainer acceptance before it lands. Open points for that review:

The holder naming in the wait message, and the automatic openclaw peer link for npm-installed plugins, are independent of the queue. They could land separately first if that's preferred.

@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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. labels Oct 28, 2026
@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 18984b9997125084f32bdc8fae68175d727506fb, but the PR head is now 71d5a7a8f6aec016a31b1c41d145b0b112125984. Its old verdict and PR readiness labels are no longer current.

Next step
Comment @clawsweeper re-review when the current head is ready; pushes after the first review are not reviewed automatically.

Review history (2 earlier review cycles)
  • reviewed 2026-10-28T03:59:27.319Z sha 340662f :: blocked before merge. :: [P2] Split the independent capacity-accounting repair
  • reviewed 2026-10-30T14:58:07.236Z sha 18984b9 :: blocked before merge. :: none

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Maintainer decision (update-reliability loop; Peter delegated this call to the loop on 2026-10-30): accept the persisted FIFO waiter intents in the existing state_leases table under core:state-lease-waiters.

Reasons: admission order has to hold across processes (CLI, Gateway, updater helper), so an in-process queue cannot fix the starvation; the rows reuse the existing table without a schema bump, expire after 30 s, and are cleaned up by their exact owner, so a crashed waiter cannot wedge admission.

Conditions before this leaves draft:

  1. Split the worktree capacity-debt settlement (src/agents/worktrees/capacity.worker.ts) into its own PR.
  2. Add rollback/upgrade compatibility proof: a previous stable build opening a state DB that holds live and expired waiter rows must neither treat them as grants nor fail admission (rollback after a failed update is the case that matters), plus latest-stable → candidate with existing plugin records intact.

The loop will carry the rework and landing unless you pick it up first.

Remove the independent worktree capacity-debt settlement and its regression for a separate follow-up. Preserve the FIFO admission and exact-owner cleanup implementation, with a separate 147-line allocation for its distinct regression contracts.

Co-authored-by: steipete <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot removed the agents Agent runtime and tooling label Oct 30, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

Please review corrected head 18984b9997125084f32bdc8fae68175d727506fb. The independent capacity-debt change and regression are split out, and fresh independent Codex review through P2 found no actionable code findings. Persisted FIFO is accepted in issuecomment-6524260103. Published-build rollback/upgrade compatibility remains required, so the draft hold is retained; the body records current evidence and gaps.

@clawsweeper

clawsweeper Bot commented Oct 30, 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. 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 30, 2026
roboclaw-bot and others added 2 commits October 30, 2026 15:22
Baseline-Refresh: 34e994a21242e8686e4dce6b037f7c055f4737de
Co-authored-by: steipete <[email protected]>
Baseline-Refresh: e74f0e1298067d3c6f7cc2b392aa68c8d6e686d9
Co-authored-by: steipete <[email protected]>
Baseline-Refresh: 40972657a4abc58a22f7da98a4dfba662b5de78c
Co-authored-by: steipete <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: plugins update blocks indefinitely on a renewing plugin lifecycle lease — lease survives gateway restarts and the holder is never identified

2 participants