feat: "waiting" status for threads with open background tasks (i.e. pr monitors)#4415
feat: "waiting" status for threads with open background tasks (i.e. pr monitors)#4415t3dotgg wants to merge 4 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review New feature introducing a 'waiting' status with non-trivial server-side state tracking logic for background tasks. While well-tested, new user-facing behavior and runtime session status changes warrant human review. You can customize Macroscope's approvability policy. Learn more. |
When the agent stops with background tasks (subagents, background bash, monitors) still running, the thread showed Done, then flicked back to Working when a task completion woke the agent. Track provider-reported open tasks in ingestion and park the session on the previously-unused "idle" status; sidebar v2 renders it as a grey "Waiting" with the same elapsed timer as Working. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review fixes: gate the terminal-status task sweep behind the lifecycle guard so rejected stale events cannot erase the active turn's tasks; ignore task starts from a provider instance that doesn't match the projected session instead of letting them displace the current set; tombstone completed task ids so late/duplicate progress cannot re-open a finished task and park the thread on Waiting. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bec6dc6 to
528adb2
Compare
A completed/failed final task wakes the agent (its notification is the wake signal), so Waiting flips straight to Working. A stopped final task is a kill — no wake follows — and previously left a live session parked on Waiting until teardown. Flip that case back to ready, and tombstone completions that outrun their start event. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 514fccf. Configure here.
Tombstones exist to stop late/duplicate progress from resurrecting a finished task, but providers reuse task ids when an agent is resumed — a fresh task.started after completion is real work, not a replay. Progress stays blocked by the tombstone; an explicit start clears it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Real-data feedback round two:
- Results render as a responsive grid (1/2/3 columns) instead of a
full-width list.
- While the sweep runs, the page shows only a progress count
("Reviewing your work — 7 of 18"); results reveal all at once when
every thread is done, so triage happens in one pass over a stable
layout instead of chasing cards as they pop in.
- The model now returns a one-sentence imperative nextStep ("Review
and merge PR #4415.") which becomes the card body — a direct answer
to "what should I do here". Summaries are capped at one sentence and
demoted to an info-icon tooltip.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…2.1-next Absorb CTM tip 408efa6 (Claude replay cleanup, ACP auth/fork provenance, derived-thread wake, fork-shell navigation wait) onto the pingdotgg#4415 Waiting sequence pinned at main ece0508. Conflict resolution (same intent as prior merge 616da6976): - Sidebar/threadList Waiting uses runtime.idle (CTM/orchestrator-v2 park) rather than session.idle from main pingdotgg#4415, including mobile tests. - Drop ProviderRuntimeIngestion (deleted on CTM; v2 uses orchestration-v2).
Update sidebar and mobile expectations for the pingdotgg#4415 Waiting status, repair command-suite settle/interrupt coverage after layer merges, and remove a duplicate settledAt JSON field that broke contracts typecheck.

When the agent stops while background tasks (subagents, background bash, monitors) are still running, the sidebar showed Done, then flicked back to Working when a task completion woke the agent (median 13s later, from local history).
Now ingestion tracks provider-reported open tasks per thread and parks the session on the previously-unused
idlestatus when a turn ends with tasks still open. Sidebar v2 (web + mobile) renders it as a grey Waiting label with the same elapsed timer as Working; the row recedes like other in-flight states. Waiting flips directly to Working on wake-up — no intermediate Done.idlewas already handled as "resting" by settlement, projection, and phase logic, so no contract or migration changes; old clients degrade to today's behavior.🤖 Generated with Claude Code
Note
Medium Risk
Changes core session lifecycle in ProviderRuntimeIngestion (when threads show ready vs idle), with broad integration tests but no contract migration—incorrect task tracking could mislabel thread state across clients.
Overview
Threads that finish a turn while provider background tasks (monitors, subagents, etc.) are still open no longer flash Done before the wake-up turn. Provider runtime ingestion now tracks open tasks per thread and provider instance and parks the session on
idleinstead ofreadywhen a turn ends with tasks still open; task state is cleared on session exit, error, and stale-instance guards, with tombstones for late events.Web sidebar v2 and the mobile thread list map
idleto a muted Waiting label (same elapsed timer as Working, in-flight row treatment). Successful task completion is expected to wake the agent without an intermediate ready; only a stopped last task returns Waiting to ready.Reviewed by Cursor Bugbot for commit 368e0e1. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add 'waiting' status for threads with open background tasks
idlesession status that signals a thread is waiting on background tasks (e.g. PR monitors) rather than active user input or processing.ProviderRuntimeIngestiontracks open tasks per thread/provider instance and transitions sessions toidleat rest when tasks remain open, returning toreadywhen the last task completes.idlesessions as 'Waiting' with a neutral style and an elapsed duration, treated as in-flight for display purposes.readywhile background tasks were open will now show aswaitinguntil those tasks complete.Macroscope summarized 368e0e1.