[PR #3814] [MERGED] Fix Gallery backgrounds, Unix env parsing, and scene-video streaming #6114

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

📋 Pull Request Information

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

Base: staging ← Head: agent/assigned-issue-sweep


📝 Commits (5)

  • da0bafc Route Gallery backgrounds through Illustrator
  • e977f24 Parse launcher env files without shell evaluation
  • b77c359 Stream scene videos with range support
  • 87e2e44 Satisfy Gallery background callback contract
  • 26fb274 Merge staging into assigned issue sweep

📊 Changes

18 files changed (+315 additions, -182 deletions)

View changed files

📝 CHANGELOG.md (+3 -0)
📝 docs/CONFIGURATION.md (+2 -0)
📝 package.json (+1 -1)
📝 packages/client/src/components/chat/ChatArea.tsx (+5 -145)
📝 packages/client/src/components/chat/ChatCommonOverlays.tsx (+1 -1)
📝 packages/client/src/components/chat/ChatGallery.tsx (+2 -2)
📝 packages/client/src/components/chat/ChatGalleryDrawer.tsx (+1 -1)
📝 packages/client/src/hooks/use-generate.ts (+2 -0)
📝 packages/server/src/app.ts (+5 -0)
📝 packages/server/src/routes/gallery.routes.ts (+1 -2)
📝 packages/server/src/routes/game.routes.ts (+1 -2)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+10 -2)
➕ scripts/read-launcher-env.mjs (+44 -0)
➕ scripts/regressions/launcher-env.regression.mjs (+75 -0)
📝 scripts/regressions/open-issues.regression.ts (+15 -0)
➕ scripts/regressions/scene-video-range.regression.ts (+101 -0)
📝 start-termux.sh (+23 -13)
📝 start.sh (+23 -13)

📄 Description

Linked issues

Closes #3809
Closes #3810
Closes #3811

Why this change

  • The Roleplay Gallery Background action bypassed Illustrator, so it could send malformed low-level prompts instead of using the installed agent and its background mode.
  • The Unix launchers sourced .env as shell code, allowing dotenv values to execute shell syntax.
  • The protected scene-video routes read complete MP4 files into memory and ignored HTTP byte-range requests, which made seeking unreliable and scaled poorly for large videos.

What changed

  • Routed Gallery Background through the existing Illustrator retry pipeline with a per-run background prompt-mode override. The saved chat prompt mode remains unchanged.
  • Replaced shell sourcing with a small Node dotenv reader restricted to launcher-owned keys while preserving ambient-environment precedence.
  • Served protected scene videos through the existing Fastify static-file machinery, retaining ownership and path validation while adding streamed GET, HEAD, and range responses.
  • Added focused regressions, user-facing launcher documentation, and changelog entries for all three issues.

Root causes

  • Gallery Background maintained a separate direct generation path rather than reusing the Illustrator orchestration already used by agent retries.
  • start.sh and start-termux.sh treated a data file as a Bash program.
  • The scene-video endpoints called readFileSync and sent the resulting buffer instead of delegating transfer semantics to a file-serving response.

Validation evidence

  • pnpm check
  • pnpm regression:issues
  • pnpm smoke:ui — 72 passed, 46 project-defined skips
  • pnpm version:check
  • git diff --check origin/staging...HEAD
  • Launcher regression includes literal $ and $(...) values, allowlisting, ambient precedence, ordering, and bash -n checks.
  • Scene-video regression covers full GET, HEAD, bounded/open/suffix byte ranges, and unsatisfiable ranges.

Manual verification requested

  • Manually verify Roleplay Gallery Background invokes Illustrator in background mode and leaves the saved Illustrator mode unchanged.
  • Manually verify prompt review still appears when image-prompt review is enabled.
  • Manually verify representative .env launcher values on desktop Linux/macOS and Termux.
  • Manually verify generated scene-video playback and seeking through both protected routes.
  • Manually verify an API-only server build can still serve authorized scene videos.

Docs and release impact

  • Re-read the Unix launcher documentation for clarity.
  • Confirm no version bump is required.

docs/CONFIGURATION.md and CHANGELOG.md are updated. No application version is changed.

Risk notes

The changes reuse existing Illustrator and Fastify behavior. Prompt selection is overridden only for this retry request, launcher parsing is restricted to keys the shell scripts consume, and all existing scene-video authorization and containment checks remain in place.

Summary by CodeRabbit

  • Bug Fixes

    • Scene videos now support efficient streaming, byte-range playback, proper HEAD requests, and long-term browser caching.
    • Gallery Background actions now use Illustrator’s background mode for more consistent results.
    • Launcher settings are read safely as plain values, preventing shell syntax in .env files from being executed.
    • Existing environment variables now correctly take precedence over .env settings.
  • Documentation

    • Clarified .env parsing behavior and environment-variable precedence.

