[PR #5515] [MERGED] fix(runtime): harden background reliability for release #6792

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

📋 Pull Request Information

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

Base: staging ← Head: fix/release-runtime-hardening


📝 Commits (5)

  • 2284f5b fix(backup): contain automatic backup failure writes
  • d87e3a9 fix(runtime): harden release-critical background paths
  • 3b6d7f0 fix(regression): restore open-issues lane
  • 99bc21e test(prompt): follow standalone agent settings links
  • b882d54 fix(runtime): address release review edge cases

📊 Changes

29 files changed (+460 additions, -106 deletions)

View changed files

📝 CHANGELOG.md (+5 -1)
📝 android/README.md (+1 -0)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+6 -0)
📝 packages/client/src/lib/local-notifications.ts (+1 -1)
📝 packages/client/src/lib/support-diagnostics.ts (+7 -0)
📝 packages/client/src/localization/locale-loader.ts (+9 -4)
📝 packages/server/src/app.ts (+2 -0)
📝 packages/server/src/index.ts (+4 -0)
📝 packages/server/src/routes/backup.routes.ts (+6 -2)
📝 packages/server/src/routes/chats.routes.ts (+10 -2)
📝 packages/server/src/routes/game.routes.ts (+12 -3)
📝 packages/server/src/routes/generate.routes.ts (+13 -2)
📝 packages/server/src/routes/generate/dry-run-route.ts (+9 -2)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+4 -0)
📝 packages/server/src/routes/lorebooks.routes.ts (+5 -1)
📝 packages/server/src/services/extensions/personal-server-extension-runtime.ts (+9 -0)
📝 packages/server/src/services/extensions/sandbox-protocol.ts (+5 -0)
📝 packages/server/src/services/lorebook/index.ts (+18 -3)
📝 packages/server/src/services/prompt/assembler.ts (+23 -13)
📝 packages/server/src/services/prompt/index.ts (+1 -0)

...and 9 more files

📄 Description

Linked issues

Fixes #5506
Fixes #5512
Fixes #5513
Fixes #5514
Fixes #5516

Why this change

Kolache's Termux audit isolated one fixed heap default that is too small for large profiles but too generous for small Android installs, plus bounded background reliability hazards in backup failure handling, lorebook macro counting, extension watchdog recovery, and the open-issues regression lane. These are the remaining runtime release blockers.

What changed

  • Choose a bounded 1–1.5 GiB Termux heap from structured profile size and device RAM while preserving explicit NODE_OPTIONS limits.
  • Expose heap-used, heap-limit, and RSS data through /api/health and copied Support Diagnostics, with a low-noise near-limit log warning.
  • Contain automatic-backup settings failures inside the original backup error path.
  • Compute lorebook-size macro counts only when an assembled prompt or relevant lorebook entry uses that macro.
  • Give resumed extension sandboxes one full heartbeat window after a process-wide pause.
  • Restore direct Node execution of the open-issues regression lane by removing its client path-alias dependency and providing Node-safe locale discovery; refresh stale source-shape assertions while retaining their behavioral contracts.
  • Add focused regression guards, Android launcher guidance, and Unreleased changelog entries.

Local automated evidence: pnpm check, the open-issues regression, launcher dotenv/format-guard regressions, extension IPC regression, server/client lint and builds, and git diff --check pass.

Validation

  • Run focused launcher, prompt, backup, sandbox, and open-issues regressions
  • Run pnpm check
  • Run pnpm regression:prompt
  • Run git diff --check
  • Manually verify Termux startup on small and large profile/device fixtures
  • Manually verify extension recovery after host suspension

Risk boundary

Launcher, backup, prompt assembly, health diagnostics, extension watchdog, and regression-only client import paths are touched. Explicit heap overrides remain authoritative; imports, exports, storage formats, and existing user capabilities are unchanged.

Summary by CodeRabbit

  • New Features

    • Added adaptive Termux memory allocation based on profile size and device RAM, with manual override support.
    • Added server memory metrics to health checks and support diagnostics.
    • Added support for lorebook-size macros across prompts, previews, exports, and scans.
  • Bug Fixes

    • Improved automatic backup failure handling without masking the original error.
    • Prevented resumed extensions from being terminated after sandbox pauses.
    • Fixed launcher handling of data directories with spaces and relative paths.
    • Fixed import-time diagnostics and localization loading in some environments.
    • Lorebook-size scanning now runs only when the macro is used.

🔄 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/5515 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 8/25/2026 **Status:** ✅ Merged **Merged:** 8/25/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/release-runtime-hardening` --- ### 📝 Commits (5) - [`2284f5b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2284f5b1b29a9e06e8065532c9a365e8e21ed48e) fix(backup): contain automatic backup failure writes - [`d87e3a9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d87e3a9a628e30b0fc9a4d2300ebd68829055400) fix(runtime): harden release-critical background paths - [`3b6d7f0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3b6d7f0461f34af8a4268407e521a558b23c9783) fix(regression): restore open-issues lane - [`99bc21e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/99bc21ec645a83ea2aa8d9d86bd35b6845a4a497) test(prompt): follow standalone agent settings links - [`b882d54`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b882d5445aba80cdf984098d6a7513835e7e2a80) fix(runtime): address release review edge cases ### 📊 Changes **29 files changed** (+460 additions, -106 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+5 -1) 📝 `android/README.md` (+1 -0) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+6 -0) 📝 `packages/client/src/lib/local-notifications.ts` (+1 -1) 📝 `packages/client/src/lib/support-diagnostics.ts` (+7 -0) 📝 `packages/client/src/localization/locale-loader.ts` (+9 -4) 📝 `packages/server/src/app.ts` (+2 -0) 📝 `packages/server/src/index.ts` (+4 -0) 📝 `packages/server/src/routes/backup.routes.ts` (+6 -2) 📝 `packages/server/src/routes/chats.routes.ts` (+10 -2) 📝 `packages/server/src/routes/game.routes.ts` (+12 -3) 📝 `packages/server/src/routes/generate.routes.ts` (+13 -2) 📝 `packages/server/src/routes/generate/dry-run-route.ts` (+9 -2) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+4 -0) 📝 `packages/server/src/routes/lorebooks.routes.ts` (+5 -1) 📝 `packages/server/src/services/extensions/personal-server-extension-runtime.ts` (+9 -0) 📝 `packages/server/src/services/extensions/sandbox-protocol.ts` (+5 -0) 📝 `packages/server/src/services/lorebook/index.ts` (+18 -3) 📝 `packages/server/src/services/prompt/assembler.ts` (+23 -13) 📝 `packages/server/src/services/prompt/index.ts` (+1 -0) _...and 9 more files_ </details> ### 📄 Description ## Linked issues Fixes #5506 Fixes #5512 Fixes #5513 Fixes #5514 Fixes #5516 ## Why this change Kolache's Termux audit isolated one fixed heap default that is too small for large profiles but too generous for small Android installs, plus bounded background reliability hazards in backup failure handling, lorebook macro counting, extension watchdog recovery, and the open-issues regression lane. These are the remaining runtime release blockers. ## What changed - Choose a bounded 1–1.5 GiB Termux heap from structured profile size and device RAM while preserving explicit `NODE_OPTIONS` limits. - Expose heap-used, heap-limit, and RSS data through `/api/health` and copied Support Diagnostics, with a low-noise near-limit log warning. - Contain automatic-backup settings failures inside the original backup error path. - Compute lorebook-size macro counts only when an assembled prompt or relevant lorebook entry uses that macro. - Give resumed extension sandboxes one full heartbeat window after a process-wide pause. - Restore direct Node execution of the open-issues regression lane by removing its client path-alias dependency and providing Node-safe locale discovery; refresh stale source-shape assertions while retaining their behavioral contracts. - Add focused regression guards, Android launcher guidance, and Unreleased changelog entries. Local automated evidence: `pnpm check`, the open-issues regression, launcher dotenv/format-guard regressions, extension IPC regression, server/client lint and builds, and `git diff --check` pass. ## Validation - [ ] Run focused launcher, prompt, backup, sandbox, and open-issues regressions - [ ] Run `pnpm check` - [ ] Run `pnpm regression:prompt` - [ ] Run `git diff --check` - [ ] Manually verify Termux startup on small and large profile/device fixtures - [ ] Manually verify extension recovery after host suspension ## Risk boundary Launcher, backup, prompt assembly, health diagnostics, extension watchdog, and regression-only client import paths are touched. Explicit heap overrides remain authoritative; imports, exports, storage formats, and existing user capabilities are unchanged. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added adaptive Termux memory allocation based on profile size and device RAM, with manual override support. * Added server memory metrics to health checks and support diagnostics. * Added support for lorebook-size macros across prompts, previews, exports, and scans. * **Bug Fixes** * Improved automatic backup failure handling without masking the original error. * Prevented resumed extensions from being terminated after sandbox pauses. * Fixed launcher handling of data directories with spaces and relative paths. * Fixed import-time diagnostics and localization loading in some environments. * Lorebook-size scanning now runs only when the macro is used. <!-- 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:13:46 +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#6792
No description provided.