Skip to content

send_to_terminal progress message repeats first question when accepting all defaults in interactive commands #309608

@meganrogge

Description

@meganrogge

Bug

When an interactive command like npm init is run and the user accepts all defaults via the askQuestions carousel, every send_to_terminal progress message displays the first question's text (e.g. "Package name?") instead of the correct question for each prompt.

Steps to Reproduce

  1. Open a chat session in default approvals mode
  2. Ask the agent to run npm init in a terminal
  3. The agent detects the interactive prompts and shows an askQuestions carousel with multiple questions (package name, version, description, entry point, etc.)
  4. Accept all defaults by leaving every field empty and submitting the carousel
  5. The agent sends each default answer via send_to_terminal (pressing Enter for each prompt)

Expected Behavior

Each send_to_terminal progress message should show the corresponding question:

  • Pressed Enter in terminal (replying to: Package name?)
  • Pressed Enter in terminal (replying to: version?)
  • Pressed Enter in terminal (replying to: description?)

Actual Behavior

Every progress message repeats the first question:

  • Pressed Enter in terminal (replying to: Package name? (default: @xterm/xterm))
  • Pressed Enter in terminal (replying to: Package name? (default: @xterm/xterm))
  • Pressed Enter in terminal (replying to: Package name? (default: @xterm/xterm))

Cause

_getQuestionContextForTerminal matches the sent command text against carousel answer values to find the corresponding question. When all answers are identical (empty string for defaults), the loop iterates questions in order and always matches the first one.

Fix

Use positional matching: count prior send_to_terminal tool invocations after the carousel in the response parts to determine the question index, rather than relying solely on answer-value matching.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugcandidateIssue identified as probable candidate for fixing in the next releaseterminal-chat-toolsunreleasedPatch has not yet been released in VS Code Insiders

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions