[GH-ISSUE #1715] [Issue]: Chat surfaces eagerly invoke TTS config and regex script reads #849

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

Originally created by @Promansis on GitHub (May 31, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1715

Originally assigned to: @Promansis on GitHub.

Summary

Chat/game surfaces eagerly invoke optional TTS and regex storage commands even when the user has never configured TTS and may not be actively using regex scripts. In CrabNebula DevTools these appeared alongside a stale stream command as long-running rows:

command: tts_config 19:41:22 1022784.77ms uri: http://ipc.localhost/tts_config

command: storage_list 19:41:22 1022784.36ms entity: regex-scripts options: null uri: http://ipc.localhost/storage_list

The exact reason those two calls remained pending in that session is not yet proven, but the code does prove that visible chat/game UI mounts these reads eagerly rather than gating them behind actual TTS/regex use.

Expected behavior

Optional systems should avoid unnecessary embedded IPC/storage work:

  • TTS config should not be fetched on ordinary message render when TTS has never been enabled or no TTS control/autoplay path is active.
  • Regex scripts should not be repeatedly fetched by general chat/game render paths unless an input/output transform actually needs them, or should at least use a stable cache/stale policy appropriate for rarely changing script definitions.
  • Any tts_config or storage_list(regex-scripts) call that is issued should complete quickly or fail visibly; it should not sit in DevTools with an ever-increasing duration.

Actual behavior

Code inspection shows eager calls from normal UI render paths:

  • useTTSConfig() calls ttsApi.config() with query key ["tts", "config"].
  • ChatMessage calls useTTSConfig() while rendering each message's TTS affordance path.
  • useChatTtsAutoplay() also calls useTTSConfig() before checking whether TTS is enabled.
  • useApplyRegex() calls useRegexScripts(), which calls storageApi.list("regex-scripts").
  • ChatInput, ChatMessage, and game narration paths call useApplyRegex(), so regex scripts are loaded as part of ordinary mode surfaces.

In the observed session, the corresponding embedded IPC rows were still running for ~17 minutes.

Steps to reproduce

  1. Run the refactor branch in Tauri desktop mode.
  2. Open CrabNebula DevTools.
  3. Open a chat/roleplay/game surface without configuring TTS.
  4. Observe embedded IPC command rows.
  5. Note that tts_config and storage_list for regex-scripts can be issued even if TTS has never been used and regex scripts are not being edited.

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
  • 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 local inspection commit 1d1fd0ca
  • Run mode: Tauri desktop
  • OS + version: Ubuntu Linux, kernel 6.8.0-117-generic
  • Node + pnpm versions: Node v24.15.0, pnpm 10.33.2
  • Rust version, if relevant: rustc 1.95.0 (59807616e 2026-04-14)
  • Remote Runtime URL configured? not relevant to observed http://ipc.localhost embedded commands
  • Provider, model, or integration, if relevant: TTS not configured/unused according to reporter

Logs, screenshots, or video

Observed DevTools rows:

command: tts_config 19:41:22 1022784.77ms uri: http://ipc.localhost/tts_config

command: storage_list 19:41:22 1022784.36ms entity: regex-scripts options: null uri: http://ipc.localhost/storage_list

Relevant local code paths:

  • src/shared/hooks/use-tts.ts:15-20
  • src/features/modes/shared/chat-ui/components/ChatMessage.tsx:1055-1057
  • src/features/modes/shared/chat-ui/hooks/use-chat-tts-autoplay.ts:34-49
  • src/features/catalog/agents/hooks/use-regex-scripts.ts:35-39
  • src/features/catalog/agents/regex-application.ts:72-82
  • src/features/modes/shared/chat-ui/components/ChatInput.tsx:166-167

Regression notes

Unknown. The user noted they had “LONG since finished the LLM” and “never even used tts_config,” but no last-known-good build was captured.

Additional context

This is intentionally separate from the llm_stream_channel lifecycle issue. The LLM command is a streaming transport command; tts_config and storage_list(regex-scripts) are ordinary reads and should be short-lived. If these ordinary reads are actually blocked for minutes, that may indicate a shared IPC/runtime/storage starvation problem, but the eager call sites are already a concrete cleanup target.

Potential fixes to evaluate:

  • Gate TTS config fetches behind a persisted lightweight “TTS enabled/configured” flag or only fetch when TTS UI/autoplay is actually needed.
  • Avoid calling useTTSConfig() per rendered message if a single parent/provider query can own that state.
  • Give regex scripts a longer explicit staleTime or load them only from owners that actually apply transforms.
  • Add instrumentation or timeout/error surfacing for ordinary embedded command reads that remain pending unexpectedly.

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 @Promansis on GitHub (May 31, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1715 Originally assigned to: @Promansis on GitHub. ## Summary Chat/game surfaces eagerly invoke optional TTS and regex storage commands even when the user has never configured TTS and may not be actively using regex scripts. In CrabNebula DevTools these appeared alongside a stale stream command as long-running rows: `command: tts_config 19:41:22 1022784.77ms uri: http://ipc.localhost/tts_config` `command: storage_list 19:41:22 1022784.36ms entity: regex-scripts options: null uri: http://ipc.localhost/storage_list` The exact reason those two calls remained pending in that session is not yet proven, but the code does prove that visible chat/game UI mounts these reads eagerly rather than gating them behind actual TTS/regex use. ## Expected behavior Optional systems should avoid unnecessary embedded IPC/storage work: - TTS config should not be fetched on ordinary message render when TTS has never been enabled or no TTS control/autoplay path is active. - Regex scripts should not be repeatedly fetched by general chat/game render paths unless an input/output transform actually needs them, or should at least use a stable cache/stale policy appropriate for rarely changing script definitions. - Any `tts_config` or `storage_list(regex-scripts)` call that is issued should complete quickly or fail visibly; it should not sit in DevTools with an ever-increasing duration. ## Actual behavior Code inspection shows eager calls from normal UI render paths: - `useTTSConfig()` calls `ttsApi.config()` with query key `["tts", "config"]`. - `ChatMessage` calls `useTTSConfig()` while rendering each message's TTS affordance path. - `useChatTtsAutoplay()` also calls `useTTSConfig()` before checking whether TTS is enabled. - `useApplyRegex()` calls `useRegexScripts()`, which calls `storageApi.list("regex-scripts")`. - `ChatInput`, `ChatMessage`, and game narration paths call `useApplyRegex()`, so regex scripts are loaded as part of ordinary mode surfaces. In the observed session, the corresponding embedded IPC rows were still running for ~17 minutes. ## Steps to reproduce 1. Run the refactor branch in Tauri desktop mode. 2. Open CrabNebula DevTools. 3. Open a chat/roleplay/game surface without configuring TTS. 4. Observe embedded IPC command rows. 5. Note that `tts_config` and `storage_list` for `regex-scripts` can be issued even if TTS has never been used and regex scripts are not being edited. ## Impact area <!-- Check the areas you think are relevant. Leave uncertain items unchecked. --> - [ ] App shell, navigation, startup, or providers - [x] Catalog resources - [x] Chat mode - [x] Roleplay mode - [x] Game mode - [x] Shared mode UI - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] React-free engine behavior, contracts, agents, or capability ports - [x] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `refactor` at local inspection commit `1d1fd0ca` - Run mode: Tauri desktop - OS + version: Ubuntu Linux, kernel `6.8.0-117-generic` - Node + pnpm versions: Node `v24.15.0`, pnpm `10.33.2` - Rust version, if relevant: `rustc 1.95.0 (59807616e 2026-04-14)` - Remote Runtime URL configured? not relevant to observed `http://ipc.localhost` embedded commands - Provider, model, or integration, if relevant: TTS not configured/unused according to reporter ## Logs, screenshots, or video Observed DevTools rows: `command: tts_config 19:41:22 1022784.77ms uri: http://ipc.localhost/tts_config` `command: storage_list 19:41:22 1022784.36ms entity: regex-scripts options: null uri: http://ipc.localhost/storage_list` Relevant local code paths: - `src/shared/hooks/use-tts.ts:15-20` - `src/features/modes/shared/chat-ui/components/ChatMessage.tsx:1055-1057` - `src/features/modes/shared/chat-ui/hooks/use-chat-tts-autoplay.ts:34-49` - `src/features/catalog/agents/hooks/use-regex-scripts.ts:35-39` - `src/features/catalog/agents/regex-application.ts:72-82` - `src/features/modes/shared/chat-ui/components/ChatInput.tsx:166-167` ## Regression notes Unknown. The user noted they had “LONG since finished the LLM” and “never even used tts_config,” but no last-known-good build was captured. ## Additional context This is intentionally separate from the `llm_stream_channel` lifecycle issue. The LLM command is a streaming transport command; `tts_config` and `storage_list(regex-scripts)` are ordinary reads and should be short-lived. If these ordinary reads are actually blocked for minutes, that may indicate a shared IPC/runtime/storage starvation problem, but the eager call sites are already a concrete cleanup target. Potential fixes to evaluate: - Gate TTS config fetches behind a persisted lightweight “TTS enabled/configured” flag or only fetch when TTS UI/autoplay is actually needed. - Avoid calling `useTTSConfig()` per rendered message if a single parent/provider query can own that state. - Give regex scripts a longer explicit `staleTime` or load them only from owners that actually apply transforms. - Add instrumentation or timeout/error surfacing for ordinary embedded command reads that remain pending unexpectedly. ## 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.
Author
Owner

@cha1latte commented on GitHub (May 31, 2026):

Tracking note: PR #1719 merged into refactor with Closes #1715, so tagging this as fixed-in-staging pending the normal branch/closure flow.

<!-- gh-comment-id:4587587924 --> @cha1latte commented on GitHub (May 31, 2026): Tracking note: PR #1719 merged into `refactor` with `Closes #1715`, so tagging this as `fixed-in-staging` pending the normal branch/closure flow.
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#849
No description provided.