@devries-cameron20 / t3code Mirror · read-only / commits / b35c9702f9
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 11:00 UTC

fix(acp): optional text questions can be left blank (#36997)

Co-authored-by: Claude Haiku 5.5 <noreply@anthropic.com>

shivam committed Nov 15, 2026 at 13:31 UTC b35c9702f940ef1395b6cadb1215c51dd81a95a7
5 files changed +42 -2
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
+18 -2
@@ -1961,7 +1961,15 @@ describe("AcpAdapterV2", () => {
1961 scenario: "OMP unrelated form uses generic mapping",
1962 settings: OMP_SETTINGS,
1963 schema: { type: "object", properties: { name: { type: "string" } } },
1964 - questions: [{ id: "name", header: "Question 1", question: "Your answer?", options: [] }],
1964 + questions: [
1965 + {
1966 + id: "name",
1967 + header: "Question 1",
1968 + question: "Your answer?",
1969 + options: [],
1970 + required: false,
1971 + },
1972 + ],
1973 answers: { name: "Ada" },
1974 result: { action: "accept", content: { name: "Ada" } },
1975 },
@@ -2004,7 +2012,15 @@ describe("AcpAdapterV2", () => {
2012 {
2013 scenario: "falls back for an unrelated form",
2014 schema: { type: "object", properties: { name: { type: "string" } } },
2007 - questions: [{ id: "name", header: "Question 1", question: "Your answer?", options: [] }],
2015 + questions: [
2016 + {
2017 + id: "name",
2018 + header: "Question 1",
2019 + question: "Your answer?",
2020 + options: [],
2021 + required: false,
2022 + },
2023 + ],
2024 answers: { name: "Ada" },
2025 result: { action: "accept", content: { name: "Ada" } },
2026 },
packages/client-runtime/src/state/pendingUserInput.test.ts
+12
@@ -83,6 +83,18 @@ describe("resolvePendingUserInputAnswer", () => {
83 ).toBe("Node.js");
84 });
85
86 + it("lets an optional text question stay blank", () => {
87 + const textQuestion = { id: "notes", options: [] };
88 + expect(resolvePendingUserInputAnswer({ ...textQuestion, required: false }, undefined)).toBe("");
89 + expect(
90 + resolvePendingUserInputAnswer({ ...textQuestion, required: false }, { customAnswer: " " }),
91 + ).toBe("");
92 + expect(resolvePendingUserInputAnswer(textQuestion, { customAnswer: " " })).toBeNull();
93 + expect(
94 + resolvePendingUserInputAnswer({ ...textQuestion, required: true }, { customAnswer: "" }),
95 + ).toBeNull();
96 + });
97 +
98 it("accepts ready attachment-only answers while preserving selected options", () => {
99 expect(resolvePendingUserInputAnswer(singleSelectQuestion, { attachmentCount: 1 })).toBe("");
100 expect(
packages/client-runtime/src/state/pendingUserInput.ts
+4
@@ -5,6 +5,7 @@ export interface PendingUserInputQuestion {
5 readonly multiSelect?: boolean | undefined;
6 readonly allowCustomAnswer?: boolean | undefined;
7 readonly initialAnswer?: string | undefined;
8 + readonly required?: boolean | undefined;
9 }
10
11 export interface PendingUserInputDraftAnswer {
@@ -71,6 +72,9 @@ export function resolvePendingUserInputAnswer(
72 if (customAnswer !== null && customAnswer.length > 0) {
73 return customAnswer;
74 }
75 + if (question.required === false && question.options.length === 0) {
76 + return "";
77 + }
78
79 const selectedOptionValues = normalizeSelectedOptionValues(question, draft?.selectedOptionValues);
80 if (question.multiSelect) {
packages/provider-acp/src/server/elicitationForm.test.ts
+7
@@ -92,6 +92,13 @@ describe("parseElicitationForm", () => {
92 "Databases?",
93 );
94 assert(multi !== undefined);
95 + assert.deepStrictEqual(
96 + multi.questions.map((question) => [question.id, question.required]),
97 + [
98 + ["q0", undefined],
99 + ["q0__other", false],
100 + ],
101 + );
102 assert.deepStrictEqual(multi.content({ q0: ["Postgres"], q0__other: "SQLite" }), {
103 q0: ["Postgres"],
104 q0__other: "SQLite",
packages/provider-acp/src/server/elicitationForm.ts
+1
@@ -230,6 +230,7 @@ export function parseElicitationForm(
230 ? {}
231 : { allowCustomAnswer: false }),
232 ...(kind === "multiChoice" ? { multiSelect: true } : {}),
233 + ...(kind === "text" && !required.has(id) ? { required: false } : {}),
234 });
235 }
236 return {