Repository navigation
fix(desktop): let a queued turn request compaction after a requested one - #4351
Merged
Merged
Conversation
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.
What
An agent that called
compact_threadwithresume: truecould stop for good instead of compacting and carrying on.When the requested
/compactturn ends,runPromptstarts the next message in the thread's queue (a PR or delegate wake, for example) and waits for that turn too before it returns. The "a compaction is running" guard was only cleared whenrunPromptreturned, so while the queued turn ran, any newcompact_threadcall from it was refused with "a compaction is already requested for this thread". The turn then ended with nothing scheduled, and the thread sat idle.Seen live: a long PR-by-PR run compacted after each PR, a PR-checks wake arrived during one compaction, the agent's next
compact_threadwas refused, and the run stopped./compactturn itself ends (requestedCompactionEnded), so a queued turn can request the next compaction. That request runs when the queued turn ends and continues as usual..finallyinrunRequestedCompactionstill clears the guard on paths that return early.Changelog
Agents that compact and continue no longer stop when a wake arrives during their compaction.
Testing
autoCompact.store.test.tspasses (25 tests).bunx tsc, biome,bunx vite buildandcheck-comments.pypass.bun run checkfails only on the known flakystopTrace.store.test.ts("a harness that ignores the Stop is forced").