fix(web): a thread opened from search stays recent after a lost connection #48071
main fromrefs/pull/48071/head·opened View on GitHubPicking a thread from command palette search sends an open that carries the search query, and the thread view skips its own open. When the connection dropped at that moment, the open was lost, so refreshed tabs and other clients did not put the thread at the top of Recent Threads. A query-bearing visit now resends with the same command id once the connection returns, as message sends already do. The server's command receipt keeps the resend from counting the pick twice, and the resend no longer depends on the thread view staying mounted.
Related: #47191
Reproduction on main#
Commit fc65ae0380 (main). The more recently edited thread still appears first. Expected: The older thread appears above the more recently edited thread because you just opened it.
- Open a thread in a project with an older thread and a more recently updated thread.
- Open the command palette.
- Search for the older thread.
- Select it as the app briefly loses its connection.
- Wait for the older thread to load after reconnecting.
- Open the original thread in a fresh tab.
- Open the command palette in that tab.
- Scroll to Recent Threads.
The cause is at apps/web/src/components/CommandPaletteThreadItems.tsx:217. Ran pnpm scenarios:prove scripts/scenarios/thread-search-open-survives-a-lost-connection.e2e.ts --target web with the repro scenario added: it failed in 2 of 2 runs on a clean checkout, with expect.toContainText failed in the output.
Evidence#
Environment: The web app in Chromium on Linux x64, a fresh checkout.
Proven: the repro fails at the test commit 52e0f895de and passes on the head 50ede37b29, both on main 0633351a65.
| Before | After | |
|---|---|---|
| Commit | 52e0f895de | 50ede37b29 |
| Result | ASSERTION_FAILED: expect.toContainText failed | passed |
| recent threads after reconnecting | ![]() The more recently edited thread still appears first. | ![]() The older thread appears above the more recently edited thread because you just opened it. |
| failure | ![]() | |
| Recording | Before: recording | After: recording |
Tests#
- 52e0f895de adds the failing test, alone, before the fix.
pnpm exec vp run check:changed 0633351a6523687a961e717b93052ed2d011e7aapassed on head.
Not in this change#
- The first commit's title still says
fix(web), but the final fix is inpackages/client-runtime(visitThread). The palette code ends up unchanged from main. - Plain opens without a search query (sidebar, links) are still not resent after a lost socket. The thread view retries those on its own path.
- If the host stays unreachable past reconnect backoff, the resend gives up and the pick is dropped, the same as a lost message send.
- Locally, every
@effect/vitestsuite inpackages/client-runtimefails to load ("Cannot read properties of undefined (reading 'config')"), and that happens on the unmodified head too. So the newcommands.test.tsrow was type-checked but not run here.
Who did the work#
- Repro written by GPT 6.2 Sol, in Codex
- Duplicate check judged by Claude Opus 5.5, in Claude Code
- Written by Claude Opus 5.5, in Claude Code
- Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex
- Reproduction, checks and proof run by a program on base and head, not by an agent
Made in T3 Code by GPT 6.2 Sol and Claude Opus 5.5
- 1
- 2
Pushed2ab726d
juliusmarminge closed this
juliusmarminge removed labelstakeover:in-progress
juliusmarminge added labelstakeover:blocked
Sign in to join this conversation.





The automated pipeline ran the reported steps in the real app without this change, and the problem did not appear. So it cannot show that this change fixes anything.
What was run on
71217d7188, the commit before this change:Created Newer notes and Older notes. Opened Newer notes, armed an injected WebSocket close on the next thread.visit, opened Command Palette with Ctrl+K, searched for Older notes and selected it, waited for Older to render, captured the result, reloaded the page to establish a fresh connection, reopened the palette, and checked Older notes in Recent Threads. Ran identically on base and head.
How: Scenario runner web surface with Replay (dev), fresh seeded project and two synthetic threads, Chromium browser, WebSocket close injected immediately after the thread.visit send, then reload and command palette inspection.
Closing this pull request. If you can share the exact steps, what you see, and the version and platform you are on, it can be reopened.