fix: make TodoItemSchema tolerant of Claude's TodoWrite payload#502
Open
GeT-LeFt wants to merge 1 commit intotiann:mainfrom
Open
fix: make TodoItemSchema tolerant of Claude's TodoWrite payload#502GeT-LeFt wants to merge 1 commit intotiann:mainfrom
GeT-LeFt wants to merge 1 commit intotiann:mainfrom
Conversation
Claude's TodoWrite tool sends {content, status, activeForm} without
priority or id fields. The strict schema causes safeParse() to fail
silently, so session.todos is never populated and the web UI todo
panel stays empty.
- Make priority optional with default 'medium'
- Make id optional with default '' (empty string)
- Add activeForm as optional field (used by Claude for in-progress labels)
Backwards-compatible: existing data with all fields still parses correctly.
Fixes tiann#501
There was a problem hiding this comment.
Findings
- No high-confidence issues found in the added/modified lines.
Summary
- Review mode: initial
- No issues found in
shared/src/schemas.ts:90. Residual risk: this fixes the parsing mismatch, but I did not find automated coverage in repo/docs forTodoWritepayloads that omitpriority/idor includeactiveForm, so a regression here could slip through silently.
Testing
- Not run (automation)
HAPI Bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Claude's
TodoWritetool sends todo items as:{ "content": "Fix the bug", "status": "in_progress", "activeForm": "Fixing the bug" }But
TodoItemSchemarequirespriorityandidas mandatory fields:This causes
TodosSchema.safeParse()to return{ success: false }in all three extraction paths (extractTodosFromClaudeOutput,extractTodosFromCodexMessage,extractTodosFromAcpMessage), sosession.todosis never populated and the web UI todo panel stays permanently empty.Solution
Make
priorityandidoptional with sensible defaults, and addactiveFormas an optional field:Backwards-compatible: existing data with all fields present still parses correctly (Zod defaults only apply when the field is missing).
Changes
shared/src/schemas.tspriorityandidoptional with defaults, addactiveFormFixes #501