mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1576] [Feature]: Lazy-load the background autonomous generation pipeline outside the startup chunk #814
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#814
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 @Xelvanis on GitHub (May 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1576
What problem does this solve?
The AppShell-level background autonomous poller currently imports generation/runtime modules at startup even though background generation only runs after the poller finds an eligible inactive conversation chat.
src/features/modes/conversation/hooks/autonomous/use-background-autonomous.tsimports these at module load:startGenerationfromsrc/engine/generation/start-generation.tssrc/engine/modes/chat/autonomous/autonomous.service.tsllmApi,storageApi, andintegrationGatewayRollup metadata for the startup entry includes generation modules such as
start-generation.ts,prompt-assembly.ts,agent-runner.ts,agent-executor.ts, and game prompt helpers. That keeps the main entry large before any background autonomous generation is actually needed.Proposed behavior
Keep the polling hook small at startup and dynamically import a focused background autonomous runtime only when generation is about to run.
The startup hook should be able to:
The lazy runtime can own
startGeneration, provider/runtime adapters, prompt assembly, notification side effects, and query invalidation after generation completes.Expected owner or impact area
Refactor branch considerations
Keep engine code React-free. UI code should pass the existing storage/LLM/integration ports or shared API wrappers into the lazy runtime rather than importing Tauri or remote-runtime internals directly.
Acceptance checks:
pnpm buildpasses.src/engine/generation/start-generation.ts,src/engine/generation/prompt-assembly.ts, orsrc/engine/agents-runtime/executor/agent-executor.tssolely because the background autonomous poller is mounted.Alternatives considered
Disabling the poller or moving all autonomous logic out of AppShell would reduce startup size but risks changing product behavior. The goal is to keep behavior and defer only the heavy generation runtime.
Additional context
This is one implementation slice under #1532.
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 29, 2026):
Triage note: labeling this as
normal-scopebecause it lazy-loads autonomous generation only after the background poller finds eligible work, preserving behavior while reducing startup cost.A good next step is to implement behind the existing background-autonomous entrypoints and verify idle startup no longer imports generation.
@cha1latte commented on GitHub (May 31, 2026):
Completed by #1711; background autonomous generation now lazy-loads startGeneration only when an eligible inactive conversation triggers