[GH-ISSUE #1986] [Issue]: Startup restore into Game mode can hang and leave conversations spinning #973

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

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

Originally assigned to: @cha1latte on GitHub.

Summary

When the app starts after Game mode was the last visited surface, Marinara tries to restore into Game mode and startup takes an unusually long time. After that slow startup, navigating to other conversations still shows the spinning waiting indicator, suggesting startup or restore work may be blocking or leaving shared runtime state stuck.

Expected behavior

The app should restore the last visited surface without an excessive startup delay. If Game mode has expensive state to load, the app should remain responsive and switching to other conversations should not keep showing a waiting spinner.

Actual behavior

On launch, because Game mode was the last place used before closing, the app attempted to load back into Game mode. That load took a very long time. Even after navigating to other conversations, the UI still showed the spinning waiting wheel.

Steps to reproduce

  1. Open the Marinara Engine Tauri desktop app.
  2. Navigate to Game mode.
  3. Close the app while Game mode is the last active surface.
  4. Reopen the app and let it restore the previous location.
  5. Try navigating to other conversations after the slow restore.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor at 9cc3d1ef locally
  • Run mode: Tauri desktop
  • OS + version: Windows, exact version not captured
  • Node + pnpm versions: Node v24.13.0, pnpm 10.33.2
  • Rust version, if relevant: rustc 1.95.0 (59807616e 2026-04-14)
  • Remote Runtime URL configured? not captured
  • Provider, model, or integration, if relevant: not captured

Logs, screenshots, or video

Not captured yet. The visible symptom is a very slow restore into Game mode on startup, followed by persistent waiting spinners when navigating to other conversations.

Regression notes

Unknown whether this worked before. The concerning part is that restoring Game mode on startup appears able to make unrelated conversation navigation look blocked afterward.

Additional context

This may involve startup route restoration, Game mode initialization, shared generation/loading state, or cleanup of pending runtime work during mode navigation. Please investigate what is making startup take so long and why the waiting spinner remains visible after switching away from Game mode.

Template check

Please uncheck 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 @cha1latte on GitHub (Jun 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1986 Originally assigned to: @cha1latte on GitHub. ## Summary When the app starts after Game mode was the last visited surface, Marinara tries to restore into Game mode and startup takes an unusually long time. After that slow startup, navigating to other conversations still shows the spinning waiting indicator, suggesting startup or restore work may be blocking or leaving shared runtime state stuck. ## Expected behavior The app should restore the last visited surface without an excessive startup delay. If Game mode has expensive state to load, the app should remain responsive and switching to other conversations should not keep showing a waiting spinner. ## Actual behavior On launch, because Game mode was the last place used before closing, the app attempted to load back into Game mode. That load took a very long time. Even after navigating to other conversations, the UI still showed the spinning waiting wheel. ## Steps to reproduce 1. Open the Marinara Engine Tauri desktop app. 2. Navigate to Game mode. 3. Close the app while Game mode is the last active surface. 4. Reopen the app and let it restore the previous location. 5. Try navigating to other conversations after the slow restore. ## Impact area - [x] App shell, navigation, startup, or providers - [ ] Catalog resources - [x] Chat mode - [ ] Roleplay mode - [x] Game mode - [x] Shared mode UI - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [ ] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `refactor` at `9cc3d1ef` locally - Run mode: Tauri desktop - OS + version: Windows, exact version not captured - Node + pnpm versions: Node `v24.13.0`, pnpm `10.33.2` - Rust version, if relevant: `rustc 1.95.0 (59807616e 2026-04-14)` - Remote Runtime URL configured? not captured - Provider, model, or integration, if relevant: not captured ## Logs, screenshots, or video Not captured yet. The visible symptom is a very slow restore into Game mode on startup, followed by persistent waiting spinners when navigating to other conversations. ## Regression notes Unknown whether this worked before. The concerning part is that restoring Game mode on startup appears able to make unrelated conversation navigation look blocked afterward. ## Additional context This may involve startup route restoration, Game mode initialization, shared generation/loading state, or cleanup of pending runtime work during mode navigation. Please investigate what is making startup take so long and why the waiting spinner remains visible after switching away from Game mode. ## Template check Please uncheck 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:24:21 +07:00
Author
Owner

@cha1latte commented on GitHub (Jun 2, 2026):

Additional diagnosis from source inspection:

The slowdown does not look limited to chats with existing conversation history. Empty conversations can still hit several startup and shared-surface reads.

Likely contributors:

  • Startup restores the last active chat from localStorage (marinara-active-chat-id). If the last active chat was Game mode, the app immediately remounts the Game route on launch.
  • The storage commands are asynchronous from the renderer side and use Tauri spawn_blocking, so this is probably not literal Rust file I/O running on the browser UI thread. However, multiple reads are still kicked off eagerly and their React/query/render follow-up can make the UI feel blocked.
  • The always-mounted sidebar fetches chat summaries, character summaries, and chat folders on startup. This means even a no-history conversation can be competing with global catalog hydration.
  • The shared chat surface for an empty conversation still loads chat detail, the first message page, delayed message count, related character rows, and persona data.
  • Restored Game mode fetches the game asset manifest on mount. That manifest scans the managed game-assets tree, so asset metadata loading is eager for Game mode even if the asset browser itself is lazy.
  • Game mode also auto-fetches remaining message pages once it has any loaded messages, which can add extra work when startup restores a non-empty Game session.

The bug may therefore be better framed as startup hydration and route-restore work being too eager, not only "chat history is slow." Suggested fix direction:

  • Let the shell become interactive before restoring heavy mode-specific work.
  • Defer Game asset manifest loading until the Game surface actually needs assets/audio, or make it incremental/cache-aware.
  • Stage sidebar/catalog hydration so chat navigation is not blocked behind global chat/character/folder lists.
  • Ensure the empty-conversation surface can render its empty state independently of global catalog hydration and delayed message-count work.
  • Check that Game-mode loading/scene-prep state is cleared when switching away so a restored Game session cannot leave unrelated conversations showing a waiting spinner.
<!-- gh-comment-id:4606408726 --> @cha1latte commented on GitHub (Jun 2, 2026): Additional diagnosis from source inspection: The slowdown does not look limited to chats with existing conversation history. Empty conversations can still hit several startup and shared-surface reads. Likely contributors: - Startup restores the last active chat from `localStorage` (`marinara-active-chat-id`). If the last active chat was Game mode, the app immediately remounts the Game route on launch. - The storage commands are asynchronous from the renderer side and use Tauri `spawn_blocking`, so this is probably not literal Rust file I/O running on the browser UI thread. However, multiple reads are still kicked off eagerly and their React/query/render follow-up can make the UI feel blocked. - The always-mounted sidebar fetches chat summaries, character summaries, and chat folders on startup. This means even a no-history conversation can be competing with global catalog hydration. - The shared chat surface for an empty conversation still loads chat detail, the first message page, delayed message count, related character rows, and persona data. - Restored Game mode fetches the game asset manifest on mount. That manifest scans the managed game-assets tree, so asset metadata loading is eager for Game mode even if the asset browser itself is lazy. - Game mode also auto-fetches remaining message pages once it has any loaded messages, which can add extra work when startup restores a non-empty Game session. The bug may therefore be better framed as startup hydration and route-restore work being too eager, not only "chat history is slow." Suggested fix direction: - Let the shell become interactive before restoring heavy mode-specific work. - Defer Game asset manifest loading until the Game surface actually needs assets/audio, or make it incremental/cache-aware. - Stage sidebar/catalog hydration so chat navigation is not blocked behind global chat/character/folder lists. - Ensure the empty-conversation surface can render its empty state independently of global catalog hydration and delayed message-count work. - Check that Game-mode loading/scene-prep state is cleared when switching away so a restored Game session cannot leave unrelated conversations showing a waiting spinner.
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#973
No description provided.