fix: bare prompt with esc-to-interrupt is active, not idle; persist runtimeHandle in spawn metadata

This commit is contained in:
sjd9021 2026-02-16 01:31:20 +05:30
parent ec36f3b3a7
commit 4c4f85172e
4 changed files with 7 additions and 3 deletions

View File

@ -202,7 +202,7 @@ describe("spawn command", () => {
const content = readFileSync(metaFile, "utf-8");
expect(content).toContain("branch=feat/INT-100");
expect(content).toContain("status=spawning");
expect(content).toContain("status=working");
expect(content).toContain("project=my-app");
expect(content).toContain("issue=INT-100");
});

View File

@ -164,7 +164,8 @@ async function spawnSession(
writeMetadata(join(sessionDir, sessionName), {
worktree: worktreePath,
branch: liveBranch || branch || "detached",
status: "spawning",
status: "working",
runtimeHandle: JSON.stringify({ id: sessionName, runtimeName: "tmux" }),
project: projectId,
...(issueId ? { issue: issueId } : {}),
createdAt: new Date().toISOString(),

View File

@ -11,6 +11,8 @@
*/
import { randomUUID } from "node:crypto";
import { join } from "node:path";
import { existsSync } from "node:fs";
import type {
LifecycleManager,
SessionManager,

View File

@ -498,7 +498,8 @@ function classifyTerminalOutput(terminalOutput: string): ActivityState {
// Check the last line FIRST — if the prompt is visible, the agent is idle
// regardless of historical output (e.g. "Reading file..." from earlier).
// The is Claude Code's prompt character.
if (/^[>$#]\s*$/.test(lastLine)) return "idle";
// Bare prompt is idle ONLY when not actively processing (no "esc to interrupt")
if (/^[>$#]\s*$/.test(lastLine) && !hasEscToInterrupt) return "idle";
// Claude Code shows inline suggestions after the prompt when idle, e.g.
// " check CI status on the PR". Distinguish from active processing by