Repository navigation
fix(gateway): reconcile root node workspaces and surface failures - #166441
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 7, 2026, 12:25 AM ET / 04:25 UTC (Revision 3). ClawSweeper reviewWhat this changesThe PR allows root-owned Linux workspaces to reconcile through the native helper and surfaces bounded, redacted workspace errors in Gateway responses and node logs. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main still rejects root-owned native workspace reconciliation and suppresses useful failure details. No introduced blocking defect was found; the earlier review contains no findings to carry forward. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway reconciles completed worker files back into the session workspace through a paired node host. The node’s quiescence helper protects that reconciliation, while command failures return through the Gateway tunnel. flowchart TD
A[Completed worker turn] --> B[Gateway reconciliation]
B --> C[Node workspace command]
C --> D[Owned or detached helper]
D --> E[Workspace lease and manifest fences]
E --> F[Reconciled workspace]
C --> G[Redacted errors and node warnings]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +23, Tests +176, Docs +3. Total +202 across 8 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep root support confined to the existing owned shared-host helper and preserve actionable diagnostics through the canonical redaction owner. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main rejects UID 0 during native helper acquisition before reconciliation proceeds. The supplied regressions establish that mechanism, but this review did not execute it or reproduce the full RunPod incident. Is this the best way to solve the issue? Yes. The patch narrows the existing root guard to the process-signaling detached path and reuses the established diagnostic formatter without adding another lifecycle owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 25affa738b0e. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
What Problem This Solves
A RunPod worker running as UID 0 could complete its turn and then fail workspace reconciliation with only
node workspace command failed (UNAVAILABLE). The node discarded the underlying exception, and the Gateway discarded most node error messages.A deterministic cause is present in the reported live build
7880834c: reconciliation acquires quiescence (src/gateway/worker-environments/workspace-result-finalize.ts:215), the node starts an owned/shared-host helper (src/node-host/node-worker-workspace-quiescence.ts:227), and the helper rejected UID 0 before reaching its no-freeze path (src/gateway/worker-environments/workspace-quiescence-scripts.ts:418). Its stderr becomes a thrown error atsrc/node-host/node-worker-workspace-quiescence.ts:311, which maps toUNAVAILABLE.User Impact
Native Linux node hosts can reconcile root-owned container sessions. Unexpected workspace failures now retain their error code and a redacted detail bounded to 500 characters at the Gateway, with bounded warnings in the node-host log. Typed transfer errors keep their classification. Operators must update the node host as well as the Gateway; updating only the portable worker bundle does not replace this helper.
No live RunPod rerun was performed. The regression proves a root-only defect sufficient to explain the reported failure; another host-specific failure could still appear after this one is removed.
Why This Change Was Made
Allow root only for the native owned helper. That mode already requires shared-host operation, empty process scopes, exact watchdog identity, and fenced renewal/release. It never sweeps or signals other root processes. Detached helpers still reject root, including detached shared-host helpers whose orphan recovery can signal recorded PIDs.
Reuse
boundedWorkerError/boundedWorkerErrorWithCodeand their existingredactSensitiveTextowner before truncation. The #123280 commit and tests preserve generic errors for unrelated supervisor operations; that protection remains unchanged. Workspace operations now carry sanitized diagnostics instead of generic supervisor text.The other RunPod differences do not explain the unconditional UID check: workspace operations do not invoke
sudo; command HOME is the prepared home or session root (src/node-host/node-worker-workspace.ts:574); managed identity checks validate paths and bindings rather than banning UID 0 (src/node-host/node-worker-workspace-identity.ts:160); Git initializes the repository as the current user (src/node-host/node-worker-workspace-git.ts:34). Later foreign ownership, disk exhaustion, or unavailablepscould independently fail, but the old root guard fires before Git export or process inspection.Evidence
UNAVAILABLE/TIMEOUTdetail, generic node workspace errors, and unredactedINVALID_REQUEST/transfer messages. Both detached-root denial cases passed before and after the fix.pnpm test src/gateway/worker-environments/node-worker-tunnel.test.ts src/node-host/invoke-worker-supervisor.test.ts src/node-host/node-worker-workspace-quiescence.test.ts --maxWorkers=1: 79 tests passed; 294.36 seconds wall time, including 130.60 seconds rebuilding subprocess fixtures. Reported test time by file: tunnel 25.229 s, supervisor 2.262 s, quiescence 0.790 s. The tunnel file's existing Git and 640-file inventory cases dominate its cost; the five new diagnostic cases total 0.101 s.git diff --check, core production types, and all 27 core/test type graphs pass. Independent Codex review is clean at P0/P1 against pinned merge base27ba9720f2c5; the sharedorigin/mainref advanced during work, so the initial literal-ref review included unrelated reverse diffs and was repeated against the correct scope. Two test-only shadowed variable names were corrected by mechanical renaming after review.pnpm check:changedstopped at the full-tree Knip scan: seven unused exports in unchangedsrc/agents/auth-profiles.runtime.ts(getSoonestCooldownExpiry,isProfileInCooldown,loadAuthProfileStoreForRuntime,maybeReprobeWhamBlockedProfiles,resolveAuthProfileEligibility,resolveAuthProfileOrder,resolveProfilesUnavailableReason). Production and script export scans passed. An isolated clean checkout of base27ba9720f2c5reproduced exactly the same seven findings (395.39 s wall), confirming this failure is inherited. Touched-file lint, native state-schema, database-first, media-helper, sidecar-loader, import-cycle, webhook, pairing-store, and account-scope guards pass (run separately after the aggregate gate stopped). No scanner exception was added.openclaw/ci-gatepassed fordfcf5a6a5ab68d4fbc759b5542fc952fd5673bc5. The requested 40-minute watcher exited GREEN, with zero pending and 13 verified superseded checks; GitHub's raw rollup still includes those superseded failures.checks-node-changed-compact-large-19job (192 s job wall). CI's job execution window was 427 s, with 1,464 aggregate job-seconds across nine changed Node test jobs.All
UNAVAILABLEentry points on this private route were audited: missing runtime and unclassified thrown workspace errors (src/node-host/node-worker-supervisor-commands.ts:276,:293); update pause, disconnect cleanup failure, and unadvertised command (src/node-host/runtime.ts:413,:426,:441); unexpected outer dispatch failure (src/node-host/invoke.ts:294); pairing-state or event-send failure (src/gateway/node-registry-private.ts:207,:328); not-ready after progress (src/gateway/node-registry.invoke-stream.ts:137); and missing-code fallback (src/gateway/worker-environments/node-worker-tunnel.ts:272). The generic workspace catch covers database/filesystem/abort, seed, inspection/reset, quiescence, manifest, and process spawn/cleanup errors. Ordinary nonzero child exits remain successful transport replies carrying command results; transfer failures use their dedicated error code.The retain-publication warning is separate:
node invoke authority closed before settlementusesAPPROVAL_AUTHORITY_CLOSED(src/gateway/node-registry.invoke-stream.ts:310), notUNAVAILABLE.