You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TODO status 필드가 z.string()으로 정의되어 잘못된 상태값(예: 'build')이 허용됨 #5612
Plan 모드에서 TODO를 생성할 때, status 필드에 잘못된 값(예: "build")이 입력되어 문제가 발생합니다.
원인
packages/opencode/src/session/todo.ts에서 TODO의 status 필드가 z.string()으로 정의되어 있어 어떤 문자열이든 허용됩니다:
exportconstInfo=z.object({content: z.string().describe("Brief description of the task"),status: z.string().describe("Current status of the task: pending, in_progress, completed, cancelled"),priority: z.string().describe("Priority level of the task: high, medium, low"),id: z.string().describe("Unique identifier for the todo item"),})
반면, UI 컴포넌트(packages/web/src/components/share/part.tsx)에서는 엄격한 타입을 사용합니다:
status: "pending"|"in_progress"|"completed"
이로 인해 AI 모델이 잘못된 상태값을 반환해도 검증되지 않습니다.
재현 방법
Plan 모드에서 TODO 생성 요청
AI가 잘못된 status 값(예: "build")을 반환하면 그대로 저장됨
제안하는 수정 방안
// packages/opencode/src/session/todo.tsexportconstInfo=z.object({content: z.string().describe("Brief description of the task"),status: z.enum(["pending","in_progress","completed","cancelled"]).describe("Current status of the task"),priority: z.enum(["high","medium","low"]).describe("Priority level of the task"),id: z.string().describe("Unique identifier for the todo item"),})
The root cause appears to be the same: the status field in the TODO schema is defined as z.string() instead of using z.enum() with strict validation, allowing AI models to return invalid status values.
Feel free to ignore if these don't match your specific case.
Activity
github-actions commentedon Dec 16, 2025
This issue might be a duplicate of existing issues. Please check:
The root cause appears to be the same: the
statusfield in the TODO schema is defined asz.string()instead of usingz.enum()with strict validation, allowing AI models to return invalid status values.Feel free to ignore if these don't match your specific case.