[GH-ISSUE #3159] [Issue]: Professor Mari floating window: blank Home, message loss, and stale state on dismiss #1696

Closed
opened 2026-10-21 05:41:48 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @spacyH on GitHub (Jul 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3159

Originally assigned to: @SpicyMarinara on GitHub.

Summary

When Professor Mari's home chat moves to the floating companion window (after switching to another chat) and the user dismisses that window, returning to Home can show a blank content area and missing assistant responses from the interrupted session. These are related failures in the floating-window lifecycle — not the original static-remount display bug, which was fixed in 2.0.8.

[NOTE: The initial investigation & recommendations were made by Prof. Mari (GLM-5.0), then reviewed & refined by Cursor (Composer 2.5) and me.]

Expected behavior

  • Dismissing the floating Professor Mari window should not break navigation: clicking Home should show the normal home screen (logo, recent chats, Professor Mari launcher).
  • Any assistant text generated before or during dismiss should be persisted and visible when the user returns to the Professor Mari home chat.
  • Navigating away while Mari is generating should preserve the session; returning Home without dismissing the floating window should reload persisted messages from the server (this path works in 2.0.8+).

Actual behavior

Three related symptoms share the same trigger (open Mari on Home → switch chat → dismiss floating window → return Home):

Symptom 1: Blank Home page (high — blocks navigation)

The home content area is empty — only top-bar chrome remains. Normal home UI is hidden because homeProfessorChatActive stays true while the inline chat window is closed (homeProfessorChatOpen is false). A browser reload restores the home page.

Symptom 2: Missing assistant responses (high — data loss)

Mari's responses from the interrupted turn are gone. The user message remains; the assistant reply does not. In-flight content that never reached the server's post-generation persist path is lost when the floating HomeProfessorMariChat instance unmounts. If the client connection drops during generation, the server aborts and the catch block emits "cancelled" without saving accumulated assistantText.

Symptom 3: "Messages vanished" on return (original report — partially fixed)

The static-remount path (switch chat → return Home without dismissing the floating window) was broken in v2.0.5–2.0.6 and is fixed in 2.0.8+ (loadingHistory default false, isMountedRef/EventSource removed, simplified load effect). The same visual symptom still reproduces through the floating-window dismiss path described above.

Steps to reproduce

  1. On Home, open Professor Mari's chat ("Ask Professor Mari") and send a message that triggers a multi-step workspace response.
  2. While the response is still generating, switch to a different chat from the sidebar — Mari moves to the floating companion window.
  3. Dismiss the floating window (X on the panel or mobile dismiss).
  4. Click the Home icon in the top bar.
  5. Observe a blank home content area (Symptom 1).
  6. Reload the browser to restore the home shell, reopen Professor Mari, and observe missing assistant responses for the interrupted turn (Symptom 2).

Control (fixed path): Repeat steps 1–2, then return Home via the Home icon without dismissing the floating window. Persisted messages should reload from the server on remount.

Environment

  • Marinara Engine version: 2.0.9 (still present; verified in source 2026-07-02)
  • Install type: docker
  • OS + version: macOS 26 (Tahoe)
  • Browser or app shell: Both Arc (Chromium) and Safari (Webkit) on macOS

Logs, screenshots, or video

None attached. Static code analysis confirms the failure paths. Recommended before implementing a fix:

  • Live repro with DB check (mari chats messages <chatId>) after dismiss to confirm server-side absence vs. display-only.
  • Runtime tracing of homeProfessorChatActive on navigate-away and Home click.

Additional context

Root causes (distinct, shared lifecycle)

Symptom Component Mechanism
Blank Home ChatArea.tsx homeProfessorChatActive set true on chat open; only cleared by framer-motion onExitComplete, which never fires when the home block unmounts on chat navigation. Floating assistant is a separate instance and does not reset ChatArea state.
Message loss (client) ProfessorMariFloatingAssistantHost.tsx dismissFloating → setVisible(false) → return null fully unmounts floating HomeProfessorMariChat with no flush, no stopWorkspace(), no workspaceAbortRef cleanup.
Message loss (server) workspace-agent.service.ts On abort, throw jumps past assistant createMessage; catch block (lines ~1518–1521) emits cancelled status only — no partial save of assistantText. User message saved at prompt start; assistant saved only after full loop completes.

What was already fixed (static remount, 2.0.8+)

Area Pre-fix Current
loadingHistory initial value true false
isMountedRef / EventSource Present Removed
Streaming Orphaned SSE api.streamEvents + AbortController
Load on remount Fragile guards hasLoadedRef + .finally(() => setLoadingHistory(false))

Suggested fixes (likely one PR)

  1. Reset stale Home state: useEffect in ChatArea.tsx to set homeProfessorChatActive to false when activeChatId becomes non-null; optionally also reset on TopBar Home click.
  2. Keep mounted on dismiss: Hide floating HomeProfessorMariChat with CSS instead of unmounting, preserving stream consumption and React state.
  3. Partial save on abort: In workspace-agent.service.ts catch block, persist trimmed assistantText when controller.signal.aborted before emitting cancelled status.
  4. Defense in depth: Unmount cleanup for workspaceAbortRef; optional flush before dismissFloating.

Workaround

Reload the browser to reset React state (restores Home shell). Does not recover lost assistant messages.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @spacyH on GitHub (Jul 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3159 Originally assigned to: @SpicyMarinara on GitHub. ## Summary When Professor Mari's home chat moves to the floating companion window (after switching to another chat) and the user dismisses that window, returning to Home can show a **blank content area** and **missing assistant responses** from the interrupted session. These are related failures in the floating-window lifecycle — not the original static-remount display bug, which was fixed in 2.0.8. _[NOTE: The initial investigation & recommendations were made by Prof. Mari (GLM-5.0), then reviewed & refined by Cursor (Composer 2.5) and me.]_ ## Expected behavior - Dismissing the floating Professor Mari window should not break navigation: clicking Home should show the normal home screen (logo, recent chats, Professor Mari launcher). - Any assistant text generated before or during dismiss should be persisted and visible when the user returns to the Professor Mari home chat. - Navigating away while Mari is generating should preserve the session; returning Home without dismissing the floating window should reload persisted messages from the server (this path works in 2.0.8+). ## Actual behavior Three related symptoms share the same trigger (open Mari on Home → switch chat → dismiss floating window → return Home): ### Symptom 1: Blank Home page (high — blocks navigation) The home content area is empty — only top-bar chrome remains. Normal home UI is hidden because `homeProfessorChatActive` stays `true` while the inline chat window is closed (`homeProfessorChatOpen` is `false`). A browser reload restores the home page. ### Symptom 2: Missing assistant responses (high — data loss) Mari's responses from the interrupted turn are gone. The user message remains; the assistant reply does not. In-flight content that never reached the server's post-generation persist path is lost when the floating `HomeProfessorMariChat` instance unmounts. If the client connection drops during generation, the server aborts and the catch block emits "cancelled" without saving accumulated `assistantText`. ### Symptom 3: "Messages vanished" on return (original report — partially fixed) The **static-remount** path (switch chat → return Home **without** dismissing the floating window) was broken in v2.0.5–2.0.6 and is **fixed in 2.0.8+** (`loadingHistory` default `false`, `isMountedRef`/`EventSource` removed, simplified load effect). The same visual symptom still reproduces through the floating-window dismiss path described above. ## Steps to reproduce 1. On Home, open Professor Mari's chat ("Ask Professor Mari") and send a message that triggers a multi-step workspace response. 2. While the response is still generating, switch to a different chat from the sidebar — Mari moves to the floating companion window. 3. Dismiss the floating window (X on the panel or mobile dismiss). 4. Click the Home icon in the top bar. 5. Observe a **blank** home content area (Symptom 1). 6. Reload the browser to restore the home shell, reopen Professor Mari, and observe **missing assistant responses** for the interrupted turn (Symptom 2). **Control (fixed path):** Repeat steps 1–2, then return Home via the Home icon **without** dismissing the floating window. Persisted messages should reload from the server on remount. ## Environment - Marinara Engine version: 2.0.9 (still present; verified in source 2026-07-02) - Install type: docker - OS + version: macOS 26 (Tahoe) - Browser or app shell: Both Arc (Chromium) and Safari (Webkit) on macOS ## Logs, screenshots, or video None attached. Static code analysis confirms the failure paths. Recommended before implementing a fix: - Live repro with DB check (`mari chats messages <chatId>`) after dismiss to confirm server-side absence vs. display-only. - Runtime tracing of `homeProfessorChatActive` on navigate-away and Home click. ## Additional context ### Root causes (distinct, shared lifecycle) | Symptom | Component | Mechanism | |---------|-----------|-----------| | Blank Home | `ChatArea.tsx` | `homeProfessorChatActive` set `true` on chat open; only cleared by framer-motion `onExitComplete`, which never fires when the home block unmounts on chat navigation. Floating assistant is a separate instance and does not reset `ChatArea` state. | | Message loss (client) | `ProfessorMariFloatingAssistantHost.tsx` | `dismissFloating` → `setVisible(false)` → `return null` fully unmounts floating `HomeProfessorMariChat` with no flush, no `stopWorkspace()`, no `workspaceAbortRef` cleanup. | | Message loss (server) | `workspace-agent.service.ts` | On abort, throw jumps past assistant `createMessage`; catch block (lines ~1518–1521) emits cancelled status only — no partial save of `assistantText`. User message saved at prompt start; assistant saved only after full loop completes. | ### What was already fixed (static remount, 2.0.8+) | Area | Pre-fix | Current | |------|---------|---------| | `loadingHistory` initial value | `true` | `false` | | `isMountedRef` / `EventSource` | Present | Removed | | Streaming | Orphaned SSE | `api.streamEvents` + `AbortController` | | Load on remount | Fragile guards | `hasLoadedRef` + `.finally(() => setLoadingHistory(false))` | ### Suggested fixes (likely one PR) 1. **Reset stale Home state:** `useEffect` in `ChatArea.tsx` to set `homeProfessorChatActive` to `false` when `activeChatId` becomes non-null; optionally also reset on TopBar Home click. 2. **Keep mounted on dismiss:** Hide floating `HomeProfessorMariChat` with CSS instead of unmounting, preserving stream consumption and React state. 3. **Partial save on abort:** In `workspace-agent.service.ts` catch block, persist trimmed `assistantText` when `controller.signal.aborted` before emitting cancelled status. 4. **Defense in depth:** Unmount cleanup for `workspaceAbortRef`; optional flush before `dismissFloating`. ### Workaround Reload the browser to reset React state (restores Home shell). Does not recover lost assistant messages. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:41:48 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jul 2, 2026):

Codex is taking this issue in branch codex/fix-professor-mari-floating-dismiss, targeting staging.

<!-- gh-comment-id:4870987381 --> @SpicyMarinara commented on GitHub (Jul 2, 2026): Codex is taking this issue in branch `codex/fix-professor-mari-floating-dismiss`, targeting `staging`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1696
No description provided.