Skip to content

fix(workers): report full nodes as at capacity, not offline - #130445

Merged
steipete merged 2 commits into
mainfrom
codex/remote-node-capacity-diagnostic
Aug 26, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/remote-node-capacity-diagnostic

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users sending a turn to an existing remote-node session were told the device was offline when it was connected but all worker slots were occupied. The incorrect reconnect guidance appeared after the bounded availability wait.

Why This Change Was Made

Node discovery combined device identity and free capacity in one filter, losing the distinction between a missing node and a full node. The launch adapter now retains the latest retryable observation and converts availability-grace expiry in one place. A connected full node produces the existing capacity error; an absent node retains the existing offline error.

The ten-second availability grace, durable supervisor admission, exact pairing/connection/authority checks, status/cancel access at capacity, and retryable placement behavior remain unchanged. No UI, config, protocol, permission policy, or storage changes. This aligns the existing node capacity/wait documentation rather than introducing a new operator contract.

Production +17/-13 (net +4); tests +52/-6 (net +46). The small growth records the missing capacity-versus-connectivity fact while removing duplicated timeout classification. AI-assisted.

User Impact

A saturated remote node reports capacity exhaustion rather than asking the operator to reconnect a healthy device. The session remains retryable after a slot becomes free. Nodes that actually disconnect still report offline.

Evidence

  • Found through a real Gateway, two signed paired node hosts, and four simultaneous Linux Docker workers on a dedicated bridge network. Both stale-slot supervisor rejection and freshly published zero-slot inventory were exercised. On unchanged a482a50cda8850e9479d28a1ae29785a509841b2, fresh zero capacity produced The device runner is offline despite node.list confirming the node remained connected.
  • That baseline stress run also completed forced container death, network-disconnected worker cancellation and immediate replacement, unaffected peer completion, six waves of four successful turns, three node disconnect/reconnect cycles, local-session availability, and cleanup. It failed only its final diagnostic assertion; zero owned containers remained.
  • Focused regression: node scripts/run-vitest.mjs src/gateway/worker-environments/node-launch-adapter.test.ts failed two new cases before the repair (2 failed, 19 passed). With the repair, this file plus src/gateway/worker-environments/worker-turn-launcher-failure-recovery.test.ts passed all 31 tests.
  • Regression cases include full, offline, full-to-offline, offline-to-full, capacity becoming available, and cancellation while waiting. Existing status/cancel-at-capacity, supervisor admission, reconnect, and authority tests remain green.
  • Independent owner review and Codex autoreview completed without actionable findings.
  • Candidate QA-enabled build and the complete network stress passed: 37 real containers, peak concurrency four across two nodes, six four-turn burst waves, forced worker death, network-detached cancellation/replacement in 2.8 seconds, three reconnect cycles, and successful retries after both capacity rejections. Zero approval events and zero remaining containers.
  • Three consecutive Chromium/real-Gateway/Docker cycles passed remote-node selection, Full Access settings-before-send ordering, real in-container exec and workspace reconciliation, Stop with delayed cancellation followed by immediate replacement, and no late command side effects. Each cycle asserted zero approval events, zero pending approvals, and no approval UI. Screenshots were inspected. Docker events confirm all 49 candidate containers were created and removed; the dedicated network was removed after verifying it was empty.
  • Full changed-file gate passed, including core and core-test typechecks, type-aware lint, dead-code scans, and architectural guards. The paired-node lifecycle wire test also passed bundle loss/reinstall, moving sessions to the Gateway and back, disconnect/retry, capacity, and role removal; this companion uses real supervisor subprocess workers rather than Docker. Final exact-head adapter/placement-recovery rerun passed all 31 tests. The model endpoint is deterministic; this is real worker/network/process/browser proof, not authenticated live model inference.
  • Exact-head normal PR CI33018340964, attempt2 passed, including openclaw/ci-gate, on c65cdab10df2dc96f8efae79eb20582fc4359f28. This resolves the exact-head CI item below; no check was waived.

Provenance: the capacity-as-connectivity filter came from #124356 (dbad5e385d38, August 16), carried into exact slot inventory by #125708 (efaa867d934c, August 18). Both code author, PR author, and merger were @steipete. This repair preserves those intentional capacity gates and fixes their diagnostic classification.

Test setup note: the diagnostic helper initially waited for a receipt for a capacity-rejected launch, which correctly has no durable receipt. The probe was corrected to distinguish rejected launches from admitted workers before the complete baseline above. A redundant dirty-checkout bootstrap rebuild was interrupted; candidate repetitions use the repository's documented prebuilt-dist E2E mode after a complete QA-enabled build.

Build provenance: the local build began while the repair was uncommitted on the baseline, so its pinned build stamp and the ad-hoc report's baseline SHA retain a482a50cda8850e9479d28a1ae29785a509841b2. The candidate run contains the repaired adapter (confirmed in the emitted device-provider bundle); the subsequently committed production source is identical. Hosted CI validates the exact PR head separately. Ordinary PR CI was cancelled; the exact-head fallback run's lint runner received a shutdown signal (exit 143), not a lint diagnostic. Hosted validation is being recovered before landing.

ClawSweeper follow-through (reviewed head c65cdab10df2dc96f8efae79eb20582fc4359f28): no actionable correctness findings. Its two before-merge items are exact-head CI (still required) and the net-four-line production increase. The latter is accepted for the missing latest-observation fact at its existing owner, after consolidating duplicate expiry handling; removing the fact or moving classification downstream would recreate the bug. The generated stored-data-model warning does not apply: the complete two-file diff changes no schema, SQL, persistent shape, storage writer, or migration. The new observation is a launch-local variable, and the transport code is internal; no durable/protocol compatibility change is introduced. Final test LOC is +52/-6, correcting the review's older metric.

Named infrastructure follow-up: hosted full-repository lint runner shutdowns. Fallback run 33018353920 lost its 4-vCPU/16-GB hosted runners during oxlint:core; baseline-ratchets repeated the same shutdown on attempt 2, again exit 143 with no lint diagnostic. Its 20-minute job timeout had not elapsed. Normal PR CI run 33018340964, attempt 2, passed both lint and baseline-ratchets on the same source head. This PR changes no CI policy or lint execution settings; normal exact-head CI is being recovered rather than relaxing checks.

@clawsweeper

clawsweeper Bot commented Aug 26, 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 size: S maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 22:05
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 6:34 PM ET / 22:34 UTC.

ClawSweeper review

What this changes

The PR makes existing sessions on connected but full remote worker nodes report capacity exhaustion rather than an offline-device error.

Regression provenance

Possible regression — probable (reviewed change; reproduction). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open. Current main still filters a connected full node out of discovery and reports it offline; this PR moves that distinction into the launch adapter and covers the relevant transitions. The maintainer-labeled PR still needs human confirmation and a successful exact-head required-check run.

Priority: P2
Reviewed head: c65cdab10df2dc96f8efae79eb20582fc4359f28
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused owner-boundary fix and transition coverage are solid; exact-head required checks remain the merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body reports real Gateway and Docker evidence, which was not executed during this read-only review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body reports real Gateway and Docker evidence, which was not executed during this read-only review.
Evidence reviewed 8 items Current-main defect: Current main combines device identity and free-slot eligibility in one discovery predicate, so a connected node with zero available slots falls through to the not-connected error.
PR owner-boundary repair: The PR first resolves the connected node, then emits a retryable capacity observation only for launch admission and converts the final observation at availability-grace expiry.
Caller behavior: The worker-turn launcher treats capacity as a recoverable placement-preserving outcome, distinct from offline handling after handoff.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/gateway/worker-environments/node-launch-adapter.test.ts

Result: FAIL (partial) — step 2 expect_output node worker launch adapter: expected terminal output was not visible within 30 seconds: "node worker launch adapter"

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

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130445-ad90XR/target

 ✓  gateway-core  ../../src/gateway/worker-environments/node-launch-adapter.test.ts (21 tests) 190ms

 Test Files  1 passed (1)
      Tests  21 passed (21)
   Start at  22:35:22
   Duration  1.67s (transform 1.13s, setup 859ms, import 309ms, tests 190ms, environment 0ms)

[test] passed 1 Vitest shard in 6.76s
[test] starting test/vitest/vitest.gateway.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130445-ad90XR/target

 ✓  gateway-core  ../../src/gateway/worker-environments/node-launch-adapter.test.ts (21 tests) 155ms

 Test Files  1 passed (1)
      Tests  21 passed (21)
   Start at  22:35:29
   Duration  939ms (transform 365ms, setup 385ms, import 213ms, tests 155ms, environment 0ms)

[test] passed 1 Vitest shard in 5.99s

Assertions:

  • FAIL expect_output: node worker launch adapter

How this fits together

Gateway worker launches look up a connected remote node, verify that a worker slot is available, and invoke its supervisor. The adapter turns those availability observations into an operator-visible result while the downstream launcher preserves the session placement.

flowchart LR
  A[Existing remote session] --> B[Gateway launch adapter]
  B --> C[Connected node inventory]
  C --> D{Node connected?}
  D -->|No| E[Offline result]
  D -->|Yes| F{Free worker slot?}
  F -->|No| G[Capacity result]
  F -->|Yes| H[Supervisor launch]
