[PR #6819] [MERGED] fix: clear consumed guided regeneration text #7342

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

📋 Pull Request Information

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

Base: staging ← Head: codex/fix-6815-guided-regeneration


📝 Commits (5)

  • 6cef747 chore: begin guided regeneration composer fix
  • 34b29d7 fix: consume guided regeneration drafts safely
  • 89c5542 Merge branch 'staging' into codex/fix-6815-guided-regeneration
  • a54d6c8 docs(changelog): move guided regeneration entry to Unreleased
  • 6169e43 Merge remote-tracking branch 'origin/staging' into codex/fix-6815-guided-regeneration

📊 Changes

5 files changed (+220 additions, -4 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
➕ e2e/guided-regeneration.e2e.ts (+193 -0)
📝 packages/client/src/components/chat/ChatArea.tsx (+23 -4)
📝 packages/client/src/components/chat/ChatInput.tsx (+1 -0)
📝 packages/client/src/components/chat/ConversationInput.tsx (+1 -0)

📄 Description

Closes #6815.

Guided regeneration used the composer text as direction but left it in the field, where it could accidentally become the next chat message. The shared regeneration handler now clears that direction through the existing composer input handling. An attempt that produces no accepted output restores the old direction only when its draft is still empty.

The existing chat ID and expected-text checks preserve a newer draft, another chat's input, canceled touch confirmation, and normal regeneration with guidance disabled. The change adds no new draft state or generation API.

Validation

Current PR head: 89c55424f545cde6f073f8febd65e3204b191ff1, a pure merge of staging fd859ccd1055a7ed741c1adda1afbb1ef15a842d. The feature source and retained guided-regeneration fixture are byte-identical to tested feature head 34b29d7ef46718ab044cada4a9453116f7d793f2.

  • On feature head 34b29d7ef, pnpm install and pnpm check passed, with two existing GameSurface hook warnings and no errors.
  • The retained guided-regeneration fixture passed 6/6 across Roleplay/Conversation and desktop Chromium, mobile Chromium and mobile WebKit. It reproduced the original failure before the fix and covers consumed guidance, late success/failure, newer drafts, chat switching/reload, blocked actions and touch confirmation.
  • The combined candidate 2049a57a9cd56f4c5681b1c8bc764e2e82fcff49, containing feature head 34b29d7ef plus the then-current #6820/#6821 heads, also passed pnpm check, UI smoke 7/7, author-notes + guided-regeneration cases 12/12 across all three browser projects, and zoomed-keyboard cases 2/2 on mobile Chromium/WebKit. This PR's product files and fixture are byte-identical in that candidate. These results precede the separate #6821 test-cleanup follow-up.
  • After the staging advance, combined candidate 867d64d0208e49cce13c40310d81839756fad787 (tree 3610bb1dbbf9b0429d7532831e3e91cdf34bff7c) passed new-base pnpm install, pnpm check and UI smoke 7/7. The merge audit confirms all feature source blobs remain unchanged and staging changes are preserved. Earlier focused browser results above remain attributed to their original tested revisions.
  • GitHub CI and the full five-file hosted CodeRabbit review passed on feature head 34b29d7ef, with no actionable hosted comments. Its docstring-coverage advisory does not identify a correctness defect. Current-head CI is being monitored; hosted CodeRabbit for merge head 89c55424f is pending because of the review-service rate limit. Those current-head gates must complete before merge.
  • Shared local CodeRabbit review completed successfully (exit 0) on combined candidate c172ae4ccef3d7052de04b5a8a198e6f308e1e74 against 0ae509df7, after the #6821 test-only follow-up. It produced three findings across the combined changes. The one concerning this PR suggested reusing composer restore helpers; source review found those helpers are private, send-specific closures with different state in each composer. The existing native input event already reuses both composers’ input handling while retaining chat ownership and expected-draft checks, so this preference-only suggestion was not applied. No local-review blocker remains for #6819; findings for the other PRs are tracked separately. No credits or account settings were changed.
  • No local container run; production builds passed through pnpm check, and GitHub container checks passed on feature head 34b29d7ef. Browser coverage uses emulated mobile devices, not physical phones/tablets or installed app shells.

Hosted review also noted an inferred interruption-recovery limitation: composer guidance is cleared when regeneration starts, so a reload or uncertain background outcome can leave it cleared without a confirmed saved reply. This matches the existing send flow's clear-before-result behavior; this change adds no durable pending-draft journal. The focused proof covers ordinary failure restoration and successful reload, and does not claim recovery after an interrupted tab/process.

Human verification remains a to-do list:

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Manually verify guided regeneration clears the consumed composer text
  • Manually verify failure/cancel recovery, a new draft, light/dark themes and a mobile viewport
  • Read and followed CONTRIBUTING.md

Docs and release impact

A concise Unreleased changelog entry describes the corrected draft behavior. No public docs, localization copy, release metadata, or storage format changed.

UI evidence

Self-contained visual evidence includes the original Roleplay composer, the cleared composer on tested head 34b29d7ef, and a light-theme Conversation negative control. Synthetic data only. The six-case suite used desktop Chromium and emulated mobile Chromium/WebKit; no physical-device or installed-app-shell verification is claimed. Download/open the HTML file to view its embedded images.

Summary by CodeRabbit

  • Bug Fixes
    • Guided regeneration clears the draft used as guidance while the request is in progress. If regeneration fails, the draft is restored unless you’ve edited it since.
    • Drafts are preserved when switching chats, and completing a regeneration in one chat won’t overwrite text entered in another—even if that text was entered while regeneration was in progress.
    • Confirming regeneration after switching chats won’t apply it to the wrong chat. Canceling confirmation leaves the draft unchanged.
    • Unguided regeneration continues to preserve unrelated drafts.

🔄 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/6819 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/28/2026 **Status:** ✅ Merged **Merged:** 9/28/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/fix-6815-guided-regeneration` --- ### 📝 Commits (5) - [`6cef747`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6cef7475025af608367c026fca0576dd66993d69) chore: begin guided regeneration composer fix - [`34b29d7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/34b29d7ef46718ab044cada4a9453116f7d793f2) fix: consume guided regeneration drafts safely - [`89c5542`](https://github.com/Pasta-Devs/Marinara-Engine/commit/89c55424f545cde6f073f8febd65e3204b191ff1) Merge branch 'staging' into codex/fix-6815-guided-regeneration - [`a54d6c8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a54d6c8976cea4c71a13c194de8a82e217902e0d) docs(changelog): move guided regeneration entry to Unreleased - [`6169e43`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6169e43f566ade0aa988c8c8c8fd0976f06acc45) Merge remote-tracking branch 'origin/staging' into codex/fix-6815-guided-regeneration ### 📊 Changes **5 files changed** (+220 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) ➕ `e2e/guided-regeneration.e2e.ts` (+193 -0) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+23 -4) 📝 `packages/client/src/components/chat/ChatInput.tsx` (+1 -0) 📝 `packages/client/src/components/chat/ConversationInput.tsx` (+1 -0) </details> ### 📄 Description Closes #6815. Guided regeneration used the composer text as direction but left it in the field, where it could accidentally become the next chat message. The shared regeneration handler now clears that direction through the existing composer input handling. An attempt that produces no accepted output restores the old direction only when its draft is still empty. The existing chat ID and expected-text checks preserve a newer draft, another chat's input, canceled touch confirmation, and normal regeneration with guidance disabled. The change adds no new draft state or generation API. ## Validation Current PR head: `89c55424f545cde6f073f8febd65e3204b191ff1`, a pure merge of staging `fd859ccd1055a7ed741c1adda1afbb1ef15a842d`. The feature source and retained guided-regeneration fixture are byte-identical to tested feature head `34b29d7ef46718ab044cada4a9453116f7d793f2`. - On feature head `34b29d7ef`, `pnpm install` and `pnpm check` passed, with two existing `GameSurface` hook warnings and no errors. - The retained guided-regeneration fixture passed 6/6 across Roleplay/Conversation and desktop Chromium, mobile Chromium and mobile WebKit. It reproduced the original failure before the fix and covers consumed guidance, late success/failure, newer drafts, chat switching/reload, blocked actions and touch confirmation. - The combined candidate `2049a57a9cd56f4c5681b1c8bc764e2e82fcff49`, containing feature head `34b29d7ef` plus the then-current #6820/#6821 heads, also passed `pnpm check`, UI smoke 7/7, author-notes + guided-regeneration cases 12/12 across all three browser projects, and zoomed-keyboard cases 2/2 on mobile Chromium/WebKit. This PR's product files and fixture are byte-identical in that candidate. These results precede the separate #6821 test-cleanup follow-up. - After the staging advance, combined candidate `867d64d0208e49cce13c40310d81839756fad787` (tree `3610bb1dbbf9b0429d7532831e3e91cdf34bff7c`) passed new-base `pnpm install`, `pnpm check` and UI smoke 7/7. The merge audit confirms all feature source blobs remain unchanged and staging changes are preserved. Earlier focused browser results above remain attributed to their original tested revisions. - GitHub CI and the full five-file hosted CodeRabbit review passed on feature head `34b29d7ef`, with no actionable hosted comments. Its docstring-coverage advisory does not identify a correctness defect. Current-head CI is being monitored; hosted CodeRabbit for merge head `89c55424f` is pending because of the review-service rate limit. Those current-head gates must complete before merge. - Shared local CodeRabbit review completed successfully (exit 0) on combined candidate `c172ae4ccef3d7052de04b5a8a198e6f308e1e74` against `0ae509df7`, after the #6821 test-only follow-up. It produced three findings across the combined changes. The one concerning this PR suggested reusing composer restore helpers; source review found those helpers are private, send-specific closures with different state in each composer. The existing native input event already reuses both composers’ input handling while retaining chat ownership and expected-draft checks, so this preference-only suggestion was not applied. No local-review blocker remains for #6819; findings for the other PRs are tracked separately. No credits or account settings were changed. - No local container run; production builds passed through `pnpm check`, and GitHub container checks passed on feature head `34b29d7ef`. Browser coverage uses emulated mobile devices, not physical phones/tablets or installed app shells. Hosted review also noted an inferred interruption-recovery limitation: composer guidance is cleared when regeneration starts, so a reload or uncertain background outcome can leave it cleared without a confirmed saved reply. This matches the existing send flow's clear-before-result behavior; this change adds no durable pending-draft journal. The focused proof covers ordinary failure restoration and successful reload, and does not claim recovery after an interrupted tab/process. Human verification remains a to-do list: - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Manually verify guided regeneration clears the consumed composer text - [ ] Manually verify failure/cancel recovery, a new draft, light/dark themes and a mobile viewport - [ ] Read and followed `CONTRIBUTING.md` ## Docs and release impact A concise Unreleased changelog entry describes the corrected draft behavior. No public docs, localization copy, release metadata, or storage format changed. ## UI evidence [Self-contained visual evidence](https://gist.github.com/SpicyMarinara/0e128c1975594b1407bb1018c367a701) includes the original Roleplay composer, the cleared composer on tested head `34b29d7ef`, and a light-theme Conversation negative control. Synthetic data only. The six-case suite used desktop Chromium and emulated mobile Chromium/WebKit; no physical-device or installed-app-shell verification is claimed. Download/open the HTML file to view its embedded images. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Guided regeneration clears the draft used as guidance while the request is in progress. If regeneration fails, the draft is restored unless you’ve edited it since. * Drafts are preserved when switching chats, and completing a regeneration in one chat won’t overwrite text entered in another—even if that text was entered while regeneration was in progress. * Confirming regeneration after switching chats won’t apply it to the wrong chat. Canceling confirmation leaves the draft unchanged. * Unguided regeneration continues to preserve unrelated drafts. <!-- 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:18:50 +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#7342
No description provided.