Skip to content

Commit 3b8e085

Browse files
committed
fix(server): fixed ACP choices without a text companion reject typed answers
1 parent 759b98d commit 3b8e085

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,6 +1824,24 @@ describe("AcpAdapterV2", () => {
18241824
content: { q0__other: "Friday", q1: ["Codex"], q1__other: "Pi" },
18251825
},
18261826
},
1827+
{
1828+
scenario: "allows only listed values without a text companion",
1829+
schema: { type: "object", properties: { q0: titledChoiceSchema.properties.q0 } },
1830+
questions: [
1831+
{
1832+
id: "q0",
1833+
header: "Deploy the rule now?",
1834+
question: "Global rule",
1835+
options: [
1836+
{ label: "Deploy now", description: "Goes live after a restart.", value: "Deploy now" },
1837+
{ label: "Not yet", description: "Not yet", value: "Not yet" },
1838+
],
1839+
allowCustomAnswer: false,
1840+
},
1841+
],
1842+
answers: { q0: "Deploy now" },
1843+
result: { action: "accept", content: { q0: "Deploy now" } },
1844+
},
18271845
])("form elicitation $scenario", ({ schema, questions, answers, result, withAttachments }) =>
18281846
Effect.gen(function* () {
18291847
const fileSystem = yield* FileSystem.FileSystem;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,7 @@ function readElicitationForm(properties: Record<string, unknown>, message: strin
13911391
question: nonEmptyText(record?.description, message),
13921392
options,
13931393
...(multiSelect ? { multiSelect } : {}),
1394+
...(options.length > 0 && !companions.has(id) ? { allowCustomAnswer: false } : {}),
13941395
}));
13951396
const content = (answers: ProviderUserInputAnswers) => {
13961397
const routed: Record<string, unknown> = { ...answers };

0 commit comments

Comments
 (0)