GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(client-runtime): a thread stays in Working when a late background subagent finishes by juliusmarminge · Pull Request #44453 · pingdotgg/t3code

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

A thread waiting on a background subagent left the sidebar's Working section and jumped to the top of the list for a moment when that subagent finished. This happened whenever the parent's last turn had ended more than a minute earlier. The thread jumped back once the parent resumed. The inbox tracker skipped the short Working grace for any run that ended over a minute ago, a rule meant for work that finished while the client was away. It now applies that rule only to a run end the client had not already seen, so a thread the client watched the whole time keeps its grace and stays in Working.

Fixes #44436

Reproduction on main

Commit d838e95 (origin/main). Ran T3CODE_DEV_SEED=0 vp run dev in a fresh worktree (fresh database), paired the web client in the preview browser, and recorded the sidebar's text on every DOM mutation with a MutationObserver. In a Claude thread (Claude Haiku 5.5, default updated_at sort) I asked the agent to start ONE background subagent (Agent tool, run_in_background) that runs python3 -c "import time; time.sleep(80)", then end its turn. The thread sat in the Working shelf as 'Waiting' while the subagent ran. When the subagent finished, at 20:49:19.687 the sidebar showed the thread outside the Working shelf (Working header gone from above it). At 20:49:19.916, 229 ms later, it was back under Working when the parent resumed. After the parent's short reply it left Working normally after the 2 s grace (20:49:23). An earlier run where the subagents ended within seconds of the parent's turn showed no flicker: the 2 s grace covered the gap. That matches the cause: the grace is dropped only when the parent's last run ended more than 60 s before the subagent finished. Unit test on branch factory/repro-44436 (packages/client-runtime/src/state/threadInbox.test.ts, 'holds a thread whose background subagent finished long after its turn ended') fails on main: isWorking is false right after the subagent finishes.

Evidence

Real web app, fresh synthetic databases, 1280×800, light theme, default updated_at sort, Claude Haiku 5.5. Launch one real T3 background delegate running an 80-second Python sleep, end the parent turn, and observe completion/resumption after more than a minute. Base jumps out of Working and returns; head stays in Working until its final reply and normal exit grace.

Before After
d838e95660 953492615d
Thread briefly outside Working Thread remains in Working while parent resumes
Before video: jump around 4.5–5.5s After video

Exact delegation driver, DOM observer, environment, steps and caveats.

Scope: this proves the T3 delegated-background-subagent path. Native Claude Agent-only runs did not reproduce the flicker on base.

Not shown:

  • The exact native Claude Agent run_in_background path described in the report did not flicker on base in this session; the positive comparison uses real T3 delegate_task background subagents instead.
  • Synthetic history differed: base had two collapsed settled exploration threads and head had one. On head Claude also launched a placeholder native agent that finished before the parent's initial turn ended; exactly one intended delegate remained pending during the long wait.

Tests

  • vp test run src/state/threadInbox.test.ts (packages/client-runtime) without the fix: 1 failed, 23 passed (the repro test)
  • vp test run src/state/threadInbox.test.ts with the fix: 24 passed
  • vp test run packages/client-runtime/src/state/entities.test.ts packages/client-runtime/src/state/threadShell.test.ts apps/mobile/src/features/threads/threadListV2.test.ts: 105 passed
  • vp run check:changed: format, lint, knip, typecheck and test all pass
  • CI on 9534926: all 39 checks pass

Not in this change

  • STALE_EXIT_MS and WORKING_EXIT_GRACE_MS values are unchanged.
  • If a subagent finishes while the client is disconnected and the tracker is not reset, the thread is held for the 2 s grace instead of moving at once; left as is.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
juliusmarminge and others added 2 commits November 27, 2026 20:50
@juliusmarminge @claude
test(client-runtime): a thread stays in Working while its parent resu…
f29f026
…mes after a late subagent

