xonecas.io
64875
Mc

mini-coder / commit 926c19a

fix: show progress while hidden reasoning streams

xonecas2026-04-07 926c19a834982973b273d9dfcbc2f9c89b0231a6 parent 3aab919

2 files changed

src/ui.test.ts+37−0
@@ -367,6 +367,43 @@ describe("ui rendering", () => {
367367 expect(text).toContain("Reasoning in progress");
368368 });
369369
370+ test("renderStreamingResponse shows line count indicator when reasoning is off", () => {
371+ const node = renderStreamingResponse(
372+ {
373+ text: "",
374+ thinking: "line one\nline two\nline three",
375+ pendingToolCalls: [],
376+ },
377+ {
378+ ...RENDER_OPTS,
379+ showReasoning: false,
380+ },
381+ );
382+ const text = collectText(node);
383+
384+ expect(text).toContain("Thinking... 3 lines.");
385+ // Should NOT show actual reasoning content
386+ expect(text).not.toContain("line one");
387+ expect(text).not.toContain("line two");
388+ });
389+
390+ test("renderStreamingResponse shows 1 line when thinking has no newlines and reasoning is off", () => {
391+ const node = renderStreamingResponse(
392+ {
393+ text: "",
394+ thinking: "some thinking",
395+ pendingToolCalls: [],
396+ },
397+ {
398+ ...RENDER_OPTS,
399+ showReasoning: false,
400+ },
401+ );
402+ const text = collectText(node);
403+
404+ expect(text).toContain("Thinking... 1 line.");
405+ });
406+
370407 test("renderStreamingResponse shows partial tool output before the tool finishes", () => {
371408 const node = renderStreamingResponse(
372409 {
src/ui.ts+25−14
@@ -871,16 +871,29 @@ export function renderStreamingResponse(
871871 ): Node | null {
872872 const children: Node[] = [];
873873
874- if (opts.showReasoning && streaming.thinking) {
875- children.push(
876- VStack({ padding: { x: 1 } }, [
877- Text(streaming.thinking, {
878- wrap: "word",
879- fgColor: opts.theme.mutedText,
880- italic: true,
881- }),
882- ]),
883- );
874+ if (streaming.thinking) {
875+ if (opts.showReasoning) {
876+ children.push(
877+ VStack({ padding: { x: 1 } }, [
878+ Text(streaming.thinking, {
879+ wrap: "word",
880+ fgColor: opts.theme.mutedText,
881+ italic: true,
882+ }),
883+ ]),
884+ );
885+ } else {
886+ const lineCount = streaming.thinking.split("\n").length;
887+ const unit = lineCount === 1 ? "line" : "lines";
888+ children.push(
889+ VStack({ padding: { x: 1 } }, [
890+ Text(`Thinking... ${lineCount} ${unit}.`, {
891+ fgColor: opts.theme.mutedText,
892+ italic: true,
893+ }),
894+ ]),
895+ );
896+ }
884897 }
885898
886899 if (streaming.text) {
@@ -1942,10 +1955,8 @@ function handleAgentEvent(event: AgentEvent, state: AppState): void {
19421955
19431956 case "thinking_delta":
19441957 streamingThinking += event.delta;
1945- if (state.showReasoning) {
1946- stickToBottom = true;
1947- cel.render();
1948- }
1958+ stickToBottom = true;
1959+ cel.render();
19491960 break;
19501961
19511962 case "assistant_message":