Repository navigation
perf(workers): speed up remote workspace captures with many files - #144017
Conversation
Hash up to four eligible workspace files concurrently while preserving the opened-byte budget, growth checks, deterministic manifests, and memo format. Stop admitting work on the first failure, abort active readers, and join pending opens and handle cleanup before returning the original error. This extracts a small independent piece from #134931. Local many-file capture benchmarks saved 77-105 ms on the 2,048-file fixture; large-file capture was unchanged. Seventeen focused cases, the full changed-file gate, and independent review passed. Real Linux/AWS qualification is pending.
|
🦞👀 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 September 10, 2026, 9:23 AM ET / 13:23 UTC (Revision 3). ClawSweeper reviewWhat this changesRemote workspace captures read up to four files concurrently and preserve the first failure while finishing outstanding reads and closing handles. Merge readiness✅ Ready for maintainer review This remains a useful, focused PR: current main still hashes remote files sequentially, and the supplied production-script measurements support the improvement. No actionable correctness or security finding remains; the previous benchmark caveat does not require contributor action. Priority: P2 Review scores
Verification
How this fits togetherCloud workers capture file hashes and metadata so the Gateway can reconcile remote workspace changes. The capture script consumes eligible files and remembered hashes, then returns a deterministic manifest reference and updated hash memo. flowchart TD
A[Workspace capture request] --> B[Select eligible files]
B --> C[Up to four file readers]
D[Remembered hashes] --> C
C --> E{All reads succeed?}
E -->|Yes| F[Publish ordered manifest and memo]
E -->|No| G[Abort reads and close handles]
G --> H[Report first failure]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +26, Tests +204. Total +230 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep bounded concurrency within the existing remote capture owner while preserving deterministic output, byte limits, and settled cleanup before publication. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main serializes file reads and can replace a read failure with a subsequent close failure. The added real-file cases target those paths; no tests were executed during this review. Is this the best way to solve the issue? Yes. The patch updates the existing standalone capture script, preserves its caller and serialization contracts, and adds bounded cleanup without introducing a competing capture path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c973fe7e7219. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
Capture remote workspace files with at most four concurrent readers while preserving the existing opened-byte budget, growth checks, deterministic manifest/memo output, and publication boundary. Stop admission on the first failure, abort active streams, and join pending opens and handle cleanup before returning that original error. Three demonstrated red-to-green regressions, 17 focused cases, the full changed-file gate and independent review passed. Actual AWS/Linux proof completed 42 captures with independently verified output and complete resource cleanup. For 2,048 small files, producer capture medians improved 326.7 to 252.0 ms without memo and 177.5 to 120.3 ms with memo; larger-file observed completion was effectively unchanged. These measurements cover one VM with uncontrolled OS caches, not overall session startup. Extracted from openclaw#134931. The original CI merge failed on unrelated documentation navigation; openclaw#144037 repaired that shared prerequisite, and the qualified hashing commit was preserved for fresh merge CI.
Related: #134931.
What Problem This Solves
Remote workspace captures spend unnecessary time opening and hashing many small files, including captures that can reuse remembered hashes. If a read fails and closing its handle also fails, the close error can hide the original cause.
Why This Change Was Made
Use up to four concurrent readers within the existing opened-byte budget and file-growth checks. The first failure stops new admission, aborts active reads, and is reported only after pending opens and handle cleanup settle. Manifest ordering, memo selection, and publication remain unchanged.
User Impact
Many-file workspace captures can finish sooner without a new setting. Local measurements saved 77–105 ms for 2,048 small files; a workload dominated by one large file was effectively unchanged. These are capture timings, not whole-session startup measurements.
Evidence
This is a two-file extraction from the original combined work. It adds 26 net production lines and three regression cases; no configuration, schema, wire-format, or workspace acceptance change is included. Overlapping per-file hash durations measure effort; total capture duration remains the wall-time measure. No changelog edit is needed before release generation.