Skip to content

feat(compaction): add continuation snapshot formatter - #266

Merged
hffmnnj merged 13 commits into
mainfrom
feat/compaction-continuation-prompt
Aug 3, 2026
Merged

hffmnnj merged 13 commits into
mainfrom
feat/compaction-continuation-prompt

Conversation

@hffmnnj

@hffmnnj hffmnnj commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • capture active task, blocker, and PR metadata in compaction handoffs
  • add a bounded, typed continuation-prompt formatter with focused coverage

Verification

  • rtk proxy bun test packages/opencode-plugin/src/tools/goop-compact/ --bail=3 --timeout=10000
  • rtk proxy bun test packages/opencode-plugin/src/shared/continuation-prompt.test.ts --bail=3 --timeout=10000
  • bun run --cwd packages/opencode-plugin typecheck
  • bun run --cwd packages/opencode-plugin lint

hffmnnj and others added 12 commits August 2, 2026 09:25
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
@hffmnnj
hffmnnj changed the base branch from custom-compaction to main August 3, 2026 01:36
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.
@hffmnnj
hffmnnj merged commit bb6ab5c into main Aug 3, 2026
0 of 2 checks passed
@hffmnnj
hffmnnj deleted the feat/compaction-continuation-prompt branch August 3, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant