Repository navigation
feat(compaction): add continuation snapshot formatter - #266
Merged
Merged
Conversation
Add optional fields to CompactionHandoffSnapshot for current-wave title, status, tasks, open blockers, and PR branch/URL. A guarded collector reads from GoopSpecDB at queue time, bounding to 8 tasks and 5 open blockers. DB failures produce undefined optional fields without preventing snapshot creation, preserving backward compatibility with the existing type guard.
Provide an allowlisted formatter that turns handoff snapshots or live workflow state into a bounded continuation brief. Include focused coverage for state collection, autopilot behavior, and deterministic truncation.
Use the typed continuation formatter as the V1 compaction hook output so workflow state replaces the default prompt safely. Preserve handoff cleanup and workflow rebinding while leaving output untouched when no valid detail exists.
Replace the legacy survival-block test suite with coverage for the output.prompt replacement contract: valid snapshot, live-state fallback, no-workflow stand-down, malformed snapshot, absent-workflow rebinding, consume-once, halt clearing, and graceful degradation on throwing state manager / DB accessor. Fix: collectContinuationDetail returns undefined on DB-read failure so output stays untouched when collection fails, matching the spec's never-throw degradation requirement.
…eplacement The structured handoff round-trip test still expected the hook to append nextStep to output.context, contradicting the output.prompt replacement contract. Assert nextStep lands in output.prompt as the first Next Move item and output.context stays empty.
…deferral Add boundary-locking tests that assert the V1-only compaction contract: - experimental.session.compacting stays in the V2 skipped list and no compaction handler is registered with either V2 runtime capability (AD8, NFR4) - goop_compact is omitted when client.session.summarize is not a function, covering the boundary where session exists but summarize is absent (NFR4) - no DEFAULT_HOOK_FACTORIES entry registers experimental.compaction.autocontinue, with a failure-site comment citing SPEC AD7 No production code changes; tests only.
…val renderer Remove the unused buildWorkflowSurvivalBlock export and its exclusively-used helpers (sanitizeNextStep, resolveSurvivalState, WorkflowStateLike, MAX_NEXT_STEP_CHARS) from the compaction hook. The hook replaces output.prompt with a bounded continuation prompt from the shared formatter instead of appending a survival block to output.context. Document the replace-not-append contract and the output.prompt last-writer-wins / output.context-discard gotcha in AGENTS.md and core-protocol.md.
Make continuation handoffs preserve the latest instruction context and verify durable state after resuming. Prevent recursive brief copying while clarifying that the summarization response contains only the generated brief.
Lock the strengthened continuation brief contract in focused behavioral tests. Verify recency, authoritative re-query, no-tool-use guidance, and the frozen formatter caps without changing production code.
feat(compaction): lock V1-only degradation boundary and remove legacy survival renderer
…ning Strengthen continuation brief directives
feat(compaction): replace default continuation prompt
Resolve hooks-v2.test.ts conflict by keeping both the compaction skipped-list test (AD8/NFR4, from this branch) and the lazy-autopilot nudge limitation/event-skipped-list tests (from main). Both are additive, independent test cases in the registerHooksV2() describe block; neither reverts nor duplicates the other.
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.
Summary
Verification
rtk proxy bun test packages/opencode-plugin/src/tools/goop-compact/ --bail=3 --timeout=10000rtk proxy bun test packages/opencode-plugin/src/shared/continuation-prompt.test.ts --bail=3 --timeout=10000bun run --cwd packages/opencode-plugin typecheckbun run --cwd packages/opencode-plugin lint