Skip to content

fix(session): reconcile compaction summary with preserved tail - #46364

Closed
samiralibabic wants to merge 1 commit into
anomalyco:devfrom
samiralibabic:compact-tail-reconcile
Closed

samiralibabic wants to merge 1 commit into
anomalyco:devfrom
samiralibabic:compact-tail-reconcile

Conversation

@samiralibabic

@samiralibabic samiralibabic commented Aug 31, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #38530

Replaces #28067, which was auto-closed for template compliance without maintainer review.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Repeated compaction can retain stale work under Next Move when the previous summary lists an action and the preserved recent turns show it was completed. The summarizer currently cannot reconcile that evidence because the preserved tail is excluded from its input.

This supplies a bounded, transformed audit of visible user and assistant text from the preserved tail while keeping the normal tail replay unchanged.

How did you verify your code works?

  • cd packages/opencode && bun test test/session/compaction.test.ts (57 pass, 1 skip)
  • cd packages/opencode && bun run typecheck
  • Changed-file Prettier and git diff --check
  • Pre-push workspace typecheck (30 packages passed)

Screenshots / recordings

N/A. This is not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Related PRs Found

The search revealed several related PRs addressing session compaction issues:

  1. feat(core): enhanced compaction with ratios and combined context-restoration advancement #45125 - feat(core): enhanced compaction with ratios and combined context-restoration advancement

    • Likely related as it addresses enhancements to compaction logic
  2. fix(session): bound compacted history hydration #39930 - fix(session): bound compacted history hydration

    • Directly related - also addresses session compaction and history handling
  3. fix(opencode): reject empty compaction summaries #42063 - fix(opencode): reject empty compaction summaries

    • Related - addresses compaction summary validation

These appear to be part of an ongoing effort to improve session compaction behavior. However, #46364 (the current PR) is specifically addressing the reconciliation of compaction summaries with preserved tail contents, which is a distinct issue from the others even if they touch related code areas.

The PR also references #28067 (auto-closed without review), which this PR replaces.

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/compact can keep completed work in Next Move after preserved-tail turns

1 participant