Skip to content

fix(crabbox): join heartbeat cleanup before replacement - #200466

Merged
vincentkoc merged 1 commit into
mainfrom
fix/crabbox-heartbeat-cleanup-scope-20261117
Nov 17, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/crabbox-heartbeat-cleanup-scope-20261117

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Strict plugin replacement can finish while a Crabbox heartbeat process is still alive. Scheduled main CI reproduces this in the existing real-process replacement test; the same assertion failed in an earlier full run.

User Impact

Crabbox heartbeat retirement waits for its command cleanup before replacement completes. An uncertain cleanup is reported through the retained stop/dispose promise rather than silently releasing the heartbeat owner.

Why This Change Was Made

The command runner intentionally permits a bounded return during startup cancellation while retaining physical cleanup separately. Heartbeats previously joined only the bounded result. Run each heartbeat in the existing command scope and retain its completion promise. Schedule retries after that scope settles, outside its async context, so the next heartbeat does not inherit a closed scope.

This changes only the heartbeat lifecycle; the command runner contract and provider protocol stay unchanged.

Evidence

  • Existing replacement test fails on Linux/Bun with its child still alive after strict stop (37 ms and 65 ms in two runs).
  • Candidate overlay passed 94 existing tests across the real-process replacement, command-scope settlement, heartbeat, stop-lifetime and command suites in a qualified macOS/Bun lab. Relevant source and runtime files match the branch base; the lab source was restored afterward.
  • Independent P0–P2 review found no actionable defects.
  • Native exact-head real-process replacement test, pnpm tsgo:extensions, targeted oxlint and formatting passed.
  • Exact-head Linux/Bun validation passed the real-process replacement test in 432 ms; the whole shard passed. Regular PR CI also passed. This is scoped Linux regression proof, not a claim that every lane of the additional validation run completed.

@vincentkoc vincentkoc self-assigned this Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 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.

@vincentkoc
vincentkoc marked this pull request as ready for review November 17, 2026 07:02
@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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. 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 Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR makes Crabbox heartbeat retirement await physical command cleanup before replacement or another heartbeat begins.

Example: Strict plugin replacement interrupts the heartbeat for lease cbx_replacement.

  • Before: Replacement can complete while the heartbeat child is still alive.
  • After: Retirement joins command cleanup and propagates uncertain cleanup through its promise.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused, source-supported repair with useful real-process regression coverage; available after-fix evidence remains harness-based and Linux confirmation is pending.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the contributor proof gate; its body reports real-process replacement and focused-suite passes, while explicitly leaving Linux/Bun confirmation to CI.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Crabbox plugin replacement can complete before its heartbeat process has finished cleanup.
Reason: The maintainer-authored change restores an established retirement contract without changing configuration, provider protocol, or the shared runner API.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it repairs an evidenced heartbeat-cleanup ownership gap using the existing command scope, with no actionable correctness or security findings.

Priority: P2
Reviewed head: 4148e0b6371eab1af6f18a305972a84d87ae0e91

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence reports a passing macOS/Bun real-process replacement test; the original Linux/Bun scenario remains pending in PR CI.
Agent review details

How this fits together

The Crabbox plugin schedules lease heartbeats through the shared process runner; provider disposal joins heartbeat retirement before plugin replacement completes.

flowchart TD
  A[Plugin replacement] --> B[Provider disposal]
  B --> C[Heartbeat retirement]
  D[Heartbeat timer] --> E[Command process scope]
  E --> F[Crabbox command]
  C --> E
  F --> G[Physical cleanup]
  G --> C
Loading

Technical review

Best possible solution:

Retain the existing heartbeat owner and join its command scope before retirement or retry scheduling proceeds.

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

Current source exposes the bounded-result versus physical-cleanup gap, and scheduled-main annotations show the matching real-child assertion failing; no target code was executed during this review.

Is this the best way to solve the issue?

The patch is the smallest complete repair: preserve the runner contract, join its existing cleanup scope, and move retry scheduling outside that scope.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8e8203f07607.

Provenance checked

  • Heartbeat retirement ownership keeps the original intent (c657918: Keep stopped heartbeat entries owned until child settlement, including concurrent disposal and strict replacement.)
  • Heartbeat retry behavior keeps the original intent (5a0fe22: Renew active worker leases and retry transient heartbeat failures without failing ordinary worker operations.)
  • Effective lifetime scheduling keeps the original intent (12fe41e: Consume effective lease policy and re-arm scheduling when the idle window shrinks.)
  • Sandbox heartbeat behavior keeps the original intent (0a47030: Refresh Sandbox activity without replacing provider-owned idle policy and distinguish retrying failures from unsupported heartbeats.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +12. Total +12 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 25 13 +12
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 25 13 +12

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: Premature heartbeat retirement affects Crabbox plugin replacement and cleanup, with limited subsystem scope.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Premature heartbeat retirement affects Crabbox plugin replacement and cleanup, with limited subsystem scope.
  • 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.

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.

Reviewed November 17, 2026, 2:17 AM ET / 07:17 UTC.

@vincentkoc
vincentkoc merged commit 6247dc4 into main Nov 17, 2026
317 of 368 checks passed
@vincentkoc
vincentkoc deleted the fix/crabbox-heartbeat-cleanup-scope-20261117 branch November 17, 2026 07:25
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

RomneyDa pushed a commit that referenced this pull request Nov 18, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 18, 2026
RomneyDa added a commit that referenced this pull request Nov 18, 2026
* improve(ci): avoid duplicate release source guard scans

* fix(ci): classify recovery browser test server ownership (#200402)

(cherry picked from commit a62e4e1)

* fix(ci): restore package harness startup

Copy the runtime process dependency manifest into the dependency-free packaging fixture so the CLI reaches argument validation. The existing startup assertion continues to reject missing modules.

(cherry picked from commit 84262af)

* test(facetime): preserve child process exports in audio fixture (#200419)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 36549cb)

* test(browser): align fixtures with navigation and CLI contracts (#200428)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit d0daf88)

* fix: restore Codex qualification fixture contracts (#200450)

* fix: restore Codex run-attempt qualification coverage

Use the complete typed transcript recorder fixtures and assert post-acceptance submission after prompt persistence, matching #199695. No production behavior or timeout changes.

Co-authored-by: RomneyDa <[email protected]>

* test: align Codex refresh callback fixtures

Co-authored-by: RomneyDa <[email protected]>

---------

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 8f0d03f)

* fix(crabbox): join heartbeat command cleanup before retirement (#200466)

(cherry picked from commit 6247dc4)

* fix(agents): retain ambiguous completed-answer receipts

* fix(qa): ignore workspace context when detecting continuation

---------

Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 19, 2026
)

* improve(ci): avoid duplicate release source guard scans

* fix(ci): classify recovery browser test server ownership (openclaw#200402)

(cherry picked from commit 4a2270d)

* fix(ci): restore package harness startup

Copy the runtime process dependency manifest into the dependency-free packaging fixture so the CLI reaches argument validation. The existing startup assertion continues to reject missing modules.

(cherry picked from commit 7dfdaec)

* test(facetime): preserve child process exports in audio fixture (openclaw#200419)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit b12070e)

* test(browser): align fixtures with navigation and CLI contracts (openclaw#200428)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit d623a9b)

* fix: restore Codex qualification fixture contracts (openclaw#200450)

* fix: restore Codex run-attempt qualification coverage

Use the complete typed transcript recorder fixtures and assert post-acceptance submission after prompt persistence, matching openclaw#199695. No production behavior or timeout changes.

Co-authored-by: RomneyDa <[email protected]>

* test: align Codex refresh callback fixtures

Co-authored-by: RomneyDa <[email protected]>

---------

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit d0d35ab)

* fix(crabbox): join heartbeat command cleanup before retirement (openclaw#200466)

(cherry picked from commit a823861)

* fix(agents): retain ambiguous completed-answer receipts

* fix(qa): ignore workspace context when detecting continuation

---------

Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 19, 2026
* improve(ci): avoid duplicate release source guard scans

* fix(ci): classify recovery browser test server ownership (#200402)

(cherry picked from commit a62e4e1)

* fix(ci): restore package harness startup

Copy the runtime process dependency manifest into the dependency-free packaging fixture so the CLI reaches argument validation. The existing startup assertion continues to reject missing modules.

(cherry picked from commit 84262af)

* test(facetime): preserve child process exports in audio fixture (#200419)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 36549cb)

* test(browser): align fixtures with navigation and CLI contracts (#200428)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit d0daf88)

* fix: restore Codex qualification fixture contracts (#200450)

* fix: restore Codex run-attempt qualification coverage

Use the complete typed transcript recorder fixtures and assert post-acceptance submission after prompt persistence, matching #199695. No production behavior or timeout changes.

Co-authored-by: RomneyDa <[email protected]>

* test: align Codex refresh callback fixtures

Co-authored-by: RomneyDa <[email protected]>

---------

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 8f0d03f)

* fix(crabbox): join heartbeat command cleanup before retirement (#200466)

(cherry picked from commit 6247dc4)

* fix(agents): retain ambiguous completed-answer receipts

* fix(qa): ignore workspace context when detecting continuation

---------

Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 60e0e21)
Release adaptation: Preserve baseline authored-request continuation classifier and extractToolOutput import; newer #201244 behavior already exists. Apply runtime-context split and regression without downgrading it.:
Backport review: #201130 selected by sibling; #201331 and #198760 are independent package script changes. #201244 classifier already present-equivalent on baseline.:
(cherry picked from commit ad2ae0e0e2bf242ab0df9f9ca29f4f848caf478c)
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
)

* improve(ci): avoid duplicate release source guard scans

* fix(ci): classify recovery browser test server ownership (openclaw#200402)

(cherry picked from commit a62e4e1)

* fix(ci): restore package harness startup

Copy the runtime process dependency manifest into the dependency-free packaging fixture so the CLI reaches argument validation. The existing startup assertion continues to reject missing modules.

(cherry picked from commit 84262af)

* test(facetime): preserve child process exports in audio fixture (openclaw#200419)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 36549cb)

* test(browser): align fixtures with navigation and CLI contracts (openclaw#200428)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit d0daf88)

* fix: restore Codex qualification fixture contracts (openclaw#200450)

* fix: restore Codex run-attempt qualification coverage

Use the complete typed transcript recorder fixtures and assert post-acceptance submission after prompt persistence, matching openclaw#199695. No production behavior or timeout changes.

Co-authored-by: RomneyDa <[email protected]>

* test: align Codex refresh callback fixtures

Co-authored-by: RomneyDa <[email protected]>

---------

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 8f0d03f)

* fix(crabbox): join heartbeat command cleanup before retirement (openclaw#200466)

(cherry picked from commit 6247dc4)

* fix(agents): retain ambiguous completed-answer receipts

* fix(qa): ignore workspace context when detecting continuation

---------

Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 60e0e21)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 90fc6d5fa4c9d0f348e83ae63fd63c3072e03433)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: crabbox P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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