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: { - +