@devries-cameron20 / t3code-1 / commits / a0ed8dc31c
Fork 0

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

fix(providers): blank question descriptions no longer fail runs (#21762)

Julius Marminge committed Oct 19, 2026 at 16:28 UTC a0ed8dc31cca459bd9ba99a772b23be5ffeda3d4
4 files changed +84 -8
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
+30
@@ -34,6 +34,7 @@ import {
34 NodeId,
35 type OrchestrationV2AppThread,
36 type OrchestrationV2ProviderThread,
37 + OrchestrationV2UserInputQuestion,
38 ProjectId,
39 ProviderInstanceId,
40 type ProviderInstanceEnvironment,
@@ -102,6 +103,10 @@ import {
103 projectionFor,
104 } from "../testkit/fixtures/shared.ts";
105
106 +const decodeUserInputQuestions = Schema.decodeUnknownSync(
107 + Schema.Array(OrchestrationV2UserInputQuestion),
108 +);
109 +
110 const DEFAULT_CLAUDE_SETTINGS = Schema.decodeSync(ClaudeSettings)({});
111 const AUTO_COMPACT_CLAUDE_SETTINGS = Schema.decodeSync(ClaudeSettings)({
112 autoCompactWindow: "300000",
@@ -332,6 +337,31 @@ describe("ClaudeAdapterV2 runtime query policy", () => {
337 );
338 });
339
340 + it("fills blank AskUserQuestion descriptions from trimmed labels", () => {
341 + const questions = decodeUserInputQuestions(
342 + ClaudeAdapterV2.claudeUserInputQuestions({
343 + questions: [
344 + {
345 + header: "Naming",
346 + question: "Which name?",
347 + options: [
348 + { label: "Recorder", description: " Matches the package name. " },
349 + { label: " Keep ", description: "" },
350 + { label: " Other ", description: " \t\n " },
351 + { label: " Ask later " },
352 + ],
353 + },
354 + ],
355 + }),
356 + );
357 + assert.deepEqual(questions[0]?.options, [
358 + { label: "Recorder", description: "Matches the package name." },
359 + { label: "Keep", description: "Keep" },
360 + { label: "Other", description: "Other" },
361 + { label: "Ask later", description: "Ask later" },
362 + ]);
363 + });
364 +
365 it("normalizes Claude todo and proposed-plan tool input", () => {
366 assert.deepEqual(
367 ClaudeAdapterV2.claudeTodoSteps({
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
+3 -7
@@ -3354,13 +3354,9 @@ export function claudeUserInputQuestions(
3354 const optionRecord = option as Record<string, unknown>;
3355 const label = typeof optionRecord.label === "string" ? optionRecord.label.trim() : "";
3356 if (label.length === 0) return [];
3357 - return [
3358 - {
3359 - label,
3360 - description:
3361 - typeof optionRecord.description === "string" ? optionRecord.description.trim() : "",
3362 - },
3363 - ];
3357 + const description =
3358 + typeof optionRecord.description === "string" ? optionRecord.description.trim() : "";
3359 + return [{ label, description: description || label }];
3360 })
3361 : [];
3362 return [
packages/provider-pi/src/server/adapter.test.ts
+46
@@ -15,6 +15,7 @@ import {
15 type ModelSelection,
16 type OrchestrationV2AppThread,
17 type OrchestrationV2ProviderThread,
18 + OrchestrationV2UserInputQuestion,
19 type OrchestrationV2ProviderTurn,
20 } from "@t3tools/contracts";
21 import * as Cause from "effect/Cause";
@@ -57,6 +58,10 @@ const layerTest = Layer.mergeAll(
58 TestProviderHost.layer().pipe(Layer.provide(NodeServices.layer)),
59 );
60
61 +const decodeUserInputQuestions = Schema.decodeUnknownSync(
62 + Schema.Array(OrchestrationV2UserInputQuestion),
63 +);
64 +
65 const decodeJsonLine = Schema.decodeSync(Schema.fromJsonString(Schema.Unknown));
66 const encodeJsonLine = Schema.encodeSync(Schema.fromJsonString(Schema.Unknown));
67
@@ -3102,6 +3107,47 @@ describe("PiAdapterV2", () => {
3107 }).pipe(Effect.scoped, Effect.provide(layerTest)),
3108 );
3109
3110 + it.effect("emits a valid empty select option and returns its original value", () =>
3111 + Effect.gen(function* () {
3112 + const fake = yield* makeFakePi;
3113 + const { runtime, takeEvent } = yield* openRuntime(fake);
3114 + yield* runtime.ensureThread({
3115 + threadId: THREAD_ID,
3116 + modelSelection: modelSelection("default"),
3117 + runtimePolicy,
3118 + });
3119 + yield* fake.emit({
3120 + type: "extension_ui_request",
3121 + id: "ui-select",
3122 + method: "select",
3123 + title: "Pick a tag",
3124 + options: ["stable", ""],
3125 + });
3126 + const event = yield* takeEvent(
3127 + (event) =>
3128 + event.type === "turn_item.updated" && event.turnItem.type === "user_input_request",
3129 + );
3130 + if (event.type !== "turn_item.updated" || event.turnItem.type !== "user_input_request") {
3131 + return assert.fail("expected a user input request");
3132 + }
3133 + const questions = decodeUserInputQuestions(event.turnItem.questions);
3134 + assert.deepEqual(
3135 + questions[0]?.options.map((option) => [option.label, option.value]),
3136 + [
3137 + ["stable", "stable"],
3138 + ["Empty value", ""],
3139 + ],
3140 + );
3141 + yield* runtime.respondToRuntimeRequest({
3142 + requestId: event.turnItem.requestId,
3143 + answers: { "ui-select": "" },
3144 + });
3145 + const response = yield* fake.takeRequest("extension_ui_response");
3146 + assert.equal(response["value"], "");
3147 + assert.isUndefined(response["cancelled"]);
3148 + }).pipe(Effect.scoped, Effect.provide(layerTest)),
3149 + );
3150 +
3151 it.effect("keeps the complete editor prefill editable and returns exact edited text", () =>
3152 Effect.gen(function* () {
3153 const fake = yield* makeFakePi;
packages/provider-pi/src/server/adapter.ts
+5 -1
@@ -3191,7 +3191,11 @@ function piQuestion(
3191 method === "select" && Array.isArray(event["options"])
3192 ? event["options"]
3193 .filter((option): option is string => typeof option === "string")
3194 - .map((option) => ({ label: option || "Empty value", description: option, value: option }))
3194 + .map((option) => ({
3195 + label: option || "Empty value",
3196 + description: option || "Empty value",
3197 + value: option,
3198 + }))
3199 : method === "editor"
3200 ? []
3201 : [