Skip to content

fix(core): honor compaction.auto on provider overflow#17779

Closed
clzoc wants to merge 1 commit intoanomalyco:devfrom
clzoc:compaction-auto-fix
Closed

fix(core): honor compaction.auto on provider overflow#17779
clzoc wants to merge 1 commit intoanomalyco:devfrom
clzoc:compaction-auto-fix

Conversation

@clzoc
Copy link

@clzoc clzoc commented Mar 16, 2026

Fixes #16882

When provider-triggered context overflow reaches the reactive processor path, compaction.auto: false was being ignored and the session still tried to compact. This change makes the processor stop cleanly with a persisted overflow error when auto-compaction is disabled, while preserving the existing compaction path when it is enabled.

Verification:

  • cd /Users/tsunami/Downloads/opencode/packages/opencode && bun test test/session/compaction.test.ts
  • cd /Users/tsunami/Downloads/opencode/packages/opencode && bun test test/session/message-v2.test.ts -t "detects context overflow from APICallError provider messages"
  • cd /Users/tsunami/Downloads/opencode/packages/opencode && bun test test/session/retry.test.ts -t "does not retry context overflow errors"
  • cd /Users/tsunami/Downloads/opencode/packages/opencode && bun typecheck

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@github-actions github-actions bot added the needs:compliance This means the issue will auto-close after 2 hours. label Mar 16, 2026
@github-actions
Copy link
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Contributor

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

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

PR #17766 - fix(provider): treat Anthropic billing_error as context overflow for auto-compaction
#17766

This PR is related because it also deals with context overflow and auto-compaction behavior in providers, though it focuses on a different error type (Anthropic billing_error). Since PR #17779 (the current PR) addresses how compaction.auto: false is honored when provider-triggered overflow occurs, these PRs may be addressing related aspects of the same overflow/compaction system but appear to be distinct fixes.

No duplicate PRs addressing the exact same issue were found.

@github-actions
Copy link
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Mar 16, 2026
@github-actions github-actions bot closed this Mar 16, 2026
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.

compaction.auto: false is ignored when provider throws a context overflow error

1 participant