fix: guard goal continuation across compaction epochs - #61
Conversation
|
@willytop8 this is ready for review. It preserves automatic goal continuation after a good compaction while adding epoch-scoped deduplication and a bounded stalled-compaction circuit breaker, with regression coverage for the retained-assistant and race cases. All PR-relevant CI jobs passed. The remaining red Windows filesystem job is an unchanged persistence-lease concurrency test flake documented in the PR body; the integration could not rerun it. |
|
Thanks for this @harryzhou2000 — the epoch-guard framing is the right model and While verifying against the vendored
Superseding here rather than pushing to your branch so the changelog credit and |
fix: harden post-compaction continuation guard (supersedes #61)
What changed
session.compactedevents and invalidate stale idle handlers beforepromptAsyncexperimental.compaction.autocontinuesuppression for active goalsWhy
OpenCode can repeatedly compact a session whose retained context does not make progress. The existing goal-plugin fix correctly cleared the pre-compaction continuation claim, but it had no epoch identity or bounded failure path. Repeated compaction delivery could reopen continuation, while retaining the same assistant could also be re-scored by existing stall gates before the required post-compaction continuation.
This change keeps good compactions autonomous and makes active-goal stalled compactions terminate safely. It does not replace the scheduler-level OpenCode guard needed for sessions without an active goal.
Checks
Passed:
/usr/bin/node test/goal-plugin.test.js(313 tests)npm run type:checknpm run smokenpm run smoke:packed-hostnpm run smoke:packed-toolsnpm run benchmark:behavior(100/100)npm run verify(7/7)npm run pack:checkgit diff --checkEnvironment baseline limitation:
npm test,npm run test:coverage,npm run check, and the mutation baseline reach the unchanged cross-process tests, wherepersistence-lease.test.jsandsession-concurrency.test.jshelper children exit with code 0 before emittingREADY.upstream/mainon this Node 22.22.3 host; the changedgoal-plugin.test.jspasses completely.GitHub Actions:
persistence-lease.test.js:simultaneous stale observers cannot both acquire the replacement leaseexpected one winner and observed zero. The integration lacks permission to rerun that failed job.Manual OpenCode smoke testing was not performed; source and packed-host/tool contracts were run instead.