Skip to content

fix(web): first reply in a new thread shows without a reload - #27570

Closed
realies wants to merge 1 commit into
pingdotgg:mainfrom
realies:fix/draft-first-reply-hidden
Closed

realies wants to merge 1 commit into
pingdotgg:mainfrom
realies:fix/draft-first-reply-hidden

Conversation

@realies

@realies realies commented Oct 30, 2026 •

Copy link
Copy Markdown

Problem

On Windows desktop (0.1.6-nightly.20261030.3917), the first reply in a new thread never appears in the chat view. The sidebar updates and the turn completes, but the conversation shows only the user's message. Switching away and back shows "Send a message to start the conversation". Only a reload (Ctrl+R) or a restart shows the reply. Later messages in the same thread work. The reporter does not see this on macOS or Linux.

Change

useThreadLifecycle read runStopAtom(activeThreadRef) while the route was still a draft. That mounted the thread state for an id the server had not created yet. The bounded snapshot request returned thread_not_found, so makeEnvironmentThreadState marked the thread deleted and parked its subscription. The resume cache kept that state after the thread was created.

The run-stop lookup now waits for the thread shell, as ChatView already does for its own detail reads through resolveThreadDetailRef. For a server thread, activeThreadShell is never null, so the Stop control behaves the same once the thread exists.

Scope and approval

This is a small, focused fix for an obvious bug, so I didn't open an issue first. It changes one guard in one hook, with no product-behavior change. A draft has no runs to stop, so the Stop control has nothing to show before the thread exists.

Verification

Tested on Windows 11 with vp run dev (isolated home) and the Replay (dev) provider, Showcase scenario:

  1. Click New thread, type "go", press Enter.
  2. Without the fix: the server log shows threadBoundedSnapshot failing with thread_not_found about 1.6s before orchestrationV2.dispatch.threadCreate. The turn completes (the sidebar shows the generated title), but the conversation shows only "go".
  3. With the fix: the reply streams in live and stays.
Before After
before after

(The Changes count in the after shot comes from an unrelated broken git index in my local checkout. The machine name is redacted.)

vp run check:changed passes: format, lint, knip, typecheck and React compiler. No test was added. The fix is wiring in a hook with no existing test, and a ChatView browser test of the draft-to-thread handoff would need much more setup than the change. Happy to add one if you want it.

Not checked: macOS and Linux. The cause looks platform-independent, so I don't know why it only shows up on Windows. It may depend on request timing.

Fixed with Claude Opus 5.5 in Claude Code.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Oct 30, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at cf48159

Macroscope's review found this PR approvable — The run-stop subscription now waits until a new thread exists, preventing premature loading from hiding its first reply. Existing thread controls remain unchanged, and the reported Windows reproduction confirms replies appear without reloading.

You can add or adjust custom eligibility rules. Learn more.

@realies
realies force-pushed the fix/draft-first-reply-hidden branch from cf48159 to ab03ad4 Compare October 30, 2026 12:14
The run-stop lookup loaded the draft's thread before it existed. The miss
cached the thread as deleted, so the chat view never showed the reply.
Wait for the thread shell before loading it.
@realies
realies force-pushed the fix/draft-first-reply-hidden branch from ab03ad4 to 52b678f Compare October 30, 2026 12:14
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
Commits

Reviewing files that changed from the base of the PR and between cf48159 and 52b678f.

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
Commits

Reviewing files that changed from the base of the PR and between 32ecd71 and cf48159.

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

The hook now reads the run-stop atom only when both the active thread reference and thread shell are available. Otherwise, it uses NO_RUN_STOP_ATOM.

Changes: Thread lifecycle

Layer / File(s) Summary
Gate run-stop atom reads
apps/web/src/components/chat/useThreadLifecycle.tsx
The hook reads the run-stop atom when both the active thread reference and shell are available. If either is unavailable, it uses NO_RUN_STOP_ATOM.

Priority: Pending latest changes

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Possibly related issues

  • pingdotgg/t3code#27482 — Reports an empty thread view after a snapshot request precedes thread creation. The PR changes a run-stop atom read that may cause an early lookup, but does not change cache or subscription handling.
  • pingdotgg/t3code#27443 — Reports a thread history request before server creation. The PR changes an early run-stop atom read, but does not change the reported deleted-state or subscription handling.
  • pingdotgg/t3code#27527 — Reports an empty new-thread view after a draft-time snapshot request. The PR gates the run-stop atom read on shell availability; the issue also describes a background-service setup.

Possibly related PRs

  • pingdotgg/t3code#27522 — Changes the same useThreadLifecycle run-stop read to avoid requesting a reserved thread ID before the server lists it.
  • pingdotgg/t3code#25477 — Uses creation-gated thread detail lookup on mobile to avoid caching a missing thread before creation.

Suggested reviewers: juliusmarminge, macroscopeapp

Merge Risk: Minimal · previous review cf481

The change safely gates run-stop reads until the thread shell is available, so the first reply can appear without introducing a verified regression.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary fix: making the first reply in a new thread visible without requiring a reload.
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.
Description check Passed The description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the reproduction, root cause, fix, approval rationale, verification steps, screenshot…
Full details: Description check

Explanation

The description includes all required sections: Problem, Change, Scope and approval, and Verification. It explains the reproduction, root cause, fix, approval rationale, verification steps, screenshots, checks run, limitations, and agent usage.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@realies

realies commented Oct 30, 2026

Copy link
Copy Markdown
Author

Closing as a duplicate of #27522, which makes the same fix and adds a test.

For the record, this isn't Windows-only. It came in with #27252: nightly 20261029.3892 is clean and 20261030.3917 has it, on both Windows and macOS desktop. My earlier "not on macOS" was from a Mac still running 3892. On 3917 the macOS server log shows the same sequence: the draft's /threads/<id>/bounded request returns 404 before threadCreate, and nothing loads the thread until a reload.

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

Labels

size:XS 0-9 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