[GH-ISSUE #1188] Imported chats: agents run and yield results but tracker panel + agent activity stay empty #586

Closed
opened 2026-10-20 17:30:30 +07:00 by bsakaguchi · 0 comments
Owner

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

Originally assigned to: @Romuromylus on GitHub.

Symptom

After importing a pre-refactor profile zip via Settings -> Import Profile, opening an imported roleplay chat (with chat.metadata.activeAgentIds: ["world-state", "quest", "character-tracker", "persona-stats"]) and sending a new message: the model reply arrives normally, but the tracker panel stays on "No tracker data yet" and the agent activity panel stays on "No agent activity yet". Same chat, same provider, same model on a freshly-created refactor chat does populate both panels.

What I confirmed

I instrumented src/engine/generation/start-generation.ts and src/engine/generation/agent-runner.ts with console.log traces and sent a message in an imported roleplay chat. From the DevTools console:

[DBG startGeneration] {chatId: 'iYaXSHsPlEOPYuknQTWhW', chatMode: 'roleplay', chatMetaType: 'string', hasRequestMessages: false, impersonateBlockAgents: undefined}
[DBG resolveAgents] {chatId: 'iYaXSHsPlEOPYuknQTWhW', chatMetaType: 'string', enableAgents: true, activeAgentIds: Array(4), chatAgentsEnabled: true, scopedSize: 4, agentTypesInput: 'undefined'}
[DBG resolveAgents] agent rows 18 samples: [{...}, {...}, {...}]
[DBG resolveAgents] resolved rows: 4 types: ['world-state', 'quest', 'character-tracker', 'persona-stats']
[DBG start-generation] post-gen results {parallel: 0, post: 4, events: 4, sample: Array(3)}

So for this imported chat:

  • chatAgentsEnabled returns true (chat metadata parses correctly from its TEXT form).
  • resolveAgents resolves the expected 4 trackers.
  • runtime.runPost(content) returns 4 post-gen results.
  • 4 agent_result events are pushed into agentEvents and yielded from startGeneration.

Despite that, the agent activity panel (RoleplayHUDActionsMenu -> useAgentStore.thoughtBubbles) and the tracker panel both remain on their empty-state messages. So the gap is downstream of the agent-result yield - somewhere in applyAgentResultEffects, the per-result handlers (applyTrackerResultToGameState, agentStore.addThoughtBubble, etc.), the tracker snapshot persistence (persistTrackerSnapshotSafely), or the panel's React Query subscription - not in agent resolution or execution.

Likely areas to inspect

Just hypotheses, didn't dig further:

  • src/features/runtime/generation/hooks/use-generate.ts:660 applyAgentResultEffects - the per-result handlers may be silently dropping the imported chat's results (e.g. result.success === false for an unrelated reason, or the result shape differs).
  • src/engine/generation/tracker-snapshots.ts persistTrackerSnapshotSafely / commitTrackerSnapshotForTarget - the imported chat may have a gameState shape that the tracker writer can't update against.
  • The agent activity panel may filter on enabledAgentTypes derived from chat-meta in a way that drops imported-chat thought bubbles before they render, despite the underlying useAgentStore.thoughtBubbles being populated.

Repro

  1. Build a pre-refactor profile zip from the test snapshot.
  2. pnpm tauri dev, fresh data dir.
  3. Settings -> Import Profile -> select the zip.
  4. Open the imported roleplay chat.
  5. Send any message.
  6. Observe: model replies, but tracker and agent activity panels remain empty.

Out of scope

I originally suspected chat.metadata.activeAgentIds was empty post-import and that no agents fire at all. After live verification that's incorrect - they fire and yield results. The actual bug is downstream of agent yield. The defensive-improvement PR I already filed (#1187: NaN guard + helper unit tests) is unrelated to this and does not fix this; this bug stays open.

If anyone is starting on this, the debug traces in agent-runner.ts:578 (resolveAgents) and start-generation.ts:606 (post-gen results) are the fastest way to confirm where in the pipeline the divergence happens. Worth noting that the same 4 agents on a fresh chat populate both panels correctly, so the divergence is data-shape-dependent on the imported chat row, not on the agents themselves.

Originally created by @Romuromylus on GitHub (May 25, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1188 Originally assigned to: @Romuromylus on GitHub. ## Symptom After importing a pre-refactor profile zip via Settings -> Import Profile, opening an imported roleplay chat (with `chat.metadata.activeAgentIds: ["world-state", "quest", "character-tracker", "persona-stats"]`) and sending a new message: the model reply arrives normally, but the tracker panel stays on "No tracker data yet" and the agent activity panel stays on "No agent activity yet". Same chat, same provider, same model on a freshly-created refactor chat does populate both panels. ## What I confirmed I instrumented `src/engine/generation/start-generation.ts` and `src/engine/generation/agent-runner.ts` with `console.log` traces and sent a message in an imported roleplay chat. From the DevTools console: ``` [DBG startGeneration] {chatId: 'iYaXSHsPlEOPYuknQTWhW', chatMode: 'roleplay', chatMetaType: 'string', hasRequestMessages: false, impersonateBlockAgents: undefined} [DBG resolveAgents] {chatId: 'iYaXSHsPlEOPYuknQTWhW', chatMetaType: 'string', enableAgents: true, activeAgentIds: Array(4), chatAgentsEnabled: true, scopedSize: 4, agentTypesInput: 'undefined'} [DBG resolveAgents] agent rows 18 samples: [{...}, {...}, {...}] [DBG resolveAgents] resolved rows: 4 types: ['world-state', 'quest', 'character-tracker', 'persona-stats'] [DBG start-generation] post-gen results {parallel: 0, post: 4, events: 4, sample: Array(3)} ``` So for this imported chat: - `chatAgentsEnabled` returns `true` (chat metadata parses correctly from its TEXT form). - `resolveAgents` resolves the expected 4 trackers. - `runtime.runPost(content)` returns 4 post-gen results. - 4 `agent_result` events are pushed into `agentEvents` and yielded from `startGeneration`. Despite that, the agent activity panel (`RoleplayHUDActionsMenu` -> `useAgentStore.thoughtBubbles`) and the tracker panel both remain on their empty-state messages. So the gap is downstream of the agent-result yield - somewhere in `applyAgentResultEffects`, the per-result handlers (`applyTrackerResultToGameState`, `agentStore.addThoughtBubble`, etc.), the tracker snapshot persistence (`persistTrackerSnapshotSafely`), or the panel's React Query subscription - not in agent resolution or execution. ## Likely areas to inspect Just hypotheses, didn't dig further: - `src/features/runtime/generation/hooks/use-generate.ts:660` `applyAgentResultEffects` - the per-result handlers may be silently dropping the imported chat's results (e.g. `result.success === false` for an unrelated reason, or the result shape differs). - `src/engine/generation/tracker-snapshots.ts` `persistTrackerSnapshotSafely` / `commitTrackerSnapshotForTarget` - the imported chat may have a `gameState` shape that the tracker writer can't update against. - The agent activity panel may filter on `enabledAgentTypes` derived from chat-meta in a way that drops imported-chat thought bubbles before they render, despite the underlying `useAgentStore.thoughtBubbles` being populated. ## Repro 1. Build a pre-refactor profile zip from the test snapshot. 2. `pnpm tauri dev`, fresh data dir. 3. Settings -> Import Profile -> select the zip. 4. Open the imported roleplay chat. 5. Send any message. 6. Observe: model replies, but tracker and agent activity panels remain empty. ## Out of scope I originally suspected `chat.metadata.activeAgentIds` was empty post-import and that no agents fire at all. After live verification that's incorrect - they fire and yield results. The actual bug is downstream of agent yield. The defensive-improvement PR I already filed (#1187: NaN guard + helper unit tests) is unrelated to this and does not fix this; this bug stays open. If anyone is starting on this, the debug traces in `agent-runner.ts:578` (`resolveAgents`) and `start-generation.ts:606` (post-gen results) are the fastest way to confirm where in the pipeline the divergence happens. Worth noting that the same 4 agents on a fresh chat populate both panels correctly, so the divergence is data-shape-dependent on the imported chat row, not on the agents themselves.
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#586
No description provided.