mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5155] [Feature]: Queue agent work per turn without blocking swipes or roleplay continuation #2850
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#2850
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 @SpicyMarinara on GitHub (Aug 16, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5155
Originally assigned to: @SpicyMarinara on GitHub.
What problem does this solve?
When post-processing or parallel agents are still working on a generated response, users must currently wait before generating a new swipe or continuing their roleplay.
The current flow keeps one chat-wide generation/agent lock active until the server has awaited parallel agents and completed post-processing. Consequently, even after the base assistant response is durably saved, the UI still blocks:
That wait is unnecessary for a new swipe. A swipe is generated from the same base state as the previous swipe, so unfinished agent output from the previous swipe would not be included in the new generation anyway.
Users should also be able to continue their roleplay once the base response is complete, without waiting for non-blocking parallel or post-processing work. Unfinished results can complete afterward and become available to later turns, but must remain owned by the turn and swipe that triggered them.
The critical concurrency risk is ownership: when a user starts another generation while older agents are still running, those older results must never be saved onto whichever message or swipe happens to be active when the agent finishes.
Proposed solution
Replace the chat-wide agent lock with per-generation, per-message, and per-swipe agent work ownership.
Once the base assistant message is durably saved, allow new swipe generation, the next roleplay turn, and Continue to start while parallel and post-processing agents for the previous response continue in the background.
Queue and persist every agent run against an immutable turn/message/swipe anchor captured when that run begins, rather than resolving its target from the currently active message or swipe when it completes.
Expected behavior:
For a roleplay continuation started before older agents finish, the new generation should use the durable chat state available when it begins. The older agents' eventual output must still be saved to their original anchor, never retroactively injected into or attached to the already-running continuation.
Alternatives considered
Additional context
The desired lifecycle is:
This should apply wherever message swipes, roleplay continuation, and parallel or post-processing agents are supported.
Template check