From 0aa4f6f8cd3bb6a772fdc0ced1a34eff980517b9 Mon Sep 17 00:00:00 2001 From: Rod Boev Date: Fri, 26 Jun 2026 09:20:52 -0400 Subject: [PATCH] fix(#4877): bind ephemeral blank boot workspace --- static/boot.js | 1 + ...issue4877_fresh_blank_boot_workspace_bind.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/static/boot.js b/static/boot.js index 6d7ba8d8..3a349841 100644 --- a/static/boot.js +++ b/static/boot.js @@ -2469,6 +2469,7 @@ window._applyTitlebarProfileVisibility=_applyTitlebarProfileVisibility; const _ephPanelPref=localStorage.getItem('hermes-webui-workspace-panel-pref')==='open' || localStorage.getItem('hermes-webui-workspace-panel')==='open'; if(_ephPanelPref&&!_isCompactWorkspaceViewport()) _workspacePanelMode='browse'; + await _maybeBindFreshDefaultWorkspaceSession(); syncTopbar();syncWorkspacePanelState(); $('emptyState').style.display=''; await renderSessionList();if(typeof startGatewaySSE==='function')startGatewaySSE(); diff --git a/tests/test_issue4877_fresh_blank_boot_workspace_bind.py b/tests/test_issue4877_fresh_blank_boot_workspace_bind.py index 497a4b48..7917f3ac 100644 --- a/tests/test_issue4877_fresh_blank_boot_workspace_bind.py +++ b/tests/test_issue4877_fresh_blank_boot_workspace_bind.py @@ -154,3 +154,20 @@ def test_no_saved_session_branch_restores_panel_pref_before_bind_attempt(): bind_idx = segment.find(bind_call) assert bind_idx >= 0, "no-saved-session path must attempt to bind after pref restore" assert pref_idx < bind_idx, "panel preference restoration must happen before bind attempt" + + +def test_ephemeral_blank_session_branch_restores_panel_pref_before_bind_attempt(): + src = BOOT_JS.read_text(encoding="utf-8") + marker = "if(S.session && (S.session.message_count||0) === 0 && !_restoredInFlight && !_restoredHasDraft){" + marker_idx = src.find(marker) + assert marker_idx >= 0, "ephemeral blank-session path not found" + return_idx = src.find("return;", marker_idx) + assert return_idx > marker_idx, "ephemeral blank-session path must still return early" + segment = src[marker_idx:return_idx] + eph_pref = "if(_ephPanelPref&&!_isCompactWorkspaceViewport()) _workspacePanelMode='browse';" + pref_idx = segment.find(eph_pref) + assert pref_idx >= 0, "ephemeral blank-session path must restore panel preference" + bind_call = "await _maybeBindFreshDefaultWorkspaceSession();" + bind_idx = segment.find(bind_call) + assert bind_idx >= 0, "ephemeral blank-session path must attempt to bind before returning" + assert pref_idx < bind_idx, "ephemeral panel preference restoration must happen before bind attempt"