Skip to content

fix: clarify cloud dispatch and heartbeat timeout diagnostics - #128434

Merged
steipete merged 2 commits into
mainfrom
fix/cloud-dispatch-guidance
Aug 24, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/cloud-dispatch-guidance

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where operators dispatching a runtime that requires remote execution were told that SSH was mandatory, even though an approved paired device is also supported. Resolves a second operational blind spot where a timed-out Crabbox heartbeat warned that workers might be reaped without reporting how long the heartbeat actually ran.

Why This Change Was Made

Keep execution-mode guidance at the Gateway dispatch boundary aligned with the paired-device and remote-exec provider capabilities already documented and implemented. Measure heartbeat runtime inside its owning lifecycle manager and include the actual elapsed milliseconds only in timeout warnings, without changing other command-error shapes or provider behavior.

User Impact

Operators can choose an approved paired device or a provider advertising remote-exec instead of being sent down an SSH-only dead end. A Crabbox heartbeat timeout now identifies its measured duration, for example (timeout after 60012 ms), making coordinator-idle and worker-reaping incidents diagnosable from the existing warning.

Evidence

  • Before the fixes, the existing Gateway boundary test failed for both unsupported and unadvertised provider modes because the response still claimed SSH was required, and the new Crabbox provider-boundary regression failed because its timeout warning omitted the measured 60012 ms.
  • node scripts/run-vitest.mjs src/gateway/server-methods/sessions.dispatch.test.ts src/gateway/server-methods/sessions.dispatch.device.test.ts: 4 test files passed, 74 tests passed, including the existing successful paired-device dispatch coverage.
  • node scripts/run-vitest.mjs extensions/crabbox: 3 test files passed, 125 tests passed. The timeout regression advances a fake clock by 60012 ms while the configured heartbeat timeout is 150000 ms, proving the warning uses measured elapsed time rather than its configured budget.
  • env -u OPENCLAW_TESTBOX OPENCLAW_LOCAL_CHECK_MODE=full node scripts/check-changed.mjs: passed all selected core, core-test, plugin, and plugin-test checks; the environment overrides only prevent inherited remote routing and use the supported full-speed local scheduler.
  • .claude/skills/autoreview/scripts/autoreview --mode branch --base origin/main: clean, with no accepted or actionable findings.
  • Diff split: production +2 net lines; tests +33 net lines. The existing Control UI locale already uses provider-neutral guidance and remains unchanged.

@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime extensions: crabbox size: XS maintainer Maintainer-authored PR labels Aug 24, 2026
@steipete
steipete marked this pull request as ready for review August 24, 2026 00:59
@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. 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. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 23, 2026, 9:07 PM ET / August 24, 2026, 01:07 UTC.

ClawSweeper review

What this changes

This PR clarifies cloud-dispatch remediation and appends measured elapsed time to Crabbox heartbeat timeout warnings.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open. The heartbeat diagnostic is correctly owned and tested, but the new generic dispatch error sends cloud-only remote-exec runtimes to an unavailable paired-device route.

Priority: P2
Reviewed head: 12c0acbda70cb4459471016d6b4024b4536c595e

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The heartbeat repair is well-scoped, but the dispatch wording has one concrete operator-facing correctness gap.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body provides focused after-fix test evidence.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body provides focused after-fix test evidence.
Evidence reviewed 7 items Current-main comparison: Current main retains the SSH-only diagnostic; the PR replaces it with the unconditional paired-device advice.
Runtime capability contract: A remote-exec harness without devicePlacement is explicitly modeled as cloud-only and not paired-device capable.
Rejected suggested route: Device eligibility rejects a runtime without a device-placement requirement before any dispatch.
Findings 1 actionable finding [P2] Only offer paired devices to runtimes that support them
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/gateway/server-methods/sessions.dispatch.test.ts src/gateway/server-methods/sessions.dispatch.device.test.ts extensions/crabbox/src/crabbox-worker-provider.test.ts

Result: PASS (completed)

node scripts/run-vitest.mjs src/gateway/server-methods/sessions.dispatch.test.ts src/gateway/server-methods/sessions.dispatch.device.test.ts extensions/crabbox/
src/crabbox-worker-provider.test.tsrunner@runnervm76f27:/tmp/clawsweeper-live-proof-128434-SfTqa2/target$ node scripts/run-vitest.mjs src/gateway/server-methods
/sessions.dispatch.test.ts src/gateway/server-methods/sessions.dispatch.device.test.ts extensions/crabbox/src/crabbox-worker-provider.test.ts
[test] starting test/vitest/vitest.gateway.config.ts
node scripts/run-vitest.mjs src/gateway/server-methods/sessions.dispatch.test.ts src/gateway/server-methods/sessions.dispatch.device.test.ts extensions/crabbox/
src/crabbox-worker-provider.test.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-128434-SfTqa2/target

 ✓  gateway-server-isolated  ../../src/gateway/server-methods/sessions.dispatch.device.test.ts (8 tests) 1136ms
     ✓ synthesizes the core device-provider target for a connected session-capable node  348ms
     ✓ rejects a 'full' node before mutating placement or provisioning  408ms
 ✓  gateway-server-isolated  ../../src/gateway/server-methods/sessions.dispatch.test.ts (29 tests) 1954ms
     ✓ prefers an explicit profile over the per-project default  312ms
 ✓  gateway-methods  ../../src/gateway/server-methods/sessions.dispatch.device.test.ts (8 tests) 1110ms
     ✓ synthesizes the core device-provider target for a connected session-capable node  340ms
     ✓ rejects a 'full' node before mutating placement or provisioning  371ms
 ✓  gateway-methods  ../../src/gateway/server-methods/sessions.dispatch.test.ts (29 tests) 1942ms

 Test Files  4 passed (4)
      Tests  74 passed (74)
   Start at  01:08:17
   Duration  29.58s (transform 38.91s, setup 2.42s, import 47.97s, tests 6.14s, environment 1ms)

[test] starting test/vitest/vitest.extensions.config.ts


























Assertions:

  • PASS expect_output: Test Files

How this fits together

Gateway session dispatch selects either a cloud worker provider or a paired device based on the selected runtime’s declared capabilities. Crabbox’s provider lifecycle periodically heartbeats active leases and emits warnings when that keepalive fails.

flowchart LR
A[Operator dispatch request] --> B[Gateway capability validation]
B --> C[Cloud provider or paired device]
C --> D[Worker placement]
B --> E[Actionable dispatch diagnostic]
F[Crabbox heartbeat command] --> G[Lease lifecycle manager]
G --> H[Timeout warning]
Loading

Before merge

  • Only offer paired devices to runtimes that support them (P2) - This message now recommends a paired device for every remote-exec mismatch, but cloud-only remote-exec harnesses intentionally have no devicePlacement and are rejected if that route is selected. Make the hint conditional on devicePlacement and cover the cloud-only variant.
  • Resolve merge risk (P1) - Cloud-only remote-exec runtimes will be told to use a paired device even though Gateway rejects that route.
  • Resolve merge risk (P1) - The heartbeat diagnostic adds two net production lines; the added state is justified only because elapsed time must span the awaited command at its lifecycle owner.
  • Complete next step (P2) - A small mechanical repair can prevent the new diagnostic from advertising an unsupported paired-device route.

Findings

  • [P2] Only offer paired devices to runtimes that support them — src/gateway/server-methods/sessions-dispatch.ts:174
Agent review details

Security

None.

PR surface

Source +2, Tests +33. Total +35 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 4 2 +2
Tests 2 34 1 +33
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 38 3 +35

Review metrics

Metric Value Why it matters
Production versus test LOC production +3/-1 (net +2); tests +34/-1 (net +33) The small production increase is localized to diagnostic timing; the added tests cover the new heartbeat text but not the cloud-only dispatch variant.

