[PR #3822] [MERGED] Fix agent cadence and custom music folder integration #6118

Closed
opened 2026-10-23 04:07:15 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3822
Author: @SpicyMarinara
Created: 7/19/2026
Status: ✅ Merged
Merged: 7/19/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/agent-turn-cadence-music-folder-3820-3821


📝 Commits (5)

  • 9b4878e chore: start agent cadence and music folder fixes
  • 24516d6 fix: preserve agent cadence and custom music source
  • bf47c58 fix: play custom-folder music
  • d2a6c4b Merge branch 'staging' into fix/agent-turn-cadence-music-folder-3820-3821
  • 21b1b50 fix: prefer current custom music source

📊 Changes

13 files changed (+368 additions, -79 deletions)

View changed files

📝 docs/game/game-assets.md (+1 -1)
📝 docs/media/illustrator-agent.md (+1 -1)
📝 docs/media/music.md (+2 -0)
📝 packages/client/src/components/agents/AgentEditor.tsx (+2 -1)
📝 packages/client/src/components/chat/AgentAddSetupFields.tsx (+94 -17)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+125 -38)
📝 packages/client/src/components/chat/LocalMusicPlayer.tsx (+69 -16)
📝 packages/server/src/routes/game-assets.routes.ts (+3 -3)
📝 packages/server/src/routes/generate.routes.ts (+4 -0)
📝 packages/server/src/services/agents/agent-executor.ts (+2 -1)
📝 packages/server/src/services/generation/agent-cadence.ts (+4 -1)
📝 scripts/regressions/open-issues.regression.ts (+15 -0)
📝 scripts/regressions/prompt.regression.ts (+46 -0)

📄 Description

Linked issue

Closes #3820
Closes #3821
Closes #3827

Why this change

  • Roleplay swipes and continuations reuse an existing assistant message, but Illustrator cadence treated each generation as a new accepted reply. This could make Illustrator eligible and reset its interval too early.
  • Music DJ already saves and reads a device-folder source, but Roleplay and Game chat surfaces only showed the Game Assets path. Users could not see the folder they had configured.
  • Custom-folder songs were encoded into a route parameter that commonly exceeded Fastify's 100-character limit. The audio element also bypassed Marinara's authenticated API client, so the route could return 404 or 403 JSON that browsers reported as an unsupported media source.

What changed

  • Count an upcoming assistant message for interval agents only when generation will create a new assistant message. Swipes, continuations, and impersonation no longer advance the interval.
  • Preserve Music DJ's customMusicSource and customMusicExternalFolder through chat agent setup.
  • Show the active Game Assets or device-folder source in Roleplay and Game settings, including the saved path and existing privileged folder picker.
  • Send long encoded device paths as a query parameter and fetch selected songs through the authenticated API client before playback, without weakening the privileged file route.
  • Revoke temporary browser media URLs when a track is replaced, stopped, or the player unmounts.
  • Document accepted-turn Illustrator cadence and the mirrored Music DJ source behavior.
  • Add regression coverage for new-message versus swipe/continuation cadence and authenticated custom-folder playback wiring.

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

Manual verification notes

  • Automated: pnpm check passed on the final diff.
  • Automated: pnpm regression:issues passed, including the custom-folder playback wiring regression.
  • Automated: pnpm regression:prompt passed, including the new cadence regression.
  • Automated: client tsc --noEmit, server lint, and git diff --check passed.
  • Direct route proof: a >100-character encoded song path returns 403 without the required admin header and returns the MP3 with audio/mpeg when authenticated.
  • The isolated client preview built and started against the local server. Browser click-through was not completed because the in-app browser controller failed to connect; manually verify Roleplay and Game Music DJ settings and one device-folder song before merge.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

Updated docs/media/illustrator-agent.md, docs/media/music.md, and docs/game/game-assets.md.

UI evidence (if applicable)

Not captured. Manually verify the Custom source selector, saved device path, Choose Folder action, and device-folder playback in Roleplay and Game on desktop and mobile.

Summary by CodeRabbit

  • New Features

    • Music DJ now supports selecting music from Game Assets or a folder on the device.
    • Saved music sources are displayed in chat settings, with a Choose Folder option for local folders.
    • Local music playback is more reliable when loading selected tracks.
  • Bug Fixes

    • Improved timing for agents that act after a set number of accepted assistant replies.
    • Clarified that Illustrator skips unworthy moments and saves generated images to the Gallery.
  • Documentation

    • Updated setup guidance for Music DJ and Illustrator 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/3822 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/19/2026 **Status:** ✅ Merged **Merged:** 7/19/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/agent-turn-cadence-music-folder-3820-3821` --- ### 📝 Commits (5) - [`9b4878e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9b4878eef8ded559e8880a1716426624bd78b52f) chore: start agent cadence and music folder fixes - [`24516d6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/24516d653cbe98a00fcd28efc21fafaaa21ca3f0) fix: preserve agent cadence and custom music source - [`bf47c58`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bf47c5813745a9690b820b0ce3cce7afd7a7035a) fix: play custom-folder music - [`d2a6c4b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d2a6c4b8b4141e62597270596a05ca25efec469a) Merge branch 'staging' into fix/agent-turn-cadence-music-folder-3820-3821 - [`21b1b50`](https://github.com/Pasta-Devs/Marinara-Engine/commit/21b1b5042faadbad02d1c1a61a6e3917e5951d86) fix: prefer current custom music source ### 📊 Changes **13 files changed** (+368 additions, -79 deletions) <details> <summary>View changed files</summary> 📝 `docs/game/game-assets.md` (+1 -1) 📝 `docs/media/illustrator-agent.md` (+1 -1) 📝 `docs/media/music.md` (+2 -0) 📝 `packages/client/src/components/agents/AgentEditor.tsx` (+2 -1) 📝 `packages/client/src/components/chat/AgentAddSetupFields.tsx` (+94 -17) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+125 -38) 📝 `packages/client/src/components/chat/LocalMusicPlayer.tsx` (+69 -16) 📝 `packages/server/src/routes/game-assets.routes.ts` (+3 -3) 📝 `packages/server/src/routes/generate.routes.ts` (+4 -0) 📝 `packages/server/src/services/agents/agent-executor.ts` (+2 -1) 📝 `packages/server/src/services/generation/agent-cadence.ts` (+4 -1) 📝 `scripts/regressions/open-issues.regression.ts` (+15 -0) 📝 `scripts/regressions/prompt.regression.ts` (+46 -0) </details> ### 📄 Description ## Linked issue Closes #3820 Closes #3821 Closes #3827 ## Why this change - Roleplay swipes and continuations reuse an existing assistant message, but Illustrator cadence treated each generation as a new accepted reply. This could make Illustrator eligible and reset its interval too early. - Music DJ already saves and reads a device-folder source, but Roleplay and Game chat surfaces only showed the Game Assets path. Users could not see the folder they had configured. - Custom-folder songs were encoded into a route parameter that commonly exceeded Fastify's 100-character limit. The audio element also bypassed Marinara's authenticated API client, so the route could return 404 or 403 JSON that browsers reported as an unsupported media source. ## What changed - Count an upcoming assistant message for interval agents only when generation will create a new assistant message. Swipes, continuations, and impersonation no longer advance the interval. - Preserve Music DJ's `customMusicSource` and `customMusicExternalFolder` through chat agent setup. - Show the active Game Assets or device-folder source in Roleplay and Game settings, including the saved path and existing privileged folder picker. - Send long encoded device paths as a query parameter and fetch selected songs through the authenticated API client before playback, without weakening the privileged file route. - Revoke temporary browser media URLs when a track is replaced, stopped, or the player unmounts. - Document accepted-turn Illustrator cadence and the mirrored Music DJ source behavior. - Add regression coverage for new-message versus swipe/continuation cadence and authenticated custom-folder playback wiring. ## 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` ### Manual verification notes - Automated: `pnpm check` passed on the final diff. - Automated: `pnpm regression:issues` passed, including the custom-folder playback wiring regression. - Automated: `pnpm regression:prompt` passed, including the new cadence regression. - Automated: client `tsc --noEmit`, server lint, and `git diff --check` passed. - Direct route proof: a >100-character encoded song path returns 403 without the required admin header and returns the MP3 with `audio/mpeg` when authenticated. - The isolated client preview built and started against the local server. Browser click-through was not completed because the in-app browser controller failed to connect; manually verify Roleplay and Game Music DJ settings and one device-folder song before merge. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) Updated `docs/media/illustrator-agent.md`, `docs/media/music.md`, and `docs/game/game-assets.md`. ## UI evidence (if applicable) Not captured. Manually verify the Custom source selector, saved device path, Choose Folder action, and device-folder playback in Roleplay and Game on desktop and mobile. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Music DJ now supports selecting music from Game Assets or a folder on the device. - Saved music sources are displayed in chat settings, with a **Choose Folder** option for local folders. - Local music playback is more reliable when loading selected tracks. - **Bug Fixes** - Improved timing for agents that act after a set number of accepted assistant replies. - Clarified that Illustrator skips unworthy moments and saves generated images to the Gallery. - **Documentation** - Updated setup guidance for Music DJ and Illustrator 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-23 04:07:15 +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#6118
No description provided.