fix(tui): render CoT once per turn, stop clipping tool output (#415, #414)

The reasoning trace was rendered twice: once as its own "thinking" row on
inference.completed, and again as a ✼ block on the following tool row, whose
Reasoning was copied from Model.lastReasoning. The fallback branch was worse —
lastReasoning is current model state, so every tool row with no Reasoning of its
own (all non-diff rows, all snapshot-restored rows) got the newest trace stamped
on it retroactively. Drop the block, the copy, and the now-dead
RouterEntry.Reasoning / Model.lastReasoning; the standalone row already covers
tool turns.

actionToolText clipped every summary to 48 columns, which cut tool output and —
worse — harness coach text: read-before-write rejections, write blocks, gate
feedback, exactly the messages that say whether the agent was steered or
silently blocked. The action renderer already wraps to panel width, so the clip
was the only single-line ceiling; raise it to 4000 chars.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-31 23:46:25 +04:00
parent 45a9fe3369
commit 5ed8ebd0c5
5 changed files with 58 additions and 31 deletions
+3 -17
View File
@@ -823,23 +823,9 @@ func (m Model) buildTranscriptRows(w int) ([]string, []int) {
rows = append(rows, t.span(s, t.P.Faint))
}
case "tool":
if e.Reasoning != "" {
if m.thinkingShown {
for _, ln := range strings.Split(strings.TrimRight(e.Reasoning, "\n"), "\n") {
rows = append(rows, t.span(" ✼ "+ln, t.P.Faint))
}
} else {
rows = append(rows, t.span(" ✼ reasoning — palette: thinking", t.P.Faint))
}
} else if m.lastReasoning != "" {
if m.thinkingShown {
for _, ln := range strings.Split(strings.TrimRight(m.lastReasoning, "\n"), "\n") {
rows = append(rows, t.span(" ✼ "+ln, t.P.Faint))
}
} else {
rows = append(rows, t.span(" ✼ reasoning — palette: thinking", t.P.Faint))
}
}
// No reasoning block here: the trace already renders as its own "thinking" row
// (appended on inference.completed), and repeating it on the following tool row
// showed the same CoT twice per turn.
gutter := t.span(" ┈", t.P.Faint)
summary := toolRowSummary(e.Content)
avail := w - 4