From c3507f8e11667bdbbeddb9fa367b5d779dce1655 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 26 Mar 2026 23:13:52 -0400 Subject: [PATCH] fix: help page back link preserves active persona Pass ?persona= query param on the help link so the server knows which persona to return to. Previously always defaulted to personas[0], causing navigation back to the wrong persona. Co-Authored-By: Claude Sonnet 4.6 --- cortex/routers/help.py | 8 ++++++-- cortex/static/app.js | 4 ++++ cortex/static/index.html | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cortex/routers/help.py b/cortex/routers/help.py index 0267956..e61b2d1 100644 --- a/cortex/routers/help.py +++ b/cortex/routers/help.py @@ -32,13 +32,17 @@ def _get_session_user(request: Request) -> str | None: @router.get("/help", include_in_schema=False) -async def help_page(request: Request): +async def help_page(request: Request, persona: str = ""): username = _get_session_user(request) if not username: return RedirectResponse("/login", status_code=302) personas = list_user_personas(username) - back_persona = personas[0] if personas else "" + # Use persona from query param if valid, else fall back to first + if persona and persona in personas: + back_persona = persona + else: + back_persona = personas[0] if personas else "" back_href = f"/{username}/{back_persona}" if back_persona else "/" html = (_STATIC / "help.html").read_text() diff --git a/cortex/static/app.js b/cortex/static/app.js index 99004b7..6c208ee 100644 --- a/cortex/static/app.js +++ b/cortex/static/app.js @@ -32,6 +32,10 @@ if (headerEmoji) headerEmoji.textContent = CORTEX_EMOJI; + // Wire help link to preserve current persona on return + const helpLink = document.getElementById('help-link'); + if (helpLink) helpLink.href = `/help?persona=${encodeURIComponent(CORTEX_PERSONA)}`; + let sessionId = null; let primaryBackend = 'claude'; let activeController = null; diff --git a/cortex/static/index.html b/cortex/static/index.html index 85c2732..a45565f 100644 --- a/cortex/static/index.html +++ b/cortex/static/index.html @@ -59,7 +59,7 @@ - +