Skip to content

fix(core): guard non-reducing compaction#34261

Open
cwj2001 wants to merge 1 commit into
anomalyco:devfrom
cwj2001:compaction-budget
Open

fix(core): guard non-reducing compaction#34261
cwj2001 wants to merge 1 commit into
anomalyco:devfrom
cwj2001:compaction-budget

Conversation

@cwj2001

@cwj2001 cwj2001 commented Jun 27, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #27924

Type of change

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

What does this PR do?

Stops overflow recovery when compaction does not make progress.

After the recovery summary is added, the runner re-estimates the request. It only retries the provider if the compacted request is smaller than the original request and within the model context budget. Otherwise it persists the original overflow error and exits instead of retrying into another overflow cycle.

How did you verify your code works?

From packages/core:

  • bun test test/session-runner.test.ts --test-name-pattern "overflow"
  • bun typecheck

Screenshots / recordings

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:

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

Related PR:

The other PRs found (#33667, #18941) are related to overflow and compaction in general but appear to address different aspects of the issue.

@cwj2001

cwj2001 commented Jun 27, 2026

Copy link
Copy Markdown
Author

#34029 and this PR cover different failure modes.

#34029 handles aborts/errors while generating the overflow recovery summary.

This PR handles the case where recovery summary generation succeeds, but the rebuilt request is still over budget or is not smaller than the original request. In that case we persist the original overflow error instead of retrying into another overflow cycle.

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(session): infinite compaction loop when compression fails to reduce context

2 participants