[Bug]: Terminal "Add to chat" inserts into a hidden message draft while answering a question#24745

opened17d agobyRReston

Before submitting

  • I searched open and closed issues and related PRs and did not find an exact duplicate.
  • I included a reproduced UI sequence and source references from the installed release.

Area

apps/web (reproduced in apps/desktop)

Steps to reproduce

  1. Open an existing Codex thread in T3 Code desktop with the integrated terminal visible and an empty message draft.
  2. Put a short harmless token such as hello in the terminal. In this reproduction it was typed at the PowerShell prompt without pressing Enter.
  3. As a control, select hello, right-click, and choose Add to chat with no pending question. A visible Terminal 1 line 1 reference appears in the normal composer. Clear that test reference.
  4. Have the agent call request_user_input_async with a question that allows a custom answer. Leave the question open and its answer empty. The reproduced request had two suggested answers and no initialAnswer.
  5. Select the same hello in the terminal, right-click, and choose Add to chat.
  6. Inspect the active answer box. Then dismiss the test question without answering and inspect the normal message draft.

Expected behavior

Adding terminal context while answering a question should visibly add it to the active answer and preserve it with that answer. If terminal context is unsupported in this mode, the action should be disabled or explain the limitation. It should not silently edit a different, hidden message draft.

Actual behavior

  • With no pending question, the terminal reference is inserted and visible.
  • With the question open, the menu action is available, but the answer stays empty: no terminal reference, excerpt, or warning appears.
  • After dismissing the question, Terminal 1 line 1 appears in the ordinary message draft. The selected context was added to that hidden draft rather than the visible answer.

This sequence was reproduced through desktop UI automation in the reporter's installed app. Accessibility readback also showed an empty answer while the question was open, then Value: Terminal 1 line 1 in the normal composer after dismissal. No test answer was submitted, so this report does not claim to have verified the provider-delivery behavior.

Source evidence

Inspected the source pinned to the installed commit:

  • ChatComposer.tsx, addTerminalContext inserts through insertComposerDraftTerminalContext(composerDraftTarget, ...), updates promptRef, and does not route the inserted text through the pending question's custom-answer update.
  • The editor value comes from activePendingProgress.customAnswer while a question is active, rather than the regular prompt.
  • The normal text-replacement path does explicitly route changes to the pending answer.
  • The terminal handler also returns early for literal-answer and choice-only questions; those additional modes were not independently reproduced here.

The split between the displayed answer and the regular draft explains the observed result. The same terminal insertion pattern was still present in current main when checked, but UI reproduction was on the release below.

Impact

Minor bug or occasional failure: terminal context cannot be visibly attached to the question answer through this action, and it unexpectedly appears in a later ordinary draft.

Version or commit

T3 Code (Beta) 0.1.2, packaged commit 044f07257c96. Read from the installed application's package.json, not a triage CLI version.

Environment

Windows 11 Pro, version 10.0.26300, x64; local desktop app; PowerShell integrated terminal; Codex provider using GPT-6.1-Sol in Default mode.

  • #18233 concerns thread-reference selection while answering a question and is closed; this report concerns the terminal's Add to chat action visibly targeting the wrong draft.
  • #22076 concerns raw assistant-citation markup in the collapsed composer; that is a different symptom and source of context.

Searches included "add to chat", "terminal context" "question", "terminal excerpt" "question", terminal/hidden/draft, and related PRs.

Workaround

Resolve or dismiss the question, then use Add to chat in the normal composer. That path was verified to show the terminal reference. No application code was changed.