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, 08:30 UTC
fix(server): Devin questions accept a typed answer when allowOther is set (#38173)
Julius Marminge committed
Nov 17, 2026 at 07:14 UTC
bee9c3b796f9bb542a78df3c15a3d7e12988cd87
3 files changed
+52
-3
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
+35
@@ -104,6 +104,7 @@ import {
104
105
const DEFAULT_GROK_SETTINGS = Schema.decodeSync(GrokSettings)({});
106
const DROID_SETTINGS = Schema.decodeSync(AcpRegistrySettings)({ agentId: "factory-droid" });
107
+const DEVIN_SETTINGS = Schema.decodeSync(AcpRegistrySettings)({ agentId: "devin" });
108
const OMP_SETTINGS = Schema.decodeSync(AcpRegistrySettings)({
109
source: "local",
110
commandPath: "/usr/local/bin/omp",
@@ -2038,6 +2039,39 @@ describe("AcpAdapterV2", () => {
2039
answers: { q0: "blue" },
2040
result: { action: "accept", content: { q0: "blue" } },
2041
},
2042
+ {
2043
+ scenario: "Devin allowOther choice accepts a typed answer",
2044
+ settings: DEVIN_SETTINGS,
2045
+ meta: { "cognition.ai/allowOther": true },
2046
+ schema: {
2047
+ type: "object",
2048
+ properties: {
2049
+ q0: {
2050
+ type: "string",
2051
+ title: "Fruit",
2052
+ description: "Which fruit?",
2053
+ oneOf: [
2054
+ { const: "Apple", title: "Apple" },
2055
+ { const: "Banana", title: "Banana" },
2056
+ ],
2057
+ },
2058
+ },
2059
+ required: ["q0"],
2060
+ },
2061
+ questions: [
2062
+ {
2063
+ id: "q0",
2064
+ header: "Fruit",
2065
+ question: "Which fruit?",
2066
+ options: [
2067
+ { label: "Apple", description: "Apple", value: "Apple" },
2068
+ { label: "Banana", description: "Banana", value: "Banana" },
2069
+ ],
2070
+ },
2071
+ ],
2072
+ answers: { q0: "Mango" },
2073
+ result: { action: "accept", content: { q0: "Mango" } },
2074
+ },
2075
])("Registry elicitation $scenario", (fixture) => {
2076
const { schema, questions, answers, result } = fixture;
2077
const withAttachments = "withAttachments" in fixture && fixture.withAttachments;
@@ -2121,6 +2155,7 @@ describe("AcpAdapterV2", () => {
2155
sessionId: "droid-session",
2156
message: "Your answer?",
2157
requestedSchema: schema,
2158
+ ...("meta" in fixture ? { _meta: fixture.meta } : {}),
2159
},
2160
},
2161
},
packages/provider-acp/src/server/adapter.ts
+3
-1
@@ -7118,7 +7118,9 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
7118
const nativeForm = flavor.extractElicitationForm?.(params);
7119
const parsedForm =
7120
nativeForm === undefined
7121
- ? parseElicitationForm(params.requestedSchema, params.message)
7121
+ ? parseElicitationForm(params.requestedSchema, params.message, {
7122
+ allowOther: unknownRecord(params._meta)?.["cognition.ai/allowOther"] === true,
7123
+ })
7124
: undefined;
7125
const form =
7126
nativeForm ??
packages/provider-acp/src/server/elicitationForm.ts
+14
-2
@@ -177,9 +177,11 @@ function typedAnswer(
177
}
178
179
// Decline unaskable forms; validate types and selection counts, leaving other constraints to the agent.
180
+// `allowOther` lets single choices take typed text, sent as the field's value.
181
export function parseElicitationForm(
182
requestedSchema: unknown,
183
message: string,
184
+ { allowOther = false }: { readonly allowOther?: boolean } = {},
185
): ElicitationForm | undefined {
186
const schema = unknownRecord(requestedSchema);
187
const required = new Set(
@@ -226,7 +228,10 @@ export function parseElicitationForm(
228
header: text(property.title) ?? `Question ${questions.length + 1}`,
229
question: text(property.description) ?? message,
230
options,
229
- ...(kind === "text" || kind === "number" || companions.has(id)
231
+ ...(kind === "text" ||
232
+ kind === "number" ||
233
+ companions.has(id) ||
234
+ (allowOther && kind === "choice")
235
? {}
236
: { allowCustomAnswer: false }),
237
...(kind === "multiChoice" ? { multiSelect: true } : {}),
@@ -243,7 +248,14 @@ export function parseElicitationForm(
248
const typed = answer === undefined ? undefined : typedAnswer(field, answer);
249
const companionId = companions.get(id);
250
if (typed !== undefined) entries.push([id, typed]);
246
- else if (companionId !== undefined && typeof answer === "string") {
251
+ else if (
252
+ allowOther &&
253
+ field.kind === "choice" &&
254
+ typeof answer === "string" &&
255
+ answer.trim() !== ""
256
+ ) {
257
+ entries.push([id, answer]);
258
+ } else if (companionId !== undefined && typeof answer === "string") {
259
entries.push([companionId, answer]);
260
} else if (required.has(id)) return undefined;
261
}