Skip to content

feat(gateway): transfer node worker workspaces - #123280

Merged
steipete merged 4 commits into
mainfrom
steipete/node-workspace-transfer
Aug 14, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/node-workspace-transfer

Conversation

@steipete

@steipete steipete commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

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/v1 for 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

  • Focused transfer proof: 86 assertions across token/capability, HTTP service, node tunnel lifecycle, bounded pack production, native Git materialization, pooled TLS GET+POST reuse, wrong-pin refusal, interrupted-workspace recovery, TLS loading, and Windows CI routing.
  • Real-wire QA: test/e2e/qa-lab/runtime/node-worker-launch-wire.e2e.test.ts passes with dirty Gateway push, supervised paired-node turn, result upload, three-way apply, and accepted-manifest advance.
  • Private QA build: OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build passes, including the new lazy transfer HTTP/service module boundary.
  • Full changed gate: all format, package/SDK, dead-code, typecheck, lint, import-cycle, schema, database-first, webhook, and pairing guards pass. Crabbox first failed before checks because its raw-sync checkout had no Git metadata; the documented trusted-source local fallback then passed in full.
  • Structured autoreview: clean, no accepted/actionable findings; TruffleHog clean.
  • Exact-head hosted CI is green: https://github.com/openclaw/openclaw/actions/runs/31767461180. The first exact-head run caught and drove two final architecture repairs: a leaf HTTP contract removed a Madge cycle, then the unused route re-export was deleted for Knip.
  • Post-rebase focused suite passes on exact head ca70b58a809a72d6c15411d65cd0704af4a82a17.

Production LOC: +3030/-824 (net +2206; concrete workspace-transfer capability plus the existing server-http.ts owner split) | Tests: +1049/-143 | Docs/tooling support: +22/-20

@clawsweeper

clawsweeper Bot commented Aug 13, 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 gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Aug 13, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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 13, 2026
@clawsweeper

clawsweeper Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 13, 2026, 11:26 PM ET / August 14, 2026, 03:26 UTC.

ClawSweeper review

What this changes

This PR adds authenticated Gateway-to-node workspace transfer and reconciliation so paired workers can run dirty, unpublished, and plain-directory workspaces.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep 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
Reviewed head: 2a4f038916d552514a4e2ec0ad20fc4acd15e530
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The PR reports focused and real-wire validation, but independent source inspection was unavailable.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository state identifies this as a maintainer-owned PR; the external-contributor proof gate does not apply, although its claimed paired-node E2E should still be checked before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state identifies this as a maintainer-owned PR; the external-contributor proof gate does not apply, although its claimed paired-node E2E should still be checked before merge.
Evidence reviewed 3 items Inspection infrastructure failed: The required read-only checkout inspection could not start: the sandbox returned bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted for wc -l AGENTS.md. Consequently, current source, scoped policy, history, and the exact branch diff were not inspected.
Prior review context: The supplied prior ClawSweeper review identified live placement binding, cancellation, replay rejection, and cleanup semantics as the remaining source-review target; the author reports a post-rebase exact-head E2E, but that claim could not be independently checked.
Related landed owner boundary: The supplied related PR context says the merged paired-worker launch work deliberately left dirty/plain workspace transport to this follow-up.
Findings None None.
Security Needs attention Verify transfer capability closure: The PR describes bindings to session, placement, and owner epoch, but the environment failure prevented checking that all request, abort, replacement, and reconciliation paths revalidate those bindings.

How this fits together

The 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]
Loading

Decision needed

Question Recommendation
Should this protected, maintainer-owned PR wait for a fresh source-level review once checkout inspection is available? Wait for source review: Hold merge until a reviewer can inspect the exact head and validate transfer authority, cancellation, and reconciliation behavior.

Why: The failed inspection prevents a reliable security and correctness verdict on a large new authenticated workspace-transfer boundary.

Before merge

  • Resolve security concern: Verify transfer capability closure - The PR describes bindings to session, placement, and owner epoch, but the environment failure prevented checking that all request, abort, replacement, and reconciliation paths revalidate those bindings.
  • Resolve merge risk (P1) - The patch creates a bearer-authenticated transfer and workspace-result reconciliation path, but the environment failure prevented verification of live authority closure, replay handling, TLS pinning, and atomic recovery before merge.
  • Complete next step (P2) - This protected maintainer-owned PR needs a source-level exact-head review once repository inspection works; no bounded automated repair is established.

