[PR #7700] [MERGED] fix(mari): give a refused question back to the composer #7886

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7700
Author: @Gunterlie
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @Gunterlie

Base: staging ← Head: fix/mari-failed-send-composer


📝 Commits (8)

  • 1db4bee fix(mari): give an unsaved question back to the composer when a send fails
  • 69ee8a1 fix(mari): never drop the failed question when the composer is busy
  • e73ecb1 fix(mari): hold the send until failure recovery lands; count saved questions, not text
  • 17fd7cd fix(mari): detect the saved question by the newest saved id, not a count
  • 65d9a3f fix(mari): reload the chat this send created when the first send fails
  • 4dd7ae0 Merge remote-tracking branch 'origin/staging' into fix/mari-failed-send-composer
  • b695d22 fix(mari): keep failure recovery's reload from being cancelled; load the baseline for a cold send
  • 27e23f2 test(mari): match the sending guard on the run-end reload

📊 Changes

7 files changed (+94 additions, -19 deletions)

View changed files

📝 packages/client/src/components/chat/HomeProfessorMariChat.tsx (+39 -15)
📝 packages/client/src/components/chat/mari/mari-chat-helpers.tsx (+10 -1)
📝 packages/client/src/components/chat/mari/mari-tool-presentation.ts (+13 -0)
📝 packages/client/src/components/chat/mari/use-mari-message-actions.ts (+1 -0)
📝 packages/client/src/components/chat/mari/use-mari-workspace-run.ts (+8 -2)
📝 scripts/regressions/command-center.regression.ts (+1 -1)
➕ scripts/regressions/professor-mari/saved-user-message.regression.ts (+22 -0)

📄 Description

Why

A user on a Docker instance reached over Tailscale (no admin secret) asked Professor Mari a question. The send failed with the access error, and the question disappeared. The error card offered Retry, but the user wanted to change the message before sending it again.

Root cause: /professor-mari/workspace/prompt refuses the request before it saves the message. failRun then reloads the thread from the server, and that reload replaces the optimistic bubble, so the question vanishes.

No linked issue: reported on Discord.

What changed

  • When a send fails and the server did not save the question, the question and its files go back to the composer, ahead of anything typed since. You can edit it and send again.
  • The error card's Retry (and "Retry with another model") then sends the composer, so edits are included. With an empty composer, Retry falls back to the failed text.
  • Questions the server did save keep their bubble and the existing edit-and-resend, as before.
  • The send keeps sending until the failure reload lands, so a new send cannot start under it.
  • The "is it saved" check compares the newest saved user message id before and after, not text (repeated questions) and not a count (the thread loads only its newest page).
  • findSavedUserMessage is extracted from the retry path unchanged and covered by a small regression.

Validation

  • pnpm check passed (before the review follow-ups); client tsc, ESLint and Prettier re-run on the changed files after each follow-up.
  • scripts/regressions/professor-mari/saved-user-message.regression.ts passes.
  • Local CodeRabbit: two rounds. Fixed: send/reload race, repeated-text match, page-window count. Not changed: text matching inside the existing Retry reuse path (findSavedUserMessage) predates this PR, and an unsaved question now retries from the composer, which does not use that path.
  • Not verified in a browser.

Manual verification

  • On an instance with an admin secret set, open the app from a non-loopback address without the secret, send Prof. Mari a question: the question returns to the composer and the error card shows.
  • Edit the question in the composer and press Retry: the edited text is sent.
  • Type new text while a send is failing: the failed question appears above it, nothing is lost.
  • A provider failure after the question was saved (for example a bad model) still keeps the bubble, with no copy in the composer.

Summary by CodeRabbit

  • Bug Fixes
    • Improved recovery after failed message sends. When a message wasn’t saved, its text and attachments are restored to the composer for editing or resending.
    • Improved retries to use the composer’s current contents when available or match a previously saved message, including after replies or failed runs.
    • Prevented conversation reloads from interrupting an in-progress send.
  • Tests
    • Added regression coverage for finding saved messages after replies and failed runs, and for messages that were not saved.

🔄 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/7700 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `fix/mari-failed-send-composer` --- ### 📝 Commits (8) - [`1db4bee`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1db4bee87bd607e0f4c97961cd33865c8236b213) fix(mari): give an unsaved question back to the composer when a send fails - [`69ee8a1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/69ee8a1136566c89cf2ecb6ec1c154325119e67d) fix(mari): never drop the failed question when the composer is busy - [`e73ecb1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e73ecb11e6b2ced4a24f52364a9f513d0674d5de) fix(mari): hold the send until failure recovery lands; count saved questions, not text - [`17fd7cd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/17fd7cdb277c92d9065f71b861834f6f95578808) fix(mari): detect the saved question by the newest saved id, not a count - [`65d9a3f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/65d9a3f4ae086390e2d320734f334cf876bf6a07) fix(mari): reload the chat this send created when the first send fails - [`4dd7ae0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4dd7ae087abd4b91ee18c1b5308a90b2d754babf) Merge remote-tracking branch 'origin/staging' into fix/mari-failed-send-composer - [`b695d22`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b695d22349472f70b16549ef562e149ab98a9fed) fix(mari): keep failure recovery's reload from being cancelled; load the baseline for a cold send - [`27e23f2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/27e23f224c73211e351b86da94569db43d8f3a7a) test(mari): match the sending guard on the run-end reload ### 📊 Changes **7 files changed** (+94 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/HomeProfessorMariChat.tsx` (+39 -15) 📝 `packages/client/src/components/chat/mari/mari-chat-helpers.tsx` (+10 -1) 📝 `packages/client/src/components/chat/mari/mari-tool-presentation.ts` (+13 -0) 📝 `packages/client/src/components/chat/mari/use-mari-message-actions.ts` (+1 -0) 📝 `packages/client/src/components/chat/mari/use-mari-workspace-run.ts` (+8 -2) 📝 `scripts/regressions/command-center.regression.ts` (+1 -1) ➕ `scripts/regressions/professor-mari/saved-user-message.regression.ts` (+22 -0) </details> ### 📄 Description ## Why A user on a Docker instance reached over Tailscale (no admin secret) asked Professor Mari a question. The send failed with the access error, and the question disappeared. The error card offered Retry, but the user wanted to change the message before sending it again. Root cause: `/professor-mari/workspace/prompt` refuses the request before it saves the message. `failRun` then reloads the thread from the server, and that reload replaces the optimistic bubble, so the question vanishes. No linked issue: reported on Discord. ## What changed - When a send fails and the server did not save the question, the question and its files go back to the composer, ahead of anything typed since. You can edit it and send again. - The error card's Retry (and "Retry with another model") then sends the composer, so edits are included. With an empty composer, Retry falls back to the failed text. - Questions the server did save keep their bubble and the existing edit-and-resend, as before. - The send keeps `sending` until the failure reload lands, so a new send cannot start under it. - The "is it saved" check compares the newest saved user message id before and after, not text (repeated questions) and not a count (the thread loads only its newest page). - `findSavedUserMessage` is extracted from the retry path unchanged and covered by a small regression. ## Validation - `pnpm check` passed (before the review follow-ups); client `tsc`, ESLint and Prettier re-run on the changed files after each follow-up. - `scripts/regressions/professor-mari/saved-user-message.regression.ts` passes. - Local CodeRabbit: two rounds. Fixed: send/reload race, repeated-text match, page-window count. Not changed: text matching inside the existing Retry reuse path (`findSavedUserMessage`) predates this PR, and an unsaved question now retries from the composer, which does not use that path. - Not verified in a browser. ## Manual verification - [ ] On an instance with an admin secret set, open the app from a non-loopback address without the secret, send Prof. Mari a question: the question returns to the composer and the error card shows. - [ ] Edit the question in the composer and press Retry: the edited text is sent. - [ ] Type new text while a send is failing: the failed question appears above it, nothing is lost. - [ ] A provider failure after the question was saved (for example a bad model) still keeps the bubble, with no copy in the composer. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved recovery after failed message sends. When a message wasn’t saved, its text and attachments are restored to the composer for editing or resending. * Improved retries to use the composer’s current contents when available or match a previously saved message, including after replies or failed runs. * Prevented conversation reloads from interrupting an in-progress send. * **Tests** * Added regression coverage for finding saved messages after replies and failed runs, and for messages that were not saved. <!-- 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-24 04:08:29 +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#7886
No description provided.