Skip to content

fix(opencode): reject empty compaction summaries - #42063

Closed
vladislav-miroshnikov wants to merge 1 commit into
anomalyco:devfrom
vladislav-miroshnikov:compaction-empty-summary
Closed

fix(opencode): reject empty compaction summaries#42063
vladislav-miroshnikov wants to merge 1 commit into
anomalyco:devfrom
vladislav-miroshnikov:compaction-empty-summary

Conversation

@vladislav-miroshnikov

@vladislav-miroshnikov vladislav-miroshnikov commented Aug 12, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #41571

Type of change

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

What does this PR do?

A compaction model can finish with reasoning but no text summary. V1 currently treats that as success, which can hide the previous history behind an empty summary boundary.

This marks the summary as errored and stops before tail, replay, auto-continue, or the compacted event — so a fresh failed attempt cannot filter away earlier messages. It's limited to the safety invariant; #41663 explores the larger structured-input alternative.

How did you verify your code works?

  • cd packages/opencode && bun test test/session/compaction.test.ts — 54 pass, 1 skip, 0 fail
  • cd packages/opencode && bun typecheck
  • Changed-file Prettier and git diff --check

The regression drives a reasoning-only processor response and verifies the error state, stopped result, absent compacted event, and retained history.

Checklist

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

Treat a successful compaction processor result without non-empty text
as a failed summary. Persist an error and stop before tail, replay,
auto-continue, or compacted-event side effects so a fresh failed
attempt cannot hide history.

Add a reasoning-only regression and make the successful processor
test fake persist a valid summary.
@github-actions

Copy link
Copy Markdown
Contributor

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

Based on my search, I found one potentially related PR:

Related PR:

All other results either returned the current PR itself (#42063) or are unrelated to compaction summary handling.

@OldKrab

OldKrab commented Aug 12, 2026

Copy link
Copy Markdown

Really miss that fix!

@josephtingiris

Copy link
Copy Markdown

missed many i have fixed all these in #41663 ... entropy is fast ... conflicts already heading down the wrong path

@vladislav-miroshnikov

Copy link
Copy Markdown
Author

@josephtingiris
#41663 closes #38801, not #41571 I validated that summaryText() is unchanged there, so the empty/no-text summary guard isn't in place. The processor change does stop Compacted from firing for a reasoning-only finish:"stop", but history is dropped by filterCompacted based on the summary message being error-free with a finish set, not on the event, so the head is still hidden, and finish:"length" is not covered either. The two PRs are complementary on different issues so if #41663 lands first I will rebase and adjust the guard.

@josephtingiris

Copy link
Copy Markdown

thx. it closes many others too just haven't had the time to link it all up here. hoping for help from the community. deterministic is more reliable in the long run.

@github-actions

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.

Compaction produces empty summary for Kimi K3-256K since v1.18.15 — conversation history silently dropped

3 participants