Skip to content

Conversation

@uinstinct
Copy link
Contributor

@uinstinct uinstinct commented Oct 31, 2025

Description

Prevent infinite looping when auto compaction happens.
Also prune messages when auto compaction fails and context length is invalid/exceeding, until chat history is within context length.

resolves CON-4681
resolves CON-4455

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screen recording or screenshot

(both having context length set as 300 in the config.yaml)

before.mp4
after.mp4

Tests

[ What tests were added or updated to ensure the changes work as expected? ]

@uinstinct uinstinct requested a review from a team as a code owner October 31, 2025 08:06
@uinstinct uinstinct requested review from RomneyDa and removed request for a team October 31, 2025 08:06
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 31, 2025
@uinstinct uinstinct changed the title fix: prevent auto compaction loop and prune messages until valid fix(cli): prevent auto compaction loop and prune messages until valid Oct 31, 2025
@uinstinct
Copy link
Contributor Author

Was looking at countChatHistoryItemTokens. Why do we not count the systemMessage and the tool call results?

From the ticket, it looks like there is some counting mistake that is happening because before getting the 500 error from the server, we should have received our internal Context length validation failed error in the tui.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

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

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant