web: a running chat reads Thinking… until a tool starts

The indicator called a silent turn "Waiting…" after 2.5s without a delta, so a
model reasoning for a minute looked idle. A running turn is now thinking for as
long as it is silent; Waiting… is reserved for a prompt queued behind the turn in
flight.
This commit is contained in:
2026-10-19 23:22:33 +01:00
parent 053bbe68a1
commit ccb97e424b
2 changed files with 22 additions and 27 deletions
+12 -5
View File
@@ -67,7 +67,6 @@ import {
TURN_PHASE_THINKING,
TURN_PHASE_TOOL,
TURN_PHASE_WAITING,
TURN_THINKING_WINDOW_MILLIS,
appendChatNotice,
applyChatEvent,
applyChatOverrides,
@@ -1296,15 +1295,23 @@ test("the chat stream badge uses the live / reconnecting / not live words", () =
});
test("the turn phase names what is happening", () => {
assert.equal(turnPhase([], 1000), TURN_PHASE_THINKING);
assert.equal(turnPhase([]), TURN_PHASE_THINKING);
assert.equal(turnPhaseLabel(TURN_PHASE_THINKING), "Thinking…");
assert.equal(turnPhase([{ type: "tool", id: "t", state: { status: "running" } }], 100000), TURN_PHASE_TOOL);
assert.equal(turnPhase([{ type: "tool", id: "t", state: { status: "running" } }]), TURN_PHASE_TOOL);
assert.equal(turnPhaseLabel(TURN_PHASE_TOOL), "Running a tool…");
assert.equal(turnPhase([], null), TURN_PHASE_WAITING);
assert.equal(turnPhase([], TURN_THINKING_WINDOW_MILLIS), TURN_PHASE_WAITING);
assert.equal(turnPhaseLabel(TURN_PHASE_WAITING), "Waiting…");
});
test("a running turn reads as thinking at any silence; a queued prompt waits", () => {
let thread = newChatThread("s1");
thread = applyChatEvent(thread, evt("step", { step: { status: "started" } }), 1000);
// Two minutes without a delta: still the model's own work, not idle.
assert.equal(threadPhase(thread, 121000), TURN_PHASE_THINKING);
const queued = { ...thread, queued: true };
assert.equal(threadPhase(queued, 121000), TURN_PHASE_WAITING);
assert.equal(threadPhase({ ...thread, running: false }, 121000), null);
});
test("only a call at or past 60s reads as long", () => {
assert.equal(toolLongRunning(TOOL_LONG_RUNNING_MILLIS - 1), false);
assert.equal(toolLongRunning(TOOL_LONG_RUNNING_MILLIS), true);