[PR #3605] [MERGED] Fix shutdown write drain and remote admin folder picker #6011

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3605
Author: @SpicyMarinara
Created: 7/14/2026
Status: ✅ Merged
Merged: 7/14/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/3602-3603-storage-admin-picker


📝 Commits (2)

  • 745d7b8 Fix shutdown flush and remote folder picker
  • e03afa3 Cover persistent shutdown write failure

📊 Changes

6 files changed (+123 additions, -25 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 package.json (+1 -1)
📝 packages/client/src/components/agents/AgentEditor.tsx (+3 -8)
📝 packages/server/src/db/file-backed-store.ts (+39 -16)
➕ scripts/regressions/file-backed-shutdown.regression.ts (+72 -0)
📝 scripts/regressions/open-issues.regression.ts (+6 -0)

📄 Description

Why

Graceful shutdown could report success before a newer file-native mutation reached disk, and the Agent Editor folder picker bypassed the shared API client, causing legitimate remote administrators to receive a 403 despite saving the correct admin secret.

Closes #3602
Closes #3603

What changed

  • track and await the active file-native flush
  • drain writes queued during that flush before shutdown completes
  • propagate a persistent close-time write failure instead of looping or silently succeeding
  • route the privileged custom-music folder picker through api.post so admin and CSRF headers are attached
  • add deterministic active-flush shutdown coverage and a regression guard for the privileged client call
  • update the v2.2.2 changelog

Risk boundary

  • Entrypoints: file-native flush() / close(), Agent Editor custom-music folder selection
  • File format: unchanged
  • Normal debounced flush behavior: retained
  • Negative controls: close cannot resolve while the captured write is blocked; persistent close-time I/O failure rejects
  • Positive proof: a mutation queued after snapshot capture is present on disk after close
  • Remote-device manual reproduction: still required

Test plan

  • Manually delay an active file-native write, mutate during it, close Marinara, and verify both mutations persist after restart
  • Manually simulate a persistent close-time I/O failure and verify shutdown reports failure
  • Manually use the custom-music folder picker from a non-loopback browser with matching ADMIN_SECRET
  • Manually verify the picker still works from localhost
  • Run pnpm regression:issues
  • Run pnpm check
  • Run pnpm smoke:ui

Automated validation performed

  • pnpm regression:issues
  • pnpm check
  • pnpm smoke:ui (54 passed, 26 intentionally skipped)

🔄 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/3605 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/14/2026 **Status:** ✅ Merged **Merged:** 7/14/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/3602-3603-storage-admin-picker` --- ### 📝 Commits (2) - [`745d7b8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/745d7b8e6af69fb5a18c3bbdee6167da53b7d9e5) Fix shutdown flush and remote folder picker - [`e03afa3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e03afa3919a97603af2a7834e67af02a8498d952) Cover persistent shutdown write failure ### 📊 Changes **6 files changed** (+123 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `package.json` (+1 -1) 📝 `packages/client/src/components/agents/AgentEditor.tsx` (+3 -8) 📝 `packages/server/src/db/file-backed-store.ts` (+39 -16) ➕ `scripts/regressions/file-backed-shutdown.regression.ts` (+72 -0) 📝 `scripts/regressions/open-issues.regression.ts` (+6 -0) </details> ### 📄 Description ## Why Graceful shutdown could report success before a newer file-native mutation reached disk, and the Agent Editor folder picker bypassed the shared API client, causing legitimate remote administrators to receive a 403 despite saving the correct admin secret. Closes #3602 Closes #3603 ## What changed - track and await the active file-native flush - drain writes queued during that flush before shutdown completes - propagate a persistent close-time write failure instead of looping or silently succeeding - route the privileged custom-music folder picker through `api.post` so admin and CSRF headers are attached - add deterministic active-flush shutdown coverage and a regression guard for the privileged client call - update the v2.2.2 changelog ## Risk boundary - Entrypoints: file-native `flush()` / `close()`, Agent Editor custom-music folder selection - File format: unchanged - Normal debounced flush behavior: retained - Negative controls: close cannot resolve while the captured write is blocked; persistent close-time I/O failure rejects - Positive proof: a mutation queued after snapshot capture is present on disk after close - Remote-device manual reproduction: still required ## Test plan - [ ] Manually delay an active file-native write, mutate during it, close Marinara, and verify both mutations persist after restart - [ ] Manually simulate a persistent close-time I/O failure and verify shutdown reports failure - [ ] Manually use the custom-music folder picker from a non-loopback browser with matching `ADMIN_SECRET` - [ ] Manually verify the picker still works from localhost - [ ] Run `pnpm regression:issues` - [ ] Run `pnpm check` - [ ] Run `pnpm smoke:ui` ## Automated validation performed - `pnpm regression:issues` - `pnpm check` - `pnpm smoke:ui` (54 passed, 26 intentionally skipped) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:06:13 +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#6011
No description provided.