Skip to content

Remove the dead TodoWrite rendering subsystem from the CLI - #3872

Merged
youknowriad merged 1 commit into
trunkfrom
remove-dead-todowrite-wiring
Jun 18, 2026
Merged

Remove the dead TodoWrite rendering subsystem from the CLI#3872
youknowriad merged 1 commit into
trunkfrom
remove-dead-todowrite-wiring

Conversation

@youknowriad

Copy link
Copy Markdown
Contributor

Related issues

  • Related to #

How AI was used in this PR

Used Claude Code to trace TodoWrite end-to-end — confirming via buildAgentTools and 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

TodoWrite is 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/Ls plus the Studio tools, ask-user, and skill — and the pi runtime ships no todo built-in. So a TodoWrite call always fails with "Tool not found", and the CLI's todo diff/render machinery (which only does anything on a successful TodoWrite) has been dead since the pi-coding-agent migration (#3360) stopped surfacing synthetic todo messages. A code comment in the deleted todo-stream.ts already 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 TodoWrite out 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 TodoWrite and 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).
  • Optional manual check: run the CLI agent and confirm tool rows (Read/Edit/Bash/Skill/etc.) still render correctly under their matching rows.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
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>
@youknowriad

Copy link
Copy Markdown
Contributor Author

This is legacy handling of the todo tool that don't exist anymore.

@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing a9f81a5 vs trunk

app-size

Metric trunk a9f81a5 Diff Change
App Size (Mac) 2355.89 MB 2355.88 MB 0.01 MB ⚪ 0.0%

site-editor

Metric trunk a9f81a5 Diff Change
load 1612 ms 1627 ms +15 ms ⚪ 0.0%

site-startup

Metric trunk a9f81a5 Diff Change
siteCreation 8005 ms 8047 ms +42 ms ⚪ 0.0%
siteStartup 3917 ms 3911 ms 6 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@youknowriad
youknowriad merged commit 02afc0d into trunk Jun 18, 2026
12 checks passed
@youknowriad
youknowriad deleted the remove-dead-todowrite-wiring branch June 18, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants