Repository navigation
refactor(coderd/x/chatd)!: drop the context-limit fallback for old compaction summaries - #31002
ibetitsmike wants to merge 1 commit into
Conversation
…paction summaries
|
@codex review
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Closing this PR. Mike chose to keep this fallback for now (decision D6). Compaction summaries written by every released version lack the recorded trigger limit, because #28568 is in no release yet, and this fallback is what handles them. It can be retired after a release that includes #28568. The rest of the deprecation stack continues as stack #31006: #30996, #30997, #30998, #31000 and #31005. The branch stays in place.
|
This PR breaks compatibility with compaction summaries written before #28568, which no release includes yet, so summaries from released versions have this shape. Their
chat_summarizedtool result hascontext_limit_tokens(then the trigger's window) and notrigger_context_limit_tokens. The check for whether a summary was recorded under another trigger used to fall back tocontext_limit_tokensfor those results. The PR deletes that fallback and itsnoTriggerContextLimitsentinel, so the check reads onlythreshold_percentandtrigger_context_limit_tokens. Coder Agents is experimental (coderd/x), and our rule for experimental persisted data is to drop the legacy shape outright and delete the helpers that existed only to parse it, instead of carrying a migration.What old chats do now: a missing
trigger_context_limit_tokensdefaults to the current trigger, the same default an empty result already gets, so an old summary compares only on its threshold. If the trigger window has not changed since that summary, nothing changes. If it has (for example, a compaction model override now binds) and the first assistant reply after the summary is over the current threshold, the chat no longer compacts again. The turn ends with "Conversation compaction could not reduce the history below your compaction threshold" instead. A manual compaction, a different threshold or a new conversation clears it.Why it is safe
trigger_context_limit_tokens. I mutated the remaining comparison and its defaults and ran./coderd/x/chatd/withgo test -overlay. The tests catch all six mutants:TestCompactionStatusFromHistory/summary_under_a_different_trigger_compacts_againfails.still over limitcases that use an empty{}result fail.TestActiveServer_CompactionModelOverridefail.trigger_context_limit_tokens:TestActiveServer_Compactionand others fail.git grep noTriggerContextLimitfinds nothing.site/still readscontext_limit_tokens, which keeps its meaning (the chat model's window).Review focus
The comment kept in
summaryRecordedUnderOtherTriggerdescribes the empty-result defaults, which stay.Validation
go test ./coderd/x/chatd/ -count=1 -p 4 -parallel 4: okgo vetandgolangci-lint run --fix=false ./coderd/x/chatd/...: clean; pre-commit hook: passedStack
This stack retires chatd compatibility paths for chat data that older Coder versions stored.
close_agenttool alias