From d7483f6b335d2d1b2e5a1c68db70c70b0e1e23bf Mon Sep 17 00:00:00 2001 From: Menghuan1918 Date: Thu, 29 Oct 2026 23:51:47 +0800 Subject: [PATCH] fix(sidechat): disable archiving a side thread the host can never recover (#949) The host's session list hides every subagent-origin row in ALL archive filters (sessionVisible() returns false before the filter), and its unarchive control only lives on those rows. Archiving a side conversation is therefore a one-way door with no entry left to recover it, so the composer-bar action is disabled for any bound session the list cannot show again, with a hover tip (all 21 dictionaries) explaining why and pointing at Save as new session. The handler keeps the same guard. The archive-and-rebind path stays covered for a host-visible binding. --- src/client/SideChatView.tsx | 33 ++++++++++++--- src/client/locales-ar.ts | 1 + src/client/locales-de.ts | 1 + src/client/locales-fr.ts | 1 + src/client/locales-hi.ts | 1 + src/client/locales-id.ts | 1 + src/client/locales-it.ts | 1 + src/client/locales-ja.ts | 1 + src/client/locales-ko.ts | 1 + src/client/locales-nl.ts | 1 + src/client/locales-pl.ts | 1 + src/client/locales-pt.ts | 1 + src/client/locales-ru.ts | 1 + src/client/locales-sv.ts | 1 + src/client/locales-th.ts | 1 + src/client/locales-tr.ts | 1 + src/client/locales-vi.ts | 1 + src/client/locales-zh-HK.ts | 1 + src/client/locales-zh-MO.ts | 1 + src/client/locales-zh-TW.ts | 1 + src/client/locales.ts | 2 + tests/sidechat-view.spec.tsx | 82 ++++++++++++++++++++++++++++++------ 22 files changed, 117 insertions(+), 19 deletions(-) diff --git a/src/client/SideChatView.tsx b/src/client/SideChatView.tsx index 15e27497..f22e94c8 100644 --- a/src/client/SideChatView.tsx +++ b/src/client/SideChatView.tsx @@ -813,6 +813,24 @@ export function SideChatView(props: { const summary = threadId === undefined ? undefined : list.byId[threadId] const running = summary?.running === true + /** + * Whether the host's own session list can ever show the bound session again + * after archiving it. It cannot for a subagent-origin row: the host's + * `sessionVisible()` returns false for `origin === 'subagent'` BEFORE the + * archived filter runs, and the only "unarchive" control lives on that list, + * so archiving a side thread is a one-way door (issue #949). Every thread + * this view binds is such a row; an absent summary is treated the same way — + * this view must not archive a session it cannot classify. The composer tip + * says why the action is disabled. + */ + const archiveBlocked = summary === undefined || summary.origin === 'subagent' + /** The archive control's hover text: the blocked reason wins over the + * running hint — stopping the thread would not make archiving recoverable. */ + const archiveTip = archiveBlocked + ? t('sideChatArchiveBlocked') + : running + ? t('sideChatArchiveRunning') + : t('sideChatArchive') // Connection recovery state (DSH 0.1.2-alpha.2+): drives the disconnect // banner and an immediate catch-up pull when the wire comes back. The poll @@ -1355,11 +1373,14 @@ export function SideChatView(props: { /** Archive the bound thread on the host (the same capability the session * list's own archive action uses; `stopActivity` settles a running agent - * first). The tab then moves to another live thread: leaving it bound to an - * archived session would dead-end the panel, because the host refuses to - * open archived sessions. */ + * first). Disabled for a side thread: the host session list never lists a + * subagent-origin row, so no "unarchive" entry could ever recover it (issue + * #949) — the guard below makes that a hard rule, not just a disabled + * styling. For a recoverable binding the tab then moves to another live + * thread: leaving it bound to an archived session would dead-end the panel, + * because the host refuses to open archived sessions. */ const handleArchive = async (): Promise => { - if (threadId === undefined || busy !== null) return + if (threadId === undefined || busy !== null || archiveBlocked) return setBusy('archiving') setError(null) setSaved(false) @@ -1546,12 +1567,12 @@ export function SideChatView(props: { - +