Repository navigation
fix: keep initial attachments available in new worktrees - #186572
Conversation
|
🦞👀 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. What this changesPreserve managed attachment originals until deferred workspace preparation selects the new session’s final worktree. Example: Attach the 184,251-byte Sales review – March 2026.zip when creating a session with New worktree.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current attachment handoff bug with a focused change, useful regression coverage, and supplied live evidence; no actionable defects remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway attachment preparation validates uploads before acceptance; deferred session preparation then binds the execution workspace, where reply preparation stages the managed originals for the agent. flowchart TD
A[Initial session upload] --> B[Managed attachment store]
B --> C[Preacceptance staging validation]
C --> D[Deferred worktree preparation]
D --> E[Reply attachment staging]
B --> E
E --> F[Agent execution workspace]
Technical reviewBest possible solution: Land the focused producer fix so staging proof describes the final execution workspace. Do we have a high-confidence way to reproduce the issue? Current main publishes interim workspace metadata that suppresses final staging; the supplied baseline screenshot and recorded base-failing regression match that path, though this review ran no target code. Is this the best way to solve the issue? The patch repairs the attachment producer using existing pending-workspace facts and the existing reply staging owner, without introducing another state or policy layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cd566f3b1d1d. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +11, Tests +108. Total +119 across 3 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 28, 2026, 2:57 AM ET / 06:57 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Fixed: Initial uploads remain readable when a session starts in a new worktree. |
…6572) Initial file attachments remain available after deferred worktree preparation, while preserving pre-acceptance validation and existing attachment paths.
What Problem This Solves
A file attached to the first message of a new worktree session can be saved successfully but unavailable to the agent. Attachment preparation copies it into the session's initial sandbox before the deferred worktree exists. The agent later receives that relative path in a different workspace, so an ordinary task can fail and ask for the file again even though the saved attachment still downloads correctly.
User Impact
Initial file attachments remain usable when the accepted turn moves into its newly prepared worktree. Users can start work from the uploaded file without reattaching it. Existing-worktree uploads retain their normal staging path, and upload validation, cancellation, managed-PDF fallback, and permission checks remain in their existing owners. This requires no configuration or stored-data migration.
Why This Change Was Made
The attachment producer was treating a successful copy into an interim sandbox as proof that the file had been staged for execution. Reply preparation intentionally trusts that proof and avoids another copy. Deferred workspace preparation changes the destination after the first copy, invalidating that assumption.
While workspace selection remains pending, attachment preparation now keeps the managed original as the runtime source instead of publishing the interim directory as final staging proof. It still completes its existing pre-acceptance staging checks and error classification. The normal reply staging path then copies the original into the bound workspace. The admission snapshot uses its internal session type so the producer can consume the existing pending-workspace facts without casts or new state.
Evidence
The focused regression uses the registered session-creation and chat handlers with the real attachment parser, sandbox staging, deferred worktree preparation, and reply preparation. Only model execution is replaced by an observer. It reads the advertised attachment path from the actual final workspace and compares the bytes with the uploaded input.
On the unchanged base, the initial-turn case fails with
ENOENTin the new worktree projection; the existing-worktree follow-up reads the expected bytes. On this patch, both cases read the expected bytes. Changed-file formatting/lint, selected type checks, and the related admission, cancellation, PDF fallback, SSH staging, and prompt-stability tests pass. Automated source review covering P0–P3 reported no actionable findings. The live guest flow onc1d0ecba1001submitted the original 184,251-byte ZIP once with New worktree. The agent read and extracted the exact uploaded bytes from the mounted worktree projection and completed an offline order explorer without reattachment. Independent runtime readback matched the managed original, worktree and execution projection. The saved HTML opened through Files; filtering a duplicate order and opening its original CSV source line worked. Final process receipts passed and preserved the archive and all 77 handoff files.Independent engineering review is clean, and exact-head hosted CI passed. The before/after evidence uses the same archive, guest permissions, project fixture, execution image and viewport; fresh session/worktree identities intentionally differ. Recording speed changes are labeled and do not measure latency.
Visual evidence
Real initial upload, completed task, and saved explorer interaction; speed changes are labeled.
proof.mp4
Visual verification
c1d0ecba10012cb1552f767006a2475bd9fce216