Skip to content

fix(doctor): report unusable cloud worker profiles - #124995

Merged
steipete merged 1 commit into
mainfrom
steipete/cloud-worker-doctor-check
Aug 18, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/cloud-worker-doctor-check

Conversation

@steipete

@steipete steipete commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where operators could configure a Crabbox cloud worker profile with a missing binary, pass openclaw config validate, and receive no relevant openclaw doctor finding until a later session dispatch failed.

Before this change, an isolated profile with settings.binary: "/nonexistent/path/to/crabbox" produced:

Config valid: .../openclaw.json
doctor --json: 28 checks run; crabbox/cloud-worker-profiles findings: 0

Gateway startup also reached ready without a profile-readiness warning. environments.list advertised the aws profile, while environments.status rejected aws as an unknown environment ID because that method reports concrete environments, not profile health. The Cloud Worker Desktop path uses the same advertised profile inventory and had the same gap.

Follow-up observed but intentionally not folded into this repair: the minimal reproduction omits Crabbox ttl and idleTimeout, so the machine-options subcall logs a provider-shape error while environments.list still advertises the profile. A separate semantic-profile doctor check can surface that broader provider-settings class without widening this binary-readiness fix.

Why This Change Was Made

Crabbox owns the readiness policy. A narrow doctor-health-api artifact contributes a plugin health check, while core only discovers configured bundled worker-provider owners from manifest metadata and invokes their optional health registrar. No Crabbox identifier or rule is hardcoded into core doctor.

The default check is conservative and local:

  • verifies that each configured Crabbox binary resolves to an executable file;
  • runs one cached, process-tree-bounded --version probe per binary with a 2-second timeout and 64 KiB output cap;
  • warns when the version is definitively older than the documented 0.41.1 floor;
  • reports timeout, launch failure, nonzero exit, oversized output, or unrecognized output only as informational “could not determine” findings with a manual command.

Deliberately excluded:

  • config validate remains a shape check, so a binary that will appear later is still valid and the two surfaces do not duplicate one another;
  • heartbeat capability is not probed: missing heartbeat is degraded operation rather than an unusable profile, has no released version floor beyond “after 0.43.0,” and the placement path already warns;
  • AWS inspect is not called because it performs fresh EC2 control-plane reads; doctor makes no cloud-provider API calls;
  • dispatch, provider allocation, config schema, and Gateway startup failure behavior are unchanged.

Codex remote-exec status was also checked directly in openai/codex at be6e8eac029b183056b7e4402879f15d2c85f61b (codex-rs/exec-server/src/environment.rs:100): it observes an already-configured exec-server connection without starting or reconnecting one, so it is not a reusable pre-dispatch Crabbox profile probe.

User Impact

Operators who run openclaw doctor --lint or openclaw doctor --json now get a profile-specific warning and exact repair command before dispatch when the Crabbox binary is missing, non-executable, or definitively too old. Healthy profiles and installations without cloud workers remain silent for this check.

Evidence

Built CLI, isolated state directories, free non-default ports, OPENCLAW_SKIP_CHANNELS=1, and Discord/Twilio credential variables unset for every run:

no-profile:
  config validate: valid
  text: crabbox/cloud-worker-profiles findings: 0
  json: crabbox/cloud-worker-profiles findings: 0

healthy-profile (/Users/steipete/.local/bin/crabbox 0.41.6):
  config validate: valid
  text: crabbox/cloud-worker-profiles findings: 0
  json: crabbox/cloud-worker-profiles findings: 0

broken-profile (/nonexistent/path/to/crabbox):
  config validate: valid
  text: [warning] crabbox/cloud-worker-profiles /nonexistent/path/to/crabbox - Cloud worker profile "aws" cannot use Crabbox because /nonexistent/path/to/crabbox is not an executable file.
        fix: Install Crabbox 0.41.1 or newer at /nonexistent/path/to/crabbox, or set cloudWorkers.profiles.aws.settings.binary to an executable absolute path, then rerun `openclaw doctor --json`.
  json: one matching warning with target="aws", path="/nonexistent/path/to/crabbox", and ocPath="cloudWorkers.profiles.aws.settings.binary"

