fix(goal-loop): resume auto-continue after session compaction - #58
Merged
willytop8 merged 3 commits intoAug 7, 2026
Merged
Conversation
After a compaction the recent message tail can still end on the same assistant message that an in-flight continuation claim points at, so the idle driver's claim dedupe suppressed the post-compaction continuation and the goal loop stalled until the user nudged it. Invalidate the continuation claim on session.compacted so the next idle issues a fresh continuation against the compacted context. Adds a reproduction test: claim set for the latest assistant turn, then session.compacted, then idle -> exactly one continuation prompt.
Merged
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 changed
Fixes the goal loop stalling after session compaction: auto-continue now resumes on the next idle instead of waiting for a user nudge.
Root cause:
claimContinuationSourcededupes continuations by claiming the source assistant turn it continues from. When a compaction interrupts an in-flight continuation, the recent message tail can still end on that same pre-compaction assistant message, so after compaction the claim matched again and the idle driver returned early forever — the goal stayed "running" but never continued.Fix: the
session.compactedhandler now invalidatesgoal.continuationClaim, so the post-compaction idle issues a fresh continuation against the compacted context (the claim's dedupe purpose does not apply across a compaction boundary).Why
The plugin disables OpenCode's generic post-compaction auto-continue while a goal is active (
experimental.compaction.autocontinue→enabled: false) to avoid two continuations racing, and relies on its own idle-triggered loop instead. That handoff broke when the stale claim survived the compaction.Checks run
node test/goal-plugin.test.js— 308/308 pass, including the new reproduction test (auto-continue fires after compaction despite a pre-compaction continuation claim), which fails onmain(0 continuations) and passes with the fix (exactly 1).npm run checkon official Node 22 — 385/385 pass.