From e15edfd017506fde396b8b0dcf68008b61b39752 Mon Sep 17 00:00:00 2001 From: qer Date: Tue, 23 Jun 2026 15:09:55 +0800 Subject: [PATCH] fix: always expose the free-text Other option in question prompts (#1003) The question adapter only set allow_other on the wire when the SDK item carried an otherLabel/otherDescription, but the AskUserQuestion tool never provides those fields. Web clients honor allow_other, so the free-text option silently disappeared in the web UI while the TUI (which renders it unconditionally) kept working. Set allow_other unconditionally to match the tool's 'users always have an Other option' contract. --- .changeset/fix-web-question-other-option.md | 5 +++++ packages/agent-core/src/services/question/question.ts | 10 ++-------- .../agent-core/test/services/question-adapter.test.ts | 3 +++ 3 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 .changeset/fix-web-question-other-option.md diff --git a/.changeset/fix-web-question-other-option.md b/.changeset/fix-web-question-other-option.md new file mode 100644 index 000000000..12bf99b30 --- /dev/null +++ b/.changeset/fix-web-question-other-option.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Fix the web question prompt missing the free-text Other option. diff --git a/packages/agent-core/src/services/question/question.ts b/packages/agent-core/src/services/question/question.ts index 772502556..23fbc9185 100644 --- a/packages/agent-core/src/services/question/question.ts +++ b/packages/agent-core/src/services/question/question.ts @@ -142,14 +142,8 @@ function buildItem( if (item.header !== undefined) out.header = item.header; if (item.body !== undefined) out.body = item.body; if (item.multiSelect !== undefined) out.multi_select = item.multiSelect; - // SDK has no `allowOther` field — `otherLabel` / `otherDescription` exist - // and we expose them on the wire alongside an inferred `allow_other: true` - // when either tag is set. (SDK semantics: presence of `otherLabel` enables - // the "Other" affordance; we surface that explicitly on the wire so client - // renderers don't have to infer.) - const hasOtherAffordance = - item.otherLabel !== undefined || item.otherDescription !== undefined; - if (hasOtherAffordance) out.allow_other = true; + // SDK has no allowOther field; always advertise the free-text Other option on the wire. + out.allow_other = true; if (item.otherLabel !== undefined) out.other_label = item.otherLabel; if (item.otherDescription !== undefined) out.other_description = item.otherDescription; return out; diff --git a/packages/agent-core/test/services/question-adapter.test.ts b/packages/agent-core/test/services/question-adapter.test.ts index 1a97c8a0e..e5a6b5d4f 100644 --- a/packages/agent-core/test/services/question-adapter.test.ts +++ b/packages/agent-core/test/services/question-adapter.test.ts @@ -63,6 +63,9 @@ describe('question-adapter · toBrokerRequest (in-process → protocol)', () => expect(protoReq.questions[0]?.header).toBe('Pets'); expect(protoReq.questions[0]?.body).toBe('pick one'); expect(protoReq.questions[0]?.multi_select).toBe(false); + // Other affordance is always on, even when the SDK item has no otherLabel. + expect(protoReq.questions[0]?.allow_other).toBe(true); + expect(protoReq.questions[0]?.other_label).toBeUndefined(); expect(protoReq.questions[1]?.id).toBe('q_1'); expect(protoReq.questions[1]?.options.map((o) => o.id)).toEqual([