Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat: "waiting" status for threads with open background tasks (i.e. pr monitors) #4415

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromt3code/sidebar-waiting-stateopened View on GitHub

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 idle status 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.

  • Task set is keyed by provider instance and cleared on exit/stop/error, so stale tasks can't park a fresh session.
  • idle was already handled as "resting" by settlement, projection, and phase logic, so no contract or migration changes; old clients degrade to today's behavior.
  • Codex/OpenCode don't emit task events — behavior unchanged there.

🤖 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 idle instead of ready when 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 idle to 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](https://cursor.com/bugbot) for commit 368e0e15274419de7d6cb9d5368a5a2afc7776dd. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add 'waiting' status for threads with open background tasks

  • Introduces a new idle session status that signals a thread is waiting on background tasks (e.g. PR monitors) rather than active user input or processing.
  • ProviderRuntimeIngestion tracks open tasks per thread/provider instance and transitions sessions to idle at rest when tasks remain open, returning to ready when the last task completes.
  • The web sidebar and mobile thread list both render idle sessions as 'Waiting' with a neutral style and an elapsed duration, treated as in-flight for display purposes.
  • Open task state is cleared on session exit or error so future sessions do not inherit the waiting state.
  • Behavioral Change: threads that previously resolved to ready while background tasks were open will now show as waiting until those tasks complete.
Macroscope summarized 368e0e1.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 91fb2c98-8548-4670-a2cd-2cbb6e8a3eee

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Commit unit tests in branch `t3code/sidebar-waiting-state`

      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.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: 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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. t3dotgg(GitHub profile, opens in a new tab) changed the title

    5. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 514fccf5297ec832fdd1e5ef0a1d31de7958ec05. Configure [here](https://www.cursor.com/dashboard/bugbot).
    6. Closing in favor of #2829 (orchestration V2).

      #2829 deletes the V1 orchestration layer this PR builds on — apps/server/src/orchestration/**, provider/Layers/*Adapter.ts and provider/Services/** are removed and replaced by apps/server/src/orchestration-v2/**, with the IPC surface renamed to ORCHESTRATION_V2_WS_METHODS. The files this PR touches either no longer exist or are rewritten, so it can't be rebased — it would need reimplementing against the V2 adapters.

      This is not a judgement on the change itself. Several of these are real gaps we still want fixed; the base just moved out from under them.

      Once #2829 merges, please rebase onto main, port the change to the V2 equivalent, and reopen (or open a fresh PR). Ping me and I'll prioritise the review.

    7. juliusmarminge closed this

Sign in to join this conversation.