mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2371] [Issue]: retryAgents drops the pre-retry game-state flush — manual tracker edits lost on Re-run Trackers / Retry Failed Agents from the roleplay HUD #1171
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#1171
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 @Romuromylus on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2371
Originally assigned to: @Romuromylus on GitHub.
Summary
Severity: Medium — data-loss (regression vs main). The refactor's
retryAgentsno longer flushes pending manual tracker edits before re-running agents. The roleplay HUD's "Re-run Trackers", "Retry Failed Agents", and per-agent "Re-run" actions all callretryAgentswith an unflushed, debounced manual edit still in memory, so the regenerated snapshot merges on top of the stale pre-editchat.gameStateand silently discards the user's edit. Main flushes first.Expected behavior
Re-running trackers / retrying agents from the roleplay HUD should first flush any pending manual tracker edit (location/date/weather/forecast, a player/NPC stat, persona inventory, custom section) so the regeneration merges on top of the user's edit, not on top of the stale baseline. Main does this —
retryAgentsflushes internally and treats a failed flush as a hard error that aborts the retry.Actual behavior
A manual tracker override is queued into the debounced patcher (
src/features/runtime/world-state/.../use-world-state-patcher.ts,PATCH_DEBOUNCE_MS = 500) and only written back tochat.gameStateon the debounce. The refactor'sretryAgents(src/features/runtime/generation/hooks/use-generate.ts:1819-1900) has noflushPatchcall beforeretryGenerationAgents—flushPatchappears nowhere undersrc/features/runtime/generation.The roleplay HUD actions menu exposes (via
use-chat-timeline-actions.ts):handleRetryFailedAgents(:458)handleRetryAgent(:463)handleRerunTrackers(:472)handleRerunSingleTracker(:479)All call
retryAgents()without flushing.retryGenerationAgents(src/engine/generation/start-generation.ts:2651) then reloads the chat from storage andpersistTrackerSnapshotForTurn(tracker-snapshots.ts:495-503) merges agent output on top of the storage-persistedchat.gameStatebaseline — never the in-memory pending patch. So a manual edit made within the ~500ms debounce window is overwritten by the regenerated snapshot.The per-section rerun via
useTrackerRerunis exempt because that hook flushes explicitly (use-tracker-rerun.ts:36), and the timeline actions (delete/swipe/regen) flush viaflushTrackerPatchesForTimelineAction— which is what makes this gap easy to miss. Only the actions-menu / failed-agent retry handlers regressed.Steps to reproduce
Impact area
Environment
330f69a8Logs, screenshots, or video
Static source audit, cited to
src/features/runtime/generation/hooks/use-generate.ts:1819-1900andsrc/features/modes/shared/chat-ui/hooks/use-chat-timeline-actions.ts:458-479.Regression notes
Regression vs main — worked on main, broken on refactor. Main's
retryAgents(packages/client/src/hooks/use-generate.ts:1847-1853) flushes pending game-state edits internally before the retry and throws on flush failure; main's callers (ChatArea.tsx:968-991) callretryAgentsraw and rely on that centralized flush. The refactor relocated the flush to only a subset of callers (per-section rerun + timeline actions) and left the HUD actions-menu retry handlers unflushed.Additional context
Fix sketch: restore the flush inside the refactor's
retryAgents(cleanest — one site covers all four handlers), mirroring main:Place it after
setProcessing(true)and beforeretryGenerationAgents. The already-correct per-sectionuseTrackerRerunpath is unaffected.Not a duplicate of #2317 (pins nulled every turn, fixed), #2327 (a concurrent turn completing during the debounce — a different trigger), or #2294 (avatar toggle).
Template check
@Romuromylus commented on GitHub (Jun 5, 2026):
Compounds with #2370: both wipe roleplay tracker data, and a single "Re-run Trackers" click can trigger both at once — this issue discards the pending manual edit, then #2370's unguarded merge can additionally clear inventory/stat bars/status if the re-run agent returns an empty array. Worth fixing together since both live on the tracker re-run path.
@Romuromylus commented on GitHub (Jun 6, 2026):
Fixed by #2429, merged into
refactor.