[PR #7304] [MERGED] feat(illustrator): Run Interval per chat #7674

Closed
opened 2026-10-24 04:06:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7304
Author: @SpicyMarinara
Created: 10/8/2026
Status: ✅ Merged
Merged: 10/8/2026
Merged by: @SpicyMarinara

Base: staging ← Head: feat/illustrator-chat-run-interval


📝 Commits (5)

  • d9cda66 feat(illustrator): set Run Interval per chat
  • ef28521 fix(illustrator): read a Run Interval saved as text, and say this chat's interval in /illustrate copy
  • 9d366cc Merge origin/staging into feat/illustrator-chat-run-interval
  • 18444cf fix(illustrator): keep the per-chat Run Interval to Roleplay; restore the /illustrate copy
  • 392dddb Merge origin/staging into feat/illustrator-chat-run-interval

📊 Changes

17 files changed (+348 additions, -48 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 docs/agents/built-in-agents.md (+2 -2)
📝 docs/media/illustrator-agent.md (+5 -3)
📝 e2e/illustrator-manual-cadence.e2e.ts (+56 -0)
📝 e2e/roleplay-commands.e2e.ts (+14 -0)
📝 packages/client/src/components/agents/AgentEditor.tsx (+3 -0)
📝 packages/client/src/components/chat/AgentAddSetupFields.tsx (+9 -4)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+68 -18)
📝 packages/client/src/components/chat/ChatSetupWizard.tsx (+23 -15)
📝 packages/client/src/localization/locales/en.json (+2 -0)
📝 packages/server/src/routes/agents.routes.ts (+12 -3)
📝 packages/server/src/routes/chats.routes.ts (+5 -0)
📝 packages/server/src/routes/generate.routes.ts (+10 -2)
📝 packages/server/src/services/generation/agent-cadence.ts (+17 -0)
📝 packages/shared/src/types/chat.ts (+5 -0)
📝 packages/shared/src/utils/illustrator-generation-count.ts (+10 -0)
📝 scripts/regressions/illustrator-manual-cadence.regression.ts (+106 -1)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7299

Why this change

Illustrator's Run Interval (messages between automatic images; 0 means only when you ask) could only be set in the Agent Editor, so one value applied to every chat. People want different rhythms per chat: every message in one, every 5 in another, manual only in a third. The add-agent window showed the field, but changing it there silently changed the Agent Editor value for every chat. Mari asked for the interval to be a per-chat setting, with the Agent Editor value as the default.

What changed

  • Shared: new optional chat metadata field illustratorRunInterval (whole number 0–100; 0 = only when you ask; missing or null = the Agent Editor value), normalized by normalizeIllustratorRunInterval next to the images-per-generation normalizer. Numbers and numeric text are both accepted, as the server already did for agent settings.
  • Server: PATCH /chats/:id/metadata clamps the field. One helper, applyIllustratorChatRunInterval in agent-cadence.ts, is applied at the only automatic Illustrator gate (skipAutomaticIllustrator in generate.routes.ts) and in the unused cadence status route. It applies the chat value only in Roleplay chats: Game orders its illustrations by scenes and asset needs, so a value carried over by a settings profile can't change Game. 0 still means never automatic. Gallery Illustrate and slash commands go through the retry route, which has no cadence check, so they ignore the interval.
  • Chat Settings → Agents → Illustrator card (Roleplay only): a Run Interval field showing the chat's value, otherwise the Agent Editor value, with Chat override / Use agent default. Help: "Messages between automatic images in this chat. 0 means only when you ask."
  • Add-agent window (Chat Settings in Roleplay, and the new-chat setup): for Illustrator the field starts from the chat value or the Agent Editor value, allows 0, and saves to the chat. It is cleared when it equals the default. It no longer writes runInterval into the global agent config, which used to change every other chat. In a Game chat, the add window doesn't show Illustrator's Run Interval. Other agents are unchanged.
  • Agent Editor: the Illustrator Run Interval gets one line: "Chats use this unless they set their own in Chat Settings."
  • An Agent Editor value saved as text ("0", from older or imported settings) is now read the way the server reads it, instead of showing 5 (CodeRabbit thread).
  • Tests: the illustrator-manual-cadence regression covers the normalizer, the chat value winning over the agent value in Roleplay and being ignored in Game, null fallback, 0/1/3 cadence decisions and the add-window patch. e2e/illustrator-manual-cadence.e2e.ts drives the card field, reset, the add window and an agent value saved as text, and checks that the agent config is never changed. e2e/roleplay-commands.e2e.ts proves through real generate runs that the chat value wins in both directions and that null falls back.
  • Docs: docs/media/illustrator-agent.md, docs/agents/built-in-agents.md. CHANGELOG entry under [Unreleased].

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Agent-run checks (not a substitute for the boxes above):

  • pnpm check on the final head (18444cfba): exit 0.
  • Regressions illustrator-* (6/6), open-issues, manual-agent-retry-resolution, agent-runtime, chat-window-icons, localization-key-references: all pass.
  • e2e/illustrator-manual-cadence.e2e.ts: desktop-chromium and mobile-webkit pass. With the drawer change reverted, the new text-value step fails (Expected "3", Received "5").
  • e2e/roleplay-commands.e2e.ts "forward Illustrator settings" and e2e/core-flows.e2e.ts "Illustrator and Storyboard keep separate visual settings cards": pass on desktop-chromium on the final head. On mobile-webkit it passed 12 of 13 repeated runs; the 1 failure was a 10 s timeout opening Chat Settings at an existing step (roleplay-commands.e2e.ts:2201), before this PR's assertions. The same test passed 4/4 on unchanged staging, which is too few runs to tell whether that timeout is new.
  • An independent reviewer found no defects. The /illustrate command description is unchanged from staging. A separate verifier traced every server runInterval read and agreed that the automatic Illustrator gate is the only cadence check.
  • Local CodeRabbit: 1 trivial finding (fetch the chat in the unused cadence status route only for Illustrator), rejected because the route has no callers and the extra lookup sits beside an existing listMessages call. GitHub CodeRabbit's text-value finding is fixed in ef285215c.

Manual verification notes

  • Manually verify in a browser: add Illustrator to a Roleplay chat; the setup window shows Run Interval prefilled with the Agent Editor value. Change it, confirm, and check the Agent Editor value is unchanged.
  • Manually verify Chat Settings → Agents → Illustrator shows that chat's Run Interval, that changing it saves, and that reset returns to the Agent Editor value.
  • Manually verify that with 0 Illustrator makes no automatic images but Gallery Illustrate and the slash command still work; with 1 it runs every reply; with 5 it waits 5 messages.
  • Manually verify two chats with different intervals behave independently.
  • Manually verify the new-chat setup's Agents step: adding Illustrator shows the chat value or the Agent Editor value, allows 0, and saves to the chat only. This path has no e2e of its own; it shares code with the Chat Settings add window, which does.
  • Manually verify a Game chat's agent-pool Illustrator card has no Run Interval field, and adding Illustrator to a Game chat shows no Run Interval in the add window.
  • Manually verify at phone width and in light and dark mode.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)

