Repository navigation
fix(gateway): prevent workspace sync truncation on short writes - #123739
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 12:32 PM ET / 16:32 UTC. ClawSweeper reviewWhat this changesThe PR retries positive short writes for staged workspace uploads and uses Node’s complete-write file API for locally generated workspace inventory and transfer-list files. Merge readinessKeep open for maintainer sign-off after exact-head checks complete. The patch is a focused owner-boundary repair with no blocking correctness finding found. Priority: P2 Review scores
Verification
How this fits togetherWorkspace sync writes uploaded worker changes into a staging area and generates local inventory files before manifest validation and reconciliation. These writers sit directly before the digest, staging-cleanup, and publication paths. flowchart LR
A[Worker workspace data] --> B[Workspace sync]
B --> C[Staged upload writer]
B --> D[Inventory and transfer writers]
C --> E[Manifest validation]
D --> E
E --> F[Workspace reconciliation]
Decision needed
Why: The PR carries the protected maintainer label, so automated cleanup must leave the merge decision to a human despite no blocking patch finding. Before merge
Agent review detailsSecurityNone. PR surfaceSource +13, Tests +260. Total +273 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the local positional retry loop for staged uploads and the complete-write primitive for sequential files, then merge only after exact-head validation and maintainer sign-off. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current writers ignore positive short-write results, and the branch’s fault-injection tests target the resulting truncated outputs. This read-only review did not execute the tests. Is this the best way to solve the issue? Yes, with a minor contract-review caveat: positional retries belong at the upload owner because they preserve offsets and authority fences, while sequential writers can use the complete-write primitive. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e74671df05e8. 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
Known proof gap: the separate pre-staging claimed-upload cleanup defect is not bundled; it is recorded as a named follow-up. |
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where workspace synchronization could truncate uploaded files, bounded command output, or generated transfer lists when the filesystem completed a legal positive short write. Reconcile uploads were eventually rejected by the staging manifest check, while the local inventory writers could return normally with incomplete files.
Why This Change Was Made
The workspace-sync owner now enforces full persistence at every raw file-handle boundary:
FileHandle.writeFile()primitive.Existing byte limits, digest verification, staging isolation, completed-upload publication, and cleanup remain authoritative. This does not change protocol or persistent state.
User Impact
Workspace transfers no longer fail or silently emit truncated inventory files solely because an underlying write persisted only a positive prefix. Authority retirement and terminal write failures continue to remove staging and leave the upload unavailable.
Evidence
node scripts/run-vitest.mjs src/gateway/worker-environments/node-workspace-transfer-service.test.ts src/gateway/worker-environments/workspace-sync-local.test.ts— 13 tests passed.node scripts/check-changed.mjs -- <five changed workspace paths>— passed on Blacksmith Testbox (tbx_01m00gepg8c19qbfw2e3fp2gt1): https://github.com/openclaw/openclaw/actions/runs/31817841929oxfmt --checkandgit diff --checkpassed.Named follow-up: reset claimed uploads after failures that occur before the staging cleanup scope begins. That is a separate lifecycle defect and is intentionally not changed here.
AI-assisted; the final owner boundary, authority behavior, regressions, and proof were independently reviewed.