Fails on main: the stale-exit rule drops the working grace once the
parent's last run is older than a minute, so the thread briefly leaves
Working when a long background subagent finishes (#44436).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge @claude
fix(client-runtime): a thread stays in Working when a late background…
9534926
… subagent finishes

The stale-exit rule skipped the working grace whenever the latest run
ended more than a minute ago. A parent waiting on background subagents
has exactly that run, so when a long subagent finished the thread left
Working and jumped to the top until the parent resumed. The tracker now
remembers the run end it last saw and only treats an end it had not seen
before as stale, which is the case the rule was for (work that finished
while the client was away).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 27, 2026
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The inbox return tracker now stores each thread’s latest run completion timestamp. It treats an old completion as stale only when its timestamp differs from the previously observed one. A test checks that a thread waiting on a subagent remains working after a delay.

Changes: Thread inbox return tracking

Layer / File(s) Summary
Preserve working state after delayed completion
packages/client-runtime/src/state/threadInbox.ts, packages/client-runtime/src/state/threadInbox.test.ts
The tracker stores the latest run completion timestamp and checks it when deciding whether an old completion is stale. The test verifies that the thread remains working and returnedAt stays unset after a delay.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: Minimal · up to 95349

This change keeps a thread in Working when a background subagent finishes after the parent run ended earlier. The change is small and has a test for the reported scenario. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the affected component and the user-visible bug: a thread stays in Working when a late background subagent finishes. The summary matches the changeset, which changes the inbox tracker'…
Linked Issues check Passed Issue #44436 requires that a thread stay in Working while its parent resumes after a background subagent finishes, when the parent turn ended more than 60 s earlier. The cause is the endedLongAgo chec…
Out of Scope Changes check Passed The whole-PR diff against merge base d838e95 changes only packages/client-runtime/src/state/threadInbox.ts and threadInbox.test.ts. The threadInbox.ts change adds an endedAt field to the tracker stat…
Description check Passed The description follows the repository template closely. It covers the problem (a thread waiting on a background subagent jumps out of the Working section when the subagent finishes after a parent run…
Full details: Title check

Explanation

The title names the affected component and the user-visible bug: a thread stays in Working when a late background subagent finishes. The summary matches the changeset, which changes the inbox tracker's stale-exit rule so a run end the client already saw keeps the Working grace.

Full details: Linked Issues check

Explanation

Issue #44436 requires that a thread stay in Working while its parent resumes after a background subagent finishes, when the parent turn ended more than 60 s earlier. The cause is the endedLongAgo check in threadInbox.ts, which skips the 2 s WORKING_EXIT_GRACE_MS. At head, endedLongAgo also requires previous?.endedAt !== endedAt. The tracker now stores endedAt per thread. A run end the client already observed while the thread kept working therefore keeps the grace. The new unit test in threadInbox.test.ts ('holds a thread whose background subagent finished long after its turn ended') covers this path: the thread is observed working, time advances 80+ s, the subagent completes with the same completedAt, and isWorking stays true with no returnedAt. A run end the client first sees already stale still moves the thread at once, which matches the STALE_EXIT_MS intent. The real-app before/after evidence is still pending in the PR description. That evidence is not a coding requirement, so it does not change this result. The disconnected-client case is an explicit known limitation in the PR and the issue does not require it.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against merge base d838e95 changes only packages/client-runtime/src/state/threadInbox.ts and threadInbox.test.ts. The threadInbox.ts change adds an endedAt field to the tracker state and a condition on endedLongAgo. Both directly implement the #44436 fix. The test adds one regression case for the same scenario. The PR does not change STALE_EXIT_MS or WORKING_EXIT_GRACE_MS, and it adds no unrelated refactoring. No out-of-scope change was found.

Full details: Description check

Explanation

The description follows the repository template closely. It covers the problem (a thread waiting on a background subagent jumps out of the Working section when the subagent finishes after a parent run ended over a minute earlier), the change (the stale-exit rule now applies only to a run end the client had not already seen), and the scope (it links issue #44436 and describes a bug fix). Verification is detailed: focused test results with and without the fix, a real-app reproduction with before/after evidence, and CI status. It also states what was not checked and includes the model and harness used. Minor gaps: the 'Scope' section does not say why the change needs no separate issue, but a linked issue is provided. The 'Evidence' section admits the native Claude path was not reproduced, which narrows the claim but is disclosed honestly. The 'Change' section is brief but adequate for a focused fix. The Problem heading is present, and the title line is absent from the body, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: pingdotgg/t3code
  • Branch: factory/issue-44436
  • File: .coderabbit.config.ts
  • Commit: 9534926
  • Layers: Repository TS config
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 21af71f0-edca-4b61-a17d-83e2ad908739
Commits

Reviewing files that changed from the base of the PR and between 9c6faa6 and 9534926.

Files selected for processing: 2

  • 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; 0 remain after this review.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge
juliusmarminge merged commit 76e38ee into main Nov 27, 2026
40 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge
juliusmarminge deleted the factory/issue-44436 branch November 27, 2026 21:22
@github-actions github-actions Bot mentioned this pull request Nov 27, 2026
Upstream fixes (2026-11-27) Ryoku-dev/hyakki#13
Closed
github-actions Bot pushed a commit to Ryoku-dev/hyakki that referenced this pull request Nov 27, 2026
@juliusmarminge @github-actions
fix(client-runtime): a thread stays in Working when a late background…
241eb0a
… subagent finishes (pingdotgg#44453)

(cherry picked from commit 76e38ee)
aorwall added a commit to aorwall/t3code that referenced this pull request Nov 28, 2026
@aorwall
chore: merge upstream t3code to 85d855b (pingdotgg#310)
a986b52
This merges upstream `pingdotgg/t3code` at `85d855bd82` (base
`3ed650f999`, 683 commits) with a merge commit. It is not stacked: no
other merge PR was open. The decisions are recorded under the 2026-11-28
entry in `docs/fork/upstream-merge-log.md`.

## Numbers
- Landed `1576` files, and the upstream range is `1576` files. They
match exactly.
- The fork delta is `789` files (`git diff HEAD^2 HEAD`).
- 10 conflicts, all resolved by their path-policy verdict. 60 files
auto-merged, and `duplicate-adds` and `resolution-check` are clean.

## Conflict resolutions
- **`ChatMarkdown.tsx`**: takes upstream's `useFileDownload` and keeps
the `FEATURES.openInEditor` gate.
- **`ChatView.tsx`**: `ChatRightPanel` takes upstream's `ref` and keeps
the fork's `threadRef`.
- **`Sidebar.tsx`, `useThreadActionMenu.ts` and its test**: take
upstream's `canMarkLatestRunUnread` and keep `isPublic` and
`isFollowed`.
- **`ThreadDetailsPanel.tsx`**: the Artifacts section stays after
lineage, and upstream's new Agent tasks section comes after it.
- **`FilePreviewPanel.tsx`**: takes upstream's positioned
`useFileLineReveal` and keeps `browserFrameRevision`.
- **`PreviewView.tsx`**: imports both helpers.
- **`agentContextBudget.json`**: upstream plus 108 bytes (`62578`).
`AgentContextBudget.test.ts` passes.
- **`reviewCommentSelection.test.ts`** (`theirs`): the fork's cosmetic
rename of a test title is dropped.
- **Lockfile**: taken from upstream and re-installed, which restores the
fork's edges. `verify --only lockfile` passes.

## Fixes after resolving
These were caught by typecheck and tests, not by conflict markers:
- **`sandboxControl.placement.test.tsx`** passes upstream's new required
`onCloseSelectedSurfaces` prop.
- **`rightPanelStore.ts` `retargetFile`** uses upstream's module-wide
`++lastFileRevealRequestId` (pingdotgg#44374) rather than `revealRequestId + 1`,
which could reuse another surface's id. Its tests now compare ids
relative to each other.
- **`ChatView.browser.test.tsx`**: upstream's pingdotgg#43920 case now expects
"Sandbox required", because a draft has no sandbox. The file joined
`upstream-tests-fork-assumptions` in the inventory.

## Verification
- **Static checks:** duplicate-adds, tripwires, resolution-check,
unsupported-methods, lockfile, fmt, lint, typecheck and build all pass.
- **`@t3tools/web`:** 738 of 738 test files pass. This used
`PLAYWRIGHT_BROWSERS_PATH` with a fetched headless shell 1248, because
the image now ships 1255.
- **Known sandbox failures:**
- ssh `tunnel` and opencode `OpenCodeServerLedger` fail as on the last
merge.
- `t3` fails, and `verify` marks it as the `/tmp` sticky-bit gap. The
files that fail alone are the same set as 2026-11-26, plus
`processRunner.test.ts`. That one fails inside upstream's new spawn
proxy, and the file is not in the fork delta.
- **Commit:** made with `--no-verify` because of the known knip
pre-commit failure.

## Feature classification

### Usable as-is
- Open project imports from Projects settings (pingdotgg#44662).
- Copy chat tables as text or PNG (pingdotgg#44055, pingdotgg#43435).
- Rendered markdown preview from the file tree (pingdotgg#30027).
- Multi-select side-panel tabs (pingdotgg#43946).
- Copy paths from the file sidebar (pingdotgg#43360).
- Sidebar folder Show more and Show less (pingdotgg#43598).
- Agent tasks section in Thread details (pingdotgg#29705).
- Previews keep their place across files and tabs (pingdotgg#44374, pingdotgg#44517).
- EPUB, ODT, RTF, Word, CSV and archive preview fixes.
- Command-label rendering fixes (pingdotgg#43626).
- Shortcuts on non-Latin layouts (pingdotgg#44275).
- About 40 i18n fixes.
- Password-protected previews (pingdotgg#44008). These unlock on the client but
still need the file bytes from the backend.

### Unsupported in Moatless / needs implementation
- **Download file** from the Files panel and chat links (pingdotgg#43833,
`useFileDownload.ts`). It calls `assets.createUrl` with
`draft-workspace-file` and `disposition: "attachment"`. Moatless
`crates/t3code/src/assets.rs` `create_url` refuses that tag, so every
click shows a "Could not download file" toast. This is new in `gaps.md`:
*Download file asks for an asset resource Moatless refuses*.
- **Jira Cloud and Jira Service Management trackers** (pingdotgg#38003, pingdotgg#39942).
They add `credential.fields`, the `commentAudiences` and
`assigneeSearch` capabilities, and the `refresh` and `query` inputs.
Connecting stays refused, so nothing new shows. Extends the existing
Issue trackers item.
- **Usage-limits-only refresh** (`limitsOnly`, `unreadProviders`,
pingdotgg#41726), with no Moatless producer.
- **Remote `localhost` links through a port forward** (pingdotgg#44452).
- **Built-in browser HTTP Basic Auth** (`authChallengeId`, pingdotgg#35046).
- **Subagent environment display** (pingdotgg#44393).
- **Optional contract fields with no Moatless producer:**
  - `ProviderStatus.modelsIncomplete`
  - `PullRequest.host` and `changedFiles`
  - project link `readOnly`
  - `createdBranch`
  - orchestrator `favorite`
- No RPC method was added, so `unsupported-methods` reports no ADD and
no DROP.

### Backend behavior to consider reproducing in Moatless
This is recorded as a new range bullet under *Runtime fixes upstream
made to its own server* in `gaps.md`:
- **Settlement and worktrees:**
- Settle scripts are serialized, and shared worktrees skip them (pingdotgg#44363,
pingdotgg#44491).
  - A successful settle closes its script terminal (pingdotgg#44351).
  - Settling a delivered delegated child archives it (pingdotgg#44615).
  - A partially deleted worktree stays removable (pingdotgg#44406).
- **Child and background work:**
  - Delegated completions wake the thread's own session (pingdotgg#44637).
  - `task_cancel` also cancels queued follow-ups (pingdotgg#44560).
  - A thread stays Working until a late subagent finishes (pingdotgg#44453).
  - A Monitor-woken child is not cut off (pingdotgg#43899).
- **Titles and launches:**
  - Titles stop at the first line break (pingdotgg#44597).
  - A title the provider refused is not retried (pingdotgg#44057).
  - A blank `t3_thread_launch` starts no turn (pingdotgg#44467).
  - A pre-launch message no longer strands the run (pingdotgg#44133).
- **Provider sessions:**
  - Idle threads detach from shared sessions (pingdotgg#44020).
  - `/compact` and handoff token caps (pingdotgg#44295, pingdotgg#43868).
- **Read paths:**
  - Shared thread reads for PR sweeps (pingdotgg#44369, pingdotgg#44341).
  - Filtered turn-item reads (pingdotgg#43981, pingdotgg#43549).
  - Limited rescans (pingdotgg#43969).
  - Checkpoints skip nested checkouts (pingdotgg#43744).
  - PR watches with no required checks (pingdotgg#42787).

## Owned-concern sweep
There were 3 hits: mobile app-state wakeups, the server issue tracker
host and Cursor Origin lookup. All three are upstream's own and were
taken. No new upstream workflows arrived.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---
Moatless task:
https://moatless.soaplabstest.com/tasks/1fcda118-593a-4d92-9b13-dc7667eabe2c
@omegent-app omegent-app Bot mentioned this pull request Nov 28, 2026
Merge upstream main through 0f78747290a1 patroza/t3code#688
Merged
@Qd99 Qd99 mentioned this pull request Nov 28, 2026
[需求·待评审][HUB-OBS-001] 统一工作流身份、事件采集与全链路 Trace 关联 Qd99/self-healing-agent-hub#12
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Bug]: Thread briefly jumps to the top of the sidebar (out of Working) each time a background subagent finishes

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@juliusmarminge
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.