mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3045] [Issue]: Manual character replies pollute the autonomous follow-up counter, so a character's first reach-out is treated as a 2nd-round follow-up (double cooldown, wrong anchor, one fewer follow-up) #1615
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#1615
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 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3045
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
In Conversation mode, the autonomous-messaging feature decides whether a character may send an unprompted message using a per-character send count. At count 0 it uses the FIRST-message gate (fires once the user has been idle past the base inactivity threshold). At count >= 1 it switches to the FOLLOW-UP branch: an escalating cooldown of
2^count * baseThreshold, measured from the last recorded send, capped atmaxFollowups(default 3). The bug is that this counter is incremented byrecordAssistantActivity, which the generate route calls for EVERY conversation assistant message — including normal manual (user-triggered) replies, not just autonomous ones. So after a normal user message + manual reply, the character's count is already 1. The next autonomous evaluation then: (a) skips the correct first-message inactivity gate; (b) requires 2x the base threshold instead of 1x; (c) measures that wait from the manual-reply timestamp instead of the user's last message; and (d) leaves only 2 real autonomous slots instead of 3. In a group individual-mode turn where several characters each reply to one user message, every replier starts at count 1, amplifying the effect across the whole group.How to reproduce (try it yourself)
inactivityThresholdMinutes= 120, status online.You'll see: the first autonomous message does not fire after ~120 min of silence; the follow-up branch is entered (count 1 -> threshold = 120 * 2^1 = 240 min, measured from the manual reply), and the character has only 2 autonomous slots left.
Expected: after ~120 min of user silence the FIRST autonomous message fires (count 0 path), measured from the user's last message, with 3 follow-up slots available.
Where it is
packages/server/src/services/conversation/autonomous.service.ts:187-201—recordAssistantActivityincrementsautonomousMessages[characterId].countunconditionally whenever a characterId is passed; no autonomous gate.packages/server/src/routes/generate.routes.ts:6977-6981— callsrecordAssistantActivity(input.chatId, targetCharId ?? undefined)for every conversation save (guard is onlychatMode === "conversation" && !impersonate && !regenerate), with noinput.autonomouscheck.autonomous.service.ts:353-392—checkAutonomousMessagingreadssentCount(line 354) and branches into theMath.pow(2, sentCount)cooldown.autonomous.service.ts:143-160(recordUserActivityclears the counter).generate.routes.ts:1309-1314(shouldAccountAutonomousGenerationrequiresinput.autonomous === true) gating the parallel persistent counterrecordSavedAutonomousGenerationat1545-1546.What's happening
recordAssistantActivityconflates two distinct events into one counter thatcheckAutonomousMessagingassumes reflects autonomous messages only. The parallel daily-budget counter is correctly gated byinput.autonomous === true, proving autonomous-only accounting was the intent; the in-memory follow-up counter just missed the same gate.Suggested fix
Gate the in-memory counter increment so it only fires for genuinely autonomous sends, mirroring the existing
shouldAccountAutonomousGeneration/input.autonomousgate. Pass the characterId only when autonomous; otherwise pass undefined so manual replies still updatelastAssistantMessageAtand cleargenerationInProgressSincebut do NOT bump the count. Apply at BOTH conversation-save call sites (a command-only/empty-prose reply pollutes via the second path too):generate.routes.ts:6978(main assistant save):recordAssistantActivity(input.chatId, input.autonomous ? (targetCharId ?? undefined) : undefined);generate.routes.ts:6935(command-only/empty-prose save): same change.Regression notes: leave the roleplay-DM cross-post call sites (generate.routes.ts:9888, 9954) and
/activity/assistant(conversation.routes.ts:673) unchanged — the DM sites legitimately seed follow-up state in the target chat, and /activity/assistant is only ever called with characterId undefined.lastAssistantMessageAtupdates unconditionally before theif (characterId)guard insiderecordAssistantActivity, so passing undefined still records the timestamp; only the per-character count is skipped. Genuine autonomous sends arrive withautonomous: trueand flow through the same block, so escalation and the maxFollowups cap stay fully functional.input.autonomousdefaults to false (chat.schema.ts:40), so the guard is always safe.v2.0.7 note:
generate.routes.tswas reworked inorigin/staging; this bug PERSISTS there —recordAssistantActivityis still ungated byinput.autonomousat staging lines ~7040 and ~7090 (vs main 6977-6981). Apply the gate at those call sites.AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Claiming this for the current staging sweep in draft PR #3053 (branch
codex/issue-sweep-3033-3052).@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed in PR #3053 on branch
codex/issue-sweep-3033-3052(commitbfb1bc76). Closing this issue as addressed; the PR remains open for staging review/merge.