xonecas.io
64875
Mc

mini-coder / commit 6ada1f2

fix: always render status bar before each prompt

Previously the status bar used a signature dedup that skipped re-rendering
when token counts hadn't changed. This caused the status bar to be missing
after ollama turns (which report 0 tokens), since the signature matched
the initial render.

Removed the signature cache — the status bar now renders unconditionally
before every prompt. Also removed the now-unused buildStatusBarSignature
function and its test.

xonecas2026-03-22 6ada1f236333ec73adb170e26ff955bc36483089 parent 380e081

4 files changed

TODO.md+0−6
@@ -1,11 +1,5 @@
11 # mini-coder TODO
22
3-- Continue with testing receiving images from models:
4-
5-```
6-What's left: the `file` chunk handling code and Gemini `responseModalities` are implemented and pass all 319 tests. The untested part is the live end-to-end path — a model actually emitting a `file` stream chunk.
7-```
8-
93 - Add a line to global agents to avoid the repeated apologies:
104
115 ```
src/cli/input-loop.ts+2−10
@@ -8,7 +8,6 @@ import { handleCommand } from "./commands.ts";
88 import { resolveFileRefs } from "./file-refs.ts";
99 import { type InputResult, readline } from "./input.ts";
1010 import { renderUserMessage, tildePath } from "./output.ts";
11-import { buildStatusBarSignature } from "./status-bar.ts";
1211 import { buildToolCallLine, renderToolResult } from "./tool-render.ts";
1312
1413 import type { CommandContext } from "./types.ts";
@@ -50,14 +49,12 @@ async function getGitBranch(cwd: string): Promise<string | null> {
5049 export async function runInputLoop(opts: InputLoopOptions): Promise<void> {
5150 const { cwd, reporter, cmdCtx, runner } = opts;
5251
53- let lastStatusSignature: string | null = null;
54-
5552 while (true) {
5653 const branch = await getGitBranch(cwd);
5754 const status = runner.getStatusInfo();
5855 const cwdDisplay = tildePath(cwd);
5956 const contextWindow = getContextWindow(status.model);
60- const statusData = {
57+ reporter.renderStatusBar({
6158 model: status.model,
6259 cwd: cwdDisplay,
6360 gitBranch: branch,
@@ -67,12 +64,7 @@ export async function runInputLoop(opts: InputLoopOptions): Promise<void> {
6764 contextTokens: status.lastContextTokens,
6865 contextWindow,
6966 thinkingEffort: status.thinkingEffort,
70- };
71- const statusSignature = buildStatusBarSignature(statusData);
72- if (statusSignature !== lastStatusSignature) {
73- reporter.renderStatusBar(statusData);
74- lastStatusSignature = statusSignature;
75- }
67+ });
7668
7769 let input: InputResult;
7870 try {
src/cli/status-bar.test.ts+1−24
@@ -1,5 +1,5 @@
11 import { afterEach, describe, expect, test } from "bun:test";
2-import { buildStatusBarSignature, renderStatusBar } from "./status-bar.ts";
2+import { renderStatusBar } from "./status-bar.ts";
33 import { terminal } from "./terminal-io.ts";
44 import { stripAnsi, withTerminalColumns } from "./test-helpers.ts";
55
@@ -90,27 +90,4 @@ describe("renderStatusBar", () => {
9090 expect(line).toContain("ctx 2.0k");
9191 expect(line).not.toContain("ctx 2.0k/");
9292 });
93-
94- test("buildStatusBarSignature is stable and reflects changed fields", () => {
95- const base = {
96- model: "zen/gpt-5.3-codex",
97- cwd: "~/src/mini-coder",
98- gitBranch: "main",
99- sessionId: "1234567890",
100- inputTokens: 1,
101- outputTokens: 2,
102- contextTokens: 3,
103- contextWindow: 100,
104- thinkingEffort: "medium",
105- activeAgent: null,
106- } as const;
107-
108- expect(buildStatusBarSignature(base)).toBe(buildStatusBarSignature(base));
109- expect(
110- buildStatusBarSignature({
111- ...base,
112- outputTokens: 9,
113- }),
114- ).not.toBe(buildStatusBarSignature(base));
115- });
11693 });
src/cli/status-bar.ts+0−14
@@ -36,20 +36,6 @@ function renderStatusLine(segments: string[]): string {
3636 return segments.join(STATUS_SEP);
3737 }
3838
39-export function buildStatusBarSignature(opts: StatusBarData): string {
40- return JSON.stringify({
41- model: opts.model,
42- cwd: opts.cwd,
43- gitBranch: opts.gitBranch,
44- sessionId: opts.sessionId,
45- inputTokens: opts.inputTokens,
46- outputTokens: opts.outputTokens,
47- contextTokens: opts.contextTokens,
48- contextWindow: opts.contextWindow,
49- thinkingEffort: opts.thinkingEffort ?? null,
50- });
51-}
52-
5339 function fitStatusSegments(
5440 required: string[],
5541 optional: string[],