mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6936
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5797
Author: @kolacheee
Created: 9/3/2026
Status: ✅ Merged
Merged: 9/3/2026
Merged by: @kolacheee
Base:
staging← Head:feat/termux-unclean-exit-postmortem📝 Commits (4)
a9de922feat(server): session heartbeat postmortem for external kills (#5506)58ecbf0fix(server): classify session endings honestly (adversarial review)57a19cbfix(server): validate the record and keep heartbeat ownership (CodeRabbit)266a7a9fix(server): validate the history file and de-flake the lane (CodeRabbit)📊 Changes
9 files changed (+699 additions, -0 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
packages/client/src/components/panels/SettingsPanel.tsx(+21 -0)📝
packages/client/src/lib/support-diagnostics.ts(+67 -0)📝
packages/server/src/app.ts(+8 -0)📝
packages/server/src/index.ts(+11 -0)➕
packages/server/src/lib/session-postmortem.ts(+359 -0)📝
packages/server/src/routes/admin.routes.ts(+4 -0)📝
packages/server/src/routes/updates.routes.ts(+4 -0)➕
scripts/regressions/termux-postmortem.regression.ts(+223 -0)📄 Description
Linked issue
Diagnostics for #5506 (Termux server dies silently in the background). Not a fix for the root cause — a fix needs to know who kills the process, which is exactly what no current log can say.
Why this change
SIGKILL: no handler runs, nothing is logged, and the launcher log simply stops mid-stream. From a support thread, that is indistinguishable from a crash, a reboot, or a network problem — as two logs from an affected tester this week show, both ending in silence after a clean startup.What changed
packages/server/src/lib/session-postmortem.ts): a small JSON file inDATA_DIR/diagnosticsrefreshed every 30s with pid, boot id, start time, last-alive time and RSS/heap. Written atomically (tmp + rename) so a kill mid-write cannot corrupt the previous beat,unref'd so it never holds the process open, and console-silent at runtime by design — users read the console for other things. The only console surface is one line at startup; the regression pins the whole module to exactly two logger calls, both in the startup path.process.on("exit"): every deliberate ending reaches that event (signal shutdown, in-app update, Advanced Settings restart, a fatal crash) and aSIGKILLreaches nothing — which is precisely the signal. Hooking the process event rather than each shutdown path means a future fifth exit path cannot silently rot the classification.endedwith its kind:clean,crash(uncaughtException / unhandledRejection name themselves), orrestart(update / settings restart name themselves);uncleanwith the full record (last alive, uptime, RSS/heap at death, boot-id reboot detection);unknownwith a reason — first run, unreadable record, or a still-live previous pid (a restart's detached child racing its parent, or two servers sharing oneDATA_DIR). "unknown" never renders as a clean shutdown.previousSession+uncleanExitCounton/api/health; andPrevious session:/Sessions ended without shutdown:lines in Support Diagnostics. The count reports even when the last session ended normally — a history of kills is the pattern worth seeing.termux-postmortemregression lane and a CHANGELOG entry.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
node ./scripts/run-regressions.mjs --filter termux-postmortem(classifier semantics, a real temp-DATA_DIRround trip, source pins), server lint, client lint,pnpm build.kill -9it, restart and confirm the startup line and the Support Diagnostics lines describe the kill; then stop it with Ctrl+C, restart, and confirm it reports a clean shutdown; then use the in-app updater and confirm the next start says "restarted itself", not a kill.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)UI evidence (if applicable)
Not applicable — server-side diagnostics plus two text lines in the Support Diagnostics copy block.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.