Skip to content

Commit 8fd5797

Browse files
committed
Fixed plan step status normalization: map Claude SDK in_progress to inProgress
The Claude SDK emits TodoWrite todos with status "in_progress" (snake_case), but RUNTIME_PLAN_STEP_STATUSES uses camelCase "inProgress". The validity check was failing silently and falling back to "pending" for all in-progress steps. Added explicit snake_case → camelCase normalization before the RUNTIME_PLAN_STEP_STATUSES inclusion check in extractPlanStepsFromTodoInput.
1 parent 0a69f1a commit 8fd5797

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

apps/server/src/provider/Layers/ClaudeAdapter.utils.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,17 @@ export function extractPlanStepsFromTodoInput(
304304
const todos = Array.isArray(input.todos) ? input.todos : [];
305305
return todos
306306
.filter((t): t is Record<string, unknown> => !!t && typeof t === "object")
307-
.map((t) => ({
308-
step:
309-
typeof t.content === "string" && t.content.trim().length > 0 ? t.content.trim() : "Task",
310-
status: (RUNTIME_PLAN_STEP_STATUSES as readonly string[]).includes(t.status as string)
311-
? (t.status as RuntimePlanStepStatus)
312-
: ("pending" as RuntimePlanStepStatus),
313-
}));
307+
.map((t) => {
308+
// Claude SDK uses snake_case "in_progress"; normalize to camelCase before validating
309+
const rawStatus = t.status === "in_progress" ? "inProgress" : t.status;
310+
return {
311+
step:
312+
typeof t.content === "string" && t.content.trim().length > 0 ? t.content.trim() : "Task",
313+
status: (RUNTIME_PLAN_STEP_STATUSES as readonly string[]).includes(rawStatus as string)
314+
? (rawStatus as RuntimePlanStepStatus)
315+
: ("pending" as RuntimePlanStepStatus),
316+
};
317+
});
314318
}
315319

316320
export function classifyRequestType(toolName: string): CanonicalRequestType {

0 commit comments

Comments
 (0)