Repository navigation
fix(platform): restore attachments when new chat creation fails - #4268
Conversation
yannickmonney
left a comment
There was a problem hiding this comment.
ACCEPT — independent review of PR #4268 / TALE-189 / #3645
Exact reviewed head: 5941844bbd641753a9ce56bd8a8508de70403b7f. Reviewer: Codex #14 c0c99cd0, TALE-609; distinct from implementation agent Codex #1 af98a247 / run 5c12a080. Head confirmed at start and again immediately before posting. This is a scoped independent acceptance record, not merge authorization or a native task-review decision.
The three-line change fixes the missing rollback in the outer chatSend.start catch. It restores the captured staged attachments alongside text only for composer sends (intoThreadId === undefined), matching the existing outcome-rejection behavior. Successful outcomes do not enter this rollback; edit sends do not consume/restore composer attachments.
Observed evidence
- PR's two regression cases pass at head: early start rejection and existing-thread outcome rejection restore text and the file chip; retry carries exactly the original attachment.
- Added four independent, local-only jsdom transport probes using real ChatSurface, Composer, useChatSend, createChatThread, backendFetch and sendChatTurn, replacing only fetch on the write path. Initial create-thread fetch rejection occurs before any message request. Text and exactly one chip return; retry message JSON carries exactly one attachment. Existing-thread message-fetch rejection has the same recovery. After a successful retry, a later text-only send has no attachments.
- Successful first-send controls for both new and existing threads send one attachment-bearing message, leave the composer clear, and send the next text-only message without duplicating the attachment.
- Head focused run: 6/6 passed. Complete targeted ChatSurface, Composer and chat-backend suites with the independent probes: 147/147 passed, one worker, 30-second test ceiling, 2300 MiB Node heap. No assertion/time-limit workaround was required in the successful runs.
- Current main
a9a19afdcc68b7114af8bace6b8db74ba1696c2f, with identical test harness staged: 2 failed / 4 passed. Both new-chat failure cases fail specifically on the missing restored file chip after text returns (PR regression and real-transport probe). Existing-thread recovery and both success controls stay green. Main production source was not modified. - Scoped oxlint, oxfmt check and diff whitespace check pass. Initial Bun/symlink setup failures ran no tests; installed Node plus a review-only Vite fs allowance resolved them. They are harness failures, not product findings.
Blockers and unrun proof
No code-correctness blocker found for the TALE-189 / #3645 contract. Merge/readiness remains unverified: the passive CI snapshot shows five queued Candidate source checks, not a green result. No CI rerun, cancellation or wait. The author/review coordinator retains CI disposition.
Unrun under the light-only admission: real browser/visual gate, full backend or real upload registration/blob lifecycle, persistent message/backend proof, external-provider/production calls, full platform suites, type checking and SAST. Reads, staged upload state and navigation remain test seams; these tests do not prove those real integration layers. This ACCEPT does not resolve another reviewer's finding, the separate late-send/cross-chat draft-restoration issue TALE-190 / #3646, or any broader merge gate.
No push, merge or card move. Evidence: /agent/output/0c01b79a-8bc7-48c0-8809-57ab4232f323/ (head-independent.log, main-independent.log, head-targeted-suites.log, independent-proof.patch, commands.md, lint/format logs and passive CI snapshot).
Summary
chatSend.startrejects before a new chat can be created.Verification
origin/mainatd4c519fa382614cefaa4a244fad287aff49c5614: the early-start regression fails with a missing chip; the existing-thread control passes.waitFortimeout under shared load.Closes #3645