Repository navigation
fix(gateway): keep cloud-managed nodes out of device placement - #128780
Conversation
Keep durable cloud node bindings out of ordinary device placement until enrollment retirement is proven, and fail closed when worker ownership inventory cannot be read.\n\nRefs #128769
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 11:33 AM ET / 15:33 UTC. ClawSweeper reviewWhat this changesThis PR keeps cloud-worker-bound nodes out of ordinary paired-device discovery until enrollment retirement is proven, and returns an unavailable response if worker inventory cannot be read. Merge readinessKeep open. Source review found no blocking defect: this is a direct ownership-boundary repair, but the maintainer-authored draft is behind main and needs exact-head validation before landing. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherGateway environment discovery merges paired-device data, connected-node data, and worker inventory before environment listing and automatic session placement. The worker record’s durable node binding determines whether a node remains cloud-managed or can be offered as an ordinary device. flowchart LR
A[Worker inventory] --> C[Ownership classification]
B[Paired devices and connected nodes] --> C
C --> D[Environment listing]
C --> E[Automatic session placement]
C --> F[Unavailable response on read failure]
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +167. Total +167 across 3 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the single worker-inventory snapshot as the canonical ownership fact, then land after an exact-head rebase validates both environment discovery and automatic placement. Do we have a high-confidence way to reproduce the issue? Yes—current-main source establishes the faulty filtering and empty-on-error path, and the added owner-boundary scenarios express a focused reproduction; no live Gateway run was performed in this read-only review. Is this the best way to solve the issue? Yes. The worker environment owns the durable binding, and gathering that fact once before all node projections is safer than downstream placement-specific exclusions. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 61bc753da306. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready proof for exact head
ClawSweeper reported no code findings. Its optional rank-up move requested another rebase and exact-head rerun because main advanced. I am skipping the extra rebase: repository policy treats behind-main drift as advisory when there is no conflict, this head already has exact-head CI and hosted prepare proof, and native Proof gap: forced worker-store read failure is covered at the shipped handler/automatic-dispatch owner rather than by replacing the store in a live Gateway. Normal node/cloud discovery remains in the campaign's final current-main live matrix. |
|
Merged via squash.
|
Keep durable cloud node bindings out of ordinary device placement until enrollment retirement is proven, and fail closed when worker ownership inventory cannot be read.\n\nRefs openclaw#128769
Closes #128769
What Problem This Solves
Fixes an issue where cloud-managed node hosts could reappear as ordinary paired-device destinations when their worker owner became orphaned, failed while retaining a durable node binding, or could not be read from the worker store.
Why This Change Was Made
Environment discovery now gathers one worker inventory snapshot and uses that exact snapshot for both node ownership classification and worker projection. A non-device worker that still retains
nodeDeviceIdremains the infrastructure owner unless its state isdestroyed, which is the lifecycle point after enrollment retirement succeeds. Canonical failed teardown already clears the binding; failed rows that still retain it remain fenced.Worker inventory read failures now fail the environment request closed with a generic redacted unavailable result instead of silently treating every cloud node as an ordinary device. Device-provider workers remain ordinary paired devices by design.
Production LOC: +7/-7 (net 0) | Tests: +252/-85 (net +167)
AI-assisted: yes. I reviewed worker enrollment retirement, provider teardown terminal states, worker inventory projection, node catalog construction, automatic device selection, status/list error handling, and the duplicate inventory-read path and understand the change.
User Impact
Operators no longer see or automatically select infrastructure-owned cloud nodes through the ordinary paired-device path while ownership is unresolved. If the ownership store cannot be read, discovery returns a visible redacted failure instead of a misleading partial inventory.
Evidence
nodeDeviceIdwere treated as released; worker inventory failures returned a successful partial gateway/node inventory;environments.listread worker ownership twice.node scripts/check-changed.mjspassed after rebase, including core/test typechecking, lint, formatting, import-cycle, pairing, database-first, and architecture guards.UNAVAILABLE, underlying store details stay redacted, and worker-specific status failures retain their existing redacted response.listGatewayEnvironmentsowner; the campaign's final current-main live matrix will cover normal node/cloud discovery.