[PR #7063] [MERGED] fix(chat): keep guided-regeneration guidance in the chat box, with a setting to clear it (#7060) #7453

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

📋 Pull Request Information

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

Base: staging ← Head: fix/guided-regenerate-input-7060


📝 Commits (6)

  • e03cc36 fix: keep guided regeneration guidance in the composer
  • c0a0afe docs: drop "again" from the guided regeneration changelog entry
  • 62dfaa3 fix: stop a sent Conversation message returning as a draft
  • df2ae47 feat: add a setting to clear guidance after guided regeneration
  • d211de4 docs(changelog): link the Conversation draft fix to #7060
  • cd6f521 Merge remote-tracking branch 'origin/staging' into fix/guided-regenerate-input-7060

📊 Changes

9 files changed (+197 additions, -54 deletions)

View changed files

📝 CHANGELOG.md (+3 -1)
📝 docs/chats/guided-and-impersonate.md (+2 -0)
📝 docs/settings/settings-overview.md (+1 -0)
📝 e2e/guided-regeneration.e2e.ts (+150 -48)
📝 packages/client/src/components/chat/ChatArea.tsx (+9 -5)
📝 packages/client/src/components/chat/ConversationInput.tsx (+5 -0)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+18 -0)
📝 packages/client/src/localization/locales/en.json (+2 -0)
📝 packages/client/src/stores/ui.store.ts (+7 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7060

Why this change

  • A user writes a direction in the chat box, runs a guided regenerate, and then wants to adjust it and regenerate again. Right now the box is emptied as soon as a guided regenerate starts, so they have to type the direction again every time. This was reported on staging build 94ce3d6851, in Roleplay with a single narrator-style character.
  • The clearing came from PR #6819 for #6815. That user wanted the guidance cleared so it couldn't later go out by accident as a chat message. That change never reached a tagged release (0c921fe67 isn't in v2.4.6).
  • The two requests are opposite, so the maintainer chose a setting. Keeping the guidance is the default, as #7060 asks. Anyone who prefers #6815's clearing can turn it off.

What changed

  • New setting: Keep guidance after regenerating. It's in Settings → General → Input & Editing, under Send on Enter, and the settings search finds it.
    • It's on by default. It's stored as keepGuidanceAfterRegenerate in ui.store.ts and synced like Send on Enter.
    • On: a guided regenerate leaves the direction in the chat box and its saved per-chat draft.
    • Off: it clears them, as #6819 did. A failed generation puts the text back, a newer draft is never overwritten, and a background chat's draft is restored only while it's still empty. That logic is the #6819 code, restored as it was.
  • What stays from #6819 in both modes: the guidance is still read live from the box, and a touch confirmation left open across a chat switch is cancelled instead of using the other chat's draft.
  • Coverage: every guided regenerate goes through ChatArea.tsx handleRegenerate, so the setting covers all of them: the message's regenerate button, the "Generate next swipe" arrow, the ArrowRight/swipe reroll, and the mobile confirmation.
  • Found while testing: in Conversation, a message sent within 300 ms of the last keystroke came back in the chat box after a chat switch or reload. Send didn't cancel the pending draft save, which the Roleplay input already does. ConversationInput.tsx now cancels it.
  • Tests: e2e/guided-regeneration.e2e.ts runs for Roleplay and Conversation.
    • On (default): the guidance is sent and stays in the box and its draft, during and after generation and after a failure. Edited guidance is sent next time, the reroll sends the same guidance, a chat switch leaves the other chat's draft alone, and the guidance survives a reload. A normal send still clears the box.
    • Off, switched through the real Settings UI: the guidance is cleared after a successful guided regenerate and restored after a failed one, including in a background chat. A newer draft is never wiped.
  • Docs: docs/chats/guided-and-impersonate.md and docs/settings/settings-overview.md mention the setting. CHANGELOG.md replaces the unreleased #6815 bullet and adds the Conversation draft fix.

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

Run by the agent (not a replacement for the checks above):

  • pnpm check (including localization) passes after merging the latest staging, which includes the chat window redesign (#7049).
  • e2e/guided-regeneration.e2e.ts results:
    • after the staging merge: 2/2 on desktop Chromium and 2/2 on mobile Chromium;
    • before the merge: 4/4 on desktop and 8/8 on mobile Chromium and WebKit, each run twice;
    • against staging's ChatArea.tsx, the keep-guidance check fails on every run.
  • The 44 node regressions that read the touched files pass, and the desktop smoke suite passes 7/7.
  • An adversarial review probe confirmed:
    • the request carries generationGuideSource: "guide", the typed text and the right regenerateMessageId;
    • a fast double-click sends exactly one request;
    • the next normal send carries no guidance and clears the box.
  • Local CodeRabbit found nothing.

Still to verify by hand:

  • In a Roleplay chat, type a direction and click the last message's Regenerate (guided). The text stays in the box during and after generation. Edit it and regenerate again; the edited text is used.
  • Turn off Settings → General → Input & Editing → Keep guidance after regenerating, then repeat. The box is cleared after a successful regenerate, and the text comes back if generation fails, for example with a disconnected connection.
  • Do the same in a Conversation chat with the Generate next swipe arrow and the right-arrow reroll.
  • In a Conversation chat, send a message right after typing, switch chats and come back, then reload. The box stays empty.
  • At phone width, check that the guided regenerate confirmation keeps the text when cancelled.

Docs and release impact

  • 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 (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

docs/chats/guided-and-impersonate.md and docs/settings/settings-overview.md changed, and their translations on docs-i18n will be updated after this lands.

UI evidence (if applicable)

Settings has one new switch. Otherwise there's no visual change: the chat box simply keeps its text.

Summary by CodeRabbit

  • New Features
    • Guided regeneration now keeps your guidance in the message box by default. Turn off Keep guidance after regenerating in Settings > General > Input & Editing to clear it instead.
  • Bug Fixes
    • Newly sent messages no longer reappear in the composer after you return to a chat or reload.
  • Documentation
    • Updated the guided-regeneration and settings guides to explain the new option.

🔄 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/7063 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/4/2026 **Status:** ✅ Merged **Merged:** 10/4/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/guided-regenerate-input-7060` --- ### 📝 Commits (6) - [`e03cc36`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e03cc36236c4dea1a4223991818fcdda6009b5b2) fix: keep guided regeneration guidance in the composer - [`c0a0afe`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c0a0afe306b021cf280a109c3a6602e5537758b4) docs: drop "again" from the guided regeneration changelog entry - [`62dfaa3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/62dfaa36bf20ab6ae6c0a91538ae5f6408e19c46) fix: stop a sent Conversation message returning as a draft - [`df2ae47`](https://github.com/Pasta-Devs/Marinara-Engine/commit/df2ae47eb98de740478b9575900c22a47dcce741) feat: add a setting to clear guidance after guided regeneration - [`d211de4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d211de445b76636992430a0bd85c86b4466493f6) docs(changelog): link the Conversation draft fix to #7060 - [`cd6f521`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cd6f521c4634661050c2736aa9113da8880270c5) Merge remote-tracking branch 'origin/staging' into fix/guided-regenerate-input-7060 ### 📊 Changes **9 files changed** (+197 additions, -54 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+3 -1) 📝 `docs/chats/guided-and-impersonate.md` (+2 -0) 📝 `docs/settings/settings-overview.md` (+1 -0) 📝 `e2e/guided-regeneration.e2e.ts` (+150 -48) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+9 -5) 📝 `packages/client/src/components/chat/ConversationInput.tsx` (+5 -0) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+18 -0) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) 📝 `packages/client/src/stores/ui.store.ts` (+7 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #7060 ## Why this change - A user writes a direction in the chat box, runs a guided regenerate, and then wants to adjust it and regenerate again. Right now the box is emptied as soon as a guided regenerate starts, so they have to type the direction again every time. This was reported on staging build 94ce3d6851ab, in Roleplay with a single narrator-style character. - The clearing came from PR #6819 for #6815. That user wanted the guidance cleared so it couldn't later go out by accident as a chat message. That change never reached a tagged release (0c921fe67 isn't in v2.4.6). - The two requests are opposite, so the maintainer chose a setting. Keeping the guidance is the default, as #7060 asks. Anyone who prefers #6815's clearing can turn it off. ## What changed - **New setting: Keep guidance after regenerating.** It's in Settings → General → Input & Editing, under Send on Enter, and the settings search finds it. - It's on by default. It's stored as `keepGuidanceAfterRegenerate` in `ui.store.ts` and synced like Send on Enter. - **On:** a guided regenerate leaves the direction in the chat box and its saved per-chat draft. - **Off:** it clears them, as #6819 did. A failed generation puts the text back, a newer draft is never overwritten, and a background chat's draft is restored only while it's still empty. That logic is the #6819 code, restored as it was. - **What stays from #6819 in both modes:** the guidance is still read live from the box, and a touch confirmation left open across a chat switch is cancelled instead of using the other chat's draft. - **Coverage:** every guided regenerate goes through `ChatArea.tsx` `handleRegenerate`, so the setting covers all of them: the message's regenerate button, the "Generate next swipe" arrow, the ArrowRight/swipe reroll, and the mobile confirmation. - **Found while testing:** in Conversation, a message sent within 300 ms of the last keystroke came back in the chat box after a chat switch or reload. Send didn't cancel the pending draft save, which the Roleplay input already does. `ConversationInput.tsx` now cancels it. - **Tests:** `e2e/guided-regeneration.e2e.ts` runs for Roleplay and Conversation. - **On (default):** the guidance is sent and stays in the box and its draft, during and after generation and after a failure. Edited guidance is sent next time, the reroll sends the same guidance, a chat switch leaves the other chat's draft alone, and the guidance survives a reload. A normal send still clears the box. - **Off, switched through the real Settings UI:** the guidance is cleared after a successful guided regenerate and restored after a failed one, including in a background chat. A newer draft is never wiped. - **Docs:** `docs/chats/guided-and-impersonate.md` and `docs/settings/settings-overview.md` mention the setting. `CHANGELOG.md` replaces the unreleased #6815 bullet and adds the Conversation draft fix. ## 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 Run by the agent (not a replacement for the checks above): - `pnpm check` (including localization) passes after merging the latest staging, which includes the chat window redesign (#7049). - `e2e/guided-regeneration.e2e.ts` results: - after the staging merge: 2/2 on desktop Chromium and 2/2 on mobile Chromium; - before the merge: 4/4 on desktop and 8/8 on mobile Chromium and WebKit, each run twice; - against staging's `ChatArea.tsx`, the keep-guidance check fails on every run. - The 44 node regressions that read the touched files pass, and the desktop smoke suite passes 7/7. - An adversarial review probe confirmed: - the request carries `generationGuideSource: "guide"`, the typed text and the right `regenerateMessageId`; - a fast double-click sends exactly one request; - the next normal send carries no guidance and clears the box. - Local CodeRabbit found nothing. Still to verify by hand: - In a Roleplay chat, type a direction and click the last message's **Regenerate (guided)**. The text stays in the box during and after generation. Edit it and regenerate again; the edited text is used. - Turn off **Settings → General → Input & Editing → Keep guidance after regenerating**, then repeat. The box is cleared after a successful regenerate, and the text comes back if generation fails, for example with a disconnected connection. - Do the same in a Conversation chat with the **Generate next swipe** arrow and the right-arrow reroll. - In a Conversation chat, send a message right after typing, switch chats and come back, then reload. The box stays empty. - At phone width, check that the guided regenerate confirmation keeps the text when cancelled. ## Docs and release impact - [ ] 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 (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) `docs/chats/guided-and-impersonate.md` and `docs/settings/settings-overview.md` changed, and their translations on `docs-i18n` will be updated after this lands. ## UI evidence (if applicable) Settings has one new switch. Otherwise there's no visual change: the chat box simply keeps its text. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Guided regeneration now keeps your guidance in the message box by default. Turn off **Keep guidance after regenerating** in **Settings** > **General** > **Input & Editing** to clear it instead. * **Bug Fixes** * Newly sent messages no longer reappear in the composer after you return to a chat or reload. * **Documentation** * Updated the guided-regeneration and settings guides to explain the new option. <!-- 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:19:57 +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#7453
No description provided.