Skip to content

[Bug]: Clicking a question option discards text typed into the composer #12569

Description

@myfunc

Area

apps/web (shared desktop composer)

Summary

While an agent is running, a structured question (single-choice options plus an editable answer field) takes over the composer. If I type into the composer while that question is active and then click one of the options, the text I typed is discarded immediately. Nothing brings it back: it is not in the thread draft, not in the answer, not in the message sent to the agent.

Steps to reproduce

  1. Start a Claude Code task (desktop app, Windows) and wait for the agent to work.
  2. Start typing a follow-up in the composer.
  3. The agent issues an AskUserQuestion-style question with several options.
  4. Type (or continue typing) some text into the composer. With the question active, the composer edits the question's custom answer.
  5. Click one of the options.

Expected behavior

Choosing an option must not destroy text the user has typed. Either the text stays visible (as clarification or as the pending follow-up message), or it moves back to the thread draft. The user decides what to do with it.

Actual behavior

The composer is emptied the moment an option is clicked. The typed text is gone with no recovery path.

Source

Confirmed from source at dfbb11bdd7c3f1a5575cb55d3e3abb12be025727 (main), same code as the installed build.

  • Selecting an option rebuilds the draft answer with customAnswer: "", so any text typed into the answer field is dropped by design:
    return {
    customAnswer: "",
    ...(nextSelectedOptionValues.length > 0
    ? { selectedOptionValues: nextSelectedOptionValues }
    : {}),
    };
    }
    return {
    customAnswer: "",
    selectedOptionValues: [optionValue],
  • The option handler in ChatView also resets the shared prompt ref to an empty string:
    promptRef.current = "";
  • The editor is bound to activePendingProgress.customAnswer while a question is active, so the emptied answer is what the user sees:
    isComposerApprovalState
    ? ""
    : activePendingProgress
    ? activePendingProgress.customAnswer
    : prompt
    }

The behaviour dates back to the original user-input implementation (12edc3455) and is covered by unit tests as intended (togglePendingUserInputOptionSelection returns customAnswer: ""). The design reason is that a non-empty custom answer takes precedence over selected options in resolvePendingUserInputAnswer, so the two are treated as mutually exclusive. That makes sense for the answer model, but it turns a click into silent data loss for text the user was composing.

Relation to existing issues

  • [Bug]: Incoming agent questions replace an unfinished message and redirect subsequent typing #11116 (accepted) covers the wider takeover: the composer switches to the question answer and Send routes to the question. This report is the destructive sub-case: even under the current takeover model, clicking an option should not delete typed text. A small fix is possible without the redesign (for example, move a non-empty custom answer back into the thread draft when an option is selected, instead of discarding it).
  • [BUG] Textarea being reset #808 (closed) reported the reset when the question appears; that text is preserved in the thread draft. This case is different: the text is lost.

Impact

Major degradation or frequent failure. Typing while the agent works is normal use, and a single click deletes the message.

Version or commit

Installed desktop build 0.0.42 (t3codeCommitHash 719a76ca1dbf). Source checked at dfbb11bdd.

Environment

Windows 11 Home 10.0.26200, T3 Code desktop (Alpha), provider Claude Code.

Workaround

Do not type while a question is active, or press Send with the typed text as the custom answer instead of clicking an option.

lovely composed in pair with Claude Fable 5.1 in Claude Code

Activity

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

    acceptedfeature request acceptedbugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions