Skip to content

fix(client-runtime): background commands keep threads in Working - #15413

Open
BeLazy167 wants to merge 2 commits into
pingdotgg:mainfrom
BeLazy167:fix/sidebar-background-working
Open

BeLazy167 wants to merge 2 commits into
pingdotgg:mainfrom
BeLazy167:fix/sidebar-background-working

Conversation

@BeLazy167

@BeLazy167 BeLazy167 commented Oct 4, 2026 •

Copy link
Copy Markdown

When 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)
before after

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)

during turn

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 typecheck passes in packages/client-runtime, apps/web, and apps/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: #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.

@github-actions github-actions Bot added size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Oct 4, 2026
@BeLazy167
BeLazy167 marked this pull request as draft October 4, 2026 01:13
@macroscopeapp

macroscopeapp Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at c5a2dfe

Macroscope'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.

@BeLazy167
BeLazy167 marked this pull request as ready for review October 4, 2026 02:19
@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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_status to false in 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 0c81120 and b344d7a.

📒 Files selected for processing (3)
  • apps/web/src/components/Sidebar.logic.test.ts
  • packages/client-runtime/src/state/threadInbox.test.ts
  • packages/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

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.ts
WorkingThreadInput includes pendingBackgroundTasks. 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.ts
Tests 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

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant