Repository navigation
fix: node workspace transfers fail after successful turns - #123564
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 4:47 AM ET / 08:47 UTC. ClawSweeper reviewWhat this changesThis PR makes node workspace transfers cache an already-validated TLS socket pin, clean backpressure listeners, preserve transfer failures through the node/Gateway path, and log the selected sync path. Merge readinessKeep this active maintainer PR open for normal exact-head CI and merge review. Current main still directly re-reads the peer certificate on reused sockets; the branch’s exact-socket cache and boundary tests address that failure without a supported regression finding. Priority: P1 Review scores
Verification
How this fits togetherA node-hosted worker transfers workspace state through the Gateway before and after a turn. The transfer client validates Gateway TLS and streams files, while the node supervisor and Gateway tunnel carry the result into final worker reconciliation. flowchart LR
A[Node-hosted worker] --> B[Workspace transfer client]
B --> C[TLS socket validation]
B --> D[Stream backpressure waits]
C --> E[Node supervisor]
D --> E
E --> F[Gateway workspace tunnel]
F --> G[Final worker reconciliation]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +129, Tests +320. Total +449 across 9 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep validation at the transfer client's TLS socket boundary, carry the closed transfer failure across the private RPC boundary, and retain the structured sync-path record; no net-neutral alternative preserves all three contracts. Do we have a high-confidence way to reproduce the issue? Yes—source reproducible. The new pooled-HTTPS regression hides the peer-certificate accessor after the first request frees its socket; current main would then reject the reused request, while the proposed cache preserves the prior verified pin. Is this the best way to solve the issue? Yes. Caching only a successfully normalized pin on the exact TLS socket fixes the Node certificate-lifetime behavior without weakening validation; re-reading an unavailable accessor fails, and bypassing the pin check would be unsafe. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0bd50cc0a5ba. 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 disposition: the only |
|
Merged via squash.
|
…23564) * fix(node-host): preserve TLS transfer failures * fix(node-host): clean transfer backpressure listeners * fix(gateway): explain node workspace sync paths
What Problem This Solves
Fixes an issue where node-hosted turns could be reported as failed after their tools and transcript had already completed when HTTPS workspace reconciliation reused a validated TLS socket whose peer-certificate accessor no longer returned a fingerprint. Retrying that false failure could repeat already-applied side effects.
The same stress campaign found cumulative stream listeners during large transfers and no operator-visible explanation when the published-origin fast path fell back to the much slower Gateway push.
Evidence source: the 2026-08-14 node-host STRESS TEST at exact revision
252bb545b47ab3c3d5bbf09a20f52728f174b3cd, captured in/tmp/openclaw-node-host-stress-evidence-20260814/REPORT.md. It reproduced the TLS failure three times, observed 33MaxListenersExceededWarningdiagnostics per node, and measured silent Gateway-push fallbacks at 133–157 seconds.Why This Change Was Made
TLS pins are now validated once per underlying socket: a pooled socket reuses its recorded normalized fingerprint, while every new socket must still present a nonempty matching fingerprint. A typed private
WORKSPACE_TRANSFER_FAILEDerror preserves the safe concrete mismatch through node invoke, the Gateway tunnel, and the launcher.Backpressure waits now use Node's paired event primitive, which removes the losing
errorordrainlistener. The same cleanup covers response and final-write waits. Origin selection now returns a closed fallback reason; the Gateway records the chosenoriginorgateway-pushpath at info level, while the node records total, pack-download, and blob-apply timings at debug level. No config key, SQLite surface, public protocol version, or metrics framework was added.AI-assisted: yes. The implementation and tests were reviewed with the repository autoreview workflow, and I verified the owner boundaries and Node runtime contracts directly.
User Impact
Operators can trust that a successfully completed node-hosted turn will not be turned into a false TLS-pin failure merely because its HTTP request reused an already-validated socket. Large workspace transfers no longer accumulate backpressure listeners, and logs now explain why an origin clone was skipped and where transfer time was spent.
Evidence
OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 ... node scripts/check-changed.mjs --timedpassed every selected core/core-test formatting, typecheck, lint, dead-code, import-cycle, database-first, and guard lane.run_b0b846f0286c(provider=daytona, leasecbx_17d638ef5eed) failed before checks because raw sync omitted Git metadata; the lease was released and the documented trusted-source local fallback passed.pnpm buildpassed, including all nine unified build invocations, runtime postbuild checks, public Plugin SDK export verification, and Control UI build.pnpm protocol:genreproduceddist/protocol.schema.jsonwith no generated diff.oxfmt --check;git diff --checkis clean.Production LOC: +210/-81 (net +129: typed cross-RPC diagnostic boundary plus sync-path/stage observability; the listener repair itself is net-negative) | Tests: +329/-9