Skip to content

/compact summary can show stale Next Steps because preserved recent tail is excluded from summary reconciliation #28063

@samiralibabic

Description

@samiralibabic

Description

Description

/compact can leave completed work under ## Next Steps.

Cause:

  • compaction.tail_turns defaults to 2
  • recent turns are preserved via tail_start_id
  • those turns are excluded from the summarizer input
  • stale Next Steps from the previous summary can survive even when the preserved tail says the work is done

Relevant code:

  • packages/opencode/src/session/compaction.ts
  • DEFAULT_TAIL_TURNS = 2
  • select() returns head: input.messages.slice(0, keep.start) plus tail_start_id
  • buildPrompt() updates the previous summary without a recent-tail reconciliation pass

Expected:

  • completed items are not listed under ## Next Steps
  • completed items move to Done, Critical Context, or are removed

Actual:

  • completed items can remain under ## Next Steps
  • the agent can repeat already-finished work after compaction

Suggested fix:

  • pass a small text-only recent-tail audit into the compaction prompt
  • use it only to reconcile Done, In Progress, Blocked, and Next Steps
  • keep the preserved tail behavior unchanged
  • tighten Next Steps to unfinished future actions only

Regression test:

  1. previous summary has Next Steps: run tests
  2. preserved recent tail says tests were run and passed
  3. new summary must not list run tests under Next Steps

Plugins

none

OpenCode version

Latest dev from source inspection. Exact release not tested.

Steps to reproduce

  1. Create a session with an existing compaction summary.
  2. Let that summary contain ## Next Steps, e.g. run tests.
  3. Complete that item in the next one or two turns.
  4. Run /compact.
  5. Inspect the new summary.

Expected: completed item is removed from ## Next Steps.

Actual: completed item can remain under ## Next Steps.

Screenshot and/or share link

N/A

Operating System

macOS

Terminal

iTerm2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions