fix(client-runtime): background commands keep threads in Working #15413
main fromrefs/pull/15413/head·opened View on GitHubWhen an agent leaves a background command running and ends its turn, the composer shows "Running: ..." with a Stop button. With the Working section beta on, that thread still drops into the inbox as if it were done. I hit this with a Claude thread that started a background Bash to wait out a lockout and then rerun QA. The agent was waiting on that command, but the thread looked finished.
The cause is isThreadWorking in packages/client-runtime/src/state/threadInbox.ts. It only counts background work that parks the runtime at idle, and #14872 made commands stop parking it. Subagents, monitors, and other background tasks already land in Working. Commands do not.
This PR makes isThreadWorking treat any live background task as work. Web and mobile both call it, so one change covers both. Notifications, idle parking, and auto-settle keep the #14872 rule. A failed run, an approval, a question, or a ready plan still keeps the thread in the inbox.
Trade-off: a dev server left running keeps its thread in Working until you stop it. The thread does return to the top of the inbox when the command ends.
Before / after#
Same live thread (Claude Sonnet 5.5 ran sleep 1800 with run_in_background, then ended its turn). Working section beta on. The only difference is threadInbox.ts.
| Before (main) | After (this PR) |
|---|---|
![]() | ![]() |
While the turn is still running, the row is already in Working on both main and this PR. The difference is only what happens after the turn ends.
Mid-turn (same on main and this PR)

Cases#
| Live background work after the turn | Before | After |
|---|---|---|
| command | inbox | Working |
| subagent, monitor, background_task | Working | Working |
| any, with a failed run | inbox | inbox |
| any, with an approval, question, or ready plan | inbox | inbox |
| Grok persistent monitor (filtered out of the roster) | inbox | inbox |
Verification#
vp test run packages/client-runtime/src/state/threadInbox.test.ts apps/web/src/components/Sidebar.logic.test.ts: 146 passed. New cases cover each background kind (command, monitor, subagent, background_task) and a failed run with a live command.vpr typecheckpasses inpackages/client-runtime,apps/web, andapps/mobile.- Manual web check in an isolated dev server, shown above.
Not checked: the mobile Working section in a simulator. It calls the same function.
Approval#
This changes how the Working section beta treats commands, which #14872 decided on purpose. I have not had maintainer sign-off on the direction. Discussion: https://github.com/pingdotgg/t3code/discussions/15433. If you'd rather keep commands out of the Working section, close this and I'll drop it.
Claude Opus 5.5 via Claude Code in T3 Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
Approvability#
Verdict: Approved at
c5a2dfeMacroscope's review found this PR approvable — This is a focused fix to the existing optional Working-shelf classification, keeping threads with live background commands visible there while preserving inbox treatment for failures and user-action states. The change is self-contained and covered by targeted tests, with no schema, infrastructure, security, or default-setting impact.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Important
Review skipped#
We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting
@coderabbitai full review.You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- 🔍 Trigger review
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
8ad937a6-3e5b-4709-a59b-01398b296316
📥 Commits
-
Reviewing files that changed from the base of the PR and between 0c8112013760617230d382e55447ddb75627a997 and b344d7a4310cbd31c6972aa2bb91ac320e7fc002.
📒 Files selected for processing (3)
-
apps/web/src/components/Sidebar.logic.test.tspackages/client-runtime/src/state/threadInbox.test.tspackages/client-runtime/src/state/threadInbox.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
📝 Walkthrough
-
The thread-working predicate now considers pending background tasks for inactive runtimes and excludes failed runtimes. Sidebar tests cover how command, monitor, subagent, and background-task rosters affect Working shelf classification.
Changes: Working shelf classification
Layer / File(s) Summary Thread working-state predicate
packages/client-runtime/src/state/threadInbox.ts,packages/client-runtime/src/state/threadInbox.test.tsWorkingThreadInputincludespendingBackgroundTasks. The predicate excludes failed runtimes and treats inactive runtimes as working when idle or when background tasks are pending. The test fixture includes an empty task list.Sidebar Working shelf expectations
apps/web/src/components/Sidebar.logic.test.tsTests expect completed-runtime threads with command, monitor, subagent, or background-task rosters to count as working. A failed runtime with a command task remains outside the Working shelf. Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~15 minutes
Change: Bug fix
Suggested reviewers:
t3dotgg
Merge Risk: ⚪ Minimal · up to
b344d-
The change keeps threads with pending background work in Working while preserving the existing exclusions. No supported defect remains that should block merging.
🚥 Pre-merge checks | ✅ 3 | ❌ 2
-
❌ Failed checks (2 warnings)#
Check name Status Explanation Resolution Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold. Description check ⚠️ Warning The description covers the problem, change, cases, and verification. However, the Scope and approval section states that maintainer sign-off is missing, while the template requires explicit approval f… Add a link to a discussion comment that explicitly approves the direction and scope. If the change qualifies for the small, focused obvious-bug exception, explain why. ✅ Passed checks (3 passed)
-
Check name Status Explanation Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. Title check ✅ Passed The title clearly summarizes the main change: background commands keep threads in the Working section.
Full details: Description check
-
Explanation
The description covers the problem, change, cases, and verification. However, the Scope and approval section states that maintainer sign-off is missing, while the template requires explicit approval for this behavior change.
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Note
Written by
gpt-6.1-solon behalf of MariaThanks for documenting the background-command case. This makes completed threads with dev servers stay in Working, changing the intentional command exception without maintainer approval. Intentional product behavior changes require prior approval. Please use discussion #15433 to agree on the intended behavior and scope before requesting reconsideration.
maria-rcks closed this
Sign in to join this conversation.


macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes