[PR #4679] [MERGED] Fix transient Roleplay message edit failures #6465

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4679
Author: @SpicyMarinara
Created: 8/6/2026
Status: ✅ Merged
Merged: 8/6/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/4678-reliable-message-edits


📝 Commits (3)

  • 06c55fd chore: start #4678 reliability fix
  • 4b1b71f fix transient roleplay message saves
  • e93ee3c fix: serialize message edit retries

📊 Changes

3 files changed (+82 additions, -36 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 e2e/core-flows.e2e.ts (+59 -33)
📝 packages/client/src/hooks/use-chats.ts (+22 -3)

📄 Description

Why

Roleplay message edits could still fail on remote Termux/Tailscale sessions after the previous cache and editor-state fixes. The five earlier PRs protected generation cleanup, cache ordering, stale snapshots, editor lifetime, and the Save hit target, but the final content PATCH still trusted a single transport attempt. One transient network or server failure therefore left the edit unpersisted and showed the recovery toast from #4678.

Closes #4678

What changed

  • Retry one idempotent message-content PATCH after 300 ms for network failures and HTTP 408, 425, 429, or 5xx responses.
  • Keep permanent 4xx failures immediate so authorization, validation, and missing-message errors are not hidden.
  • Extend the existing stopped-generation browser regression to delay Save, switch tabs, return a 503 on the first attempt, and require the retry to persist through server readback and reload.
  • Add the user-facing fix to the Unreleased changelog.

Validation

  • pnpm check
  • pnpm localization:check
  • Desktop Chromium stopped-generation edit regression
  • Mobile Chromium stopped-generation edit regression
  • Manually verify editing after stopping generation over a real Tailscale connection

Automated validation completed while preparing the PR: pnpm check, pnpm localization:check, and the focused Playwright regression on desktop and mobile Chromium (2 passed). The validation boxes remain unchecked for maintainer verification.

Manual verification

Manually reproduce the original remote Termux/Tailscale path and confirm that a brief connection interruption does not require a second Save click.

Summary by CodeRabbit

  • Bug Fixes

    • Automatically retries message edits once after transient network or service failures.
    • Remote message edits can recover without requiring another manual save.
    • Permanent and non-transient errors continue to surface without unnecessary retries.
  • Tests

    • Added coverage for delayed saves, failed initial attempts, recovery, and persistence after reload.
  • Documentation

    • Documented the automatic retry behavior in the changelog.

🔄 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/4679 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 8/6/2026 **Status:** ✅ Merged **Merged:** 8/6/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/4678-reliable-message-edits` --- ### 📝 Commits (3) - [`06c55fd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/06c55fd58793ef14177d0c01501666279215defd) chore: start #4678 reliability fix - [`4b1b71f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4b1b71f01f93bc81ecdee18f9f514f59ae83ab66) fix transient roleplay message saves - [`e93ee3c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e93ee3c650f1f5c35f019ef84cd3b6f5b7b40fe1) fix: serialize message edit retries ### 📊 Changes **3 files changed** (+82 additions, -36 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `e2e/core-flows.e2e.ts` (+59 -33) 📝 `packages/client/src/hooks/use-chats.ts` (+22 -3) </details> ### 📄 Description ## Why Roleplay message edits could still fail on remote Termux/Tailscale sessions after the previous cache and editor-state fixes. The five earlier PRs protected generation cleanup, cache ordering, stale snapshots, editor lifetime, and the Save hit target, but the final content `PATCH` still trusted a single transport attempt. One transient network or server failure therefore left the edit unpersisted and showed the recovery toast from #4678. Closes #4678 ## What changed - Retry one idempotent message-content `PATCH` after 300 ms for network failures and HTTP 408, 425, 429, or 5xx responses. - Keep permanent 4xx failures immediate so authorization, validation, and missing-message errors are not hidden. - Extend the existing stopped-generation browser regression to delay Save, switch tabs, return a 503 on the first attempt, and require the retry to persist through server readback and reload. - Add the user-facing fix to the Unreleased changelog. ## Validation - [ ] `pnpm check` - [ ] `pnpm localization:check` - [ ] Desktop Chromium stopped-generation edit regression - [ ] Mobile Chromium stopped-generation edit regression - [ ] Manually verify editing after stopping generation over a real Tailscale connection Automated validation completed while preparing the PR: `pnpm check`, `pnpm localization:check`, and the focused Playwright regression on desktop and mobile Chromium (2 passed). The validation boxes remain unchecked for maintainer verification. ## Manual verification Manually reproduce the original remote Termux/Tailscale path and confirm that a brief connection interruption does not require a second Save click. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Automatically retries message edits once after transient network or service failures. * Remote message edits can recover without requiring another manual save. * Permanent and non-transient errors continue to surface without unnecessary retries. * **Tests** * Added coverage for delayed saves, failed initial attempts, recovery, and persistence after reload. * **Documentation** * Documented the automatic retry behavior in the changelog. <!-- 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:10:40 +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#6465
No description provided.