Skip to content

Default Claude AskUserQuestion to allow free-form input - #336285

Open
David Anthoff (davidanthoff) wants to merge 1 commit into
microsoft:mainfrom
davidanthoff:claude-askuser-freeform
Open

David Anthoff (davidanthoff) wants to merge 1 commit into
microsoft:mainfrom
davidanthoff:claude-askuser-freeform

Conversation

@davidanthoff

Copy link
Copy Markdown
Contributor

Fixes #335933

When the built-in Claude harness asks a multiple-choice question via the AskUserQuestion tool, the chat UI shows only the fixed options and never the free-form "Other" text field that the Claude Code extension always offers.

The Claude Agent SDK never sends an allowFreeformInput field on AskUserQuestion questions — the tool schema explicitly instructs the model not to include an "Other" option because "that will be provided automatically" by the harness UI. The workbench question carousel (createInputRequestCarousel in stateToProgressAdapter.ts) already defaults an absent allowFreeformInput to true, but buildAskUserSessionInputQuestions in the Claude agent explicitly forced it to false, so the free-text field never appeared.

This change defaults the absent flag to true instead. An explicit false from the SDK is still honored. No other changes are needed: flattenAskUserAnswers already folds freeform answers into the value sent back to the SDK, and the MCP-elicitation path (which intentionally sets allowFreeformInput: false for strict enums) is untouched.

Testing: updated the buildAskUserSessionInputQuestions unit tests to cover absent → true, explicit false → false, and explicit true → true; ran the claudeInteractiveTools, claudeAgent, and claudeElicitation node unit suites (303 passing).

This PR was written by Claude (Anthropic's Claude Code) on behalf of David Anthoff (@davidanthoff).

🤖 Generated with Claude Code

The Claude Agent SDK never sends allowFreeformInput on AskUserQuestion
questions - its tool schema tells the model not to include an "Other"
option because the harness UI is expected to provide one automatically.
The Claude agent defaulted the absent flag to false, so the chat UI
never showed the free-text field. Default it to true instead; an
explicit false from the SDK is still honored.

Fixes microsoft#335933

Co-Authored-By: Claude Fable 5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings September 15, 2026 15:30
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

TylerLeonhardt

Matched files:

  • src/vs/platform/agentHost/node/claude/claudeInteractiveTools.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused implementation matches existing carousel semantics and has appropriate regression coverage.

Pull request overview

Defaults Claude AskUserQuestion prompts to permit free-form answers while preserving explicit SDK overrides.

Changes:

  • Defaults allowFreeformInput to true.
  • Adds coverage for absent, enabled, and disabled values.
File summaries
File Description
claudeInteractiveTools.ts Updates question mapping and documents the default.
claudeInteractiveTools.test.ts Verifies default and explicit behavior.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@romanrokon

Copy link
Copy Markdown

I've run the equivalent change as a local patch since 2026-09-25, now on VS Code 1.141.0 (macOS arm64), using the built-in Claude agent signed in with a Claude subscription. In the built agentHostMain.js it rewrites

allowFreeformInput:X.allowFreeformInput??!1

to ??!0, which is the same default this PR sets in buildAskUserSessionInputQuestions. With it applied, AskUserQuestion shows the free-text field next to the options, as the Claude Code CLI and extension do. I haven't seen any side effects. Every VS Code update reverts the patch, so it would be good to have this merged.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claude in the chat window doesn't show free text option when display decision choices

5 participants