mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5660] [MERGED] feat(server): detect host freezes and surface the Termux wake-lock outcome #6868
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#6868
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/5660
Author: @kolacheee
Created: 8/30/2026
Status: ✅ Merged
Merged: 8/30/2026
Merged by: @kolacheee
Base:
staging← Head:feat/5655-5656-freeze-observability📝 Commits (2)
2fb9a65feat(server): detect host freezes and surface the Termux wake-lock outcome03ae9cbfix(client): gate diagnostics copy on health settling; align the changelog claim📊 Changes
9 files changed (+182 additions, -1 deletions)
View changed files
📝
CHANGELOG.md(+3 -0)📝
packages/client/src/components/panels/SettingsPanel.tsx(+7 -1)📝
packages/client/src/lib/support-diagnostics.ts(+7 -0)📝
packages/server/src/app.ts(+6 -0)📝
packages/server/src/index.ts(+3 -0)➕
packages/server/src/lib/freeze-detector.ts(+81 -0)➕
scripts/regressions/freeze-detector.regression.ts(+50 -0)📝
scripts/regressions/open-issues.regression.ts(+2 -0)📝
start-termux.sh(+23 -0)📄 Description
Closes #5655
Closes #5656
Why
The Termux background-freeze triage (see #4956 and the #5655/#5656 issue family) hit an observability wall: when Android freezes the backgrounded server, nothing a user can paste shows it happened. An idle server logs nothing, every timer silently stops and resumes, and the one decisive fact — whether the launcher's wake lock engaged — existed only as one scroll-away line at launch. Diagnosing this week's report required asking the user to dig the session log's first lines out of
~/.marinara-engine/logs/.What this adds
Freeze detector (#5655). An
unref()'d 60-second tick (packages/server/src/lib/freeze-detector.ts) measures its own lateness; a tick beyond 2× its interval records the suspension ({detectedAt, gapMs, suspendedMs}) and logs a warning with the estimated length. Design decisions, each deliberate:CLOCK_MONOTONICdoes not advance through an OS suspension — a monotonic detector would miss exactly the freezes this exists to catch. The cost (a forward clock-step fabricates a record; a backward step is silently absorbed) is acceptable for evidence-gathering./api/healthfor disambiguation, instead of steering every thread toward battery settings.unref), and shutdown stops it explicitly.Wake-lock surfacing (#5656).
start-termux.shexportsMARINARA_WAKE_LOCK_STATUS=acquired|failed|unavailablefrom its existing branches and, when the lock is not held, prints a prominent boxed warning immediately before the server starts — including the corrected guidance thattermux-wake-lockships in coretermux-tools(the Termux:API claim in the docs is wrong; that correction is #5659)./api/healthnow returnswakeLockandlastFreeze, and Copy Support Diagnostics renders both:Those two lines are exactly what the next freeze report will need.
Validation
freeze-detector.regression.ts: pins the pure gap classifier, then the wired detector by genuinely blocking the event loop withAtomics.wait(900ms)against a 200ms interval. The on-time phase tolerates real CI stalls honestly: a freeze recorded there must itself reflect a genuinely late tick, distinguishing environment stalls from detector false positives. Green locally.open-issues.regression.tsnow covers the two new lines' default rendering.start-termux.sh(ran the guard), env inheritance into the server launch,/healthconsumers are all additive-safe (keep-alive,checkVersion, e2e, auth middlewares — no strict shape validation anywhere), unref/shutdown hygiene, and module-singleton safety. Its findings (attribution hedge, on-time-phase tolerance, empty-string env normalization, formatter pins) are all applied.pnpm checkgreen;bash -n start-termux.shclean.start-termux.sh, confirm the wake-lock line appears in Copy Support Diagnostics; background Termux long enough to trigger a freeze, foreground, and confirm the session log shows the suspension warning and diagnostics show the freeze record.Related follow-ups filed separately: #5657 (client unreachable-state UX), #5658 (checkVersion fetch leak), #5659 (TROUBLESHOOTING corrections).
Summary by CodeRabbit
New Features
Bug Fixes
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.