fix(tui): restore inline todo table rendering from tool args - #129
Conversation
The persistent todo table at the top of the viewport depended on CtrlTodos arriving via the control channel. If the channel-buffered message was silently dropped (select/default), or arrived after the ToolEndEvent already refreshed the viewport, the table would never render. Two changes: 1. Remove select/default from the OnWrite callback so CtrlTodos is never silently dropped. The 64-slot buffered channel makes blocking a non-issue in practice. 2. Add inline todo table rendering in AddToolResult. When the todowrite tool completes, parse the tool args JSON directly and render the table inside the tool result box. This bypasses the control channel entirely and guarantees the table is always visible regardless of CtrlTodos delivery timing.
| rendered := m.renderToolResult(toolName, content) | ||
|
|
||
| if toolName == "todowrite" && toolArgs != "" { | ||
| if items := parseTodosFromArgs(toolArgs); len(items) > 0 { |
There was a problem hiding this comment.
WARNING: Inline todo rendering receives truncated tool args
toolArgs comes from ToolEndEvent.Args (tui.go:762), which is truncated to 80 characters via abbreviateArgs(tc.Function.Arguments, 80) at internal/agent/agent_tools.go:46. For any realistic todowrite call with multiple todo items, the JSON exceeds 80 chars and is truncated with ..., causing json.Unmarshal in parseTodosFromArgs (tui.go:1869) to fail and return nil. The inline table rendering at this line never fires.
The actual table-visibility guarantee comes solely from change #1 (the blocking send at cmd/yaah/agent_frame.go:574), not this inline path. Consider reading from TodoWriteTool.Store.List() directly, or carrying full (unabbreviated) args in ToolEndEvent.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (2 files)
Fix these issues in Kilo Cloud Reviewed by laguna-s-2.1:free · Input: 756K · Output: 31.6K · Cached: 511.4K |
The persistent todo table at the top of the viewport relied on \CtrlTodos\ arriving via the control channel. If the channel-buffered message was silently dropped (select/default), or arrived after the ToolEndEvent already refreshed the viewport, the table would never render.
Changes
1. Remove select/default from OnWrite (\cmd/yaah/agent_frame.go)
The \default\ case silently dropped \CtrlTodos\ if the channel buffer was full. Removed it so the send always succeeds. The 64-slot buffer makes blocking a non-issue in practice.
2. Inline table rendering from tool args (\internal/tui/tui.go)
Added \parseTodosFromArgs\ and inline rendering in \AddToolResult. When \ odowrite\ completes, the tool args JSON is parsed directly to render the table inside the tool result box. This completely bypasses the control channel and guarantees the table is always visible.
The inline rendering also works alongside the existing persistent top-of-viewport rendering — both paths complement each other.