Merge-risk options

Maintainer options:

  1. Gate the paired-device hint (recommended)
    Offer a paired device only when the selected runtime declares devicePlacement, and add a cloud-only remote-exec regression case.
  2. Accept the misleading remediation
    Land the current wording knowing cloud-only remote-exec operators can be directed to an impossible route.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Update the dispatch diagnostic to offer paired devices only when devicePlacement exists, add cloud-only regression coverage, and rerun the focused Gateway tests.

Technical review

Best possible solution:

Make paired-device remediation conditional on devicePlacement, while retaining the elapsed-time measurement in the heartbeat lifecycle manager.

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

Yes—source-reproducible: a cloud-only remote-exec harness with an unsupported provider receives the new paired-device advice, then fails paired-device eligibility because it declares no devicePlacement.

Is this the best way to solve the issue?

No. The diagnostic should derive its remediation from the existing devicePlacement capability rather than advertising paired devices for every remote-exec runtime.

Full review comments:

  • [P2] Only offer paired devices to runtimes that support them — src/gateway/server-methods/sessions-dispatch.ts:174
    This message now recommends a paired device for every remote-exec mismatch, but cloud-only remote-exec harnesses intentionally have no devicePlacement and are rejected if that route is selected. Make the hint conditional on devicePlacement and cover the cloud-only variant.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a bounded operator-facing dispatch diagnostic defect with a clear local repair.
  • add merge-risk: 🚨 other: Merging the generic paired-device advice can leave cloud-only remote-exec operators at an unsupported remediation path.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body provides focused after-fix test evidence.

Label justifications:

  • P2: This is a bounded operator-facing dispatch diagnostic defect with a clear local repair.
  • merge-risk: 🚨 other: Merging the generic paired-device advice can leave cloud-only remote-exec operators at an unsupported remediation path.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body provides focused after-fix test evidence.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/gateway/server-methods/sessions.dispatch.test.ts src/gateway/server-methods/sessions.dispatch.device.test.ts.
  • [P1] git diff --check.

What I checked:

Likely related people:

  • steipete: Peter Steinberger authored the commits that introduced the dispatch validation, paired-device support, and Crabbox heartbeat manager. (role: feature introducer and recent area contributor; confidence: high; commits: 259a14b83b51, 1353ce0995c6, 5a0fe2232b46; files: src/gateway/server-methods/sessions-dispatch.ts, extensions/crabbox/src/crabbox-worker-heartbeat.ts)

Rank-up moves

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

  • Condition paired-device advice on devicePlacement and add the cloud-only runtime regression.
  • Rerun the focused Gateway dispatch tests after the wording repair.

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Live verification of the dispatch guidance fix, real gateway built from this head (12c0acbda70), isolated state dir, port 19842:

  • sessions.create with openai/gpt-5.6-luna (pinned agentRuntime.id: "codex"), registered Git project, managed worktree.
  • sessions.dispatch { profileId: "hetzner" } against a real Crabbox cloud profile returned the corrected message verbatim over RPC:
selected cloud worker provider does not support the remote-exec execution mode required by runtime codex; use an approved paired device or a provider that advertises remote-exec

The rejection fired before any provider allocation (no lease created), matching the pre-allocation gate's contract. The heartbeat elapsed-time addition is covered by the new provider test (timeout after 60012 ms asserted on a fake 60s-hang heartbeat); firing it live requires an AWS lease whose heartbeat naturally exceeds the budget, which the measured latency distribution only produces probabilistically, so unit coverage carries that half.

@steipete
steipete merged commit c337919 into main Aug 24, 2026
304 checks passed
@steipete
steipete deleted the fix/cloud-dispatch-guidance branch August 24, 2026 03:14
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 24, 2026
…aw#128434)

* fix: clarify cloud dispatch and heartbeat timeout diagnostics

* test(crabbox): satisfy heartbeat timeout regression lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: crabbox gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant