Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Cancelling a new citation leaves it in the composer #10379

ClosedNeel2107(GitHub profile, opens in a new tab) opened this issue 2 comments

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web (reproduced in the desktop app)

Steps to reproduce

  1. Open a thread containing an assistant response.
  2. Select some text in the response and click Cite.
  3. In the citation comment popover, click Cancel or press Esc.
  4. Check the chat composer.

Expected behavior

Cancelling a new citation should dismiss the popover and remove that citation from the composer, preserving any existing draft text and previously saved citations. Cancelling comment edits on an already saved citation should keep that citation and its original comment.

Actual behavior

The popover closes, but the newly selected citation remains in the composer. The user has to remove it manually even though they cancelled the action.

Impact

Minor bug or occasional failure

Version or commit

Reproduced on main at 223ff4490 before the local fix.

Environment

macOS, local T3 Code desktop development build (Electron 43.4.1). Originally observed in T3 Code Nightly.

Workaround

Click the citation chip's remove button in the composer after cancelling.

  1. Thanks for the clear repro. Confirmed on main at 223ff4490 — this is a real web/desktop composer bug, not a wash duplicate.

    What happens. Cite inserts the chip first, then opens the comment popover. Cancel/Esc only closes the popover.

    • ChatComposer.citeAssistantText → insertComposerText with citationCommentAnchor writes formatAssistantCitationForComposer(...) into the draft immediately, then requestCitationComment.
    • ComposerPromptEditor / $consumeComposerCitationCommentRequest opens the popover on the new ComposerCitationNode.
    • AssistantCitationChip Cancel/Esc is onCancel={() => commentEditor.onOpenChange(false)}, which only clears openCitationComment. It never runs the existing onRemove path.

    New cites carry a sourceAnchor; pencil-edits of an already-saved chip do not. That is enough to tell “undo this insert” from “discard a comment edit.” Clicking outside the popover uses the same onOpenChange(false) path, so a leftover chip is likely there too unless dismiss is handled the same way as Cancel/Esc.

    Not already fixed upstream. No open PR covers cancel-of-new-citation. #10374 (same author) is screenshots/preview annotations and is unrelated.

    Related cite/composer history only: #9146 (feature), #9307 (Cmd+Enter send), #9306 (select-cite remount), #9499 (keep composer open while selecting). #9605 is Codex source citations, a different feature.

    Next step. Please open a PR for the local fix:

    1. Dismissing a new citation (Cancel, Esc, or equivalent popover close) should remove that chip and leave existing draft text and previously saved citations.
    2. Dismissing a comment edit on an already-saved citation should keep the citation and its original comment.
    3. Add a regression test — current coverage only checks opening the comment after insert (ComposerPromptEditor.test.ts).

    Workaround until then: the citation chip’s remove button.

  2. juliusmarminge added labelsvia-triage

  3. juliusmarminge added labelsbug

  4. Fixed by #10518 — canceling a newly inserted citation now removes the chip from the composer.

  5. juliusmarminge closed this

Sign in to join this conversation.