From 93ac4f495eb1df045e3ababe92280b0144311b45 Mon Sep 17 00:00:00 2001 From: Guilhem Lemouel Date: Tue, 13 Oct 2026 07:42:21 -0700 Subject: [PATCH] fix: hand a proposal only to the page the reader is looking at MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Re-pointing a tab reloads it and rebuilds its url. On a tab that is not on screen that silently drops whatever had been typed into its form and leaves the call on a page the reader cannot see, while the card folds because the call is carried — so the run is confirmable on neither surface in view. Declining instead leaves it on the card, which can run it. The automatic path therefore requires the matching tab to be the active one in an open panel, alongside the existing version-pin check, and the three ways of being busy read as one condition. An explicit Preview press still re-points, reveals and unpins, which is what pressing it asks for. Co-Authored-By: Claude Opus 5 (1M context) --- .../sessions/sessionRuntime.svelte.ts | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/frontend/src/lib/components/sessions/sessionRuntime.svelte.ts b/frontend/src/lib/components/sessions/sessionRuntime.svelte.ts index 08c710f9cc..41cd28401b 100644 --- a/frontend/src/lib/components/sessions/sessionRuntime.svelte.ts +++ b/frontend/src/lib/components/sessions/sessionRuntime.svelte.ts @@ -666,22 +666,26 @@ function createRuntime(session: Session): SessionRuntime { return slot.kind === 'viewer' && slot.viewerKind === kind && slot.path === path }) if (open) { - // A tab pinned to a version is one the reader put somewhere deliberately, and - // `navigate` below rebuilds its url without the pin. Worth it when the reader asked - // for this page; not worth silently moving them off a version they chose, so an - // unasked-for hand-off declines and leaves the call on the card. - if (onlyIfAlreadyOpen && new URL(open.url, 'http://x').searchParams.get('version')) { + // An unasked-for hand-off goes only to the page the reader already has in front of + // them. `navigate` below re-points the tab, which reloads it and rebuilds its url: + // on a tab they cannot see that silently drops whatever they had typed into its + // form and leaves the call on an off-screen page, and on a pinned one it moves them + // off the version they chose. Declining leaves the call on the card, which can run + // it. A reader who presses Preview is asking for all of that. + if ( + onlyIfAlreadyOpen && + (previewTabs.activeId !== open.id || + previewTabs.collapsed || + new URL(open.url, 'http://x').searchParams.get('version')) + ) { return false } previewTabs.navigate(viewTarget, open.id) // `navigate` re-points a tab in place and nothing more, while the call is about to // tell the reader the page is open. `open` would have brought it forward and shown - // the panel; this path has to do both itself — except when nobody asked, where - // taking the panel off the tab the reader is on is the thing to avoid. - if (!onlyIfAlreadyOpen || previewTabs.activeId === open.id) { - previewTabs.select(open.id) - previewTabs.setCollapsed(false) - } + // the panel; this path has to do both itself. + previewTabs.select(open.id) + previewTabs.setCollapsed(false) } else { // Only the item's own page carries a form for this call, so a caller routing a call // that was not asked to open anything gets a no rather than a new tab.