Skip to content

refactor(workers): separate runner consent from capacity - #124356

Merged
steipete merged 6 commits into
mainfrom
steipete/node-bundle-inventory
Aug 16, 2026
Merged

steipete merged 6 commits into
mainfrom
steipete/node-bundle-inventory

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #124037

AI-assisted maintainer work for milestone 7 of the runner plan.

What Problem This Solves

The paired-device runner inventory still overloaded one optional local-build object with three unrelated meanings: node-local consent, transient launch capacity, and executable build identity. Node hosts also scanned and hashed their local OpenClaw installation at startup even though #124037 made the installed Gateway bundle receipt the sole worker execution authority.

Why This Change Was Made

This deletes the obsolete local package scanner and removes the connect-time build claim from runtime authority. The current private runner inventory now declares node-local hosting consent and available/full capacity as a closed state, while the shipped v1 connect/inventory envelope remains validation-only so older nodes receive the existing update-and-reconnect path without regaining authority.

Status and cancellation proofs remain usable while a host is full; only new launches require available capacity. No public protocol-version bump, config key, environment variable, SQLite schema-version change, or compatibility execution fallback is added.

User Impact

Opted-in node hosts no longer perform a full local package scan at startup. Capacity transitions are explicit instead of being inferred from the presence or absence of a build object, which leaves the next installed-version and bundle-retention slices with one clear owner: the validated Gateway bundle receipt.

Evidence

  • Focused runtime, Gateway, provider, launch, projection, and protocol proof: 14 files / 309 tests passed.
  • Final changed gate passed locally after the remote Crabbox backends supplied unhydrated workspaces: formatting, environment/config ratchets, dependency and plugin boundaries, deprecated API usage, dead exports, core and core-test typechecks, core lint, schema-version/database-first guards, import cycles, and pairing/auth guards.
  • Additional bundle transfer and retention fixtures: 4 files / 9 tests passed.
  • pnpm docs:list passed.
  • Fresh P0-P2 autoreview completed cleanly with no accepted/actionable findings.
  • Production delta is approximately -192 lines; the removed scanner accounts for 141 lines, and its now-unused source-identity staging path is also deleted.

Proof gap: Blacksmith was unavailable, while Daytona and AWS started raw boxes without hydrated workspace dependencies. Repository-approved trusted-source local fallback passed; this is not represented as remote proof.

@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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: L maintainer Maintainer-authored PR labels Aug 16, 2026
@steipete
steipete force-pushed the steipete/node-bundle-inventory branch from b722a7a to b16dca4 Compare August 16, 2026 02:30
@steipete
steipete marked this pull request as ready for review August 16, 2026 02:30
@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. 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 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 16, 2026, 7:46 AM ET / 11:46 UTC.

ClawSweeper review

What this changes

The PR separates paired-node worker-host consent from available/full launch capacity, moves bundle-prewarm metadata into that declaration, and removes node-local build scanning.

Merge readiness

⛔ Blocked by patch quality or review findings - 4 items remain

Keep open: the v3 inventory cutover leaves an independently upgraded node host unable to give an actionable recovery when its Gateway still accepts only v2 inventory.

Priority: P1
Reviewed head: 039c3a1e636c3a87056c481533fc626bc9db5962

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The authority direction and stated validation are substantial, but the unhandled sequential-upgrade path is a merge-blocking compatibility defect.
Proof confidence 🌊 off-meta tidepool Not applicable: This is maintainer-authored work; the body reports focused and end-to-end validation, while the remaining blocker is a missing mixed-version recovery case.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is maintainer-authored work; the body reports focused and end-to-end validation, while the remaining blocker is a missing mixed-version recovery case.
Evidence reviewed 6 items Current Gateway contract: Current main accepts only v2 or v1 runner-inventory features, with v2 carrying the prior workerRuns shape.
Changed publication path: The branch publishes only the new v3 workerHost declaration after connection.
Rejected inventory is not recovery: An INVALID_REQUEST outside narrowly recognized legacy cases becomes a rejected optional publication, which logs a failure and suppresses the identical request.
Findings 1 actionable finding [P1] Preserve an actionable old-Gateway recovery
Security None None.

How this fits together

Paired node hosts publish runner inventory to the Gateway, which selects hosts and installs Gateway-managed worker bundles before launching sessions. The inventory must distinguish consent, new-launch capacity, and the continued status/cancellation access needed by existing work.

flowchart LR
  A[Node host configuration] --> B[Runner inventory update]
  B --> C[Gateway inventory validation]
  C --> D[Host selection]
  D --> E[Bundle installation]
  E --> F[Worker launch or status]
Loading

Before merge

  • Preserve an actionable old-Gateway recovery (P1) - Current main accepts only the v2 inventory declaration, while this publication sends only v3. A node upgraded ahead of its Gateway therefore receives invalid node runner inventory; the optional-publication loop records that rejection and leaves the host unavailable without a Gateway-update recovery. Keep v3 authority, but surface a deterministic update-and-reconnect outcome and cover this mixed-version path.
  • Resolve merge risk (P1) - A node upgraded before its Gateway loses worker-host availability through a generic rejected inventory request rather than an operator-visible Gateway-update recovery.
  • Improve patch quality - Add a regression that simulates v3 inventory rejection by a v2 Gateway and verifies actionable node-host recovery.
  • Improve patch quality - Provide a redacted after-fix node-host or Gateway trace for that recovery.

Findings

  • [P1] Preserve an actionable old-Gateway recovery — src/node-host/runner.ts:467-475
Agent review details

Security

None.

PR surface

Source -201, Tests -212, Docs +1. Total -412 across 37 files.

View PR surface stats
Area Files Added Removed Net
Source 16 144 345 -201
Tests 20 208 420 -212
Docs 1 8 7 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 37 360 772 -412

Review metrics

Metric Value Why it matters
Production vs test delta production -196, tests/support -217, docs +1 The refactor is materially net-negative, but it also deletes the prior mixed-version inventory publication path.

Stored data model

Persistent data-model change detected: durable storage schema: src/gateway/worker-environments/bundle-staging.ts, durable storage schema: src/gateway/worker-environments/bundle.test.ts, durable storage schema: src/gateway/worker-environments/device-provider.test.ts, durable storage schema: src/gateway/worker-environments/node-launch-adapter.test.ts, durable storage schema: src/gateway/worker-environments/node-worker-bundle-installer.test.ts, durable storage schema: src/gateway/worker-environments/node-worker-bundle-transfer-service.test.ts, and 8 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Add old-Gateway recovery (recommended)
    Detect the known rejected v3 inventory response and visibly direct the node operator to update the Gateway and reconnect, with focused mixed-version regression coverage.
  2. Accept coordinated upgrades
    Merge only if maintainers explicitly accept that independently upgraded nodes cannot host sessions until their Gateway is updated and that requirement is surfaced to operators.

Technical review

Best possible solution:

Keep v3-only execution authority, but convert an older Gateway's v3 rejection into a clear update-Gateway-and-reconnect outcome instead of silently retaining a rejected inventory publication.

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

Yes. A node built from this branch connected to the current v2 Gateway sends v3-only inventory, which the current parser rejects; the node-host publication loop then treats that as a rejected optional update.

Is this the best way to solve the issue?

No. The consent/capacity split is a sound direction, but deleting the mixed-version behavior without an explicit old-Gateway recovery makes the sequential-upgrade path opaque.

Full review comments:

  • [P1] Preserve an actionable old-Gateway recovery — src/node-host/runner.ts:467-475
    Current main accepts only the v2 inventory declaration, while this publication sends only v3. A node upgraded ahead of its Gateway therefore receives invalid node runner inventory; the optional-publication loop records that rejection and leaves the host unavailable without a Gateway-update recovery. Keep v3 authority, but surface a deterministic update-and-reconnect outcome and cover this mixed-version path.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P1: A routine sequential node/Gateway upgrade can stop paired-device session launches without a useful recovery path.
  • merge-risk: 🚨 compatibility: The branch changes the inventory dialect from current v2 to v3 while node hosts and Gateways can be upgraded independently.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This is maintainer-authored work; the body reports focused and end-to-end validation, while the remaining blocker is a missing mixed-version recovery case.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/node-host/runner.optional-publication.test.ts.
  • [P1] node scripts/run-vitest.mjs src/gateway/server-methods/nodes.runner-inventory.test.ts.
  • [P1] node scripts/run-vitest.mjs src/gateway/worker-environments/node-launch-adapter.test.ts.

What I checked:

Likely related people:

  • steipete: Current main history attributes the Gateway-bundle cutover and recent node-host runner work to this contributor. (role: feature owner and recent area contributor; confidence: high; commits: 78502eda6dec, f19f62cb77e3; files: src/infra/node-runner-inventory.ts, src/node-host/runner.ts, src/gateway/node-registry-private.ts)

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 (2 earlier review cycles)
  • reviewed 2026-08-16T02:36:28.092Z sha b16dca43f40838e80f921d7696b4ef619058b91d :: found issues before merge. :: [P2] Update the full-capacity runner description
  • reviewed 2026-08-16T03:09:42.778Z sha df2638d :: found issues before merge. :: [P1] Classify the existing v2 inventory as update-required legacy state | [P2] Correct the full-capacity runner plan

@steipete
steipete force-pushed the steipete/node-bundle-inventory branch from e7bfa35 to fb775bf Compare August 16, 2026 02:55
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. and removed P2 Normal backlog priority with limited blast radius. labels Aug 16, 2026
@steipete
steipete force-pushed the steipete/node-bundle-inventory branch from df2638d to 039c3a1 Compare August 16, 2026 11:40
@steipete
steipete merged commit dbad5e3 into main Aug 16, 2026
186 checks passed
@steipete
steipete deleted the steipete/node-bundle-inventory branch August 16, 2026 11:46
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 16, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 17, 2026
…4356)

* refactor(workers): separate runner inventory state

* docs(runners): track inventory cleanup

* test(workers): use bundle-only launch wire

* test(workers): update optional inventory fixture

* test(workers): validate prewarm inventory capability

* fix(workers): version runner inventory cutover
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL 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