From 1b9fe071276a6be0271f849bb1e8e39cc10b2189 Mon Sep 17 00:00:00 2001 From: Teigen Date: Thu, 23 Apr 2026 22:47:57 +0800 Subject: [PATCH] fix: drop phantom ended-tab stubs, trust server as source of truth Previously the client cached open session tabs in localStorage and resurrected any that the server no longer knew about as grayed-out "ended" stubs. On multi-device use (close tab on mobile, open desktop) this left stale phantom tabs the user had to manually dismiss. Remove _restoreEndedTabs / _saveTabMetadata, the session._ended branch in selectSession, the data-ended render attribute, and the matching CSS rule. Clear the legacy localStorage key on init to purge stale entries. --- src/web/public/app.js | 48 +++++------------------------------ src/web/public/styles.css | 1 - src/web/public/terminal-ui.js | 1 - 3 files changed, 6 insertions(+), 44 deletions(-) diff --git a/src/web/public/app.js b/src/web/public/app.js index 1a9ddde5..8f3fbf4d 100644 --- a/src/web/public/app.js +++ b/src/web/public/app.js @@ -1794,8 +1794,10 @@ class CodemanApp { } }); - // Restore tabs that were open before refresh but are no longer on the server - this._restoreEndedTabs(); + // Server is source of truth for open sessions — don't resurrect stale tabs + // from localStorage (would show phantom "ended" tabs when a session was closed + // on another device). + try { localStorage.removeItem('codeman-tab-meta'); } catch {} // Sync sessionOrder with current sessions (preserve order, add new, remove stale) this.syncSessionOrder(); @@ -2117,8 +2119,7 @@ class CodemanApp { const tallTabsEnabled = this._tallTabsEnabled ?? false; const showFolder = tallTabsEnabled && session.name && folderName && folderName !== name; - const endedAttr = session._ended ? ' data-ended="1"' : ''; - parts.push(`