Skip to content

Commit 0741444

Browse files
committed
fix(server): typed listed values reach ACP multi-select companions
1 parent b43fa28 commit 0741444

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,6 +1919,13 @@ describe("AcpAdapterV2", () => {
19191919
content: { q0__other: "Friday", q1: ["Codex"], q1__other: "Pi" },
19201920
},
19211921
},
1922+
{
1923+
scenario: "keeps a typed listed value for a multiple choice",
1924+
schema: titledChoiceSchema,
1925+
questions: titledChoiceQuestions,
1926+
answers: { q0: "Not yet", q1: "Codex" },
1927+
result: { action: "accept", content: { q0: "Not yet", q1: ["Codex"] } },
1928+
},
19221929
])("form elicitation $scenario", ({ schema, questions, answers, result, withAttachments }) =>
19231930
Effect.gen(function* () {
19241931
const fileSystem = yield* FileSystem.FileSystem;

‎packages/provider-acp/src/server/elicitationForm.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,16 @@ export function parseElicitationForm(
243243
(entry): entry is string =>
244244
typeof entry === "string" && !field.values.has(entry) && entry.trim().length > 0,
245245
);
246-
if (custom.length === 0) continue;
247-
routed.set(companion, custom.join(", "));
248-
if (field.kind === "choice") routed.delete(id);
249-
else
246+
if (custom.length > 0) routed.set(companion, custom.join(", "));
247+
if (field.kind === "choice") {
248+
if (custom.length > 0) routed.delete(id);
249+
} else if (custom.length > 0 || typeof answer === "string") {
250+
// Clients submit typed text as a string, even when it names a listed option.
250251
routed.set(
251252
id,
252253
entries.filter((entry) => typeof entry === "string" && field.values.has(entry)),
253254
);
255+
}
254256
}
255257
return routed;
256258
};

0 commit comments

Comments
 (0)