Skip to content

TODO status 필드가 z.string()으로 정의되어 잘못된 상태값(예: 'build')이 허용됨 #5612

Closed

Description

@jungminjo-PMA

문제 설명

Plan 모드에서 TODO를 생성할 때, status 필드에 잘못된 값(예: "build")이 입력되어 문제가 발생합니다.

원인

packages/opencode/src/session/todo.ts에서 TODO의 status 필드가 z.string()으로 정의되어 있어 어떤 문자열이든 허용됩니다:

export const Info = 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 모델이 잘못된 상태값을 반환해도 검증되지 않습니다.

재현 방법

  1. Plan 모드에서 TODO 생성 요청
  2. AI가 잘못된 status 값(예: "build")을 반환하면 그대로 저장됨

제안하는 수정 방안

// packages/opencode/src/session/todo.ts
export const Info = 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"),
  })

환경

  • OpenCode 버전: 1.0.162
  • OS: macOS (darwin arm64)

Activity

  1. github-actions commented on Dec 16, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    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.

  2. removed
    webRelates to opencode on web / desktop
    on Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions