mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3106] [Issue]: conversation-summary / autonomous generation retries permanent failures (e.g. Gemini 404) every tick forever — no backoff, unbounded log spam #1666
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#1666
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?
Originally created by @kolacheee on GitHub (Jun 30, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3106
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
When the conversation-summary "day summary" generation fails with a permanent error (e.g. a
4xxlikeGemini API error 404: Not Foundbecause a connection's model id is stale/invalid), the failure is only logged — it is never recorded — so the same missing day stays "missing" and is re-attempted on every generation tick, forever. For a chat with autonomous messaging and/or summaries enabled on a misconfigured connection, this produces an unbounded stream of identical warnings (and wasted upstream API calls) every ~30–60s for as long as the chat exists. There is no backoff, no max-attempt cap, and no distinction between transient and permanent failures. The server-side autonomous scheduler exhibits the same no-backoff pattern (it re-attempts the failing generation every poll).This is log spam + pointless network traffic, not a crash — but on a long-lived install it floods the logs and hammers a dead endpoint indefinitely.
How to reproduce (try it yourself)
404 Not Found.You'll see, repeating every ~30–60s indefinitely:
(and, from the scheduler,
[autonomous-scheduler] Generate failed for chat <id>: Gemini API error 404).Expected: after a few consecutive hard failures for a given day (especially permanent 4xx), the engine should stop re-attempting that day-summary (and/or back off), instead of retrying it on every tick forever.
Where it is
packages/server/src/routes/generate.routes.ts::2685—const summaryRun = await generateMissingConversationSummaries({ ..., maxMissingDays: 2 }). "Missing" days are days without a stored summary.:2697-2701— failed days are onlylogger.warn'd ("[conversation-summary] failed to generate day summary");:2703-2707same for failed weeks.:~2708-2712— metadata is patched onlyif (hasNewSummaries)(i.e. only on success), so a failed day is never recorded as attempted/failed → it remains "missing" → re-attempted on the next generation.packages/server/src/services/conversation/server-autonomous-scheduler.service.ts:SERVER_AUTONOMOUS_POLL_MS = 60_000(:18) — the scheduler re-evaluates eligible chats every 60s.:149,:160— generation failures are logged and the chat is simply re-evaluated next poll; no per-chat backoff/cooldown after repeated hard failures.What's happening
The summary generator treats "no summary stored for this day" as "still needs generating," but a failed attempt writes nothing, so a permanently-failing day (dead model, revoked key, removed endpoint) is indistinguishable from a never-attempted day and is retried every tick. A
404/401/403will not self-heal, yet the code retries it identically to a transient network blip.Suggested fix
Record failed attempts and stop hammering permanent failures. Options (any combination):
generateMissingConversationSummaries, persist a smallfailedDaySummaries/failedWeekSummariesrecord in chat metadata (date →{ lastAttempt, attempts, lastError }) and skip re-attempting a day whose last failure was recent / whose attempt count exceeds a cap — with a longer cooldown (or permanent skip until the connection changes) for hard4xxerrors. Clear the record when the connection/model changes or on a successful run.server-autonomous-scheduler.service.ts, apply a per-chat cooldown after N consecutive hard failures so autonomous evaluation pauses for that chat instead of retrying every 60s.Distinguish transient (5xx/network → retry with backoff) from permanent (4xx → stop and surface once) so a misconfigured connection produces one clear warning, not an endless stream.
Note: observed live on a maintainer dev install — a chat with autonomous messaging + summaries enabled on a Gemini connection whose model 404s logged this warning continuously every ~30s. It is distinct from the tracker-panel freeze and the regex-script ReDoS reports.
AI-investigated against v2.0.8 (
main); cited lines read and confirmed. Please verify before fixing.@SpicyMarinara commented on GitHub (Jun 30, 2026):
Taking this in branch
codex/issue-sweep-3098-3105; I’ll add bounded failure tracking/backoff for conversation summaries and autonomous scheduler retries, then close it after the fix lands.