Skip to content

Commit 3213963

Browse files
committed
Show plain interrupted when no leftover tool remains
After tools drain, currentToolName is null. Claiming "tools still running" lied to the operator. Name a leftover tool while one is present; otherwise just say interrupted. Also satisfy prettier on the lifecycleStatus union.
1 parent 3478fa0 commit 3213963

2 files changed

Lines changed: 20 additions & 9 deletions

File tree

src/tui/agent-progress.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,24 @@ describe("agentProgress", () => {
4949
expect(progress?.stalled).toBe(false);
5050
});
5151

52+
test("an interrupted session with no leftover tool shows plain interrupted", () => {
53+
const progress = agentProgress(
54+
{
55+
...base,
56+
lifecycleStatus: "interrupted",
57+
currentToolName: null,
58+
currentToolPreview: null,
59+
currentToolStartedAt: null,
60+
lastActivityAt: 1_000,
61+
},
62+
91_000,
63+
);
64+
expect(progress?.stat).toBe("interrupted");
65+
expect(progress?.stat).not.toContain("still running");
66+
expect(progress?.working).toBe(false);
67+
expect(progress?.stalled).toBe(false);
68+
});
69+
5270
test("a running session reports elapsed time and its current tool", () => {
5371
const progress = agentProgress({ ...base, lastActivityAt: 42_000 }, 42_000);
5472
expect(progress).toEqual({

src/tui/agent-progress.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ export interface AgentProgressSession {
1818
readonly status: "running" | "done" | "failed" | "cancelled";
1919
/** Present when the strip knows lifecycle independently of TUI status. */
2020
readonly lifecycleStatus?:
21-
| "pending_init"
22-
| "running"
23-
| "interrupted"
24-
| "completed"
25-
| "shutdown"
26-
| "not_found";
21+
"pending_init" | "running" | "interrupted" | "completed" | "shutdown" | "not_found";
2722
readonly currentToolName: string | null;
2823
/**
2924
* Bounded subject of the oldest outstanding call (command, path, pattern…),
@@ -156,9 +151,7 @@ export function agentProgress(
156151

157152
if (session.lifecycleStatus === "interrupted") {
158153
const toolBit =
159-
hasSubject && session.currentToolName !== null
160-
? ` · ${subject} still running`
161-
: " · tools still running";
154+
hasSubject && session.currentToolName !== null ? ` · ${subject} still running` : "";
162155
return {
163156
stat: `interrupted${toolBit}`,
164157
state,

0 commit comments

Comments
 (0)