[PR #1464] [MERGED] Fix roleplay generation lifecycle and prompt replay #5103

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1464
Author: @Xelvanis
Created: 5/28/2026
Status: ✅ Merged
Merged: 5/28/2026
Merged by: @Xelvanis

Base: refactor ← Head: fix/roleplay-generation-lifecycle


📝 Commits (10+)

  • 6f2790c Fix generation controller lifecycle
  • 09fb63c Cache generated prompts for prompt preview
  • 8f872ef Fix stale prompt preview cache fallback
  • 3a198d9 Persist prompt metadata per swipe
  • ce21c06 Harden per-swipe prompt metadata fallbacks
  • eda55ac Harden prompt debug metadata failpaths
  • c4bc846 Refresh Graphify output after refactor sync
  • 83cbd10 Align swipe metadata test with lightweight response
  • a5ef7c7 Refresh Graphify output after test sync
  • 265f502 Address prompt replay review findings

📊 Changes

53 files changed (+2760 additions, -345 deletions)

View changed files

📝 graphify-out/.graphify_labels.json (+1 -0)
📝 graphify-out/GRAPH_REPORT.md (+33 -28)
➕ graphify-out/cache/ast/0d9b4a9037cbc1137cf0bf01b32fe5bbcb753a2a154a61db4f33b675d43b642b.json (+1 -0)
➕ graphify-out/cache/ast/23f5be604307cef0f4727f5613f93256204ce62dac710478c72f0e7110a2a22b.json (+1 -0)
➕ graphify-out/cache/ast/26fe56effa9ab9e5539de40d8d82662177e758d2d8ff83cb941269f48d798157.json (+1 -0)
➕ graphify-out/cache/ast/3c237d13304556751b0f9551a238d489f0a5f24aa7ced9ba5ebd9fa9257510ff.json (+1 -0)
➕ graphify-out/cache/ast/3f2153f701449e11e06429931249c5f20ecb2dc297c61d6aefe42d326a776ff6.json (+1 -0)
➕ graphify-out/cache/ast/44ed21b113afe227fe5519ad08f0dee224b14b5e78e4670d9502043883ab9aff.json (+1 -0)
➕ graphify-out/cache/ast/47eb73516ff90043015d5c482083ce96f58f196880cf09e5122f1e0c669b8989.json (+1 -0)
➕ graphify-out/cache/ast/48b0b89cb58296dab111369ed8888167cf0ddc4393dd2edd6525104923f4c0e8.json (+1 -0)
➕ graphify-out/cache/ast/6299e3366ecc32e51ef5ec419217b7758fe0a76ebaf3140eb035c670d7b3ba18.json (+1 -0)
➕ graphify-out/cache/ast/68f681e5e57c56ad11b9c82d593b3d40bccb5ec3070c868702f629750161749e.json (+1 -0)
➕ graphify-out/cache/ast/75d144bc641d9a18a37f1da018ee97db66c3f0a7173fc1b75c7641512f480a25.json (+1 -0)
➕ graphify-out/cache/ast/7776c0966318e9858099076d91c57b8b42d497e0db4e7fee5ae95aa1cc5974b9.json (+1 -0)
➕ graphify-out/cache/ast/7d96d25d0caa6ea97fb58a6ba4bd0f00e26da5c83bc7af595202099c93f210b8.json (+1 -0)
➕ graphify-out/cache/ast/866047c91c98dc903ef0c9bfcc3f93ad41e6afe866e100918cd100f01ca59242.json (+1 -0)
➕ graphify-out/cache/ast/94768cabe819d3e9ba3d8bc66ed64b3aba48df41d51f3ca26e7096ac67d7c0de.json (+1 -0)
➕ graphify-out/cache/ast/a55c707e2b7271fb193d9fe9724e1471790ac82202d6c49d51e168e5745c2b0c.json (+1 -0)
➕ graphify-out/cache/ast/a803050a4392c9572db158b2050373145f47b93e36dbe3648dd36515d9c0e936.json (+1 -0)
➕ graphify-out/cache/ast/a81d1c23f7008f7636b8c43c919c7972446e0db38a901872971c5b5540984ed9.json (+1 -0)

...and 33 more files

📄 Description

Why this change

Roleplay generation needed the lifecycle and prompt-debug path brought back into parity with the refactor architecture:

  • stopping, finishing, or failing generation could leave UI/query state stale;
  • Peek Prompt needed to show the exact saved prompt snapshot for generated responses when available;
  • prompt metadata needed to remain aligned with the active swipe, including legacy/stringified extras.

What changed

  • Harden same-chat generation controller cleanup so stale generation cleanup cannot clear a newer active controller.
  • Use the refactor branch's generationPromptSnapshot path for Peek Prompt, including saved per-swipe prompt snapshots and rebuilt fallback previews before the selected message.
  • Wait for pending swipe mutations before opening Peek Prompt so an immediate click after switching swipes does not show the previous swipe's prompt data.
  • Preserve swipe-scoped debug metadata in Rust storage, including stringified legacy extra, legacy parent extras without per-swipe metadata, and generationPromptSnapshot / generationPromptSnapshotsBySwipe fields.
  • Keep generation parameter display parity for prompt snapshots and live preview parameters.
  • Sync with current refactor, including PR #1463 and PR #1465, and refresh Graphify output.

Impact areas reviewed

  • Runtime generation hook cleanup and query refresh behavior.
  • Engine start-generation prompt snapshot capture and prompt preview fallback assembly.
  • Shared chat UI Peek Prompt wiring and message/swipe type shape.
  • Chat storage swipe persistence and active-swipe metadata behavior.
  • Generation parameter editor changes from the latest refactor sync.
  • Graphify generated map output.

Validation

  • pnpm test -- src/engine/generation/start-generation.test.ts src/engine/generation/prompt-assembly.test.ts src/engine/generation/main-tool-loop.test.ts src/features/runtime/generation/hooks/use-generate.test.ts
  • pnpm test -- src/shared/components/ui/GenerationParametersEditor.test.ts
  • cargo test --manifest-path src-tauri/Cargo.toml extra
  • pnpm typecheck
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace
  • pnpm check:architecture
  • graphify update .

Docs and release impact

  • No changelog or docs update included; this is a focused roleplay generation/debug metadata parity fix.

Known coordination

  • Synced with current origin/refactor and mergeable as of commit d6098867.
  • CodeRabbit review is queued on the latest push.

🔄 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/1464 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/28/2026 **Status:** ✅ Merged **Merged:** 5/28/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/roleplay-generation-lifecycle` --- ### 📝 Commits (10+) - [`6f2790c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6f2790cfee8f3f5305180fb07cfb6df8be3fc73f) Fix generation controller lifecycle - [`09fb63c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/09fb63c424e6f6d2fcc10833b8861f2d1566e955) Cache generated prompts for prompt preview - [`8f872ef`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8f872efd8bc255a953baf450b7325f268e9b8b81) Fix stale prompt preview cache fallback - [`3a198d9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3a198d945521122920fc364f48198d148ff92c95) Persist prompt metadata per swipe - [`ce21c06`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ce21c063c04d438ff10af83311d8dd1dc20af969) Harden per-swipe prompt metadata fallbacks - [`eda55ac`](https://github.com/Pasta-Devs/Marinara-Engine/commit/eda55acb744ad532ca9b0a98a45a2ef19785a712) Harden prompt debug metadata failpaths - [`c4bc846`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c4bc846b4d072b72de22bfcb2219e10815046a1c) Refresh Graphify output after refactor sync - [`83cbd10`](https://github.com/Pasta-Devs/Marinara-Engine/commit/83cbd102b53b77376d75f6b00548921c409d0610) Align swipe metadata test with lightweight response - [`a5ef7c7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a5ef7c7157381cea018bf5d5253be4c1e0c5cf80) Refresh Graphify output after test sync - [`265f502`](https://github.com/Pasta-Devs/Marinara-Engine/commit/265f50250921ed5cfd6105b76280e84d840d4a6d) Address prompt replay review findings ### 📊 Changes **53 files changed** (+2760 additions, -345 deletions) <details> <summary>View changed files</summary> 📝 `graphify-out/.graphify_labels.json` (+1 -0) 📝 `graphify-out/GRAPH_REPORT.md` (+33 -28) ➕ `graphify-out/cache/ast/0d9b4a9037cbc1137cf0bf01b32fe5bbcb753a2a154a61db4f33b675d43b642b.json` (+1 -0) ➕ `graphify-out/cache/ast/23f5be604307cef0f4727f5613f93256204ce62dac710478c72f0e7110a2a22b.json` (+1 -0) ➕ `graphify-out/cache/ast/26fe56effa9ab9e5539de40d8d82662177e758d2d8ff83cb941269f48d798157.json` (+1 -0) ➕ `graphify-out/cache/ast/3c237d13304556751b0f9551a238d489f0a5f24aa7ced9ba5ebd9fa9257510ff.json` (+1 -0) ➕ `graphify-out/cache/ast/3f2153f701449e11e06429931249c5f20ecb2dc297c61d6aefe42d326a776ff6.json` (+1 -0) ➕ `graphify-out/cache/ast/44ed21b113afe227fe5519ad08f0dee224b14b5e78e4670d9502043883ab9aff.json` (+1 -0) ➕ `graphify-out/cache/ast/47eb73516ff90043015d5c482083ce96f58f196880cf09e5122f1e0c669b8989.json` (+1 -0) ➕ `graphify-out/cache/ast/48b0b89cb58296dab111369ed8888167cf0ddc4393dd2edd6525104923f4c0e8.json` (+1 -0) ➕ `graphify-out/cache/ast/6299e3366ecc32e51ef5ec419217b7758fe0a76ebaf3140eb035c670d7b3ba18.json` (+1 -0) ➕ `graphify-out/cache/ast/68f681e5e57c56ad11b9c82d593b3d40bccb5ec3070c868702f629750161749e.json` (+1 -0) ➕ `graphify-out/cache/ast/75d144bc641d9a18a37f1da018ee97db66c3f0a7173fc1b75c7641512f480a25.json` (+1 -0) ➕ `graphify-out/cache/ast/7776c0966318e9858099076d91c57b8b42d497e0db4e7fee5ae95aa1cc5974b9.json` (+1 -0) ➕ `graphify-out/cache/ast/7d96d25d0caa6ea97fb58a6ba4bd0f00e26da5c83bc7af595202099c93f210b8.json` (+1 -0) ➕ `graphify-out/cache/ast/866047c91c98dc903ef0c9bfcc3f93ad41e6afe866e100918cd100f01ca59242.json` (+1 -0) ➕ `graphify-out/cache/ast/94768cabe819d3e9ba3d8bc66ed64b3aba48df41d51f3ca26e7096ac67d7c0de.json` (+1 -0) ➕ `graphify-out/cache/ast/a55c707e2b7271fb193d9fe9724e1471790ac82202d6c49d51e168e5745c2b0c.json` (+1 -0) ➕ `graphify-out/cache/ast/a803050a4392c9572db158b2050373145f47b93e36dbe3648dd36515d9c0e936.json` (+1 -0) ➕ `graphify-out/cache/ast/a81d1c23f7008f7636b8c43c919c7972446e0db38a901872971c5b5540984ed9.json` (+1 -0) _...and 33 more files_ </details> ### 📄 Description ## Why this change Roleplay generation needed the lifecycle and prompt-debug path brought back into parity with the refactor architecture: - stopping, finishing, or failing generation could leave UI/query state stale; - Peek Prompt needed to show the exact saved prompt snapshot for generated responses when available; - prompt metadata needed to remain aligned with the active swipe, including legacy/stringified extras. ## What changed - Harden same-chat generation controller cleanup so stale generation cleanup cannot clear a newer active controller. - Use the refactor branch's `generationPromptSnapshot` path for Peek Prompt, including saved per-swipe prompt snapshots and rebuilt fallback previews before the selected message. - Wait for pending swipe mutations before opening Peek Prompt so an immediate click after switching swipes does not show the previous swipe's prompt data. - Preserve swipe-scoped debug metadata in Rust storage, including stringified legacy `extra`, legacy parent extras without per-swipe metadata, and `generationPromptSnapshot` / `generationPromptSnapshotsBySwipe` fields. - Keep generation parameter display parity for prompt snapshots and live preview parameters. - Sync with current `refactor`, including PR #1463 and PR #1465, and refresh Graphify output. ## Impact areas reviewed - Runtime generation hook cleanup and query refresh behavior. - Engine start-generation prompt snapshot capture and prompt preview fallback assembly. - Shared chat UI Peek Prompt wiring and message/swipe type shape. - Chat storage swipe persistence and active-swipe metadata behavior. - Generation parameter editor changes from the latest `refactor` sync. - Graphify generated map output. ## Validation - `pnpm test -- src/engine/generation/start-generation.test.ts src/engine/generation/prompt-assembly.test.ts src/engine/generation/main-tool-loop.test.ts src/features/runtime/generation/hooks/use-generate.test.ts` - `pnpm test -- src/shared/components/ui/GenerationParametersEditor.test.ts` - `cargo test --manifest-path src-tauri/Cargo.toml extra` - `pnpm typecheck` - `cargo check --manifest-path src-tauri/Cargo.toml --workspace` - `pnpm check:architecture` - `graphify update .` ## Docs and release impact - No changelog or docs update included; this is a focused roleplay generation/debug metadata parity fix. ## Known coordination - Synced with current `origin/refactor` and mergeable as of commit `d6098867`. - CodeRabbit review is queued on the latest push. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:13:16 +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#5103
No description provided.