Findings

  • [medium] Verify transfer capability closure
Agent review details

Security

Needs attention: A source-level security pass is still required because the patch adds bearer-authenticated transfer and result-upload routes.

PR surface

Source +2209, Tests +906, Docs +3, Config 0, Other -1. Total +3117 across 42 files.

View PR surface stats
Area Files Added Removed Net
Source 25 3033 824 +2209
Tests 14 1049 143 +906
Docs 1 21 18 +3
Config 1 1 1 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 42 4104 987 +3117

Review metrics

Metric Value Why it matters
Production versus test delta production +2,202 net; tests +906 net The PR body reports substantial capability growth, making owner-boundary and real-wire verification important before merge.

Stored data model

Persistent data-model change detected: durable storage schema: src/gateway/worker-environments/node-worker-tunnel.test.ts, durable storage schema: src/gateway/worker-environments/node-worker-tunnel.ts, durable storage schema: src/gateway/worker-environments/node-worker-workspace-fallback.test.ts, durable storage schema: src/gateway/worker-environments/node-worker-workspace-fallback.ts, durable storage schema: src/gateway/worker-environments/node-workspace-transfer-http-contract.ts, durable storage schema: src/gateway/worker-environments/node-workspace-transfer-http.ts, and 26 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Complete boundary verification (recommended)
    Inspect the exact head and rerun or validate the reported paired-node transfer evidence before merge.
  2. Pause pending review access
    Keep this PR in maintainer review until a usable read-only checkout can establish the required source evidence.

Technical review

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

Labels

Label justifications:

  • P2: This is a substantial but bounded paired-worker capability whose effects are limited to device workspace execution.
  • merge-risk: 🚨 session-state: Worker-created changes are reconciled into the Gateway-owned workspace and session flow.
  • merge-risk: 🚨 security-boundary: The patch introduces bearer-authenticated HTTP transfer routes between the Gateway and paired nodes.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The repository state identifies this as a maintainer-owned PR; the external-contributor proof gate does not apply, although its claimed paired-node E2E should still be checked before merge.

Evidence

Security concerns:

  • [medium] Verify transfer capability closure
    The PR describes bindings to session, placement, and owner epoch, but the environment failure prevented checking that all request, abort, replacement, and reconciliation paths revalidate those bindings.
    Confidence: 0.92

What I checked:

  • Inspection infrastructure failed: The required read-only checkout inspection could not start: the sandbox returned bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted for wc -l AGENTS.md. Consequently, current source, scoped policy, history, and the exact branch diff were not inspected.
  • Prior review context: The supplied prior ClawSweeper review identified live placement binding, cancellation, replay rejection, and cleanup semantics as the remaining source-review target; the author reports a post-rebase exact-head E2E, but that claim could not be independently checked. (test/e2e/qa-lab/runtime/node-worker-launch-wire.e2e.test.ts, 2a4f038916d5)
  • Related landed owner boundary: The supplied related PR context says the merged paired-worker launch work deliberately left dirty/plain workspace transport to this follow-up. (src/gateway/worker-environments/node-worker-tunnel.ts, 438d0358857b)

Likely related people:

  • steipete: Authored the current transfer commits and the merged paired-worker launch work that this PR extends. (role: recent area contributor; confidence: high; commits: ffbf81673136, 94a4c4387da3, 2a4f038916d5; files: src/gateway/worker-environments/node-worker-tunnel.ts, src/gateway/worker-environments/node-workspace-transfer-service.ts, src/node-host/node-worker-transfer-client.ts)

Rank-up moves

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

  • Run a fresh exact-head source review when checkout access is restored.
  • Confirm the reported paired-node E2E or capture a redacted transfer trace.

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-13T21:11:55.146Z sha 74bc784 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-14T03:13:08.207Z sha 94a4c43 :: needs maintainer review before merge. :: none

@steipete steipete self-assigned this Aug 14, 2026
@steipete
steipete force-pushed the steipete/node-workspace-transfer branch from 74bc784 to 2ff7502 Compare August 14, 2026 02:43
@openclaw-barnacle openclaw-barnacle Bot removed the docs Improvements or additions to documentation label Aug 14, 2026
@steipete
steipete marked this pull request as ready for review August 14, 2026 02:44
@steipete
steipete requested a review from a team as a code owner August 14, 2026 02:44
@steipete
steipete force-pushed the steipete/node-workspace-transfer branch from 2ff7502 to d5aed86 Compare August 14, 2026 02:54
@steipete