The post-rebase stdout/stderr captures were inspected separately. Config validation and human-text stderr were empty. Each JSON run also emitted one unrelated current-main memory-core owner-authorization diagnostic on stderr; JSON integrity and the Crabbox finding state were unaffected.

Validation:

node scripts/run-vitest.mjs extensions/crabbox/src/crabbox-worker-provider.test.ts src/flows/bundled-health-checks.test.ts src/commands/doctor-lint.test.ts
  3 files, 144 tests passed

OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 node scripts/check-changed.mjs
  passed all selected core, core-test, extension, and extension-test gates

pnpm build
  passed; doctor-health-api.js present in the built Crabbox plugin surface

.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --stream-engine-output
  clean; no accepted/actionable findings

Production LOC: +237/-5 (net +232) | Tests: +287/-1. The production growth is the new generic manifest-owner discovery boundary plus the plugin-owned readiness detector and bounded subprocess contract; no parallel runtime, config, or dispatch path was added.


Rebased over worker node-transport convergence

Rebased onto 0e7f3209f2d and force-pushed exact head d581993bfab. The conflict preserved current main's node-enrollment provider and tests while keeping the shared provider ID needed by doctor.

identityRefId, CRABBOX_KEY_REF_PROVIDER, and Crabbox's resolveSshIdentity remain deleted. They are dead rather than renamed: Crabbox now advertises worker-turn, returns { node: { deviceId } }, and core launches turns through node-worker-tunnel.ts. The generic SSH tunnel is workspace-only after #125465; no key-reference replacement exists for Crabbox.

The rebuilt three-state proof again shows no Crabbox finding for no-profile and real-binary configs, and exactly one actionable warning for /nonexistent/path/to/crabbox in both human text and JSON. pnpm build emits dist/extensions/crabbox/doctor-health-api.js on the rebased head. Focused tests, the complete local changed gate, and autoreview are clean. The prior unrelated Codex fixture and ratchet notes were removed because their fixes are now upstream and absent from this branch diff.

@clawsweeper

clawsweeper Bot commented Aug 17, 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 commands Command implementations extensions: crabbox size: L maintainer Maintainer-authored PR labels Aug 17, 2026
@steipete
steipete marked this pull request as ready for review August 17, 2026 02:48
@steipete
steipete force-pushed the steipete/cloud-worker-doctor-check branch 2 times, most recently from 8c30cf1 to 65627a8 Compare August 17, 2026 03:29
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 17, 2026, 9:51 PM ET / August 18, 2026, 01:51 UTC.

ClawSweeper review

What this changes

Adds a Crabbox-owned Doctor health check that reports configured cloud-worker profiles whose Crabbox binary is missing, non-executable, or too old before dispatch.

Merge readiness

⚠️ Needs maintainer review before merge - 4 items remain

Keep open: the prior P1 remains on the rebased head. Doctor registers the Crabbox check for disabled, denied, or excluded plugins, so lint can fail for a provider the Gateway will not activate.

Priority: P2
Reviewed head: d581993bfab19594d37716e93426fc818a82c2bf

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The real command proof is useful, but the remaining P1 activation-policy regression blocks merge readiness.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body provides after-fix built-CLI output for no-profile, healthy-profile, and missing-binary configurations, including the resulting JSON and text warning.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides after-fix built-CLI output for no-profile, healthy-profile, and missing-binary configurations, including the resulting JSON and text warning.
Evidence reviewed 6 items Missing activation gate: The new worker-provider registration selects every configured bundled owner and loads its Doctor artifact without applying the already-imported shared manifest-owner base policy.
Runtime sibling honors policy: Gateway startup recognizes configured worker-provider ownership but starts it only through its activation-policy evaluation, so Doctor must not register checks for policy-disabled owners.
Observable lint failure: The added lint test establishes that this warning returns exit code 1; therefore an incorrectly registered disabled-provider check can break preflight automation.
Findings 1 actionable finding [P1] Honor plugin activation policy before loading provider health
Security None None.

How this fits together

Doctor reads configured cloud-worker profiles, discovers their bundled provider owner, and registers that owner’s health check. The Crabbox check then resolves the configured binary, probes its version, and emits lint/JSON findings for operators.

flowchart TD
A[Cloud worker profiles] --> B[Bundled provider manifest]
B --> C[Plugin activation policy]
C --> D[Doctor health registration]
D --> E[Crabbox binary and version check]
E --> F[Doctor lint and JSON findings]
Loading

Before merge

  • Honor plugin activation policy before loading provider health (P1) - This path loads every configured bundled provider artifact without passesManifestOwnerBasePolicy, unlike Gateway startup. Thus plugins.enabled: false, an explicit Crabbox disable, a deny entry, or an excluding allowlist still registers the check; a missing binary then makes Doctor lint exit 1 even though the provider cannot run. Filter the owners through the shared policy and cover those states.
  • Resolve merge risk (P1) - A disabled, denied, or restrictive-allowlist-excluded Crabbox plugin can still register its check and make openclaw doctor --lint fail on a stale binary path, although Gateway startup will not activate that provider.
  • Resolve merge risk (P1) - The fix adds production +232 lines; its generic discovery boundary and plugin-owned detector are distinct responsibilities, but that growth should land only with the missing policy gate rather than adding a second activation path.
  • Complete next step (P2) - The remaining blocker is a narrow, mechanical policy-gating repair with an obvious focused regression suite.

Findings

  • [P1] Honor plugin activation policy before loading provider health — src/flows/bundled-health-checks.ts:157-163
Agent review details

Security

None.

PR surface

Source +232, Tests +286. Total +518 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 6 237 5 +232
Tests 3 287 1 +286
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 524 6 +518

Review metrics

Metric Value Why it matters
Production versus test delta production +232, tests +286 The new generic owner-discovery boundary and Crabbox detector explain the growth, but the active policy defect must be resolved before that larger bug-fix surface is accepted.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/crabbox/doctor-health-api.ts, migration/backfill/repair: extensions/crabbox/src/crabbox-worker-provider.test.ts, migration/backfill/repair: extensions/crabbox/src/doctor.ts, migration/backfill/repair: src/commands/doctor-lint.test.ts, serialized state: src/commands/doctor-lint.test.ts, unknown-data-model-change: extensions/crabbox/src/doctor.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Apply the shared activation gate (recommended)
    Filter configured bundled worker-provider owners with the existing manifest-owner base policy and add coverage for disabled, denylisted, explicitly disabled, and excluded-allowlist states.
  2. Accept false lint failures
    Merge as-is knowing disabled provider configurations can still produce a nonzero Doctor lint result.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Reuse the manifest-owner base policy before loading worker-provider Doctor artifacts, and add focused tests for global disablement, explicit disablement, denylist, and restrictive allowlist exclusion.

Technical review

Best possible solution:

Filter bundled worker-provider Doctor owners through the shared manifest-owner base policy, cover every disabled-policy mode, and retain the plugin-owned binary detector.

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

Yes, source-reproducible: configure a missing Crabbox binary together with any disabled-policy state, then run the targeted Doctor lint check; registration currently bypasses the policy gate and the warning exits nonzero.

Is this the best way to solve the issue?

No: the plugin-owned detector is the right owner, but its core registration must reuse the shared activation policy before this is the best fix.

Full review comments:

  • [P1] Honor plugin activation policy before loading provider health — src/flows/bundled-health-checks.ts:157-163
    This path loads every configured bundled provider artifact without passesManifestOwnerBasePolicy, unlike Gateway startup. Thus plugins.enabled: false, an explicit Crabbox disable, a deny entry, or an excluding allowlist still registers the check; a missing binary then makes Doctor lint exit 1 even though the provider cannot run. Filter the owners through the shared policy and cover those states.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix built-CLI output for no-profile, healthy-profile, and missing-binary configurations, including the resulting JSON and text warning.

Label justifications:

  • P2: This is a bounded preflight regression for configured cloud-worker profiles rather than an outage of the default runtime.
  • merge-risk: 🚨 compatibility: Merging can make existing disabled-provider configurations fail Doctor lint despite the corresponding provider remaining inactive at runtime.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR body provides after-fix built-CLI output for no-profile, healthy-profile, and missing-binary configurations, including the resulting JSON and text warning.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix built-CLI output for no-profile, healthy-profile, and missing-binary configurations, including the resulting JSON and text warning.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/flows/bundled-health-checks.test.ts extensions/crabbox/src/crabbox-worker-provider.test.ts src/commands/doctor-lint.test.ts.
  • [P1] node scripts/check-changed.mjs.

What I checked:

  • Missing activation gate: The new worker-provider registration selects every configured bundled owner and loads its Doctor artifact without applying the already-imported shared manifest-owner base policy. (src/flows/bundled-health-checks.ts:157, d581993bfab1)
  • Runtime sibling honors policy: Gateway startup recognizes configured worker-provider ownership but starts it only through its activation-policy evaluation, so Doctor must not register checks for policy-disabled owners. (src/plugins/gateway-startup-plugin-activation.ts:216, b5b17c654b2d)
  • Observable lint failure: The added lint test establishes that this warning returns exit code 1; therefore an incorrectly registered disabled-provider check can break preflight automation. (src/commands/doctor-lint.test.ts:358, d581993bfab1)
  • Coverage gap: The new flow test covers a configured Crabbox owner, but does not cover global plugin disablement, an explicit disable, denylist, or restrictive allowlist. (src/flows/bundled-health-checks.test.ts:312, d581993bfab1)
  • Prior finding persists: The latest ClawSweeper review identified this same activation-policy omission; the changed registration path remains ungated on the current head. (src/flows/bundled-health-checks.ts:157, d581993bfab1)
  • Current-main and release check: The PR head is d581993 while current main is b5b17c6; git tag --contains returned no release tag for the PR head, so the requested behavior is not already implemented on main or shipped. (d581993bfab1)

Likely related people:

  • steipete: Authored the current health-registration change and the recently merged cloud-worker transport refactor. (role: recent cloud-worker and startup contributor; confidence: high; commits: d581993bfab1, bb1ce585149a; files: src/flows/bundled-health-checks.ts, extensions/crabbox/src/doctor.ts)
  • vincentkoc: History credits this contributor with the manifest-owner trust-policy refactor that supplies the policy this new registration path must reuse. (role: manifest-policy contributor; confidence: medium; commits: 0fd9aa8e001e; files: src/plugins/manifest-owner-policy.ts)

Rank-up moves

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

  • Apply the shared manifest-owner policy before loading worker-provider Doctor artifacts and add the four disabled-policy regression cases.

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 (4 earlier review cycles)
  • reviewed 2026-08-17T03:36:54.315Z sha 65627a8 :: found issues before merge. :: [P1] Honor disabled provider-plugin policy before registering checks
  • reviewed 2026-08-17T14:06:43.524Z sha 6029b7d :: found issues before merge. :: [P1] Honor disabled provider policy before registering checks
  • reviewed 2026-08-17T16:33:16.630Z sha 3c4e96c :: found issues before merge. :: [P1] Honor worker-provider activation before registering checks
  • reviewed 2026-08-17T19:03:04.547Z sha 3c4e96c :: needs changes before merge. :: [P1] Honor worker-provider activation before registering checks

@steipete
steipete force-pushed the steipete/cloud-worker-doctor-check branch from 65627a8 to 6029b7d Compare August 17, 2026 13:51
@steipete
steipete force-pushed the steipete/cloud-worker-doctor-check branch from 6029b7d to 3c4e96c Compare August 17, 2026 16:25
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 17, 2026
@steipete
steipete force-pushed the steipete/cloud-worker-doctor-check branch from 3c4e96c to d581993 Compare August 18, 2026 01:42
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 18, 2026
@steipete
steipete merged commit b82d07f into main Aug 18, 2026
220 checks passed
@steipete
steipete deleted the steipete/cloud-worker-doctor-check branch August 18, 2026 01:58
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

commands Command implementations extensions: crabbox maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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