mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1716] [Issue]: llm_stream_channel remains pending after visible generation finishes #850
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#850
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Promansis on GitHub (May 31, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1716
Originally assigned to: @Promansis on GitHub.
Summary
CrabNebula DevTools can show an embedded Tauri
llm_stream_channelcommand still running long after the foreground generation appears complete. One observed row was:command: llm_stream_channel 19:41:24 1020502.04ms streamid: cd44cadb-80b4-4c63-a472-59491049baee uri: http://ipc.localhost/llm_stream_channelCode inspection points at a stuck stream/IPC lifetime rather than a visible generation state problem: the foreground UI can release after persisted generation events, while the shared LLM stream generator still waits for the underlying Tauri command promise to resolve.
Expected behavior
When a generation finishes, errors, or is cancelled, the embedded Tauri
llm_stream_channelcommand should resolve promptly and unregister its stream id. DevTools should not show old LLM stream commands increasing in duration after the user-visible LLM work is done.Actual behavior
At least one
llm_stream_channelcommand remains pending for ~17 minutes and continues increasing in duration in CrabNebula DevTools after the user considers the LLM generation finished.The likely failure path from local inspection:
src/shared/api/llm-api.tsmarks the JS stream completed only when the channel receivesdoneorerror, but then still awaits theinvokeTauri("llm_stream_channel", ...)command promise before the async generator fully returns.src-tauri/src/commands/storage/llm.rsresolvesllm_stream_channelonly whenmarinara_llm::stream_events(...)returns or cancellation fires.src-tauri/crates/llm/src/lib.rsemits the terminaldoneevent only after the provider-specific stream reader returns.response.bytes_stream()until EOF. They do not appear to enforce an app-side idle/read timeout or always break on provider semantic terminal events such as[DONE].This leaves two plausible but related ways for the command to outlive the visible generation:
doneand the Tauri command stays pending.await commandif the embedded Tauri command promise does not resolve promptly.Steps to reproduce
llm_stream_channel.Impact area
Environment
refactorat local inspection commit1d1fd0ca6.8.0-117-genericv24.15.0, pnpm10.33.2rustc 1.95.0 (59807616e 2026-04-14)http://ipc.localhostembedded commandLogs, screenshots, or video
Observed DevTools row:
command: llm_stream_channel 19:41:24 1020502.04ms streamid: cd44cadb-80b4-4c63-a472-59491049baee uri: http://ipc.localhost/llm_stream_channelRelevant local code paths:
src/shared/api/llm-api.ts:92-115src-tauri/src/commands/storage/llm.rs:172-204src-tauri/crates/llm/src/lib.rs:99-124src-tauri/crates/llm/src/lib.rs:876-894for the OpenAI-compatible byte stream loop; equivalent EOF-driven loops exist for other streaming providers.Regression notes
Unknown. This was observed on the refactor branch during normal app use with CrabNebula DevTools open.
Additional context
This should be investigated separately from eager TTS/regex config reads. Those are ordinary React Query calls and not intentionally long-lived, while
llm_stream_channelis a streaming IPC command whose lifecycle spans Rust provider transport, Tauri channel events, and the frontend async generator.A robust fix probably needs a lifecycle contract such as:
Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:
@cha1latte commented on GitHub (May 31, 2026):
Tracking note: PR #1723 is open against
refactorwithCloses #1716, so tagging this asin-prwhile review/merge finishes.