steipete commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor Author

ClawSweeper follow-up for exact head ca70b58a809a72d6c15411d65cd0704af4a82a17:

  • Rebased after feat(gateway): launch workers on paired nodes #123157 landed and refit onto the final merged owner layout. node-worker-tunnel.ts retains durable binding recovery and pending-start cancellation; authenticated transfer replaces the old workspace-transport-pending boundary. The remaining fallback is only the optional clean, credential-free, published HTTP(S) clone fast path.
  • Exact-head proof is green: hosted CI https://github.com/openclaw/openclaw/actions/runs/31767461180, 86 focused assertions, the complete changed-surface gate, private-QA build, and the real paired-node E2E. The E2E covers dirty Gateway push, nested tracked content, supervised worker execution, result upload, three-way apply, and accepted-manifest advancement.
  • The first hosted run caught two final static-contract issues. The HTTP route/callback types now live in a leaf contract module, eliminating the Madge cycle, and the unused route re-export was removed for Knip.
  • Crabbox first failed before repository checks because its raw-sync checkout had no Git metadata. The documented trusted-source local fallback then passed every format, package/SDK, dead-code, typecheck, lint, import-cycle, schema, database-first, webhook, and pairing guard.
  • Structured autoreview and TruffleHog are clean on the exact branch diff.

Security review disposition:

  • Transfer bearers are random process-local capabilities, immediately registered for exact-value redaction. Persisted worker credential hashes remain verifier material only and are never bearer-signing keys.
  • Each capability is bound to the exact environment, owner epoch, session, placement generation, direction, and manifest/base reference. Download requests remain valid only inside that live context. Upload admission claims the token before reading the body, permits one in-flight operation, and rejects replay.
  • Active HTTP streams share the tunnel/context abort signal and client-disconnect signal. Replacement, disconnect, credential/owner invalidation, or explicit context close prevents settlement; copied bearer text is insufficient authority.
  • Request, manifest, inventory, pack, reconciliation-entry, total-byte, and response bounds are enforced. Streamed files are size- and SHA-256-verified, and pack production is capped while writing.
  • TLS fingerprint validation runs for both new and pooled HTTPS sockets, including upload-body requests. Wrong pins fail before another request reaches the server.
  • Git materialization uses direct argv-safe Git commands rather than sh, explicitly selects SHA-1/SHA-256 object format, handles gitlinks, and is included in native Windows CI.
  • Gateway and node staging use owned cleanup namespaces. Interrupted promotion restores one unambiguous backup; ambiguous recovery fails visibly; rollback errors retain the recovery path; post-commit backup cleanup cannot turn a successful promotion into a failed transfer.

This applies the latest review's rank-up moves. The paired-node E2E is confirmed. ClawSweeper's source checkout remained unavailable because of its bwrap loopback failure, so the equivalent source-level requirement was satisfied by the full local changed gate plus clean structured source autoreview; the only later commit removes an unused type re-export and was separately cycle-, dead-code-, test-, lint-, CI-, and autoreview-clean. A new ClawSweeper request is intentionally skipped because the review is under 12 hours old, every actionable item is addressed, exact-head CI is green, and the post-review change is mechanical. No protocol/schema version, SQLite surface, configuration key, environment variable, or compatibility fallback was added.

@steipete
steipete force-pushed the steipete/node-workspace-transfer branch from d5aed86 to 94a4c43 Compare August 14, 2026 03:08
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Aug 14, 2026
@steipete
steipete merged commit 860aeed into main Aug 14, 2026
171 checks passed
@steipete
steipete deleted the steipete/node-workspace-transfer branch August 14, 2026 04:00
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 14, 2026
* feat(gateway): transfer node worker workspaces

* fix(gateway): harden node workspace transfer

* fix(gateway): isolate transfer HTTP contract

* fix(gateway): trim transfer HTTP exports
@eleqtrizit eleqtrizit assigned eleqtrizit and unassigned steipete Sep 13, 2026
steipete added a commit that referenced this pull request Oct 14, 2026
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.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

2 participants