Repository navigation
fix(gateway): allow workspace retry after rejected upload - #123830
Conversation
Reset claimed workspace uploads when HTTP validation fails before staging so a later reconciliation can mint a fresh operation.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 5:44 PM ET / 21:44 UTC. ClawSweeper reviewWhat this changesThe PR releases a claimed node-workspace upload when validation or manifest parsing fails before staging begins, so a later reconciliation can mint a new upload token. Merge readinessKeep open for normal maintainer handling: the patch repairs a source-proven Gateway upload-claim leak, and no blocking correctness or security finding was found. Priority: P2 Review scores
Verification
How this fits togetherNode workspace reconciliation uploads pass through the Gateway transfer service, which authorizes one upload claim, validates and stages its contents, then publishes the completed workspace to the tunnel. Failed requests must clear their claim without weakening the active-transfer authority fence. flowchart LR
A[Node workspace reconciliation] --> B[Gateway upload endpoint]
B --> C[Authorize and claim upload]
C --> D[Validate request and manifests]
D --> E[Stage changed files]
E --> F[Publish completed workspace]
D --> G[Release failed upload claim]
G --> A
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1, Tests +15. Total +16 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep complete post-authorization receive cleanup in the transfer service, with an explicit optional staging root, then land after normal exact-head maintainer checks. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible at high confidence: on current main an authorized zero-length POST throws before cleanup, and the next upload preparation observes the still-active claim. The read-only review did not execute the test. Is this the best way to solve the issue? Yes. Cleanup belongs to the transfer service that claims the upload; moving it to the tunnel would mask the owner leak and could disturb receiving or completed state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d27e318072ac. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready on exact head
Since the review, #123859 landed the same production cleanup as part of the broader transfer-scratch lifecycle repair. The merge remains conflict-free and this PR retains its distinct HTTP-boundary retry regression; native prepare verified the exact remote head with hosted gates. |
|
Merged via squash.
|
Reset claimed workspace uploads when HTTP validation fails before staging so a later reconciliation can mint a fresh operation.
What Problem This Solves
Fixes an issue where a node workspace reconciliation upload that was rejected before staging began could leave the upload permanently marked active. A later reconciliation for the same workspace then failed with “Node workspace transfer upload is already active” instead of receiving a fresh upload token.
Why This Change Was Made
The transfer service now owns cleanup for the complete post-authorization receive lifecycle, including content-length validation and manifest parsing before a staging directory exists. Failed operations release the exact claimed upload while preserving delegated-authority checks, transfer limits, staging cleanup, and completed-upload publication.
This is intentionally separate from #123739, which fixed positive short writes. No short-write behavior is changed here.
User Impact
Node workspace reconciliation can recover from rejected or malformed upload requests by minting a fresh upload operation instead of leaving the workspace stuck until its transfer context is replaced.
Evidence
node scripts/run-vitest.mjs src/gateway/worker-environments/node-workspace-transfer-service.test.tsfailed 1 of 3 tests withNode workspace transfer upload is already active.node scripts/run-vitest.mjs src/gateway/worker-environments/node-workspace-transfer-service.test.ts src/gateway/worker-environments/node-worker-tunnel.test.ts src/gateway/server-http.node-workspace-transfer.test.ts— 13 tests passed.node scripts/check-changed.mjs -- src/gateway/worker-environments/node-workspace-transfer-service.ts src/gateway/worker-environments/node-workspace-transfer-service.test.ts— passed on Blacksmith Testboxtbx_01m0109bkrjxxjy9x370gcr5yc: https://github.com/openclaw/openclaw/actions/runs/31839270350oxfmt --check, oxlint, andgit diff --checkpassed.AI-assisted; the lifecycle owner, authority behavior, regression, and final rebased diff were independently reviewed.