[PR #5880] [MERGED] fix(mobile): reduce Illustrator image-arrival pressure and refresh saved images #6978

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5880
Author: @SpicyMarinara
Created: 9/5/2026
Status: ✅ Merged
Merged: 9/5/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/5870-illustration-arrival


📝 Commits (6)

  • 0e367fe chore: track iPhone illustration arrival regression
  • e5b3ad9 fix(mobile): reduce illustration decode pressure and refresh saved arrivals
  • 64bf0c3 fix(images): retain EXIF orientation in cached previews
  • 9396bf7 test: align illustration refresh guard regression with durable handoff
  • ff35d8b Merge remote-tracking branch 'origin/staging' into fix/5870-illustration-arrival
  • e546342 fix(images): keep cache hits cheap and guard descriptor cleanup

📊 Changes

12 files changed (+443 additions, -24 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
➕ e2e/illustration-arrival.e2e.ts (+194 -0)
📝 packages/client/src/components/chat/ChatGallery.tsx (+6 -3)
➕ packages/client/src/components/chat/ChatImagePreview.tsx (+17 -0)
📝 packages/client/src/components/chat/ChatMessage.tsx (+3 -2)
📝 packages/client/src/components/chat/ConversationMessageShared.tsx (+2 -1)
📝 packages/client/src/hooks/use-generate.ts (+4 -5)
📝 packages/server/src/routes/gallery.routes.ts (+9 -0)
📝 packages/server/src/services/image/image-thumbnail.ts (+35 -11)
📝 packages/shared/src/constants/defaults.ts (+3 -0)
➕ scripts/regressions/gallery-previews.regression.ts (+166 -0)
📝 scripts/regressions/roleplay-streaming.regression.ts (+2 -2)

📄 Description

Linked issue

Refs #5870. Leave the physical iPhone crash report open until the maintainer can retest; this is a bounded rendering mitigation plus a reproduced automatic-image refresh fix.

Why this change

On current staging, Mari's iPhone Home Screen app goes black when an Illustrator image arrives. Restarting only the app restores it. A manual illustration subsequently appeared in both Gallery and the message after refresh, confirming it survived and was saved; the automatic illustration was still missing. Docker logs and physical-device profiling are unavailable, so GPU exhaustion is a hypothesis, not a confirmed diagnosis.

Two concrete paths were checked: mobile chat/gallery images decode the full original despite their small display size, and a saved automatic Roleplay image stays hidden while another agent keeps the generation stream open.

What changed

  • Reuse the existing on-disk thumbnailer for mobile inline chat images (1024px wide) and gallery tiles (320px). Native picture selection avoids fetching the original in the phone transcript/grid. Desktop, external/data URLs, lightbox, and downloads retain originals.
  • Keep gallery ownership/path validation before thumbnailing; reuse validated media serving, including HEAD/range requests. Unsupported widths, animated sources, and unavailable decoding fall back to the original. Keep EXIF display orientation and do not upscale small images.
  • Reuse the existing live-presentation guard to refresh an automatic illustration as soon as its message is durable, without waiting for the remaining agent tail. Game's deferred reveal is unchanged.
  • No dependency, schema, agent package, provider request, or new setting changes. Added focused browser/API regressions and an Unreleased changelog entry.

Validation

Recorded execution, separate from the unchecked human checklist:

  • pnpm check passed (local TypeScript, ESLint, localization, formatting, E2E types, production build).

  • pnpm version:check passed.

  • Focused Playwright: 9/9 passed in development across desktop Chromium, mobile Chromium, and mobile WebKit, with 20-message fixture chats. Final production-Docker browser run: 15/15 passed across the same browsers (new arrival checks, reopened-image recovery, entrance-animation lifecycle). Phone chat/grid requests did not fetch the original; opening did, and downloads matched original bytes.

  • Before the change: mobile naturalWidth was 2048 instead of 1024; a controlled provider SSE with an open remaining-agent tail failed to reveal a newly persisted illustration. After: both claims pass. SSE timing is synthetic; storage and media routes are real. This is not a reproduction of the physical black screen.

  • node scripts/run-regressions.mjs --filter gallery-previews passed: current shared and legacy files, fixed widths, no upscaling, EXIF orientation, GIF/WebP/APNG preservation, large-PNG-metadata fallback, originals unchanged, cache reuse, HEAD/ranges, wrong ownership, traversal and invalid media.

  • node scripts/run-regressions.mjs --filter illustrator-disconnect passed: actual HTTP disconnect preserves saving; explicit Stop cancels. This behavior was already fixed in #5871.

  • Production Docker built and ran successfully after freeing local disk space: health, SPA, upload, both preview sizes and byte-identical original downloads passed. The isolated browser-fixture container used the existing E2E rate-limit bypass for rapid seeding; the initial isolated API smoke ran with normal limits. No host data was mounted.

  • Initial broader local browser run and Docker build were interrupted by host ENOSPC / Docker connection loss, not treated as passes. Only reinstallable dependency caches from this task's three completed temporary worktrees were removed. A stale-server retry and dev-store-import tests aimed at a production server were not counted as passes; final production-compatible checks passed above.

  • Updated the existing Roleplay streaming source assertion to match the new live-presentation guard while still requiring the Game-mode exclusion; that regression now passes. Required CI and CodeRabbit must pass before merge.

  • Final head e5463428e includes the latest staging integration and both CodeRabbit fixes (versioned, early cache hits; guarded descriptor close). It passes pnpm check, the production Docker/API smoke, and all 15 selected production-browser checks.

  • The complete Linux CI Node suite passes: 207/207. The isolated macOS run passed 206/207; the unchanged writer-lease fixture at storage-writer-lock.regression.ts:314 forces a v4 record using a missing macOS boot ID, which the validator rejects. Its standalone rerun fails the same way. No storage-runtime or unrelated fixture change was added to this PR.

  • The complete desktop Chromium, mobile Chromium, and mobile WebKit CI matrix passed. Initial CI mobile-Chromium shard 3 failed in the unchanged Home widget test: the random Chibi Professor Mari toast intercepted its bookmark-button click (confirmed in the log and failure screenshot). The new illustration tests passed even in that attempt; the shard and its required aggregate gate passed on rerun without code changes or skipped assertions. CodeRabbit completed its follow-up review of e5463428e with no outstanding findings.

  • 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 manual and automatic Illustrator on the physical iPhone Home Screen app, using the existing Docker install and 20 messages per page.
  • Manually verify no black screen on image arrival, with both gallery-open and gallery-closed cases; the screenshot alone does not establish a GPU cause.
  • Manually verify the full-quality image still opens/downloads and animated uploads still animate.
  • Real GPT Image / GPT-5.6-Sol calls were not made; tests used synthetic images and no paid provider requests.

Docs and release impact

Changelog only; no version bump, translated user guide change, or main release.

  • 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
  • Version/release files updated (only if this PR includes a version bump)

UI evidence

Before/after screenshots and proof notes. Download/open the self-contained proof.html to view the embedded screenshots. These prove the described rendering/refresh path, not an iPhone process crash diagnosis.


🔄 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/5880 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/5/2026 **Status:** ✅ Merged **Merged:** 9/5/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/5870-illustration-arrival` --- ### 📝 Commits (6) - [`0e367fe`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0e367fedb183656920202442806a0d6750cb2cd6) chore: track iPhone illustration arrival regression - [`e5b3ad9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e5b3ad9bdd1e261cfe5737eba98a61a23df33c2e) fix(mobile): reduce illustration decode pressure and refresh saved arrivals - [`64bf0c3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/64bf0c382943a282ddf87d9299ecbb15d5b0b83c) fix(images): retain EXIF orientation in cached previews - [`9396bf7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9396bf77df12657c654b199e75797d3896120d78) test: align illustration refresh guard regression with durable handoff - [`ff35d8b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ff35d8bcb5324f4796186d0ebe7a7388857bd896) Merge remote-tracking branch 'origin/staging' into fix/5870-illustration-arrival - [`e546342`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e5463428e3ff00f5f4840082f7e78aa5265d67bd) fix(images): keep cache hits cheap and guard descriptor cleanup ### 📊 Changes **12 files changed** (+443 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) ➕ `e2e/illustration-arrival.e2e.ts` (+194 -0) 📝 `packages/client/src/components/chat/ChatGallery.tsx` (+6 -3) ➕ `packages/client/src/components/chat/ChatImagePreview.tsx` (+17 -0) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+3 -2) 📝 `packages/client/src/components/chat/ConversationMessageShared.tsx` (+2 -1) 📝 `packages/client/src/hooks/use-generate.ts` (+4 -5) 📝 `packages/server/src/routes/gallery.routes.ts` (+9 -0) 📝 `packages/server/src/services/image/image-thumbnail.ts` (+35 -11) 📝 `packages/shared/src/constants/defaults.ts` (+3 -0) ➕ `scripts/regressions/gallery-previews.regression.ts` (+166 -0) 📝 `scripts/regressions/roleplay-streaming.regression.ts` (+2 -2) </details> ### 📄 Description ## Linked issue Refs #5870. Leave the physical iPhone crash report open until the maintainer can retest; this is a bounded rendering mitigation plus a reproduced automatic-image refresh fix. ## Why this change On current staging, Mari's iPhone Home Screen app goes black when an Illustrator image arrives. Restarting only the app restores it. A manual illustration subsequently appeared in both Gallery and the message after refresh, confirming it survived and was saved; the automatic illustration was still missing. Docker logs and physical-device profiling are unavailable, so GPU exhaustion is a hypothesis, not a confirmed diagnosis. Two concrete paths were checked: mobile chat/gallery images decode the full original despite their small display size, and a saved automatic Roleplay image stays hidden while another agent keeps the generation stream open. ## What changed - Reuse the existing on-disk thumbnailer for mobile inline chat images (1024px wide) and gallery tiles (320px). Native `picture` selection avoids fetching the original in the phone transcript/grid. Desktop, external/data URLs, lightbox, and downloads retain originals. - Keep gallery ownership/path validation before thumbnailing; reuse validated media serving, including HEAD/range requests. Unsupported widths, animated sources, and unavailable decoding fall back to the original. Keep EXIF display orientation and do not upscale small images. - Reuse the existing live-presentation guard to refresh an automatic illustration as soon as its message is durable, without waiting for the remaining agent tail. Game's deferred reveal is unchanged. - No dependency, schema, agent package, provider request, or new setting changes. Added focused browser/API regressions and an Unreleased changelog entry. ## Validation Recorded execution, separate from the unchecked human checklist: - `pnpm check` passed (local TypeScript, ESLint, localization, formatting, E2E types, production build). - `pnpm version:check` passed. - Focused Playwright: 9/9 passed in development across desktop Chromium, mobile Chromium, and mobile WebKit, with 20-message fixture chats. Final production-Docker browser run: 15/15 passed across the same browsers (new arrival checks, reopened-image recovery, entrance-animation lifecycle). Phone chat/grid requests did not fetch the original; opening did, and downloads matched original bytes. - Before the change: mobile `naturalWidth` was 2048 instead of 1024; a controlled provider SSE with an open remaining-agent tail failed to reveal a newly persisted illustration. After: both claims pass. SSE timing is synthetic; storage and media routes are real. This is not a reproduction of the physical black screen. - `node scripts/run-regressions.mjs --filter gallery-previews` passed: current shared and legacy files, fixed widths, no upscaling, EXIF orientation, GIF/WebP/APNG preservation, large-PNG-metadata fallback, originals unchanged, cache reuse, HEAD/ranges, wrong ownership, traversal and invalid media. - `node scripts/run-regressions.mjs --filter illustrator-disconnect` passed: actual HTTP disconnect preserves saving; explicit Stop cancels. This behavior was already fixed in #5871. - Production Docker built and ran successfully after freeing local disk space: health, SPA, upload, both preview sizes and byte-identical original downloads passed. The isolated browser-fixture container used the existing E2E rate-limit bypass for rapid seeding; the initial isolated API smoke ran with normal limits. No host data was mounted. - Initial broader local browser run and Docker build were interrupted by host ENOSPC / Docker connection loss, not treated as passes. Only reinstallable dependency caches from this task's three completed temporary worktrees were removed. A stale-server retry and dev-store-import tests aimed at a production server were not counted as passes; final production-compatible checks passed above. - Updated the existing Roleplay streaming source assertion to match the new live-presentation guard while still requiring the Game-mode exclusion; that regression now passes. Required CI and CodeRabbit must pass before merge. - Final head `e5463428e` includes the latest staging integration and both CodeRabbit fixes (versioned, early cache hits; guarded descriptor close). It passes `pnpm check`, the production Docker/API smoke, and all 15 selected production-browser checks. - The complete Linux CI Node suite passes: 207/207. The isolated macOS run passed 206/207; the unchanged writer-lease fixture at `storage-writer-lock.regression.ts:314` forces a v4 record using a missing macOS boot ID, which the validator rejects. Its standalone rerun fails the same way. No storage-runtime or unrelated fixture change was added to this PR. - The complete desktop Chromium, mobile Chromium, and mobile WebKit CI matrix passed. Initial CI mobile-Chromium shard 3 failed in the unchanged Home widget test: the random Chibi Professor Mari toast intercepted its bookmark-button click (confirmed in the log and failure screenshot). The new illustration tests passed even in that attempt; the shard and its required aggregate gate passed on rerun without code changes or skipped assertions. CodeRabbit completed its follow-up review of `e5463428e` with no outstanding findings. - [ ] `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 manual and automatic Illustrator on the physical iPhone Home Screen app, using the existing Docker install and 20 messages per page. - Manually verify no black screen on image arrival, with both gallery-open and gallery-closed cases; the screenshot alone does not establish a GPU cause. - Manually verify the full-quality image still opens/downloads and animated uploads still animate. - Real GPT Image / GPT-5.6-Sol calls were not made; tests used synthetic images and no paid provider requests. ## Docs and release impact Changelog only; no version bump, translated user guide change, or main release. - [ ] 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 - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence [Before/after screenshots and proof notes](https://gist.github.com/SpicyMarinara/774a3d7fb5fa58e993a9ae3d749aeb15). Download/open the self-contained `proof.html` to view the embedded screenshots. These prove the described rendering/refresh path, not an iPhone process crash diagnosis. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:15: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#6978
No description provided.