Repository navigation
Keep idle Claude CLIs with background subagents alive; show their progress between turns (#1443, #1522) - #1547
Conversation
…#1443) The idle cap and the 30-min reap skip a session whose thread has a running subagent; the exemption lapses 2h after the session went idle so a lost task-notification can't pin it forever. When the last subagent settles the reaper re-arms. Subagents killed with their CLI (reap, quit, crash, stop) now settle as "failed" instead of "done"; a cursor run that exits normally still settles its rows as done. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The idle CLI's system task_started/task_progress events (and the agent's parent_tool_use_id-stamped tool calls) for a running subagent now land on its row as `activity`, which the Agents panel shows as the row's last-activity line. A structured system task_notification settles the row and re-arms the idle reaper. Events that match no running subagent still hit the guard. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7481c1c32f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (fresh) sess.idleSince = Date.now(); | ||
| else clearTimeout(sess.idleTimer); | ||
| armIdleTimer(threadId, sess); | ||
| if (!fresh) return; |
There was a problem hiding this comment.
Re-run the idle-cap sweep when a pin is released
When more than three sessions are retained because all are pinned, settling one subagent invokes this function with an existing idle timer, so this early return skips the cap sweep below. The newly unpinned session therefore remains alive for another full idle timeout even though the map is already above CLAUDE_IDLE_MAX; re-evaluate the cap when an existing pinned timer is re-armed.
Useful? React with 👍 / 👎.
| if (system && (ev.subtype === "task_progress" || ev.subtype === "task_started")) { | ||
| text = | ||
| (typeof ev.summary === "string" && ev.summary) || | ||
| (typeof ev.last_tool_name === "string" && ev.last_tool_name | ||
| ? `Using ${ev.last_tool_name}` | ||
| : null); |
There was a problem hiding this comment.
Record descriptions from task-started events
A task_started event can contain only description for its human-readable progress—the new test fixture itself emits exactly that shape—but this branch reads only summary and last_tool_name. Until a later tool call or progress event arrives, no activity is stored or pushed, so the Agents panel fails to show that the background subagent started; use description as the fallback for task_started.
Useful? React with 👍 / 👎.
Closes #1443. Closes #1522.
#1443 (422e2d6): idle reaping (both the cap of 3 idle CLIs and the 30-min timer) killed Claude CLIs that were still running background subagents, then marked those subagents
done.runner-claude-sessions.js: the cap sweep skips sessions whose thread has arunningsubagent, and the timer re-checks instead of disposing them. The exemption lapses 2 h after the session went idle, so a lost task-notification can't keep a session alive forever.runner-subagents.js: when the last running subagent settles,scheduleClaudeIdleReapruns again.finishRunningSubagentsnow marks killed workfailed; a run that ends normally passesdone(Cursor). A crashed Claude CLI also settles its subagents.#1522 (7481c1c): between turns, events from an idle CLI were dropped at the guard. The new
ingestSubagentEventfoldstask_started,task_progressandtask_notificationsystem events, plus messages stamped withparent_tool_use_id, onto the running row'sactivity. The Agents panel shows it as last activity.SubagentInfo.activityis added tosrc/shared/ipc.ts.Tests: new fake-claude scenarios in
electron/test/claude.test.js. Electron: 4351 pass, 0 fail (clean env). Renderer: 2882 pass, 0 fail.tsc --noEmitis clean. The memory-server suite has 3 failures in the #409 injection-scan test, which fail the same way on main.Part of the #1532 gap pass.
🤖 Generated with Claude Code