[PR #8097] [MERGED] fix(editors): preserve agent copies and avatar/image state #8100

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

📋 Pull Request Information

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

Base: staging ← Head: fix/assigned-editor-data-controls


📝 Commits (8)

  • c7fedf0 chore: reserve assigned editor fixes
  • 31cacef fix(editors): retain effective agent copies and reusable avatar image state
  • 249794d fix(editors): prune exported image mappings and scope removal progress
  • 9e74dca fix(personas): scope removal progress and clean unused avatar files
  • ce55609 fix(personas): clear rendered mutation state on forced teardown
  • 8e744c4 fix(editors): reset persona sessions before paint and retain frozen avatars
  • 12d5475 fix(editors): scope upload progress and prune greeting mappings on save
  • f45080a fix(storage): keep cache cleanup out of card revision comparisons

📊 Changes

15 files changed (+719 additions, -51 deletions)

View changed files

📝 e2e/editor-ui-polish.e2e.ts (+226 -4)
📝 packages/client/src/components/characters/CharacterEditor.tsx (+6 -2)
📝 packages/client/src/components/panels/AgentsPanel.tsx (+1 -21)
📝 packages/client/src/components/personas/PersonaEditor.tsx (+66 -6)
📝 packages/client/src/hooks/use-characters.ts (+25 -2)
📝 packages/client/src/lib/agent-transfer.ts (+36 -0)
📝 packages/client/src/localization/locales/en.json (+3 -0)
📝 packages/server/src/routes/backup.routes.ts (+1 -0)
📝 packages/server/src/routes/characters.routes.ts (+25 -1)
📝 packages/server/src/services/storage/characters.storage.ts (+9 -1)
📝 packages/shared/src/utils/greeting-image-bake.ts (+28 -8)
➕ scripts/regressions/agent-duplicate-defaults.regression.ts (+99 -0)
📝 scripts/regressions/greeting-image-bake.regression.ts (+127 -3)
📝 scripts/regressions/persona-api-decoded-reads.regression.ts (+64 -0)
📝 scripts/regressions/persona-client-contract.regression.ts (+3 -3)

📄 Description

Linked issues

Closes #8047
Closes #8080
Closes #8084

Why this change

Duplicating an installed agent loses defaults that were never saved as overrides. Existing personas cannot clear their avatar. Converting greeting images downloads them again after reverting to web links because the editor discards its URL-to-gallery mapping.

What changed

  • Copy effective package settings, default tools and fallback prompts into an independent custom agent. Preserve explicit overrides, empty tool selections, prompt options and Music DJ's selected provider prompt, using the existing credential/source sanitization.
  • Remove a persona avatar through the existing crop control and serialized, versioned storage update. Clear its crop and preserve unrelated unsaved fields. Bind progress to the operation and persona ID; clear session state before paint on forced selection changes. Removal keeps the disabled replace button labeled Upload avatar; actual uploads and gallery replacements retain upload progress.
  • Retain avatar files used by frozen chat identities. This change clears the current card reference; it does not add automatic file reclamation. The existing cleaner's missing frozen-message references are separately reproduced and tracked in #8112.
  • Retain greeting mappings while a URL or gallery reference remains in a greeting. Reuse only a validated existing file owned by that character; redownload deleted, invalid or wrong-owner copies. Prune mappings during storage normalization, including ordinary partial saves after editing an image out of every greeting. Compare normalized current and next content so cache cleanup alone creates no card revision; genuine edits and explicit version changes retain their existing history behavior. Keep mappings referenced by a web image URL or gallery reference, and remove cache metadata from compatible individual and profile exports without a gallery.

Validation

Local Node 24.22.1 / macOS arm64:

  • pnpm install --frozen-lockfile and final pnpm check: passed, including localization, types and production build.
  • Five focused Node regression files passed: effective agent defaults, greeting-image bake, decoded persona API, persona client contract and character-update deep merging. The ordinary-save API controls cover dropping the last reference while retaining live web URLs and alternate-greeting gallery references. A legacy orphan-cache fixture also proves a no-op save preserves both character_version and the snapshot count, while real content/comment edits and explicit version changes still snapshot. The API control verifies a frozen avatar remains HTTP 200 after replacing and removing an unversioned persona's current avatar.
  • Nine focused browser cases passed across desktop Chromium, mobile Chromium and mobile WebKit. Coverage includes cancellation, dirty fields, save/reload, held metadata saves, held upload/removal labels and progress isolation and greeting convert/save/revert/reload/reuse.
  • A forced parent selection while persona A's removal is held checks both of B's avatar fieldsets at the first animation frame, then opens and cancels B's removal confirmation. Ordinary navigation remains protected by the existing leave guard.
  • Final pnpm smoke:ui: 7/7 passed. Dark desktop and light mobile avatar-removal screenshots were inspected; these are browser emulation.

Fresh local CodeRabbit reviewed all 15 changed files with zero findings. Earlier valid export, operation-progress, pre-paint teardown, ordinary-save pruning and cache-only revision findings were reproduced and repaired. An earlier TypeScript-configuration finding was rejected using the effective client configuration and successful production type/build checks. The unrequested automatic cleanup proposal was removed after reproducing frozen-avatar data loss; its retention control remains in the final patch.

Desktop/mobile UI evidence is embedded in a downloadable HTML file. Published PNG hashes are verified against the original captures.

Human verification tasks:

  • Manually duplicate an installed agent with custom settings and compare the copy's editor.
  • Manually remove a persona avatar with unsaved edits in light and dark themes.
  • Manually toggle greeting image conversion against a real remote image server.
  • Manually verify physical Android/iOS behavior if required.

Verification limits

Image downloads are mocked in the browser tests; Node route coverage separately verifies gallery reuse, ownership and export behavior. The session test deliberately forces the parent selection to exercise teardown; it does not claim normal guarded navigation reproduces the race. An earlier browser run lost its served shared bundle during a concurrent production build; evidence was preserved and validation was repeated without that overlap. No assertion or timeout was weakened.

Docs and release impact

No user-facing documentation paths, release metadata or storage-format changes. New UI copy uses canonical English localization keys; community locales fall back to English.


🔄 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/8097 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/assigned-editor-data-controls` --- ### 📝 Commits (8) - [`c7fedf0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c7fedf049eab3d51097d51710e76b7378e530aa1) chore: reserve assigned editor fixes - [`31cacef`](https://github.com/Pasta-Devs/Marinara-Engine/commit/31cacefdad9a7f9a114630e8d651849728666376) fix(editors): retain effective agent copies and reusable avatar image state - [`249794d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/249794dab2eaaf8e78fef65a3f22ec59b3be9c55) fix(editors): prune exported image mappings and scope removal progress - [`9e74dca`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9e74dcaefe6c9e3832c23e6d3688e0ca510aff2b) fix(personas): scope removal progress and clean unused avatar files - [`ce55609`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ce5560946fd5b351b2e335f03ae44d0b34b68c94) fix(personas): clear rendered mutation state on forced teardown - [`8e744c4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8e744c47082f74c887167ca4817f665cbef3065c) fix(editors): reset persona sessions before paint and retain frozen avatars - [`12d5475`](https://github.com/Pasta-Devs/Marinara-Engine/commit/12d54755a2ace5a156b84efd691c55f355521cf6) fix(editors): scope upload progress and prune greeting mappings on save - [`f45080a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f45080a0ebf12e6d2ec17627cc515bd5f9cced74) fix(storage): keep cache cleanup out of card revision comparisons ### 📊 Changes **15 files changed** (+719 additions, -51 deletions) <details> <summary>View changed files</summary> 📝 `e2e/editor-ui-polish.e2e.ts` (+226 -4) 📝 `packages/client/src/components/characters/CharacterEditor.tsx` (+6 -2) 📝 `packages/client/src/components/panels/AgentsPanel.tsx` (+1 -21) 📝 `packages/client/src/components/personas/PersonaEditor.tsx` (+66 -6) 📝 `packages/client/src/hooks/use-characters.ts` (+25 -2) 📝 `packages/client/src/lib/agent-transfer.ts` (+36 -0) 📝 `packages/client/src/localization/locales/en.json` (+3 -0) 📝 `packages/server/src/routes/backup.routes.ts` (+1 -0) 📝 `packages/server/src/routes/characters.routes.ts` (+25 -1) 📝 `packages/server/src/services/storage/characters.storage.ts` (+9 -1) 📝 `packages/shared/src/utils/greeting-image-bake.ts` (+28 -8) ➕ `scripts/regressions/agent-duplicate-defaults.regression.ts` (+99 -0) 📝 `scripts/regressions/greeting-image-bake.regression.ts` (+127 -3) 📝 `scripts/regressions/persona-api-decoded-reads.regression.ts` (+64 -0) 📝 `scripts/regressions/persona-client-contract.regression.ts` (+3 -3) </details> ### 📄 Description ## Linked issues Closes #8047 Closes #8080 Closes #8084 ## Why this change Duplicating an installed agent loses defaults that were never saved as overrides. Existing personas cannot clear their avatar. Converting greeting images downloads them again after reverting to web links because the editor discards its URL-to-gallery mapping. ## What changed - Copy effective package settings, default tools and fallback prompts into an independent custom agent. Preserve explicit overrides, empty tool selections, prompt options and Music DJ's selected provider prompt, using the existing credential/source sanitization. - Remove a persona avatar through the existing crop control and serialized, versioned storage update. Clear its crop and preserve unrelated unsaved fields. Bind progress to the operation and persona ID; clear session state before paint on forced selection changes. Removal keeps the disabled replace button labeled Upload avatar; actual uploads and gallery replacements retain upload progress. - Retain avatar files used by frozen chat identities. This change clears the current card reference; it does not add automatic file reclamation. The existing cleaner's missing frozen-message references are separately reproduced and tracked in #8112. - Retain greeting mappings while a URL or gallery reference remains in a greeting. Reuse only a validated existing file owned by that character; redownload deleted, invalid or wrong-owner copies. Prune mappings during storage normalization, including ordinary partial saves after editing an image out of every greeting. Compare normalized current and next content so cache cleanup alone creates no card revision; genuine edits and explicit version changes retain their existing history behavior. Keep mappings referenced by a web image URL or gallery reference, and remove cache metadata from compatible individual and profile exports without a gallery. ## Validation Local Node 24.22.1 / macOS arm64: - `pnpm install --frozen-lockfile` and final `pnpm check`: passed, including localization, types and production build. - Five focused Node regression files passed: effective agent defaults, greeting-image bake, decoded persona API, persona client contract and character-update deep merging. The ordinary-save API controls cover dropping the last reference while retaining live web URLs and alternate-greeting gallery references. A legacy orphan-cache fixture also proves a no-op save preserves both character_version and the snapshot count, while real content/comment edits and explicit version changes still snapshot. The API control verifies a frozen avatar remains HTTP 200 after replacing and removing an unversioned persona's current avatar. - Nine focused browser cases passed across desktop Chromium, mobile Chromium and mobile WebKit. Coverage includes cancellation, dirty fields, save/reload, held metadata saves, held upload/removal labels and progress isolation and greeting convert/save/revert/reload/reuse. - A forced parent selection while persona A's removal is held checks both of B's avatar fieldsets at the first animation frame, then opens and cancels B's removal confirmation. Ordinary navigation remains protected by the existing leave guard. - Final `pnpm smoke:ui`: 7/7 passed. Dark desktop and light mobile avatar-removal screenshots were inspected; these are browser emulation. Fresh local CodeRabbit reviewed all **15 changed files with zero findings**. Earlier valid export, operation-progress, pre-paint teardown, ordinary-save pruning and cache-only revision findings were reproduced and repaired. An earlier TypeScript-configuration finding was rejected using the effective client configuration and successful production type/build checks. The unrequested automatic cleanup proposal was removed after reproducing frozen-avatar data loss; its retention control remains in the final patch. [Desktop/mobile UI evidence](https://gist.github.com/SpicyMarinara/d4fc0a4759c14e9770c663474dd7cb16) is embedded in a downloadable HTML file. Published PNG hashes are verified against the original captures. Human verification tasks: - [ ] Manually duplicate an installed agent with custom settings and compare the copy's editor. - [ ] Manually remove a persona avatar with unsaved edits in light and dark themes. - [ ] Manually toggle greeting image conversion against a real remote image server. - [ ] Manually verify physical Android/iOS behavior if required. ## Verification limits Image downloads are mocked in the browser tests; Node route coverage separately verifies gallery reuse, ownership and export behavior. The session test deliberately forces the parent selection to exercise teardown; it does not claim normal guarded navigation reproduces the race. An earlier browser run lost its served shared bundle during a concurrent production build; evidence was preserved and validation was repeated without that overlap. No assertion or timeout was weakened. ## Docs and release impact No user-facing documentation paths, release metadata or storage-format changes. New UI copy uses canonical English localization keys; community locales fall back to English. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:10:22 +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#8100
No description provided.