Skip to content

fix(platform): restore attachments when new chat creation fails - #4268

Merged
yannickmonney merged 1 commit into
mainfrom
fix/new-chat-attachment-recovery
Oct 4, 2026
Merged

yannickmonney merged 1 commit into
mainfrom
fix/new-chat-attachment-recovery

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

Summary

  • Restore consumed staged attachments alongside text when chatSend.start rejects before a new chat can be created.
  • Keep the rollback under the composer-only guard, matching the later outcome-rejection path without changing edit sends.
  • Add stateful upload-seam regressions through real ChatSurface/Composer: early-start failure restores the file chip and text, existing-thread outcome rejection stays covered, and retry carries the original file.

Verification

  • Checked origin/main at d4c519fa382614cefaa4a244fad287aff49c5614: the early-start regression fails with a missing chip; the existing-thread control passes.
  • Targeted jsdom run of ChatSurface, Composer, chat-backend and the chat route-loader: 143/144 passed; the existing unavailable-backend axe audit exceeded its waitFor timeout under shared load.
  • Isolated ChatSurface rerun, one worker and 30-second test limit: 69/69 passed with no source or assertion changes for the timeout.
  • Scoped lint and format checks pass for both changed files; scoped TypeScript source diagnostics: 0 errors.
  • No whole-platform suite, whole-workspace type check, stack/browser, external provider or production call.

Closes #3645

@yannickmonney yannickmonney left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@yannickmonney
yannickmonney merged commit 3d21ef7 into main Oct 4, 2026
@yannickmonney
yannickmonney deleted the fix/new-chat-attachment-recovery branch October 4, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(platform): a failed new-chat creation restores the message text but drops its staged attachment

1 participant