[PR #8790] [MERGED] fix: ElevenLabs sound effect length, Music DJ test samples, WebP backgrounds and Japanese MMD ZIPs #8806

Closed
opened 2026-11-07 17:39:51 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8790
Author: @SpicyMarinara
Created: 11/3/2026
Status: ✅ Merged
Merged: 11/3/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/media-audio-fixes


📝 Commits (6)

  • 44c64d6 fix(audio): let ElevenLabs choose sound effect length again
  • 9b5b612 fix(agents): keep connection test samples out of the Music DJ library
  • c4d37ee fix(images): save generated backgrounds as WebP when the setting asks
  • 9b60323 fix(avatars): import MMD ZIPs with Japanese or differently cased names
  • 98b0a2e fix(images): replace the old format when a background is regenerated
  • b03a7a5 fix(images): keep folder, star and old links when a background changes format

📊 Changes

14 files changed (+410 additions, -56 deletions)

View changed files

📝 packages/server/src/lib/zip-reader.ts (+29 -2)
📝 packages/server/src/routes/backgrounds.routes.ts (+15 -25)
📝 packages/server/src/services/agents/agent-executor.ts (+6 -1)
📝 packages/server/src/services/audio/generative-audio-providers.ts (+7 -3)
📝 packages/server/src/services/audio/generative-audio.service.ts (+2 -1)
📝 packages/server/src/services/avatars/formats/mmd.ts (+7 -1)
📝 packages/server/src/services/background-library-organization.ts (+34 -2)
📝 packages/server/src/services/game/game-asset-generation.ts (+66 -16)
📝 scripts/regressions/avatar-mmd.regression.ts (+33 -0)
📝 scripts/regressions/generated-image-format.regression.ts (+99 -1)
📝 scripts/regressions/generative-audio-legacy-cache.regression.ts (+8 -1)
📝 scripts/regressions/generative-audio-providers.regression.ts (+7 -0)
➕ scripts/regressions/music-dj-local-library.regression.ts (+70 -0)
📝 scripts/regressions/zip-reader.regression.ts (+27 -3)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.

Linked issue

Closes #8789

Why this change

A release-prep audit found four media problems in this release, and two independent verifiers confirmed each. (1) Every new Game and Roleplay ElevenLabs sound effect was forced to exactly 5 s, which padded short cues and cut long ones. Before, ElevenLabs picked the length from the prompt. (2) The sample saved by a Music & Sound Effects connection test was offered to the Music DJ as a playable track. (3) With 'Save generated images as WebP' on, Game backgrounds, Background agent images and scene illustrations were made lossy WebP and then saved as larger PNGs, so the setting did not work for the largest images. (4) MMD ZIPs from Japanese Windows tools (CP932 names without the UTF-8 flag), or with texture names in a different case, were refused as missing textures or unsafe paths, although the docs promise Japanese names work.

What changed

  • Nothing that worked before stops working. Missing MMD textures are still refused, and sound effects on a Custom endpoint still ask for 5 seconds.
  • ElevenLabs sound effects in Game mode and the Roleplay sound command no longer send a fixed 5-second length, so ElevenLabs picks a length that fits the cue again. Music lengths are unchanged.
  • The Music DJ's Game Assets music library no longer lists the sample left by a Music & Sound Effects connection test. Generated context tracks, such as Gacha Forge's, are still listed.
  • With 'Save generated images as WebP' on, Game backgrounds, Roleplay Background agent images and scene illustrations are now saved as WebP, with one encode after resizing. With the setting off they stay PNG.
  • MMD ZIPs made on Japanese Windows (Shift_JIS/CP932 file names) now import. Textures whose case or Unicode form differs from the PMX reference are found too. Every ZIP importer now reads unflagged non-UTF-8 names as Shift_JIS when they are valid Shift_JIS.
  • Regenerating a Game background or a Background agent background after changing 'Save generated images as WebP' now replaces the old file instead of leaving a second copy in the other format. Later lookups, asset tags and the background tag list point to the new image. The new background keeps the old one's folder and star. Chats and the default Roleplay background that still use the old filename show the new image instead of a missing background. A failed regeneration keeps the previous image.

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

  • Manually verify, with a real ElevenLabs Music & Sound Effects connection, that a short Game-mode sound effect (a door knock) and a long one (rolling thunder) come back at fitting lengths, not both at 5 seconds.
  • Manually verify that the Roleplay [sound:] command with an ElevenLabs connection still plays a cue.
  • Manually verify that after Connections > Music & Sound Effects > Test music, the Music DJ with custom local music (Game Assets source) does not list or play the test sample.
  • Manually verify that with Settings > Save generated images as WebP on, a generated Game background, a Roleplay Background agent image and a scene illustration are saved as .webp under data/game-assets/backgrounds or data/backgrounds, and display in chat.
  • Manually verify importing a real MMD model ZIP made with Windows Explorer or 7-Zip on Japanese Windows (Japanese texture names) under Avatars > 3D/MMD, and confirm its textures render.
  • Manually verify that a ZIP made on a non-Japanese system (for example a Western Windows character card .charx) still imports as before.
  • Manually verify in the browser: star a generated Roleplay background and put it in a folder, toggle 'Save generated images as WebP', force-regenerate it (for example with a manual Illustrator background request), and check it stays starred and in the folder.
  • Manually verify that another chat, or the default Roleplay background, that used the regenerated location's old file still shows a background and now shows the new image.

Agent-run checks (for reference; each regression was shown to fail without its fix):

  • git diff 475208f00f aed5e3578d --stat (re-verify findings on current staging): Only 4 docs files changed. Every finding's code is unchanged, so all four still apply.
  • node ./scripts/pnpm-runner.mjs build:shared: exit 0
  • Fail-before runs: each source file temporarily reverted, then node ./scripts/run-regressions.mjs --filter <name>: Each new assertion FAILED without its fix and PASSED with it (details per finding).
  • node ./scripts/run-regressions.mjs --filter <file>, one by one, for 34 nearby regressions (zip/archive/mmd/avatar-models/glb/vrm/backgrounds/generative-audio/im: 33 PASSED. avatar-backgrounds.regression.ts timed out once at the 30 s per-file limit while the machine was loaded. Rerun alone it PASSED twice (16.5 s and 27.2 s). It is not in the code I touched.
  • cd packages/server && node ../../scripts/pnpm-runner.mjs run lint (tsc -b ../shared && tsc --noEmit && tsc -p ../../scripts/regressions/tsconfig.character-activ: No type errors reported (about 3 min).
  • tsc -p <temporary tsconfig extending scripts/regressions/tsconfig.character-activity.json, listing the changed regression files> (file deleted afterwards): The new music-dj-local-library.regression.ts is clean. Remaining errors are in lines I didn't change: providers regression lines 89 and 162-163 exist identically in HEAD, plus legacy-cache null checks
  • node_modules/.bin/prettier --write <all 12 changed files>: All unchanged (already formatted).
  • eslint: Not run. ESLint is set up only for packages/client (packages/client/eslint.config.js), and the server lint script is tsc only. No client files changed.
  • pnpm localization:check: Not run. No client copy changed.

Independent adversarial review: approve.

Known limits and risks:

  1. The zip-reader change is global: import routes, the package manager, custom agent repositories, mavatar, st-character and MMD all use it. An unflagged name that is not valid UTF-8 but is valid Shift_JIS now decodes as Japanese text instead of U+FFFD replacement characters. CP437/CP850 Western names become different mojibake than before. Path checks still run on the decoded name, and no caller extracts with a second decoder (AdmZip is only used for writing). Node builds without the shift_jis decoder keep the old reading. The 0x7075 Unicode Path field is not read.
  2. Stored filenames are not rewritten: chats keep the old extension and are served the new file through a fallback for missing generated-* names. Pairs already on disk are cleaned up at that slug's next successful forced regeneration.
  3. Connection-test samples are hidden from the DJ but still not deleted when their connection is deleted, which the verifiers marked an optional follow-up.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) 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)
  • Version/release files updated (only if this PR includes a version bump)

🤖 Generated with Claude Code


🔄 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/8790 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 11/3/2026 **Status:** ✅ Merged **Merged:** 11/3/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/media-audio-fixes` --- ### 📝 Commits (6) - [`44c64d6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/44c64d60b82eb04863e7331b6f80f5e0e4d8bc24) fix(audio): let ElevenLabs choose sound effect length again - [`9b5b612`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9b5b61286432f796fc24269354a1f4c4575afc4f) fix(agents): keep connection test samples out of the Music DJ library - [`c4d37ee`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c4d37eef8950746f07dd8305c46f901b274b9003) fix(images): save generated backgrounds as WebP when the setting asks - [`9b60323`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9b60323283f97b31e169635b07ee0ef6d436889a) fix(avatars): import MMD ZIPs with Japanese or differently cased names - [`98b0a2e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/98b0a2ea67a8bb931beadab71b0c57b7ba1c229f) fix(images): replace the old format when a background is regenerated - [`b03a7a5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b03a7a54955b8156b5ca89245fd2e9230ce2771f) fix(images): keep folder, star and old links when a background changes format ### 📊 Changes **14 files changed** (+410 additions, -56 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/lib/zip-reader.ts` (+29 -2) 📝 `packages/server/src/routes/backgrounds.routes.ts` (+15 -25) 📝 `packages/server/src/services/agents/agent-executor.ts` (+6 -1) 📝 `packages/server/src/services/audio/generative-audio-providers.ts` (+7 -3) 📝 `packages/server/src/services/audio/generative-audio.service.ts` (+2 -1) 📝 `packages/server/src/services/avatars/formats/mmd.ts` (+7 -1) 📝 `packages/server/src/services/background-library-organization.ts` (+34 -2) 📝 `packages/server/src/services/game/game-asset-generation.ts` (+66 -16) 📝 `scripts/regressions/avatar-mmd.regression.ts` (+33 -0) 📝 `scripts/regressions/generated-image-format.regression.ts` (+99 -1) 📝 `scripts/regressions/generative-audio-legacy-cache.regression.ts` (+8 -1) 📝 `scripts/regressions/generative-audio-providers.regression.ts` (+7 -0) ➕ `scripts/regressions/music-dj-local-library.regression.ts` (+70 -0) 📝 `scripts/regressions/zip-reader.regression.ts` (+27 -3) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. ## Linked issue Closes #8789 ## Why this change A release-prep audit found four media problems in this release, and two independent verifiers confirmed each. (1) Every new Game and Roleplay ElevenLabs sound effect was forced to exactly 5 s, which padded short cues and cut long ones. Before, ElevenLabs picked the length from the prompt. (2) The sample saved by a Music & Sound Effects connection test was offered to the Music DJ as a playable track. (3) With 'Save generated images as WebP' on, Game backgrounds, Background agent images and scene illustrations were made lossy WebP and then saved as larger PNGs, so the setting did not work for the largest images. (4) MMD ZIPs from Japanese Windows tools (CP932 names without the UTF-8 flag), or with texture names in a different case, were refused as missing textures or unsafe paths, although the docs promise Japanese names work. ## What changed - Nothing that worked before stops working. Missing MMD textures are still refused, and sound effects on a Custom endpoint still ask for 5 seconds. - ElevenLabs sound effects in Game mode and the Roleplay sound command no longer send a fixed 5-second length, so ElevenLabs picks a length that fits the cue again. Music lengths are unchanged. - The Music DJ's Game Assets music library no longer lists the sample left by a Music & Sound Effects connection test. Generated context tracks, such as Gacha Forge's, are still listed. - With 'Save generated images as WebP' on, Game backgrounds, Roleplay Background agent images and scene illustrations are now saved as WebP, with one encode after resizing. With the setting off they stay PNG. - MMD ZIPs made on Japanese Windows (Shift_JIS/CP932 file names) now import. Textures whose case or Unicode form differs from the PMX reference are found too. Every ZIP importer now reads unflagged non-UTF-8 names as Shift_JIS when they are valid Shift_JIS. - Regenerating a Game background or a Background agent background after changing 'Save generated images as WebP' now replaces the old file instead of leaving a second copy in the other format. Later lookups, asset tags and the background tag list point to the new image. The new background keeps the old one's folder and star. Chats and the default Roleplay background that still use the old filename show the new image instead of a missing background. A failed regeneration keeps the previous image. ## Validation <!-- These are human tasks. Never tick a box for a check that was not actually performed. --> - [ ] `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 - Manually verify, with a real ElevenLabs Music & Sound Effects connection, that a short Game-mode sound effect (a door knock) and a long one (rolling thunder) come back at fitting lengths, not both at 5 seconds. - Manually verify that the Roleplay [sound:] command with an ElevenLabs connection still plays a cue. - Manually verify that after Connections > Music & Sound Effects > Test music, the Music DJ with custom local music (Game Assets source) does not list or play the test sample. - Manually verify that with Settings > Save generated images as WebP on, a generated Game background, a Roleplay Background agent image and a scene illustration are saved as .webp under data/game-assets/backgrounds or data/backgrounds, and display in chat. - Manually verify importing a real MMD model ZIP made with Windows Explorer or 7-Zip on Japanese Windows (Japanese texture names) under Avatars > 3D/MMD, and confirm its textures render. - Manually verify that a ZIP made on a non-Japanese system (for example a Western Windows character card .charx) still imports as before. - Manually verify in the browser: star a generated Roleplay background and put it in a folder, toggle 'Save generated images as WebP', force-regenerate it (for example with a manual Illustrator background request), and check it stays starred and in the folder. - Manually verify that another chat, or the default Roleplay background, that used the regenerated location's old file still shows a background and now shows the new image. Agent-run checks (for reference; each regression was shown to fail without its fix): - `git diff 475208f00f aed5e3578d --stat (re-verify findings on current staging)`: Only 4 docs files changed. Every finding's code is unchanged, so all four still apply. - `node ./scripts/pnpm-runner.mjs build:shared`: exit 0 - `Fail-before runs: each source file temporarily reverted, then node ./scripts/run-regressions.mjs --filter <name>`: Each new assertion FAILED without its fix and PASSED with it (details per finding). - `node ./scripts/run-regressions.mjs --filter <file>, one by one, for 34 nearby regressions (zip/archive/mmd/avatar-models/glb/vrm/backgrounds/generative-audio/im`: 33 PASSED. avatar-backgrounds.regression.ts timed out once at the 30 s per-file limit while the machine was loaded. Rerun alone it PASSED twice (16.5 s and 27.2 s). It is not in the code I touched. - `cd packages/server && node ../../scripts/pnpm-runner.mjs run lint (tsc -b ../shared && tsc --noEmit && tsc -p ../../scripts/regressions/tsconfig.character-activ`: No type errors reported (about 3 min). - `tsc -p <temporary tsconfig extending scripts/regressions/tsconfig.character-activity.json, listing the changed regression files> (file deleted afterwards)`: The new music-dj-local-library.regression.ts is clean. Remaining errors are in lines I didn't change: providers regression lines 89 and 162-163 exist identically in HEAD, plus legacy-cache null checks - `node_modules/.bin/prettier --write <all 12 changed files>`: All unchanged (already formatted). - `eslint`: Not run. ESLint is set up only for packages/client (packages/client/eslint.config.js), and the server lint script is tsc only. No client files changed. - `pnpm localization:check`: Not run. No client copy changed. Independent adversarial review: approve. Known limits and risks: 1. The zip-reader change is global: import routes, the package manager, custom agent repositories, mavatar, st-character and MMD all use it. An unflagged name that is not valid UTF-8 but is valid Shift_JIS now decodes as Japanese text instead of U+FFFD replacement characters. CP437/CP850 Western names become different mojibake than before. Path checks still run on the decoded name, and no caller extracts with a second decoder (AdmZip is only used for writing). Node builds without the shift_jis decoder keep the old reading. The 0x7075 Unicode Path field is not read. 2. Stored filenames are not rewritten: chats keep the old extension and are served the new file through a fallback for missing `generated-*` names. Pairs already on disk are cleaned up at that slug's next successful forced regeneration. 3. Connection-test samples are hidden from the DJ but still not deleted when their connection is deleted, which the verifiers marked an optional follow-up. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) 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) - [ ] Version/release files updated (only if this PR includes a version bump) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:39:51 +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#8806
No description provided.