Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): a thread opened from search stays recent after a lost connection #48071

ClosedStiensWout(GitHub profile, opens in a new tab)wants to merge 5 commits intomain fromrefs/pull/48071/headopened View on GitHub

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

  1. Open a thread in a project with an older thread and a more recently updated thread.
  2. Open the command palette.
  3. Search for the older thread.
  4. Select it as the app briefly loses its connection.
  5. Wait for the older thread to load after reconnecting.
  6. Open the original thread in a fresh tab.
  7. Open the command palette in that tab.
  8. 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.

BeforeAfter
Commit52e0f895de50ede37b29
ResultASSERTION_FAILED: expect.toContainText failedpassed
recent threads after reconnectingBefore: recent threads after reconnecting Before: recent threads after reconnecting (changed region)
The more recently edited thread still appears first.
After: recent threads after reconnecting After: recent threads after reconnecting (changed region)
The older thread appears above the more recently edited thread because you just opened it.
failureBefore: failure
RecordingBefore: recordingAfter: recording

Tests

  • 52e0f895de adds the failing test, alone, before the fix.
  • pnpm exec vp run check:changed 0633351a6523687a961e717b93052ed2d011e7aa passed on head.

Not in this change

  • The first commit's title still says fix(web), but the final fix is in packages/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/vitest suite in packages/client-runtime fails to load ("Cannot read properties of undefined (reading 'config')"), and that happens on the unmodified head too. So the new commands.test.ts row 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. Pushed2ab726d

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

    3. juliusmarminge closed this

    4. juliusmarminge removed labelstakeover:in-progress

    5. juliusmarminge added labelstakeover:blocked

Sign in to join this conversation.