Skip to content

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

Closed

Description

@yannickmonney

P2 · Reproduced locally at 44e0dcf254975286c0e9dea443b5cd1ca6b23347.

An ordinary connection failure silently removes an uploaded file from the retry draft.

Reproduction:

  1. Open a fresh chat, stage a file, and type a message.
  2. Make the initial POST /api/app/chat/threads fail before it creates the thread, for example by losing connectivity at Send.
  3. Wait for the send failure and inspect the retry draft.

Expected: A failure before any thread or message was created restores both the unsent text and the staged file for retry.

Observed: The text returns to the composer, but the file chip is gone and staged attachments remain empty. Retrying sends only the restored text unless the person notices and reattaches the file.

Cause: handleSend takes the staged attachments before awaiting chatSend.start. Its outer catch restores text and video jobs but omits setStagedAttachments(consumedAttachments). The later outcome-rejection path does restore them.

Frozen observation/control output:

CONFIRMED early create-thread transport rejection: text restored; staged attachments=0; send adapter used=true
CONTROL existing-thread message rejection: text and registered attachment restored; request attachments=1

Control: With the same text and registered local attachment, failure of the message request on an existing thread restores both text and file. Only failure before chatSend.start resolves loses the file.

Exact probe command:

/Users/yannick/.npm/_npx/22f2fe8d8bc13000/node_modules/.bin/bun x vitest run --config /Users/yannick/.codex/notes/tale-100-findings/project-chat-proof/vitest.config.ts /Users/yannick/.codex/notes/tale-100-findings/project-chat-proof/chat-boundaries.probe.test.tsx --maxWorkers 2 --reporter verbose --silent=false

Proof boundary: Executed actual ChatSurface, Composer, useChatSend, createChatThread, backendFetch and sendChatTurn. Transport rejection was controlled at fetch; reads and the upload hook’s already-staged state were test seams. The file was separately uploaded and registered through the local API, and the existing-thread control verifies the real send adapter forwards it. No browser, production, or external-provider call.

Source:

Deduplication: Cached all-state titles and current findings reviewed. Parent checked #725: a historical generic attachment-send failure with no recovery/draft-loss root. #2663 is the shared-chat fork dropping attachments; #3558 is an Inbox upload failure. This is the direct chat create-thread rejection path.

Independent verification

The parent independently reran all five chat observations and controls, including the real local edit/regenerate HTTP persistence path: 5 passed, exit 0 (project-chat-proof/parent-chat-confirmed.log). The first combined run hit 5-second time limits under concurrent load; the isolated rerun used one worker and a 30-second per-test limit. No source or assertions were changed. The local deterministic model was the only provider involved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions