[GH-ISSUE #2373] [Issue]: Quest-tracker re-run removes just-completed quests that main keeps visible (autoRemoveFullyCompleted opt-out deleted) #1175

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

Originally created by @Romuromylus on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2373

Originally assigned to: @Romuromylus on GitHub.

Summary

Severity: Low — correctness (regression vs main). The refactor deleted the autoRemoveFullyCompleted opt-out from applyQuestUpdatesToPlayerStats, so it now unconditionally removes a fully-completed quest from activeQuests. When the user presses the per-section quest refresh button in the roleplay Quest panel, a just-completed quest is dropped from the tracker. Main's re-run path keeps it visible (with line-through styling) until the next normal turn.

Expected behavior

Pressing the quest-tracker refresh button in the roleplay HUD should match main: a freshly-completed quest stays visible in the tracker (shown completed / struck-through) on a manual re-run, and is removed on the next normal generation turn — not removed immediately on the re-run click.

Actual behavior

src/engine/shared/game-state/player-stats.ts:307-355 — applyQuestUpdatesToPlayerStats has no options parameter; lines 343-351 unconditionally splice out any completed quest:

for (let index = quests.length - 1; index >= 0; index -= 1) {
  const quest = quests[index]!;
  if (quest.completed && (quest.objectives.length === 0 || quest.objectives.every((o) => o.completed))) {
    quests.splice(index, 1);
  }
}

Both refactor call sites funnel through it with no gate: the per-turn persist path (src/engine/generation/tracker-snapshots.ts:476, via persistTrackerSnapshotForTurn) and the client apply path (src/features/runtime/generation/hooks/use-generate.ts:792). So on refactor both per-turn and the manual re-run remove completed quests.

Reachability: RoleplayHUDQuestsTrackerSection.tsx:55-59 renders TrackerSectionRefresh with agentType = TRACKER_SECTION_AGENT_TYPES.quests (resolves to "quest"), use-tracker-rerun.ts:30 gate passes, then retryAgents → retryGenerationAgents (server-side removes) + applyQuestUpdates (client removes).

Steps to reproduce

  1. Roleplay chat with the quest tracker enabled; drive a quest to completion (completed = true, all objectives done).
  2. Press the per-section quest refresh button in the HUD quest panel.
  3. The quest agent re-emits the quest as complete → refactor removes it from the tracker immediately. Main keeps it shown (struck-through) until the next turn.

Impact area

  • Roleplay mode
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • React-free engine behavior, contracts, agents, or capability ports

Environment

  • Branch or commit: refactor @ 330f69a8
  • Run mode: Tauri desktop
  • OS + version: not relevant (static source audit)
  • Node + pnpm versions: not relevant
  • Rust version, if relevant: not relevant
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

Static source audit, cited to src/engine/shared/game-state/player-stats.ts:343-351 and call site src/engine/generation/tracker-snapshots.ts:476.

Regression notes

Regression vs main — worked on main, broken on refactor. On main, applyQuestUpdatesToPlayerStats takes options: { autoRemoveFullyCompleted?: boolean } = {} and only splices completed quests when options.autoRemoveFullyCompleted === true (packages/shared/src/utils/quest-state.ts:219-265). Call-site map:

  • Server per-turn packages/server/src/routes/generate.routes.ts:9237 passes { autoRemoveFullyCompleted: true } (removes).
  • Server re-run packages/server/src/routes/generate/retry-agents-route.ts:1642 omits it (keeps).
  • Client per-turn packages/client/src/hooks/use-generate.ts:1148 and client retry :1970 both omit it (keep).

So on main the re-run/refresh button keeps a completed quest visible; the refactor dropped the option entirely and removes on the first re-run.

Additional context

This is a narrow visual-persistence delta, not lost editable data: on main the same completed quest is removed on the very next normal turn (per-turn passes autoRemoveFullyCompleted: true), so it only stays visible slightly longer across manual quest-refresh clicks. It changes what tracker rows the user sees, hence a regression, but minor.

Fix sketch: re-add options: { autoRemoveFullyCompleted?: boolean } = {} to applyQuestUpdatesToPlayerStats, gate the 343-351 splice behind options.autoRemoveFullyCompleted === true, pass { autoRemoveFullyCompleted: true } from the per-turn/persist paths, and omit it on the single-tracker re-run path to match main.

Not a duplicate of #2317 / #2327 / #2294.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Romuromylus on GitHub (Jun 5, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2373 Originally assigned to: @Romuromylus on GitHub. ## Summary **Severity: Low — correctness (regression vs main).** The refactor deleted the `autoRemoveFullyCompleted` opt-out from `applyQuestUpdatesToPlayerStats`, so it now unconditionally removes a fully-completed quest from `activeQuests`. When the user presses the per-section quest refresh button in the roleplay Quest panel, a just-completed quest is dropped from the tracker. Main's re-run path keeps it visible (with line-through styling) until the next normal turn. ## Expected behavior Pressing the quest-tracker refresh button in the roleplay HUD should match main: a freshly-completed quest stays visible in the tracker (shown completed / struck-through) on a manual re-run, and is removed on the next normal generation turn — not removed immediately on the re-run click. ## Actual behavior `src/engine/shared/game-state/player-stats.ts:307-355` — `applyQuestUpdatesToPlayerStats` has no `options` parameter; lines 343-351 unconditionally splice out any completed quest: ```ts for (let index = quests.length - 1; index >= 0; index -= 1) { const quest = quests[index]!; if (quest.completed && (quest.objectives.length === 0 || quest.objectives.every((o) => o.completed))) { quests.splice(index, 1); } } ``` Both refactor call sites funnel through it with no gate: the per-turn persist path (`src/engine/generation/tracker-snapshots.ts:476`, via `persistTrackerSnapshotForTurn`) and the client apply path (`src/features/runtime/generation/hooks/use-generate.ts:792`). So on refactor both per-turn and the manual re-run remove completed quests. Reachability: `RoleplayHUDQuestsTrackerSection.tsx:55-59` renders `TrackerSectionRefresh` with `agentType = TRACKER_SECTION_AGENT_TYPES.quests` (resolves to `"quest"`), `use-tracker-rerun.ts:30` gate passes, then `retryAgents` → `retryGenerationAgents` (server-side removes) + `applyQuestUpdates` (client removes). ## Steps to reproduce 1. Roleplay chat with the quest tracker enabled; drive a quest to completion (`completed = true`, all objectives done). 2. Press the per-section quest refresh button in the HUD quest panel. 3. The quest agent re-emits the quest as complete → refactor removes it from the tracker immediately. Main keeps it shown (struck-through) until the next turn. ## Impact area - [x] Roleplay mode - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [x] React-free engine behavior, contracts, agents, or capability ports ## Environment - Branch or commit: refactor @ 330f69a8 - Run mode: Tauri desktop - OS + version: not relevant (static source audit) - Node + pnpm versions: not relevant - Rust version, if relevant: not relevant - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video Static source audit, cited to `src/engine/shared/game-state/player-stats.ts:343-351` and call site `src/engine/generation/tracker-snapshots.ts:476`. ## Regression notes Regression vs main — worked on main, broken on refactor. On main, `applyQuestUpdatesToPlayerStats` takes `options: { autoRemoveFullyCompleted?: boolean } = {}` and only splices completed quests when `options.autoRemoveFullyCompleted === true` (`packages/shared/src/utils/quest-state.ts:219-265`). Call-site map: - Server per-turn `packages/server/src/routes/generate.routes.ts:9237` passes `{ autoRemoveFullyCompleted: true }` (removes). - Server re-run `packages/server/src/routes/generate/retry-agents-route.ts:1642` omits it (keeps). - Client per-turn `packages/client/src/hooks/use-generate.ts:1148` and client retry `:1970` both omit it (keep). So on main the re-run/refresh button keeps a completed quest visible; the refactor dropped the option entirely and removes on the first re-run. ## Additional context This is a narrow visual-persistence delta, not lost editable data: on main the same completed quest is removed on the very next normal turn (per-turn passes `autoRemoveFullyCompleted: true`), so it only stays visible slightly longer across manual quest-refresh clicks. It changes what tracker rows the user sees, hence a regression, but minor. Fix sketch: re-add `options: { autoRemoveFullyCompleted?: boolean } = {}` to `applyQuestUpdatesToPlayerStats`, gate the `343-351` splice behind `options.autoRemoveFullyCompleted === true`, pass `{ autoRemoveFullyCompleted: true }` from the per-turn/persist paths, and omit it on the single-tracker re-run path to match main. Not a duplicate of #2317 / #2327 / #2294. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:28:20 +07:00
Author
Owner

@Romuromylus commented on GitHub (Jun 6, 2026):

Fixed by #2430, merged into refactor.

<!-- gh-comment-id:4637952814 --> @Romuromylus commented on GitHub (Jun 6, 2026): Fixed by #2430, merged into `refactor`.
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#1175
No description provided.