Repository navigation
fix(server): idle compaction skips a session the next message would not resume - #456
Merged
Merged
Conversation
…ot resume After a scheduled task's fresh run, the timer measured the schedule's session while the /compact went to the main conversation. The orchestrator now drops a before-cache-expires compaction when the active session is not the one the next message resumes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-up to the context-boundary notes from #439. One clear bug is fixed here. The rest are product calls, listed below with a recommendation.
What was wrong and the fix
Since #439, a thread can hold a fresh native session for a scheduled task's runs, beside the main conversation. After such a run, the idle-compaction timer measured the active session (the schedule's), found it large with a warm cache, and dispatched
/compact. Dispatch then sent that/compactto the main conversation, the session the next message resumes. The measurement and the compaction were about different sessions.Now the orchestrator drops a
beforeCacheExpirescompaction when the active session is not the one the next message resumes. The thread then waits for the user's next message instead of compacting a session nobody measured. "Compact and send" (onReturn) and a typed/compactare unchanged. They already go to the conversation the message resumes.Tests
ProviderSwitch.integration.test.ts: in the existing scheduled-fresh-session case, an idle compaction after the scheduled run reaches no provider. It fails onmain, where the compaction lands on the main conversation.Council review
Round 1: Codex (gpt-6.2-astra, high) and Claude Opus, on a first version that sent idle compaction to the active session.
Round 2: both reviewers, on a version that skipped in
idleCompactionWindow./compactroute consistently, and that no compaction is wrongly skipped in the cases asked about. That holds for the dispatch version too: when no main session qualifies, the conversation session is the active one, so compaction still runs.Context-boundary notes from #439
Product calls, not changed here. Both reviewers agreed with each recommendation.
post_tokens, and Codex's retained user messages, undercount the post-compaction estimate. The work reserve cushions it but does not bound it.Left
Opus 5.5 in Claude Code, through Onicode.
🤖 Generated with Claude Code