Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

ClosedBeLazy167(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromrefs/pull/15413/headopened View on GitHub

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)
beforeafter

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 turnBeforeAfter
commandinboxWorking
subagent, monitor, background_taskWorkingWorking
any, with a failed runinboxinbox
any, with an approval, question, or ready planinboxinbox
Grok persistent monitor (filtered out of the roster)inboxinbox

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: 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 labelsvouch:unvouched

    2. 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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      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 0c8112013760617230d382e55447ddb75627a997 and b344d7a4310cbd31c6972aa2bb91ac320e7fc002.

      📒 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

      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 nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring 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⚠️ WarningThe 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 nameStatusExplanation
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Title check✅ PassedThe 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.
    4. Note

      Written by gpt-6.1-sol on behalf of Maria

      Thanks 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.

    5. maria-rcks closed this

Sign in to join this conversation.