Remove the dead TodoWrite rendering subsystem from the CLI - #3872
Merged
Conversation
TodoWrite is no longer a registered agent tool — buildAgentTools wires up Read/Write/Edit/Bash/Grep/Glob/Ls plus the Studio tools, and the pi runtime has no todo built-in, so a TodoWrite call can never succeed. The CLI's todo diff/render machinery has therefore been unreachable since the pi-coding-agent migration (#3360) dropped synthetic todo messages. Delete todo-stream.ts, todo-render.ts, the ui.ts special-casing and snapshot state, and the unused display label so stray TodoWrite attempts fall through to the generic tool renderer. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
This is legacy handling of the todo tool that don't exist anymore. |
Collaborator
📊 Performance Test ResultsComparing a9f81a5 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
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.
Related issues
How AI was used in this PR
Used Claude Code to trace
TodoWriteend-to-end — confirming viabuildAgentToolsand the pi runtime that it is not a registered tool, mapping every reference across the CLI TUI, and removing the wiring plus the state/tests it orphaned.Proposed Changes
TodoWriteis not a tool the agent can call.buildAgentTools(apps/cli/ai/runtimes/pi/index.ts) constructs the full tool list explicitly —Read/Write/Edit/Bash/Grep/Glob/Lsplus the Studio tools, ask-user, and skill — and the pi runtime ships no todo built-in. So aTodoWritecall always fails with "Tool not found", and the CLI's todo diff/render machinery (which only does anything on a successfulTodoWrite) has been dead since the pi-coding-agent migration (#3360) stopped surfacing synthetic todo messages. A code comment in the deletedtodo-stream.tsalready noted that the runtime "no longer surfaces" the todo message type.This removes that unreachable subsystem: the todo diff engine, the snapshot rendering, the per-instance todo state on the CLI UI, and the now-unused display label. If a model still emits a stray
TodoWriteout of habit, it now renders through the generic tool path (a normal "tool not found" line) instead of dedicated dead code — no user-facing behavior is lost, since the dedicated path could only ever render the same failure.This is pure dead-code removal: no behavior that was actually reachable changes. Scope was deliberately limited to
TodoWriteand the state/tests it orphaned; no broader dead-code sweep was done.Companion to the annotate-workflow PR (#3870), which stops instructing the agent to call
TodoWrite. The two are independent — this one removes the rendering, that one removes the prompt instructions.Testing Instructions
npm run cli:build && npm run typecheck— passes.npm test -- apps/cli/ai/tests/ui.test.ts— all 12 tests pass (the removed lines were leftover state setup, not todo assertions).Pre-merge Checklist