Repository navigation
fix(web): Reopen Closed Tab finds tabs of older settled threads - #49321
Conversation
Scenario for #49308. Fails on main: after a fresh shell snapshot leaves the older settled owner out, the shortcut skips its closed tab and does nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shortcut took an owner missing from the client shell as gone, but a fresh shell snapshot leaves older settled threads out. Before restoring an entry whose owner the shell does not list, read the thread's family from the server (as the thread route does) and use its row for the owner's project. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
||
| type OwnerFamilies = ReadonlyMap<string, OrchestrationV2ThreadFamily | null>; | ||
| const familyRow = (families: OwnerFamilies, ref: ScopedThreadRef) => | ||
| families.get(scopedThreadKey(ref))?.threads.find((row) => row.id === ref.threadId) ?? null; |
There was a problem hiding this comment.
🟡 Medium components/ReopenClosedViewShortcut.tsx:118
After a thread is archived or deleted, familyRow can still return its cached row, causing planReopen to restore and consume the closed entry before navigating to a nonexistent thread instead of skipping to the next valid entry. Unlike readThreadShell, this lookup does not validate the row against shell removals; apply the removedAt/snapshotSequence check before accepting it.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/web/src/components/ReopenClosedViewShortcut.tsx around line 118:
After a thread is archived or deleted, `familyRow` can still return its cached row, causing `planReopen` to restore and consume the closed entry before navigating to a nonexistent thread instead of skipping to the next valid entry. Unlike `readThreadShell`, this lookup does not validate the row against shell removals; apply the `removedAt`/`snapshotSequence` check before accepting it.
ApprovabilityVerdict: Would Approve Macroscope's review found this PR approvable — The shortcut now looks up older settled threads before reopening their closed views. Exposure is limited to user-triggered restoration; the reported stale-cache issue remains covered by the separate correctness gate. Needs human approval because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
Merges upstream `pingdotgg/t3code` `28a4a03a51..b1f4a74` (545 commits) into the fork. It stacks on nothing, because no merge PR was open. The tracker entry in `docs/fork/upstream-merge-log.md` (2026-12-06) has the full record. ## Numbers - **Landed:** 4562 files, against 4562 in the upstream range. - Three upstream files did not land. `cli/pair.ts`, its test and `useDiscoveredLocalServers.test.ts` are `deletedUpstreamPaths`, so they stay deleted. - Three extra files landed: `fork/features.ts`, `gaps.md` and `inventory.json`. - **Fork delta:** 799 files. ## Resolution - **Stale inventory entries:** preflight found two. Both named browser tests that upstream deleted in pingdotgg#49319 ("delete 21k low-value tests"). I took the deletions and dropped those paths from the two entries. - **Conflicts:** 38, each resolved by its inventory verdict. Most were pingdotgg#49319 deleting upstream tests the fork had adapted: I took the deletion and kept the fork-authored cases. - **Sidebar filter moved:** upstream moved the sidebar filter and partition into client-runtime's `state/threadList.ts`. The fork's thread-list rule moved there with it: - A Moatless child task stays listed beside its parent. - A pinned thread is never settled. - Mobile now follows this rule too. Upstream's mobile `threadListV2.test.ts` subagent case now builds a `provider` child. - **Fixes the merge needed after resolution:** - `PendingBackgroundWorkTurnItem.origin` is widened to `unknown`, because pingdotgg#49240's `string` rejects the fork's message-origin object. - Upstream's new `apps/mobile-nitro` client reads `.terminals` off the fork's `TerminalMetadataState`. - `Sidebar.logic.ts` re-imports `threadEntityKey`. - `SETTINGS_SEARCH_ITEMS` is re-exported for `fork/features.test.ts`. - **Unsupported methods:** the ADD bucket was applied. `UnsupportedMethodError` is now on `mcpGateway.servers`, `mcpGateway.serverIcons`, `mcpGateway.signIn.start`, `mcpGateway.signIn.complete`, `mcpGateway.signOut` and `tools.agentMcpServers`. The DROP bucket was empty. - **Commit hook:** the commit used `--no-verify`. The knip pre-commit failure is the known gap, and it now reports 27 exports. ## Verification The parallel test pass got the pod evicted, so I re-ran with `verify.mjs --sequential`. - **Checks:** duplicate adds, tripwires, resolution check, unsupported methods, lockfile, fmt, lint, typecheck and build pass. `i18n-check` matches. - **Tests:** 41 packages ran. - **`@t3tools/mobile`:** `threadListV2.test.ts` failed. I fixed it as described above, and the package then passed on its own. - **`@t3tools/web`:** `ChatView.browser.test.tsx`, which is identical to upstream, failed inside the package run and passed alone. - **Still failing:** only sandbox gaps already in `docs/fork/gaps.md`. In `@t3tools/shared` that is `AgentScope`. In `t3` it is `Orchestrator.control-reads`/`ProjectionStore`, `ServerBrowser`, `CodexChatGptAuth`/`CodexManagedRuntime`, `ClaudeTextGeneration`, `GitVcsDriver` and `GitVcsDriverCore`. ## After merging Upstream's new workflow `.github/workflows/mobile-nitro-cd.yml` will arrive enabled. Disable it once this lands: ``` gh workflow disable mobile-nitro-cd.yml --repo soaplabs/t3code ``` ## Usable as-is - **Sidebar navigation:** entries use a dropdown menu (pingdotgg#49332), entries can be hidden (pingdotgg#45136), and a `SidebarNavigationSettings` device preference. - **Sending:** Cmd+Enter sends and moves to the next thread (pingdotgg#49032). Shortcut, IME and CapsLock fixes. - **Chat draft:** - Previewed files can be added to the draft (`onAttachFile`, pingdotgg#47797). - Unsent text survives a reconnect or a pending send (pingdotgg#49203, pingdotgg#49603). - A custom answer's attachments are set aside with it (pingdotgg#49355). - **File preview:** - A dedicated code viewer (pingdotgg#49341). - Oversized files can be loaded (pingdotgg#49470). - Fixes for document, notebook and spreadsheet previews. - Undo no longer reverts an agent's edit on disk (pingdotgg#49179). - **Lists:** - Rows no longer scroll on hover. - Reopen Closed Tab finds older tabs (pingdotgg#49321). - Undo archive reopens the thread (pingdotgg#49103). - **Appearance and links:** - Appearance Contrast (pingdotgg#49225). - Theme colour validation (pingdotgg#48977). - Localized usage percentages (pingdotgg#49039). - `t3code://new` links for Bitbucket and other hosts (pingdotgg#48612). - **Not fork targets:** the new `apps/mobile-nitro` client arrives (pingdotgg#49141), but it does not ship from this fork. Desktop and marketing commits are not fork targets either. ## Unsupported in Moatless / needs implementation - **MCP gateway and the Tools settings page (pingdotgg#47943, pingdotgg#47948):** the methods listed above, backed by `apps/server/src/mcp/McpGateway.ts` and `McpClientOAuth.ts`. - In the fork, the Labs `McpGatewayRow` sits behind `FEATURES.serverBehaviorSettings` and `mcp-gateway-beta` is gated in settings search. - `/settings/tools` stays hidden by upstream's `useHasMcpGatewayEnvironment`, because Moatless never sends `mcpGatewayEnabled`. - Recorded in `gaps.md` → "Methods the backend does not dispatch". - **Workflows:** upstream turned workflows into a single workspace (pingdotgg#48616). It stays hidden while Moatless does not report `workflowsEnabled`. - **Goal line:** it shows only the controls the server accepts (pingdotgg#48744), which needs capability reporting. - **T3 Connect, SSH and pairing fixes:** pingdotgg#49266, pingdotgg#49166, pingdotgg#46604, pingdotgg#49678 and pingdotgg#49261 have nothing to talk to in Moatless. ## Backend behavior to consider reproducing in Moatless All of these are recorded in `gaps.md` → "Runtime fixes upstream made to its own server". - **Settlement:** - An unsettle in the same turn cancels a pending self-settle (pingdotgg#49379). - A settle action still runs after a restart or terminal close (pingdotgg#48910, pingdotgg#49061). - A thread on a reused branch with a new PR does not auto-settle (pingdotgg#49347). - A PR watch reports a pass once per head (pingdotgg#49395). - **Lifecycle:** - Idle cleanup no longer kills background work after four hours (pingdotgg#49438). - Idle resumable sessions are released after two minutes (pingdotgg#49083). - Stop no longer waits behind a held steer (pingdotgg#49180). - Force stop finishes when the target run settles (pingdotgg#49486). - **Scheduled tasks:** - A one-time task that never sent survives a restart (pingdotgg#49223). - An interrupted fixed-time task keeps its slot (pingdotgg#49417). - **Git:** - Passive status reads are isolated (pingdotgg#49270). - Background fetches are bounded (pingdotgg#49648). - Branch switches are refused while a thread works (pingdotgg#49294). - A rejected commit keeps what was staged (pingdotgg#48959). - Earlier turn diffs no longer show later edits (pingdotgg#49246). - **Delegated tasks:** listed by the id `task_status` takes (pingdotgg#49240). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- Moatless task: https://moatless.soaplabstest.com/tasks/87efbf21-0020-4f58-8617-677e58ccc844
Pressing Ctrl+Shift+T (Cmd+Shift+T on macOS) skipped a closed tab whose thread was an older settled one that the app no longer had loaded, for example after a reload from a fresh snapshot. Nothing happened, or an older tab from another thread reopened instead. The shortcut now asks the server whether that thread still exists, the same way opening such a thread does. If it does, the shortcut reopens the tab and goes back to the thread.
Fixes #49308
Reproduction on main
Commit origin/main ba27fdc, web dev stack started by the repo's e2e scenario runner (fresh database, Replay (dev) agent). Steps: create project 'demo'; create thread 'Ancient design notes' plus 25 newer threads; settle all of them over RPC (thread.settle), the old one first. Open the old thread, open the right panel, open Files, close Files. Open 'Newer 25'. Press Ctrl+Shift+T.
Result 1, the reporter's exact steps: NOT reproduced. Opening the old thread records a visit. The shell delta for that visit puts the row into the client's live shell state and its IndexedDB shell cache. The row stays there after you navigate away and even after a page reload, which resumes from the cache. I added temporary instrumentation in planReopen, and it showed owner=true, so the tab reopened correctly.
Result 2, reproduced: same steps, but the 't3code:connection-runtime' IndexedDB 'shell' store is cleared before reloading on 'Newer 25'. This stands in for the client's 12-hour CACHE_RESUME_MAX_AGE_MILLIS limit or a server build change, either of which makes the client take a fresh HTTP snapshot. The fresh snapshot leaves the old thread out, and probing readThreadShells confirmed it is absent. Closed-tab history is persisted in localStorage, so the entry survives. On Ctrl+Shift+T the instrumentation showed owner=false, shell status 'live', plan {restore:null, drop:0}. Nothing happened: the view stayed on 'Newer 25' with no Files tab and no navigation. The entry is kept but can never be restored until the thread is loaded again; a newer reopenable entry behind it would be reopened instead. The scenario scripts/scenarios/reopen-closed-tab-finds-older-settled-thread.e2e.ts on factory/repro-49308 encodes result 2 and fails on main with 'expect.toBeVisible failed'.
Evidence
Create project “demo”, “Ancient design notes”, and 25 newer threads with Replay (dev). Settle all 26 over RPC, the ancient thread first. Open the ancient thread, open the right panel and Files, then close Files. Open “Newer 25”, clear only the IndexedDB connection-runtime shell store, and reload to force a fresh shell snapshot while preserving closed-tab history. Press Ctrl+Shift+T.
Environment on both sides: real web dev stack, Chromium, 1280×800, light theme, separate fresh databases, Replay (dev).
Scenario: Reopen Closed Tab returns to a tab of an older settled thread
Proven: the scenario fails on base ba27fdc71a and passes on head bae52905a5.
ASSERTION_FAILED: expect.toBeVisible failed
locator: getByText("Ancient work")
expected: visible
observed: no node (match count 0)
Scenario source
Not shown:
Tests
vp run scenarios scenarios/reopen-closed-tab-finds-older-settled-thread.e2e.ts(fromscripts/): fails without the fix (expect.toBeVisible failed), passes with itvp test run src/reopenClosedView.test.ts(apps/web): 19 passedvp test run src/components/ReopenClosedViewShortcut.browser.test.tsx(apps/web): 21 passedvp run typecheck(apps/web): passvp run check:changed: all pass (format, lint, knip, i18n, typecheck, test, react compiler)Not in this change
Who did the work
Run by the t3code factory in T3 Code.