Repository navigation
feat(gateway): transfer node worker workspaces - #123280
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 11:26 PM ET / August 14, 2026, 03:26 UTC. ClawSweeper reviewWhat this changesThis PR adds authenticated Gateway-to-node workspace transfer and reconciliation so paired workers can run dirty, unpublished, and plain-directory workspaces. Merge readinessKeep open for maintainer review. The read-only inspection environment failed before any repository command could run, so this review cannot verify the large transfer, reconciliation, or bearer-authority implementation. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway snapshots an operator workspace for a paired node, whose private supervisor materializes it and runs the worker. Changed files return through an authenticated upload for Gateway-owned three-way reconciliation. flowchart LR
A[Gateway workspace] --> B[Snapshot and transfer authority]
B --> C[Authenticated HTTPS transfer]
C --> D[Paired node workspace]
D --> E[Worker execution]
E --> F[Result upload]
F --> G[Gateway reconciliation]
Decision needed
Why: The failed inspection prevents a reliable security and correctness verdict on a large new authenticated workspace-transfer boundary. Before merge
Findings
Agent review detailsSecurityNeeds attention: A source-level security pass is still required because the patch adds bearer-authenticated transfer and result-upload routes. PR surfaceSource +2209, Tests +906, Docs +3, Config 0, Other -1. Total +3117 across 42 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Restore read-only repository access, then complete an exact-head review of transfer capability binding, node-side promotion/recovery, and Gateway result reconciliation before merging. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug report. The PR describes a paired-node E2E, but the checkout failure prevented independently confirming its exact-head path. Is this the best way to solve the issue? Unclear. The proposed owner split may be appropriate, but source inspection is required to compare it with the existing worker lifecycle and to verify the authority boundary. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against f3db7fe51158. LabelsLabel justifications:
EvidenceSecurity concerns:
What 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
History |
74bc784 to
2ff7502
Compare
2ff7502 to
d5aed86
Compare
|
ClawSweeper follow-up for exact head
Security review disposition:
This applies the latest review's rank-up moves. The paired-node E2E is confirmed. ClawSweeper's source checkout remained unavailable because of its |
d5aed86 to
94a4c43
Compare
|
Merged via squash.
|
* feat(gateway): transfer node worker workspaces * fix(gateway): harden node workspace transfer * fix(gateway): isolate transfer HTTP contract * fix(gateway): trim transfer HTTP exports
The launch-wire E2E approached its unchanged 240-second deadline. A
phase-timed baseline passed in 180.795 seconds; its initial workspace
transfer spent 28.661 seconds fetching identical blob content once per
path for all 4,096 inventory files. This is redundant work at the transfer owner.
Remember successfully validated downloads by digest and length within
one private staging tree. Copy those bytes into independent files with
each destination's mode, size bound, containment, and cancellation.
Keep final manifest verification. No persistent cache or hardlinks.
The regression test failed before the fix (three requests, expected one)
and now proves one request, correct contents/modes, and independent files.
Temporary E2E diagnostics were removed; assertions and budgets are unchanged.
Phase timings in seconds (before / after, instrumented runs):
Fixture publication 0.3 / 0.2
Gateway startup 19.6 / 10.6
Operator/node pairing 2.8 / 2.9
Main workspace creation 3.1 / 2.9
Main dispatch 46.5 / 19.2
Bundle install, included 8.7 / 5.8
Workspace download, included 28.7 / 7.4
Main run proof 5.4 / 4.6
Worker launch, included 1.1 / 0.8
Main settlement/reconcile 3.9 / 5.9
Main audit and verification 0.8 / 0.8
Permission run proof 3.8 / 4.3
Permission settlement/reconcile 3.7 / 5.8
Legacy pairing 1.0 / 0.8
Legacy dispatch 6.4 / 6.5
Unsupported run proof 0.4 / 0.4
Legacy reconnect/supported run 2.2 / 2.3
Twelve load workspace creations 11.8 / 12.8
Twelve load dispatches 17.6 / 15.4
Three load waves incl. settlement 22.1 / 19.4
Settlement, included 2.1 / 1.9
Gateway restart 14.8 / 14.5
Restart audit 1.5 / 1.2
Fixture cleanup 12.0 / 3.8
Total test 180.8 / 135.1
A second run without diagnostics passed in 128.332 seconds. Attribute the
21.250-second download reduction directly to this fix; unrelated startup
and cleanup also varied. The well-under-120-second target remains unmet.
Repeated serialized bundle validation still costs about 15 seconds in
load dispatch. Sharing that operation needs a separately scoped installer
change preserving per-caller authority and cancellation. Unsupported
requests already fail fast; worktree timestamp guards remain intact.
No commit is established as the cause of the October 13 timeout. Per-path
fetching originated in 860aeed
(feat(gateway): transfer node worker workspaces (#123280)); the inventory
proof was added by f9dc685
(improve: keep large workspace transfers responsive (#147626)).
Proof commands (all test commands set
OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/Users/steipete/.cache/openclaw-redmain-qa-cache
and OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1):
- pnpm test test/e2e/qa-lab/runtime/node-worker-launch-wire.e2e.test.ts --maxWorkers=1
Before: 1 passed, 180795ms. After: 1 passed, 135118ms and 128332ms.
- pnpm test src/node-host/node-worker-transfer-client.git.test.ts --maxWorkers=1 -t 'downloads repeated blob'
Before: failed, expected 3 to be 1.
- pnpm test src/node-host/node-worker-transfer-client.git.test.ts src/node-host/node-worker-transfer-client.test.ts src/node-host/node-worker-transfer-client.encoding.test.ts --maxWorkers=1
3 files passed; 28 passed, 2 existing platform skips.
- pnpm test src/node-host/node-worker-transfer-client.git.test.ts --maxWorkers=1
Final cleanup callback: 1 file passed; 8 passed, 1 existing platform skip.
- pnpm format:check src/node-host/node-worker-transfer-client.ts src/node-host/node-worker-transfer-client.git.test.ts
All matched files use the correct format.
- node scripts/check-changed.mjs --base HEAD -- src/node-host/node-worker-transfer-client.ts src/node-host/node-worker-transfer-client.git.test.ts
Expanded into broad ratchets; reported inherited OPENCLAW variable count
455 > budget 454, then stopped. This patch adds no environment variables.
- pnpm lint --files-json '["src/node-host/node-worker-transfer-client.ts","src/node-host/node-worker-transfer-client.git.test.ts"]'
Authorized fallback: core shard passed; exit 0.
- Fresh Codex autoreview: scoped-clean, no actionable P0-P2 findings.
- git diff --check: passed.
The launch-wire E2E approached its unchanged 240-second deadline. A
phase-timed baseline passed in 180.795 seconds; its initial workspace
transfer spent 28.661 seconds fetching identical blob content once per
path for all 4,096 inventory files. This is redundant work at the transfer owner.
Remember successfully validated downloads by digest and length within
one private staging tree. Copy those bytes into independent files with
each destination's mode, size bound, containment, and cancellation.
Keep final manifest verification. No persistent cache or hardlinks.
The regression test failed before the fix (three requests, expected one)
and now proves one request, correct contents/modes, and independent files.
Temporary E2E diagnostics were removed; assertions and budgets are unchanged.
Phase timings in seconds (before / after, instrumented runs):
Fixture publication 0.3 / 0.2
Gateway startup 19.6 / 10.6
Operator/node pairing 2.8 / 2.9
Main workspace creation 3.1 / 2.9
Main dispatch 46.5 / 19.2
Bundle install, included 8.7 / 5.8
Workspace download, included 28.7 / 7.4
Main run proof 5.4 / 4.6
Worker launch, included 1.1 / 0.8
Main settlement/reconcile 3.9 / 5.9
Main audit and verification 0.8 / 0.8
Permission run proof 3.8 / 4.3
Permission settlement/reconcile 3.7 / 5.8
Legacy pairing 1.0 / 0.8
Legacy dispatch 6.4 / 6.5
Unsupported run proof 0.4 / 0.4
Legacy reconnect/supported run 2.2 / 2.3
Twelve load workspace creations 11.8 / 12.8
Twelve load dispatches 17.6 / 15.4
Three load waves incl. settlement 22.1 / 19.4
Settlement, included 2.1 / 1.9
Gateway restart 14.8 / 14.5
Restart audit 1.5 / 1.2
Fixture cleanup 12.0 / 3.8
Total test 180.8 / 135.1
A second run without diagnostics passed in 128.332 seconds. Attribute the
21.250-second download reduction directly to this fix; unrelated startup
and cleanup also varied. The well-under-120-second target remains unmet.
Repeated serialized bundle validation still costs about 15 seconds in
load dispatch. Sharing that operation needs a separately scoped installer
change preserving per-caller authority and cancellation. Unsupported
requests already fail fast; worktree timestamp guards remain intact.
No commit is established as the cause of the October 13 timeout. Per-path
fetching originated in 27c8c0e
(feat(gateway): transfer node worker workspaces (openclaw#123280)); the inventory
proof was added by 3bb5851
(improve: keep large workspace transfers responsive (openclaw#147626)).
Proof commands (all test commands set
OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/Users/steipete/.cache/openclaw-redmain-qa-cache
and OPENCLAW_NODE_TEST_PLAN_CONTINUE_ON_FAILURE=1):
- pnpm test test/e2e/qa-lab/runtime/node-worker-launch-wire.e2e.test.ts --maxWorkers=1
Before: 1 passed, 180795ms. After: 1 passed, 135118ms and 128332ms.
- pnpm test src/node-host/node-worker-transfer-client.git.test.ts --maxWorkers=1 -t 'downloads repeated blob'
Before: failed, expected 3 to be 1.
- pnpm test src/node-host/node-worker-transfer-client.git.test.ts src/node-host/node-worker-transfer-client.test.ts src/node-host/node-worker-transfer-client.encoding.test.ts --maxWorkers=1
3 files passed; 28 passed, 2 existing platform skips.
- pnpm test src/node-host/node-worker-transfer-client.git.test.ts --maxWorkers=1
Final cleanup callback: 1 file passed; 8 passed, 1 existing platform skip.
- pnpm format:check src/node-host/node-worker-transfer-client.ts src/node-host/node-worker-transfer-client.git.test.ts
All matched files use the correct format.
- node scripts/check-changed.mjs --base HEAD -- src/node-host/node-worker-transfer-client.ts src/node-host/node-worker-transfer-client.git.test.ts
Expanded into broad ratchets; reported inherited OPENCLAW variable count
455 > budget 454, then stopped. This patch adds no environment variables.
- pnpm lint --files-json '["src/node-host/node-worker-transfer-client.ts","src/node-host/node-worker-transfer-client.git.test.ts"]'
Authorized fallback: core shard passed; exit 0.
- Fresh Codex autoreview: scoped-clean, no actionable P0-P2 findings.
- git diff --check: passed.
What Problem This Solves
Completes milestone 6-C workspace transfer for local-install device runners. The landed launch path could start a worker from a clean published HTTP(S) origin, but dirty, unpublished, credentialed-origin, plain-directory, submodule, and Git LFS workspaces stopped at
workspace-transport-pending; changed device results could not reconcile back to the Gateway workspace.Why This Change Was Made
Adds a reserved HTTPS transfer family under
/__openclaw__/worker-transfer/v1for manifest, pack, and blob downloads plus one reconciliation upload. The Gateway owns the authoritative workspace snapshot and three-way apply. The node owns bounded download, integrity verification, atomic promotion, and result upload.Transfer bearers are now random process-local capabilities, registered for exact-value redaction and stored only inside the live transfer context. Each capability is bound to the exact environment, owner epoch, session, placement generation, direction, and manifest/base reference. Download streams share the tunnel/context abort signal; upload admission claims its token before reading the body, permits one in-flight operation, and rejects replay. Persisted worker credential hashes are used only for credential verification and never as bearer-signing material.
The node constructs the HTTP(S) origin from its existing Gateway connection and revalidates the configured TLS fingerprint on both new and pooled sockets. Git workspaces are materialized with direct argv-safe Git commands instead of
sh, including explicit SHA-1/SHA-256 repository initialization and gitlink handling on native Windows. Gateway and node staging live in owned, sweepable namespaces; interrupted directory promotion restores the one unambiguous prior workspace, reports rollback failure with its recovery path, and treats post-commit backup cleanup as deferred maintenance rather than a failed transfer.Clean published origins remain an optional clone fast path. Unsupported clone shapes use the canonical HTTPS carrier. Reconciliation reuses the existing quiescence watchdog, delta caps, keep-local three-way apply, durable result journal, and final remote/local stability fences.
No protocol/schema version, SQLite surface, configuration key, environment variable, or bundle-update behavior was added.
User Impact
Operators can run sessions on paired devices from managed Git worktrees with dirty or unpublished changes and from plain directories. Device-created files and edits return through the same conflict-preserving reconciliation model as existing workers. A sleeping/replaced runner or disconnected client closes active transfer authority instead of allowing a copied bearer to continue.
Evidence
test/e2e/qa-lab/runtime/node-worker-launch-wire.e2e.test.tspasses with dirty Gateway push, supervised paired-node turn, result upload, three-way apply, and accepted-manifest advance.OPENCLAW_BUILD_PRIVATE_QA=1 pnpm buildpasses, including the new lazy transfer HTTP/service module boundary.ca70b58a809a72d6c15411d65cd0704af4a82a17.Production LOC: +3030/-824 (net +2206; concrete workspace-transfer capability plus the existing
server-http.tsowner split) | Tests: +1049/-143 | Docs/tooling support: +22/-20