🔄 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/3814 **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:** `agent/assigned-issue-sweep` --- ### 📝 Commits (5) - [`da0bafc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/da0bafcae80c1a332a2ac49949ccd1b013f34b64) Route Gallery backgrounds through Illustrator - [`e977f24`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e977f241eaee71f6976e5cfa1fa318ac3c8e5fcd) Parse launcher env files without shell evaluation - [`b77c359`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b77c359d4009079d0830fc04f5d346048b40e5f1) Stream scene videos with range support - [`87e2e44`](https://github.com/Pasta-Devs/Marinara-Engine/commit/87e2e44f0962311334490bd8e07bab05ef8e1128) Satisfy Gallery background callback contract - [`26fb274`](https://github.com/Pasta-Devs/Marinara-Engine/commit/26fb274b898bdcdbcece6405851feda11a9f8bcb) Merge staging into assigned issue sweep ### 📊 Changes **18 files changed** (+315 additions, -182 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+3 -0) 📝 `docs/CONFIGURATION.md` (+2 -0) 📝 `package.json` (+1 -1) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+5 -145) 📝 `packages/client/src/components/chat/ChatCommonOverlays.tsx` (+1 -1) 📝 `packages/client/src/components/chat/ChatGallery.tsx` (+2 -2) 📝 `packages/client/src/components/chat/ChatGalleryDrawer.tsx` (+1 -1) 📝 `packages/client/src/hooks/use-generate.ts` (+2 -0) 📝 `packages/server/src/app.ts` (+5 -0) 📝 `packages/server/src/routes/gallery.routes.ts` (+1 -2) 📝 `packages/server/src/routes/game.routes.ts` (+1 -2) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+10 -2) ➕ `scripts/read-launcher-env.mjs` (+44 -0) ➕ `scripts/regressions/launcher-env.regression.mjs` (+75 -0) 📝 `scripts/regressions/open-issues.regression.ts` (+15 -0) ➕ `scripts/regressions/scene-video-range.regression.ts` (+101 -0) 📝 `start-termux.sh` (+23 -13) 📝 `start.sh` (+23 -13) </details> ### 📄 Description ## Linked issues Closes #3809 Closes #3810 Closes #3811 ## Why this change - The Roleplay Gallery Background action bypassed Illustrator, so it could send malformed low-level prompts instead of using the installed agent and its background mode. - The Unix launchers sourced `.env` as shell code, allowing dotenv values to execute shell syntax. - The protected scene-video routes read complete MP4 files into memory and ignored HTTP byte-range requests, which made seeking unreliable and scaled poorly for large videos. ## What changed - Routed Gallery Background through the existing Illustrator retry pipeline with a per-run `background` prompt-mode override. The saved chat prompt mode remains unchanged. - Replaced shell sourcing with a small Node dotenv reader restricted to launcher-owned keys while preserving ambient-environment precedence. - Served protected scene videos through the existing Fastify static-file machinery, retaining ownership and path validation while adding streamed GET, HEAD, and range responses. - Added focused regressions, user-facing launcher documentation, and changelog entries for all three issues. ## Root causes - Gallery Background maintained a separate direct generation path rather than reusing the Illustrator orchestration already used by agent retries. - `start.sh` and `start-termux.sh` treated a data file as a Bash program. - The scene-video endpoints called `readFileSync` and sent the resulting buffer instead of delegating transfer semantics to a file-serving response. ## Validation evidence - `pnpm check` - `pnpm regression:issues` - `pnpm smoke:ui` — 72 passed, 46 project-defined skips - `pnpm version:check` - `git diff --check origin/staging...HEAD` - Launcher regression includes literal `$` and `$(...)` values, allowlisting, ambient precedence, ordering, and `bash -n` checks. - Scene-video regression covers full GET, HEAD, bounded/open/suffix byte ranges, and unsatisfiable ranges. ## Manual verification requested - [ ] Manually verify Roleplay Gallery Background invokes Illustrator in background mode and leaves the saved Illustrator mode unchanged. - [ ] Manually verify prompt review still appears when image-prompt review is enabled. - [ ] Manually verify representative `.env` launcher values on desktop Linux/macOS and Termux. - [ ] Manually verify generated scene-video playback and seeking through both protected routes. - [ ] Manually verify an API-only server build can still serve authorized scene videos. ## Docs and release impact - [ ] Re-read the Unix launcher documentation for clarity. - [ ] Confirm no version bump is required. `docs/CONFIGURATION.md` and `CHANGELOG.md` are updated. No application version is changed. ## Risk notes The changes reuse existing Illustrator and Fastify behavior. Prompt selection is overridden only for this retry request, launcher parsing is restricted to keys the shell scripts consume, and all existing scene-video authorization and containment checks remain in place. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Scene videos now support efficient streaming, byte-range playback, proper HEAD requests, and long-term browser caching. * Gallery Background actions now use Illustrator’s background mode for more consistent results. * Launcher settings are read safely as plain values, preventing shell syntax in `.env` files from being executed. * Existing environment variables now correctly take precedence over `.env` settings. * **Documentation** * Clarified `.env` parsing behavior and environment-variable precedence. <!-- 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:13 +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#6114
No description provided.