Translation follow-up: #7305.

  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

None yet.

Summary by CodeRabbit

  • New Features
    • Set Illustrator’s automatic image interval separately for each Roleplay chat. Chats use the agent’s default unless you choose an override; Use agent default clears the override.
    • Set an interval of 0 to generate images only when requested. Game chats continue to order illustrations by scenes and asset needs.
  • Bug Fixes
    • Chat-specific intervals now determine when automatic illustrations run, while other chats and agents retain their existing cadence behavior.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7304 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/8/2026 **Status:** ✅ Merged **Merged:** 10/8/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `feat/illustrator-chat-run-interval` --- ### 📝 Commits (5) - [`d9cda66`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d9cda66136256f57e502d54ab6cf07f18d54f136) feat(illustrator): set Run Interval per chat - [`ef28521`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ef285215cc0f68fe71be0c14466dbb26713e5df1) fix(illustrator): read a Run Interval saved as text, and say this chat's interval in /illustrate copy - [`9d366cc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9d366ccc8bf594464257d08b5c4a1ec258575c47) Merge origin/staging into feat/illustrator-chat-run-interval - [`18444cf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/18444cfbaa012ea59a23b9d2371b7a16688b85eb) fix(illustrator): keep the per-chat Run Interval to Roleplay; restore the /illustrate copy - [`392dddb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/392dddbf6ccf55dff7101417f5d343dc216ed343) Merge origin/staging into feat/illustrator-chat-run-interval ### 📊 Changes **17 files changed** (+348 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `docs/agents/built-in-agents.md` (+2 -2) 📝 `docs/media/illustrator-agent.md` (+5 -3) 📝 `e2e/illustrator-manual-cadence.e2e.ts` (+56 -0) 📝 `e2e/roleplay-commands.e2e.ts` (+14 -0) 📝 `packages/client/src/components/agents/AgentEditor.tsx` (+3 -0) 📝 `packages/client/src/components/chat/AgentAddSetupFields.tsx` (+9 -4) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+68 -18) 📝 `packages/client/src/components/chat/ChatSetupWizard.tsx` (+23 -15) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) 📝 `packages/server/src/routes/agents.routes.ts` (+12 -3) 📝 `packages/server/src/routes/chats.routes.ts` (+5 -0) 📝 `packages/server/src/routes/generate.routes.ts` (+10 -2) 📝 `packages/server/src/services/generation/agent-cadence.ts` (+17 -0) 📝 `packages/shared/src/types/chat.ts` (+5 -0) 📝 `packages/shared/src/utils/illustrator-generation-count.ts` (+10 -0) 📝 `scripts/regressions/illustrator-manual-cadence.regression.ts` (+106 -1) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7299 ## Why this change Illustrator's **Run Interval** (messages between automatic images; 0 means only when you ask) could only be set in the Agent Editor, so one value applied to every chat. People want different rhythms per chat: every message in one, every 5 in another, manual only in a third. The add-agent window showed the field, but changing it there silently changed the Agent Editor value for every chat. Mari asked for the interval to be a per-chat setting, with the Agent Editor value as the default. ## What changed - **Shared:** new optional chat metadata field `illustratorRunInterval` (whole number 0–100; 0 = only when you ask; missing or null = the Agent Editor value), normalized by `normalizeIllustratorRunInterval` next to the images-per-generation normalizer. Numbers and numeric text are both accepted, as the server already did for agent settings. - **Server:** `PATCH /chats/:id/metadata` clamps the field. One helper, `applyIllustratorChatRunInterval` in `agent-cadence.ts`, is applied at the only automatic Illustrator gate (`skipAutomaticIllustrator` in `generate.routes.ts`) and in the unused cadence status route. It applies the chat value **only in Roleplay chats**: Game orders its illustrations by scenes and asset needs, so a value carried over by a settings profile can't change Game. 0 still means never automatic. Gallery Illustrate and slash commands go through the retry route, which has no cadence check, so they ignore the interval. - **Chat Settings → Agents → Illustrator card** (Roleplay only): a **Run Interval** field showing the chat's value, otherwise the Agent Editor value, with **Chat override** / **Use agent default**. Help: "Messages between automatic images in this chat. 0 means only when you ask." - **Add-agent window** (Chat Settings in Roleplay, and the new-chat setup): for Illustrator the field starts from the chat value or the Agent Editor value, allows 0, and saves to the chat. It is cleared when it equals the default. It **no longer writes `runInterval` into the global agent config**, which used to change every other chat. In a Game chat, the add window doesn't show Illustrator's Run Interval. Other agents are unchanged. - **Agent Editor:** the Illustrator Run Interval gets one line: "Chats use this unless they set their own in Chat Settings." - An Agent Editor value saved as text (`"0"`, from older or imported settings) is now read the way the server reads it, instead of showing 5 (CodeRabbit thread). - **Tests:** the `illustrator-manual-cadence` regression covers the normalizer, the chat value winning over the agent value in Roleplay and being ignored in Game, null fallback, 0/1/3 cadence decisions and the add-window patch. `e2e/illustrator-manual-cadence.e2e.ts` drives the card field, reset, the add window and an agent value saved as text, and checks that the agent config is never changed. `e2e/roleplay-commands.e2e.ts` proves through real generate runs that the chat value wins in both directions and that null falls back. - Docs: `docs/media/illustrator-agent.md`, `docs/agents/built-in-agents.md`. CHANGELOG entry under `[Unreleased]`. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Agent-run checks (not a substitute for the boxes above): - `pnpm check` on the final head (18444cfba): exit 0. - Regressions `illustrator-*` (6/6), `open-issues`, `manual-agent-retry-resolution`, `agent-runtime`, `chat-window-icons`, `localization-key-references`: all pass. - `e2e/illustrator-manual-cadence.e2e.ts`: desktop-chromium and mobile-webkit pass. With the drawer change reverted, the new text-value step fails (`Expected "3"`, `Received "5"`). - `e2e/roleplay-commands.e2e.ts` "forward Illustrator settings" and `e2e/core-flows.e2e.ts` "Illustrator and Storyboard keep separate visual settings cards": pass on desktop-chromium on the final head. On mobile-webkit it passed 12 of 13 repeated runs; the 1 failure was a 10 s timeout opening Chat Settings at an existing step (`roleplay-commands.e2e.ts:2201`), before this PR's assertions. The same test passed 4/4 on unchanged staging, which is too few runs to tell whether that timeout is new. - An independent reviewer found no defects. The `/illustrate` command description is unchanged from staging. A separate verifier traced every server `runInterval` read and agreed that the automatic Illustrator gate is the only cadence check. - Local CodeRabbit: 1 trivial finding (fetch the chat in the unused cadence status route only for Illustrator), rejected because the route has no callers and the extra lookup sits beside an existing `listMessages` call. GitHub CodeRabbit's text-value finding is fixed in ef285215c. ### Manual verification notes - Manually verify in a browser: add Illustrator to a Roleplay chat; the setup window shows Run Interval prefilled with the Agent Editor value. Change it, confirm, and check the Agent Editor value is unchanged. - Manually verify Chat Settings → Agents → Illustrator shows that chat's Run Interval, that changing it saves, and that reset returns to the Agent Editor value. - Manually verify that with 0 Illustrator makes no automatic images but Gallery **Illustrate** and the slash command still work; with 1 it runs every reply; with 5 it waits 5 messages. - Manually verify two chats with different intervals behave independently. - Manually verify the new-chat setup's Agents step: adding Illustrator shows the chat value or the Agent Editor value, allows 0, and saves to the chat only. This path has no e2e of its own; it shares code with the Chat Settings add window, which does. - Manually verify a Game chat's agent-pool Illustrator card has **no** Run Interval field, and adding Illustrator to a Game chat shows no Run Interval in the add window. - Manually verify at phone width and in light and dark mode. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) Translation follow-up: #7305. - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) None yet. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Set Illustrator’s automatic image interval separately for each Roleplay chat. Chats use the agent’s default unless you choose an override; **Use agent default** clears the override. - Set an interval of **0** to generate images only when requested. Game chats continue to order illustrations by scenes and asset needs. - **Bug Fixes** - Chat-specific intervals now determine when automatic illustrations run, while other chats and agents retain their existing cadence behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:06:25 +07:00
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#7674
No description provided.