[GH-ISSUE #1703] [Issue]: Agent Save & close closes after failed save #844

Closed
opened 2026-10-21 05:21:44 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @cha1latte on GitHub (May 31, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1703

Originally assigned to: @Xelvanis on GitHub.

Summary

The Agent editor's "Save & close" path closes the editor even when the async save fails. This hides the user's unsaved edits immediately after showing the save failure state.

Expected behavior

If the agent save fails, the editor should stay open with the user's unsaved edits visible and a clear error message.

Actual behavior

handleSave catches the failed updateAgent.mutateAsync call and sets saveError, but the "Save & close" click handler calls closeAgentDetail() afterward anyway. That unmounts the editor despite the failed save.

Steps to reproduce

  1. Open an agent on the refactor branch.
  2. Edit the agent so the unsaved warning appears.
  3. Click Back.
  4. Click "Save & close" while updateAgent.mutateAsync fails.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: upstream/refactor at 9f5ec8c4
  • Run mode: scratch proof against editor save-close control flow
  • OS + version: Windows, version not specified
  • Node + pnpm versions: Not specified
  • Rust version, if relevant: Not relevant
  • Remote Runtime URL configured? Not relevant
  • Provider, model, or integration, if relevant: Not relevant

Logs, screenshots, or video

Scout proof was captured locally in the scout worktree, not attached to this issue:

  • C:\tmp\ME-refactor-scout-b3-save-close-20260531\scratch\save-close-agent-editor-failure-repro.mjs
  • C:\tmp\ME-refactor-scout-b3-save-close-20260531\scratch\save-close-agent-editor-failure-repro.json

The repro recorded these events: updateAgent.mutateAsync, setSaveError:simulated storage write failure, and then closeAgentDetail. The scout also included a negative control showing ToolEditor does not close on the same simulated failure.

Regression notes

Not specified.

Additional context

Suspected owner file:

  • src/features/catalog/agents/components/AgentEditor.tsx

This is related to #1701, but it is a separate agent-editor owner path rather than the preset editor.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @cha1latte on GitHub (May 31, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1703 Originally assigned to: @Xelvanis on GitHub. ## Summary The Agent editor's "Save & close" path closes the editor even when the async save fails. This hides the user's unsaved edits immediately after showing the save failure state. ## Expected behavior If the agent save fails, the editor should stay open with the user's unsaved edits visible and a clear error message. ## Actual behavior `handleSave` catches the failed `updateAgent.mutateAsync` call and sets `saveError`, but the "Save & close" click handler calls `closeAgentDetail()` afterward anyway. That unmounts the editor despite the failed save. ## Steps to reproduce 1. Open an agent on the refactor branch. 2. Edit the agent so the unsaved warning appears. 3. Click Back. 4. Click "Save & close" while `updateAgent.mutateAsync` fails. ## Impact area <!-- Check the areas you think are relevant. Leave uncertain items unchecked. --> - [ ] App shell, navigation, startup, or providers - [x] Catalog resources - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [ ] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [ ] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `upstream/refactor` at `9f5ec8c4` - Run mode: scratch proof against editor save-close control flow - OS + version: Windows, version not specified - Node + pnpm versions: Not specified - Rust version, if relevant: Not relevant - Remote Runtime URL configured? Not relevant - Provider, model, or integration, if relevant: Not relevant ## Logs, screenshots, or video Scout proof was captured locally in the scout worktree, not attached to this issue: - `C:\tmp\ME-refactor-scout-b3-save-close-20260531\scratch\save-close-agent-editor-failure-repro.mjs` - `C:\tmp\ME-refactor-scout-b3-save-close-20260531\scratch\save-close-agent-editor-failure-repro.json` The repro recorded these events: `updateAgent.mutateAsync`, `setSaveError:simulated storage write failure`, and then `closeAgentDetail`. The scout also included a negative control showing `ToolEditor` does not close on the same simulated failure. ## Regression notes Not specified. ## Additional context Suspected owner file: - `src/features/catalog/agents/components/AgentEditor.tsx` This is related to #1701, but it is a separate agent-editor owner path rather than the preset editor. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:21:44 +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#844
No description provided.