Skip to content

fix(core): summarize compaction without the session reasoning variant - #56772

Open
Graffian wants to merge 1 commit into
anomalyco:devfrom
Graffian:compaction-variant
Open

Graffian wants to merge 1 commit into
anomalyco:devfrom
Graffian:compaction-variant

Conversation

@Graffian

Copy link
Copy Markdown

Issue for this PR

Closes #56766

Type of change

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

What does this PR do?

Compaction was failing with "Compaction summary reached the output token limit" on Haiku 5.5 at max effort, even with the context only half full.

The summary request reused the session's reasoning variant. At max effort the model can use up the whole 32K summary output limit on thinking and get cut off before writing the summary. Now, when no compaction agent model is configured, the summary resolves the model again without the variant, so it uses the provider's default reasoning. A configured compaction model and native compaction work as before.

How did you verify your code works?

Added a test in session-compaction.test.ts that sets the session variant to max and checks that compaction asks for the model without a variant. It fails without the change and passes with it. The existing compaction tests and the packages/core typecheck also pass. I haven't tried it against a live Haiku 5.5 session.

Screenshots / recordings

Not a UI change.

Checklist

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

The summary request inherited the session's reasoning variant. At max effort
the model can spend the whole 32k summary output limit on reasoning and finish
with reason "length", which surfaces as "Compaction summary reached the output
token limit" even though the context window is far from full.

When no compaction agent model is configured, resolve the model again without
the variant so the summary uses the provider default reasoning. An explicit
compaction agent model, native compaction, and a failed resolve keep their
current behavior.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012f8hnxtEXXXiuwuWWpg7SA
@github-actions

Copy link
Copy Markdown
Contributor

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

This branch has not been deployed

No deployments
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.

[Bug] opencode compaction issues

2 participants