[GH-ISSUE #3831] [Issue]: Agent-default changes (prompt template, per-agent toggles) don't propagate to existing chats — chatMeta overrides pin forever #2067

Closed
opened 2026-10-21 05:45:04 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @GetBeholder on GitHub (Jul 19, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3831

Originally assigned to: @SpicyMarinara on GitHub.

Summary

When a user changes an agent's default (e.g. the Illustrator agent's default prompt template, or its default Attach-Card-Appearance / Send-Avatar-References toggles), new chats correctly pick up the new default, but existing chats continue to use the old value indefinitely. There is no UI affordance to inherit-from-default; the only workaround is opening every existing chat and manually re-selecting the current default.

Confirmed by inspection: chatMeta is authoritative once it holds any value for a given field, and it's written on the user's first interaction with that field (even implicit interaction, in some cases). After that, the "default" the user changes in agent settings applies only to future chats.

Expected behavior

A change to an agent's default should be reflected in all chats that have not explicitly overridden that field. Concretely, one of:

  1. Existing chats without an explicit user pick track the current default (sentinel-based / null-means-inherit).
  2. Users can "reset to agent default" per chat via a small UI control.
  3. A one-click "push current defaults to all existing chats" bulk action from the agent editor.

Actual behavior

Pattern in the server code (Node/TS Engine):

packages/server/src/routes/generate/retry-agents-route.ts:3057-3063 (mirror at generate.routes.ts:7872):

```ts
const useAvatarRefs =
typeof chatMeta.illustratorUseAvatarReferences === "boolean"
? chatMeta.illustratorUseAvatarReferences
: illustratorAgent?.resolved.settings?.useAvatarReferences === true;
```

Once chatMeta.illustratorUseAvatarReferences is set (true or false), the ternary always resolves to chatMeta, and the agent's default is never consulted again. Same shape for illustratorIncludeCharacterAppearance and illustratorPromptConnectionId.

For prompt template selection, chatMeta.agentPromptTemplateIds is a Record<agentType, templateId>:

packages/server/src/routes/generate/retry-agents-route.ts:1046:

```ts
const agentPromptTemplateSelections = normalizeAgentPromptTemplateSelectionMap(chatMeta.agentPromptTemplateIds);
// … later …
selectedPromptTemplateId: agentPromptTemplateSelections[cfg.type as string] ?? null,
```

Client-side fallback at packages/client/src/components/chat/ChatSettingsDrawer.tsx:3821 also picks a stable string:

```ts
selectedId={agentPromptTemplateSelections[agent.id] ?? getDefaultPromptTemplateIdForAgent(agent.id)}
```

Whichever template ID lands in chatMeta.agentPromptTemplateIds[agentType] sticks. Changing defaultPromptTemplateId on the agent afterward has no effect on that chat.

Same-shape pattern is used across other per-chat agent overrides (Music DJ, Storyboard, Video, etc.).

Steps to reproduce

  1. Attach the Illustrator agent to two chats. Let both save their per-chat metadata (open the agent settings drawer to trigger it).
  2. In the Illustrator agent editor, change the default prompt template selection from Template A to Template B.
  3. Start a new chat and attach the Illustrator agent → Template B is used ✓.
  4. Return to either existing chat → still uses Template A. Same result if you change the default value of Attach-Card-Appearance or Send-Avatar-References.

Suggested fix (pick one)

  1. Sentinel-based reset (minimal change). Treat chatMeta.X === null (or missing) as "inherit from agent default." Add a small "Reset to agent default" affordance per field in the chat's agent settings that writes null. Chats that don't have the field set at all keep working; users can opt back into inheritance any time.
  2. Bulk-migration action (matches the reporter's actual pain most directly). From the agent editor: "Push current defaults to all existing chats using this agent." Explicit, destructive, single click.
  3. Effective-value + override badge (aligned UI). Show the effective value in the chat drawer with a small "inherited" / "overridden" tag and a per-field revert control. Matches the code's real semantics and makes the model discoverable.

Options 1 and 3 are compatible; 2 stands alone as a maintenance action.

Test plan (leave boxes unchecked until a human verifies)

  • With two existing chats using the Illustrator agent, change the agent's default prompt template. A new chat picks up the new default. Existing chats behave per the chosen fix (inherit / show badge / receive the bulk push).
  • Same for Attach-Card-Appearance toggle.
  • Same for Send-Avatar-References toggle.
  • Same for Illustrator prompt connection selection.
  • Verify parallel behavior for Music DJ, Storyboard, Video agent per-chat overrides (same code shape, presumably same fix).

Impact

Users who tune agent defaults after building up a chat backlog have to manually walk every chat to apply the change. Scales poorly, easy to miss chats, invisible to the user which chats are stale.

Environment

  • Marinara Engine version: 2.3.3 (and current staging HEAD)
  • Install type: local dev (pnpm)
  • OS + version: Linux (CachyOS)
Originally created by @GetBeholder on GitHub (Jul 19, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3831 Originally assigned to: @SpicyMarinara on GitHub. ## Summary When a user changes an agent's default (e.g. the Illustrator agent's default prompt template, or its default Attach-Card-Appearance / Send-Avatar-References toggles), **new chats** correctly pick up the new default, but **existing chats** continue to use the old value indefinitely. There is no UI affordance to inherit-from-default; the only workaround is opening every existing chat and manually re-selecting the current default. Confirmed by inspection: `chatMeta` is authoritative once it holds any value for a given field, and it's written on the user's first interaction with that field (even implicit interaction, in some cases). After that, the "default" the user changes in agent settings applies only to future chats. ## Expected behavior A change to an agent's default should be reflected in all chats that have not explicitly overridden that field. Concretely, one of: 1. Existing chats without an explicit user pick track the current default (sentinel-based / null-means-inherit). 2. Users can "reset to agent default" per chat via a small UI control. 3. A one-click "push current defaults to all existing chats" bulk action from the agent editor. ## Actual behavior Pattern in the server code (Node/TS Engine): `packages/server/src/routes/generate/retry-agents-route.ts:3057-3063` (mirror at `generate.routes.ts:7872`): \`\`\`ts const useAvatarRefs = typeof chatMeta.illustratorUseAvatarReferences === "boolean" ? chatMeta.illustratorUseAvatarReferences : illustratorAgent?.resolved.settings?.useAvatarReferences === true; \`\`\` Once `chatMeta.illustratorUseAvatarReferences` is set (`true` or `false`), the ternary always resolves to `chatMeta`, and the agent's default is never consulted again. Same shape for `illustratorIncludeCharacterAppearance` and `illustratorPromptConnectionId`. For prompt template selection, `chatMeta.agentPromptTemplateIds` is a `Record<agentType, templateId>`: `packages/server/src/routes/generate/retry-agents-route.ts:1046`: \`\`\`ts const agentPromptTemplateSelections = normalizeAgentPromptTemplateSelectionMap(chatMeta.agentPromptTemplateIds); // … later … selectedPromptTemplateId: agentPromptTemplateSelections[cfg.type as string] ?? null, \`\`\` Client-side fallback at `packages/client/src/components/chat/ChatSettingsDrawer.tsx:3821` also picks a stable string: \`\`\`ts selectedId={agentPromptTemplateSelections[agent.id] ?? getDefaultPromptTemplateIdForAgent(agent.id)} \`\`\` Whichever template ID lands in `chatMeta.agentPromptTemplateIds[agentType]` sticks. Changing `defaultPromptTemplateId` on the agent afterward has no effect on that chat. Same-shape pattern is used across other per-chat agent overrides (Music DJ, Storyboard, Video, etc.). ## Steps to reproduce 1. Attach the Illustrator agent to two chats. Let both save their per-chat metadata (open the agent settings drawer to trigger it). 2. In the Illustrator agent editor, change the default prompt template selection from Template A to Template B. 3. Start a **new** chat and attach the Illustrator agent → Template B is used ✓. 4. Return to either existing chat → still uses Template A. Same result if you change the default value of Attach-Card-Appearance or Send-Avatar-References. ## Suggested fix (pick one) 1. **Sentinel-based reset (minimal change).** Treat `chatMeta.X === null` (or missing) as "inherit from agent default." Add a small "Reset to agent default" affordance per field in the chat's agent settings that writes `null`. Chats that don't have the field set at all keep working; users can opt back into inheritance any time. 2. **Bulk-migration action (matches the reporter's actual pain most directly).** From the agent editor: "Push current defaults to all existing chats using this agent." Explicit, destructive, single click. 3. **Effective-value + override badge (aligned UI).** Show the effective value in the chat drawer with a small "inherited" / "overridden" tag and a per-field revert control. Matches the code's real semantics and makes the model discoverable. Options 1 and 3 are compatible; 2 stands alone as a maintenance action. ## Test plan (leave boxes unchecked until a human verifies) - [ ] With two existing chats using the Illustrator agent, change the agent's default prompt template. A new chat picks up the new default. Existing chats behave per the chosen fix (inherit / show badge / receive the bulk push). - [ ] Same for Attach-Card-Appearance toggle. - [ ] Same for Send-Avatar-References toggle. - [ ] Same for Illustrator prompt connection selection. - [ ] Verify parallel behavior for Music DJ, Storyboard, Video agent per-chat overrides (same code shape, presumably same fix). ## Impact Users who tune agent defaults after building up a chat backlog have to manually walk every chat to apply the change. Scales poorly, easy to miss chats, invisible to the user which chats are stale. ## Environment - Marinara Engine version: 2.3.3 (and current `staging` HEAD) - Install type: local dev (pnpm) - OS + version: Linux (CachyOS)
bsakaguchi 2026-10-21 05:45:04 +07:00
  • closed this issue
  • added the
    in-pr
    label
Author
Owner

@SpicyMarinara commented on GitHub (Jul 19, 2026):

Claimed by @SpicyMarinara in draft PR #3835 for this assigned issue sweep.

<!-- gh-comment-id:5016973230 --> @SpicyMarinara commented on GitHub (Jul 19, 2026): Claimed by @SpicyMarinara in draft PR #3835 for this assigned issue sweep.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 19, 2026):

Addressed in #3835: agent prompt-template overrides and Illustrator prompt/reference settings now expose inherited versus chat-override state and can be reset to the current agent default; matching setup values remain inherited.

<!-- gh-comment-id:5017046592 --> @SpicyMarinara commented on GitHub (Jul 19, 2026): Addressed in #3835: agent prompt-template overrides and Illustrator prompt/reference settings now expose inherited versus chat-override state and can be reset to the current agent default; matching setup values remain inherited.
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#2067
No description provided.