Skip to content

feat: add lease heartbeat command - #1356

Merged
steipete merged 2 commits into
mainfrom
feat/lease-heartbeat-command
Aug 16, 2026
Merged

steipete merged 2 commits into
mainfrom
feat/lease-heartbeat-command

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • add crabbox heartbeat --id <lease-or-slug> [--provider <p>] [--idle-timeout <duration>] [--json]
  • send one owner-scoped heartbeat through the existing coordinator endpoint and print the committed lease state
  • use the established direct-provider Touch fallback only after exact local-claim and terminal-state checks
  • update CLI help, command docs, the shipped Crabbox skill, and the changelog

Why

External drivers can keep a warm Crabbox lease busy entirely over SSH without invoking crabbox run. In that workflow, ordinary SSH activity and read-only inspect / status calls do not advance the coordinator's lastTouchedAt, so an actively used machine can cross its idle deadline and be reaped.

This provides the missing explicit keepalive surface for openclaw/openclaw#124546 without adding a second endpoint or changing the coordinator protocol.

Backend behavior

Managed coordinator leases use the same provider-bound heartbeat client methods as the existing background heartbeat loop. Registered mode updates both the canonical coordinator lease and the exact claimed direct-provider resource because both own expiry state. Coordinator-free SSH providers use their existing Touch capability. Unsupported providers fail with a clear lease-heartbeat diagnostic.

Unknown, unowned, expired, released, or otherwise terminal coordinator leases retain the coordinator's existing error shape. Direct-provider mutation requires an exact matching local claim and rejects terminal state before touching the resource.

Verification

  • go build -trimpath -o bin/crabbox ./cmd/crabbox
  • go vet ./...
  • go test -race ./...
  • node scripts/check-command-docs.mjs
  • node scripts/build-docs-site.mjs
  • source-blind CLI contract against a loopback coordinator fixture: help flags, one 90-minute heartbeat payload, JSON state output, missing-ID failure, and non-positive-timeout failure
  • .agents/skills/autoreview/scripts/autoreview --mode local --stream-engine-output

No new configuration keys, credentials, secrets, Worker source changes, or coordinator protocol changes are required.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 16, 2026 12:35
@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 16, 2026, 8:45 AM ET / 12:45 UTC.

ClawSweeper review

What this changes

This PR adds crabbox heartbeat to refresh an owned lease’s idle deadline through the existing coordinator heartbeat or direct provider touch path.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 3 items remain

Keep open: source review finds no blocking correctness defect, but this external PR still needs inspectable real lease behavior proof before merge. Likely related people: steipete (high confidence).

Priority: P2
Reviewed head: 45ed59d2cd55ef59d6ac03f94ef96cc6f75f2419

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused implementation and regression coverage look sound, but real lease behavior proof remains required before merge.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR reports loopback-fixture tests and CI, but no inspectable after-fix run against a real lease or provider. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR reports loopback-fixture tests and CI, but no inspectable after-fix run against a real lease or provider. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 7 items Coordinator path: The command loads the selected backend and uses the provider-bound coordinator heartbeat helper before rendering the returned lease state.
Direct-provider safeguards: The direct path resolves read-only, rejects terminal leases, and requires an exact local claim before calling the provider touch capability.
Regression coverage: Tests cover coordinator request/output behavior, coordinator failure responses, registered mode, unsupported providers, and exact-claim enforcement.
Findings None None.
Security None None.

How this fits together

The Crabbox CLI resolves a lease to either a coordinator-managed backend or a direct SSH provider, then updates lifecycle state. The new command accepts a lease identifier and returns the committed or touched lease state to external SSH-based drivers.

flowchart LR
  A[Heartbeat command] --> B[Lease configuration]
  B --> C{Coordinator managed?}
  C -->|Yes| D[Provider-bound coordinator heartbeat]
  C -->|No| E[Exact claim and provider touch]
  D --> F[Lease state output]
  E --> F[Lease state output]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR reports loopback-fixture tests and CI, but no inspectable after-fix run against a real lease or provider. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - A real coordinator or provider-backed run has not been shown, leaving runtime lifecycle behavior unverified beyond fixtures.
  • Complete next step (P2) - No code repair is identified; the contributor needs to provide real behavior proof before a human merge decision.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Implementation and regression coverage production +229, tests +330 The command adds a bounded CLI implementation with more regression-test lines than production code.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Add a redacted terminal transcript from a real owned lease showing the heartbeat result and refreshed expiry, then merge the focused implementation if that proof confirms the documented behavior.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Add a redacted terminal transcript from a real owned lease showing the heartbeat result and refreshed expiry, then merge the focused implementation if that proof confirms the documented behavior.

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

Not applicable: this is a proposed command, while its fixture tests provide a clear contract-level validation path.

Is this the best way to solve the issue?

Yes, pending real behavior proof: using the existing provider-bound heartbeat and touch operations preserves the established lifecycle boundary.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded lease-lifecycle feature with meaningful operator impact but no demonstrated urgent regression.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR reports loopback-fixture tests and CI, but no inspectable after-fix run against a real lease or provider. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Coordinator path: The command loads the selected backend and uses the provider-bound coordinator heartbeat helper before rendering the returned lease state. (internal/cli/heartbeat.go:51, 45ed59d2cd55)
  • Direct-provider safeguards: The direct path resolves read-only, rejects terminal leases, and requires an exact local claim before calling the provider touch capability. (internal/cli/heartbeat.go:82, 45ed59d2cd55)
  • Regression coverage: Tests cover coordinator request/output behavior, coordinator failure responses, registered mode, unsupported providers, and exact-claim enforcement. (internal/cli/heartbeat_test.go:20, 45ed59d2cd55)
  • Prior-cycle continuity: Since the prior review, the branch changes only the shipped skill example; it adds no real-provider evidence and does not change the implementation. (skills/crabbox/SKILL.md:425, 45ed59d2cd55)
  • Area provenance: Current provider-bound coordinator mutation behavior follows recent lease-routing and provider-binding work in the same CLI area. (internal/cli/provider_coordinator.go:914, fda80796fa81)
  • Real behavior proof: The PR body reports loopback-fixture validation but contains no inspectable after-fix run against a real lease or provider. (45ed59d2cd55)

Likely related people:

  • steipete: Recent main-branch lease routing and provider-bound coordinator mutation work defines the safety constraints extended here. (role: recent lease-lifecycle contributor; confidence: high; commits: b63d61bb4f93, fda80796fa81, 87007220e956; files: internal/cli/lease_flags.go, internal/cli/provider_coordinator.go, internal/cli/status.go)

Rank-up moves

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

  • Add a redacted terminal transcript from a real owned lease showing the command and refreshed state, then update the PR body for automatic re-review.

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 (1 earlier review cycle)
  • reviewed 2026-08-16T12:40:06.608Z sha b29caa9 :: needs real behavior proof before merge. :: none

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

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant