fix(daemon): send self-compact nudge straight away instead of queueing for Stop#73
Closed
rogeriochaves wants to merge 1 commit into
Closed
fix(daemon): send self-compact nudge straight away instead of queueing for Stop#73rogeriochaves wants to merge 1 commit into
rogeriochaves wants to merge 1 commit into
Conversation
The auto-compact guard queued the 500k/600k/700k self-compact nudges and relied on auto-send when the agent next emits a Stop. A freshly-resumed or idle session never emits a Stop, so those gentle nudges never fired and context coasted up to the 750k hard /compact — which then collided with whatever prompt landed next (e.g. the morning nudge), losing it. Paste the nudge straight into the session instead. Claude queues pasted input and runs it after the current turn, so a busy agent still finishes gracefully, while a resumed/idle session self-compacts immediately and is well below the limit by the time its next prompt arrives.
Contributor
Author
|
Dropping this. The queued self-compact nudge (fire at next Stop) is the intended behavior: a soft nudge should land at a stop point, and an idle session just rides up to the 750k hard /compact, after which the next prompt arrives post-compaction. The straight-away paste defeated the purpose of the queuePrompt path. |
rogeriochaves
added a commit
that referenced
this pull request
May 28, 2026
The 500k/600k/700k soft nudges stay queued and auto-send on the next Stop, as designed: a soft nudge is meant to land at a stop point, and an idle session simply rides up to the 750k hard /compact, after which the next prompt arrives post-compaction. Reverts the daemon paste-straight-away change so the queuePrompt path is preserved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The headless auto-compact guard escalates: at 500k/600k/700k it nudges the agent to self-compact, and at 750k it sends
/compactdirectly. The 500/600/700k nudges were queued and only auto-sent when the agent next emitted aStophook.A freshly-resumed or idle session never emits a Stop, so those gentle nudges never fired. Context coasted all the way up to the 750k hard
/compact, which then fired on top of whatever prompt landed next (in practice, the morning scheduled nudge) and that prompt was lost — the agent skipped a day's work.Fix
Paste the self-compact nudge straight into the session when the threshold is crossed, instead of parking it in the queue. Claude Code queues pasted input and runs it after the current turn, so:
lastTriggeredstill ensures each threshold nudges only once; the 750k hard/compactbackstop is unchanged. Removed the now-unusedenqueueOncehelper.Tests
Updated the daemon auto-compact test to assert the nudge is pasted straight away (not queued) and not re-sent for the same threshold. Full suite green (197).