From 20362c04eed69e50f3d9cd2946dde1c674de3888 Mon Sep 17 00:00:00 2001 From: Quickbeard Date: Fri, 14 Aug 2026 10:29:39 +0700 Subject: [PATCH] fix(app): put new sessions in Recents right away MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QueryProvider builds a fresh QueryClient on every render, and it was mounted twice: once in AppBaseProviders and again inside AppInterface's ServerShell. GlobalProvider sits above ServerShell, so ServerSync — and the home session index cache it owns — resolved the outer client, while everything under the router, the sidebar and home screen included, resolved the nested one. The index that session.created/session.updated write to therefore had no readers, and the list those events exist to keep fresh could only change when its own query refetched. In this fork that list is the persistent sidebar's Recents section, so a new session stayed missing from it until something remounted the observer — switching Code/Work and back reassigns the observer's key, which is why that looked like the fix. Work made it obvious because there is less incidental navigation there, but Code was affected the same way. Both AppInterface call sites already wrap it in AppBaseProviders, so the nested client was always redundant. Drop it: Recents now gains the row as the session is created, and picks up the generated title as soon as the model chooses one instead of waiting for the next reload. Co-Authored-By: Claude Opus 5 (1M context) --- CHANGELOG.md | 7 +++++++ DIVERGENCES.md | 1 + packages/app/src/app.tsx | 18 ++++++++++++------ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b102d67316..2b8bfa3f70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ file is the human-readable summary of what changed and why. ### Desktop / Web UI +- **New sessions show up in Recents right away** — starting a session left the + sidebar's Recents list unchanged; the session only appeared once something + made that list reload, which is why switching between Code and Work and back + brought it in. The list now updates as sessions are created, and a session's + title lands in it as soon as the model picks one instead of waiting for the + next reload. This was most obvious in Work, where there is less to nudge the + list into reloading, but Code was affected the same way. - **Windows sandboxes are now firewalled** — on macOS and Linux the sandbox guest has no network device at all, but a WSL guest shares Windows' network, so a Windows sandbox could previously reach the internet directly. The diff --git a/DIVERGENCES.md b/DIVERGENCES.md index f288ee2a19..235036704b 100644 --- a/DIVERGENCES.md +++ b/DIVERGENCES.md @@ -121,6 +121,7 @@ from the squash message first, or use a plain merge. | `packages/app/src/context/tabs.tsx` | `newDraft` inserts with `tabs.unshift(tab)` instead of `tabs.push(tab)`, so a draft opens at the head of the tab strip. Session tabs (`addSessionTab`) still append, and nothing else about draft handling changes. | A draft is where you start a session, so it belongs at the front of the strip rather than behind every session already open — with several tabs open the New session tab was scrolling off the right-hand end. | Keep the `unshift`. On conflict take upstream's `newDraft` and swap the insert back. Note the knock-on: `promoteDraft` replaces the draft **at its own index**, so a promoted session keeps the head position and sessions accumulate newest-first. That is intended — the tab you are working in should not jump across the strip the moment you send the first message — but if it is ever unwanted, move the tab in `promoteDraft` rather than reverting this, or the New session tab goes back to the end. | | `packages/app/src/pages/layout-new.tsx` (again) | Mounts the fork-only ``, which on desktop redirects one time per boot to a new-session draft (reusing an existing empty draft rather than stacking one up per launch). It pins its decision to the pathname the window came up on and disarms as soon as anything navigates, so it can never hijack a later visit to `/` — the sidebar's "View all" links there. Desktop-only: in the browser there is no "launch" distinct from "navigate to /", so redirecting would make the recents screen unreachable by URL and would break two `packages/app/e2e` specs that `goto("/")`. | Launching should put you in front of a prompt, the way Claude Desktop does, rather than on a list. This supersedes the desktop's restore-last-screen behaviour (`getLastActiveUrl`, `packages/desktop/src/renderer/index.tsx`); the previous session stays one click away in Recents and its tab is still restored. | Keep the mount. If upstream restructures this layout, re-add it. Do not "simplify" the boot-window guard into a plain `location.pathname === "/"` check — that is the bug it exists to prevent. | | `packages/app/src/pages/layout-new.tsx`, `packages/app/src/pages/home.tsx`, `packages/app/src/i18n/{en,es}.ts` | **Persistent app sidebar.** Upstream's project column is an `