Skip to content

Conversation

@RomneyDa
Copy link
Collaborator

@RomneyDa RomneyDa commented Jan 16, 2026

Description

  • Read file tool no longer truncates when limit is hit, just throws Error and explains why and ways to get around it with bash tools etc. Partial file output isn't usually very useful. Claude handles similarly.
  • Truncate bash and read tool output proportionally by the number of parallel tool calls, and notify model if they were truncated more than usual because of parallel calls
  • Update the autocompaction threshold to be contextLength - maxTokens - Min(maxTokens, 15k). This is based off of reasoning that if we leave contextLength - maxTokens - output, we will always be able to compact the next turn, and data shows that max tokens > 15k is very rare. This doesn't account for tool output exceeding max tokens but the above change should reduce that issue quite a bit. It's difficult to deterministically prevent tool output from exceeding context length without complicated and/or partial pruning or super aggressive truncation but some complex pruning will likely be worth it in the near future
  • Use rough token multiplier with 10% buffer to account for tokenizers which will have higher token counts, e.g. often 25% higher tokens in claude then gpt. Used this article
  • Removes duplicate token counting step by rearranging logic a bit

Continue Tasks: ▶️ 2 queued — View all


Summary by cubic

Fixes auto-compaction failures by reserving space for the compaction prompt and centralizing compaction so we stay within the model’s context window. Also prevents context spikes from tool outputs with clear file-size errors and proportional limits when tools run in parallel, and adjusts token counting for non-GPT models.

  • Bug Fixes

    • Reserve 150 tokens for the compaction prompt during pruning.
    • Route all paths through handleAutoCompaction; remove premature checks that caused missed or late compactions.
    • Use a ratio-based buffer for auto-compaction: contextLength − maxTokens − min(max(maxTokens, 20% of remaining), 15k) to compact earlier and avoid overruns.
    • Adjust token counts for Anthropic, Gemini, and Mistral models using safe multipliers.
    • readFile now throws a FileTooLarge error with counts instead of truncating.
    • Divide readFile and bash output limits by the number of parallel tool calls to prevent overflow; add a note when truncation occurs.
  • Refactors

    • Extract compaction prompt to a constant and make TUI compaction delegate to the core auto-compaction handler via callbacks for consistent behavior.

Written for commit c0a9309. Summary will update on new commits.

@continue
Copy link
Contributor

continue bot commented Jan 16, 2026

All Green - Keep your PRs mergeable

Learn more

All Green is an AI agent that automatically:

✅ Addresses code review comments

✅ Fixes failing CI checks

✅ Resolves merge conflicts


Unsubscribe from All Green comments

@RomneyDa RomneyDa marked this pull request as ready for review January 22, 2026 01:37
@RomneyDa RomneyDa requested a review from a team as a code owner January 22, 2026 01:37
@RomneyDa RomneyDa requested review from sestinj and removed request for a team January 22, 2026 01:37
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Jan 22, 2026
@github-actions
Copy link

github-actions bot commented Jan 22, 2026

✅ Review Complete

Code Review Summary

⚠️ Continue API authentication failed. Please check your CONTINUE_API_KEY.


sestinj
sestinj previously approved these changes Jan 22, 2026
Copy link
Contributor

@sestinj sestinj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Jan 22, 2026
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 22, 2026
@sestinj sestinj merged commit 29aa682 into main Jan 22, 2026
55 of 58 checks passed
@sestinj sestinj deleted the dallin/compaction-fixes-2 branch January 22, 2026 21:15
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Jan 22, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2026
@sestinj
Copy link
Contributor

sestinj commented Jan 22, 2026

🎉 This PR is included in version 1.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

lgtm This PR has been approved by a maintainer released size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants