Feature Request: ask_user enum/oneOf fields should always offer an 'Other / custom answer' escape hatch
- 主要語言
- Shell
- 星號
- 11.2k
- 分支
- 1.9k
- 平均合併
- 14 小時 16 分鐘
- 30 天內合併 PR
- 6
描述
### Describe the feature or problem you'd like to solve
The `ask_user` tool requires each field to be either a fixed `enum`/`oneOf` (no escape hatch) or a fully open-ended `string` (no suggestions). There's no way for the agent to offer suggested choices while still letting the user provide a custom answer on the same field.
When the agent doesn't know all the valid answers in advance, it has to either:
1. Guess at an enum (forcing the user into one of the agent's guesses), or
2. Use a plain string field (giving the user no guidance), or
3. Manually add an `"Other"` / `"I don't know"` value to the enum (which the agent often forgets to do)
If the user picks "decline" to escape, they lose all their other field inputs, not just the one they don't know.
### Proposed solution
Adopt the pattern Claude Code's `AskUserQuestion` uses: the tool runtime automatically appends an "Other" option to every multiple-choice question, which opens a freeform text input. The agent declares structured suggestions; the runtime guarantees the user can always escape with a custom answer.
From the Claude Code system prompt (extracted from the binary):
> "Users will always be able to select 'Other' to provide custom text input"
>
> "The available choices for this question. ... There should be no 'Other' option, that will be provided automatically."
For Copilot CLI's `ask_user`, this could be:
- On `string` fields with `enum`/`oneOf`: render an additional "Other..." option that opens a freeform input.
- On array fields with `enum`/`anyOf` (multi-select): same — an "Other..." entry that opens freeform.
- The agent declares `enum` choices as before; the runtime adds the escape hatch.
Alternative (less elegant): add an `allowOther: true` field on the schema, or document a convention that the agent must include `"Other (please specify)"` in every enum. But the auto-injection approach matches Claude Code's prior art and means agents don't have to remember.
### Example prompts or workflows
A user asks me to create a service account YAML and I need to know which orgs it should belong to. I know the common orgs but not which ones apply to this specific service account.
Current behavior — I either:
- List the orgs I know as a multi-select enum, forcing the user to pick from my guess, OR
- Use a plain string field "comma-separated org names", losing autocomplete-style guidance
Desired: I offer the common orgs as suggested choices, the runtime adds an "Other..." escape, and a user who doesn't know can either pick a sensible default I marked or type whatever's appropriate.
### Additional context
Related: #2067 (multiline freeform input). That's a different but adjacent gap — even today's freeform string fields are single-line only.
貢獻指南
研究方向
先追蹤 CLI 中 ask_user schema 的處理與選項呈現,接著檢視 issue #2067 以了解相鄰行為。當 enum/oneOf 與多選 enum/anyOf 欄位能自動注入並提供 Other/custom-text 路徑,且不丟棄其他答案時,即代表完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- shell
- 領域
- cli
- Issue 類型
- 功能
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 活躍
- 描述清晰度
- 基本清楚
- 新手友好度
- 52/100