Loading

Decision needed

Question Recommendation
Should a connected remote node that remains full through the availability grace return the existing capacity error for an existing session, rather than reconnect guidance? Confirm the capacity diagnostic: Accept the adapter-local distinction and merge after the exact-head required checks succeed.

Why: This maintainer-labeled PR changes the operator-visible diagnostic for a live worker-session path, and the supplied exact-head check state is not yet green.

Before merge

  • Resolve merge risk (P1) - Exact-head required checks are not yet successful in the supplied PR state; merge only after a fresh required run validates the current head.
  • Resolve merge risk (P1) - Production grows by four net lines; the added launch-local observation is justified only if it remains the single owner of availability-grace classification rather than creating downstream duplicate policy.
  • Complete next step (P2) - A protected maintainer item with incomplete exact-head validation needs human merge review; no narrow automated repair is identified.
Agent review details

Security

None.

PR surface

Source +4, Tests +46. Total +50 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 17 13 +4
Tests 1 52 6 +46
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 69 19 +50

Review metrics

Metric Value Why it matters
Production versus tests production +17/-13 (net +4); tests +52/-6 (net +46) The small production increase retains the latest availability observation at the launch owner; the larger test change covers state transitions and no-early-dispatch behavior.

Stored data model

Persistent data-model change detected: durable storage schema: src/gateway/worker-environments/node-launch-adapter.test.ts, durable storage schema: src/gateway/worker-environments/node-launch-adapter.ts, unknown-data-model-change: src/gateway/worker-environments/node-launch-adapter.test.ts, unknown-data-model-change: src/gateway/worker-environments/node-launch-adapter.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the connected-versus-full distinction in the launch adapter, retain the transition coverage, and land only after exact-head checks and maintainer confirmation of the operator-facing error contract.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the connected-versus-full distinction in the launch adapter, retain the transition coverage, and land only after exact-head checks and maintainer confirmation of the operator-facing error contract.

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

Yes, from source: current main filters a zero-slot connected node out of discovery and then emits the offline path. The read-only review did not execute the failing baseline test.

Is this the best way to solve the issue?

Yes. The adapter owns the discovery-and-availability grace, its caller already distinguishes capacity from offline outcomes, and current docs describe those as separate operator conditions.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This corrects a bounded remote-worker session diagnostic and retry outcome without changing configuration, storage, or protocol surfaces.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body reports real Gateway and Docker evidence, which was not executed during this read-only review.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame names Peter Steinberger on the affected predicate, and supplied related PR history attributes the preceding worker-capacity work to this account. (role: recent area contributor; confidence: medium; commits: 6f378774d5dd, dbad5e385d38, efaa867d934c; files: src/gateway/worker-environments/node-launch-adapter.ts, src/gateway/node-runner-inventory-runtime.ts)

Rank-up moves

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

  • Restore and pass the required exact-head CI run before merge.

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-26T22:11:21.375Z sha c65cdab :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 8237d3f into main Aug 26, 2026
646 of 770 checks passed
@steipete
steipete deleted the codex/remote-node-capacity-diagnostic branch August 26, 2026 22:57
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 26, 2026
* origin/main: (26 commits)
  fix(plugins): preserve registry epoch on activation rollback (#129232)
  refactor(plugins): make discovery invocation-owned (#130486)
  feat(ui): save appearance preferences per user profile (#130340)
  fix: Buzz bots recover relay stalls and reject revoked senders (#130467)
  fix(code-mode): serialize catalog handles nested in final values (#130276)
  fix(webchat): CLI skill and harness-injected turns render as operator-sent messages (#130427)
  fix(agents): read the published model catalog owner from session_status (#130277)
  fix(channels): preserve long presentation text (#130368)
  fix(agents): route CLI bootstrap truncation notice into the system prompt (#130325)
  refactor(plugins): unify setup registration and artifact selection (#130474)
  fix(memory): prevent forgotten session content from returning (#130451)
  refactor(outbound): consolidate transport completion (#130460)
  fix(workers): protect in-flight workspace manifests from concurrent retention (#130449)
  fix(portals): keep worker previews reachable and owned by the active environment (#130434)
  fix(config): keep core channels keys in the generated config schema (#120736)
  chore(deps): refresh dependencies after seven-day cooldown (#130296)
  fix(agents): remind exec models to quote shell metacharacters (#125485)
  fix(auth): honor shared-store ownership in temp-state exec and agent deletion (#130437)
  fix(openshell): preserve file writes during concurrent mirror commands (#130447)
  fix(workers): report full nodes as at capacity, not offline (#130445)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…#130445)

* fix(workers): distinguish full nodes from offline runners

* test(workers): follow conditional block style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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