fix(web): new threads show the agent's output without a reload #27609
main fromrefs/pull/27609/head·opened View on GitHubProblem#
Since 0.1.6-nightly.20261030.3917, a new thread stays on "Send a message to start the conversation." after the first send, while the agent runs normally on the server. A reload shows the transcript. Fixes #27527.
Change#
#27252 added runStopAtom(activeThreadRef) to useThreadLifecycle. activeThreadRef is set for drafts, so it mounts the thread state before the thread exists: the bounded snapshot returns thread_not_found, and makeEnvironmentThreadState records the thread as deleted and parks its subscription. After thread.create, the view reads that same parked state, so nothing renders until a reload.
The hook now reads runStopAtom only once the server thread exists (activeThreadShell), the same condition ChatView's other detail reads use through resolveThreadDetailRef.
Scope and approval#
A very small, focused fix for an obvious regression: one condition in one hook. The bug is tracked in #27527, with confirmations on macOS, Windows, and Linux.
Verification#
Dev server on isolated state, Replay (dev) provider, new thread, then send:
main: the draft's/boundedrequest returns 404, there is nosubscribeThread, and the view shows only the user message (before video).- This branch: no request for the draft. After create,
/boundedreturns 200,subscribeThreadruns, and the reply streams in (after video).
vp run check:changed passes.
No automated test: this hook has no test harness, and building one (~40 inputs) for a one-condition fix seemed out of proportion. Happy to add one if you want it.
Before#
https://github.com/user-attachments/assets/f0adbe25-bd7a-464a-85f3-20d02f7144d5
After#
https://github.com/user-attachments/assets/9899a2c0-7bca-48c8-a600-cdf20f0049ca
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
No actionable comments were generated in the recent review.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 6575ce3
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2ce9f9f0-c125-43b0-a6cb-200870a82f82
Commits-
Reviewing files that changed from the base of the PR and between 6575ce32508bd7908444241f3719aa33aaf77f90 and 2612b07b14cdec35d2a49a9f59280bd9ba6b0bc6.
Files selected for processing: 1-
apps/web/src/components/chat/useThreadLifecycle.tsx
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
-
useThreadLifecyclenow selects the thread’s run-stop atom only when both the active thread reference and shell are available. Otherwise, it usesNO_RUN_STOP_ATOM.Changes: Thread lifecycle
Priority:Layer / File(s) Summary Gate the run-stop subscription
apps/web/src/components/chat/useThreadLifecycle.tsxThe run-stop subscription now requires both the active thread reference and its shell. Without either, the code uses NO_RUN_STOP_ATOM. NormalEstimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related issues
pingdotgg/t3code#27482— Reports that a draft thread can be marked missing before server creation, preventing a later subscription. This change gates the run-stop subscription until the thread shell exists.pingdotgg/t3code#27443— Reports a similar pre-creation request and missed subscription. This change prevents the run-stop read before the shell exists.
Possibly related PRs
- pingdotgg/t3code#27522: Addresses the same new-thread regression by preventing run-stop state reads through a draft reference.
- pingdotgg/t3code#27570: Uses
NO_RUN_STOP_ATOMuntil both the thread reference and shell exist. - pingdotgg/t3code#25477: Gates mobile thread detail reads until creation completes, addressing a related premature-read issue.
Suggested reviewers:
juliusmarminge,macroscopeapp
Merge Risk:
Minimal · up to2612b-
The change addresses the draft-thread subscription race without leaving an identified current-head risk.
Pre-merge checks:
4-
Check name Status Explanation Title check The title names the main change: new threads now show the agent's output without a reload. It follows the conventional commit form and matches the raw summary, which describes gating the run-stop subs… Description check The description follows the template. It covers Problem, Change, Scope and approval, and Verification, with before and after videos. It states the regression, the root cause (runStopAtom mounted for d… Linked Issues check The directly linked issue [ #27527] requires a new server-backed thread to show the user message and streaming agent output without reload. The change gates `environmentThreadDetails.runStopAtom(active…Out of Scope Changes check The pull request changes one condition and one explanatory comment in apps/web/src/components/chat/useThreadLifecycle.tsx. The change directly prevents draft thread state from being marked missing b…Full details: Title check
-
Explanation
The title names the main change: new threads now show the agent's output without a reload. It follows the conventional commit form and matches the raw summary, which describes gating the run-stop subscription on the server thread shell. The title is specific and short.
Full details: Description check
-
Explanation
The description follows the template. It covers Problem, Change, Scope and approval, and Verification, with before and after videos. It states the regression, the root cause (runStopAtom mounted for drafts before the server thread exists), and the one-condition fix. It links issue
#27527and gives macOS, Windows, and Linux confirmations. It also explains why no automated test was added. The Scope section is weaker: it relies on the issue as triage evidence but does not link a maintainer approval comment. The template asks for that approval, or for an explanation of why a small obvious fix qualifies without one. The author gives the second explanation, which covers the requirement. The verification section states what was checked and what was not. It does not name the agent or harness used, though the template asks for that only when an agent was used.
Full details: Linked Issues check
-
Explanation
The directly linked issue [
#27527] requires a new server-backed thread to show the user message and streaming agent output without reload. The change gatesenvironmentThreadDetails.runStopAtom(activeThreadRef)onactiveThreadShell, so draft threads useNO_RUN_STOP_ATOMuntil the server thread exists. The reported verification shows no draft/boundedrequest, then a successful post-create/boundedrequest,subscribeThread, and streamed output. No linked issue requires an automated test for this hook.
Full details: Out of Scope Changes check
-
Explanation
The pull request changes one condition and one explanatory comment in
apps/web/src/components/chat/useThreadLifecycle.tsx. The change directly prevents draft thread state from being marked missing beforethread.create. The reported verification andvp run check:changedsupport the focused scope. No unrelated implementation is shown.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
Note
🤖 Claude Opus 5.5 responding on behalf of Theo
Closing: this is covered by #27522, which landed. Reopen if a needed part is still missing.
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Berezhnyk(GitHub profile, opens in a new tab) approved these changes