mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #4716] [MERGED] fix(autonomous): gate the 60s scheduler sweep behind a chats write-generation counter #6475
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#6475
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/4716
Author: @kolacheee
Created: 8/7/2026
Status: ✅ Merged
Merged: 8/7/2026
Merged by: @kolacheee
Base:
staging← Head:fix/4705-autonomous-scheduler-gate📝 Commits (3)
78aeb79fix(autonomous): gate the 60s scheduler sweep behind a chats write-generation counter6db53a2Merge branch 'staging' into fix/4705-autonomous-scheduler-gatebed41a0test(regressions): close the write-generation store from the finally path📊 Changes
4 files changed (+173 additions, -3 deletions)
View changed files
📝
package.json(+1 -1)📝
packages/server/src/db/file-backed-store.ts(+21 -0)📝
packages/server/src/services/conversation/server-autonomous-scheduler.service.ts(+59 -2)➕
scripts/regressions/autonomous-scheduler-gate.regression.ts(+92 -0)📄 Description
Linked issue
Closes #4705 (from the Termux battery follow-up audit; sibling of #4715/#4704 — client-side autonomous polling — and the pattern-precedent Noodler gate from #4635)
Why this change
The server-side autonomous scheduler ran
chats.list()plus a per-chat metadataJSON.parsesweep every 60 seconds, forever, with no opt-in gate — even with zero autonomous chats and zero connected clients. On a phone-hosted (Termux) install that's a permanent idle cost.What changed
The file-native store has no cheap "any chat enabled?" probe (no indexes; a raw-metadata substring probe would couple to serialization details, where a false negative silently kills the feature — the regression class this design avoids). Instead:
markDirty— the single choke point every insert/update/delete funnels through (including cascades and capability-package writers) — exposed asgetTableWriteGenerationon the store controller. Deliberately never rolled back.autonomous-scheduler-gate.regression.ts, wired intoregression:issues):shouldSkipAutonomousSweep/concludeAutonomousSweep) and the full decision matrix is pinned.Review provenance (tiered): a mechanical 57-site inventory of chats-table writers and scheduler neighbors, classification to 3 suspects, then adversarial verification — 1 real defect confirmed (the rollback dirty-read above, fixed here), 6 gate-semantics points explicitly refuted (capture ordering, stop/cap-break lifecycle equivalence, eligible-chat re-arming, degradation paths, restart behavior, post-generation re-arm correctness).
Known trade-offs (accepted, safe-direction):
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Automated/scripted checks already performed (green):
pnpm check(lint + production build)autonomous-scheduler-gate.regression.ts: counter semantics (fresh-zero, insert/update bumps, unrelated-table isolation), the rollback dirty-read sequence, and the full gate decision matrix — all passing against the real file store in a temp dirStill to verify manually (please tick above once done):
chats.list()churn every 60s).Docs and release impact
Summary by CodeRabbit
Performance
Reliability
Tests
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.