Skip to content

refactor(coderd/x/chatd)!: drop the context-limit fallback for old compaction summaries - #31002

Closed
ibetitsmike wants to merge 1 commit into
mike/chatd-retire-unstamped-reasoningfrom
mike/chatd-retire-summary-limit-fallback
Closed

ibetitsmike wants to merge 1 commit into
mike/chatd-retire-unstamped-reasoningfrom
mike/chatd-retire-summary-limit-fallback

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

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_summarized tool result has context_limit_tokens (then the trigger's window) and no trigger_context_limit_tokens. The check for whether a summary was recorded under another trigger used to fall back to context_limit_tokens for those results. The PR deletes that fallback and its noTriggerContextLimit sentinel, so the check reads only threshold_percent and trigger_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_tokens defaults 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

  • The compaction writer always records trigger_context_limit_tokens. I mutated the remaining comparison and its defaults and ran ./coderd/x/chatd/ with go test -overlay. The tests catch all six mutants:
    • Trigger limit or threshold not compared: TestCompactionStatusFromHistory/summary_under_a_different_trigger_compacts_again fails.
    • Default for the trigger limit or the threshold removed: the still over limit cases that use an empty {} result fail.
    • Comparison against the chat window instead of the trigger: that case and TestActiveServer_CompactionModelOverride fail.
    • Writer omitting trigger_context_limit_tokens: TestActiveServer_Compaction and others fail.
  • The deleted case "summary without trigger limit compares context limit" covered only the old result shape. git grep noTriggerContextLimit finds nothing. site/ still reads context_limit_tokens, which keeps its meaning (the chat model's window).

Review focus

The comment kept in summaryRecordedUnderOtherTrigger describes the empty-result defaults, which stay.

Validation

  • go test ./coderd/x/chatd/ -count=1 -p 4 -parallel 4: ok
  • go vet and golangci-lint run --fix=false ./coderd/x/chatd/...: clean; pre-commit hook: passed

Stack

This stack retires chatd compatibility paths for chat data that older Coder versions stored.

  1. test(coderd): stamp chat message fixtures with the current content version #30996 stamp chat message fixtures with the current content version
  2. test(coderd/x/chatd/chatprompt): drop tests of the legacy content codec #30997 drop tests of the legacy content codec
  3. refactor(coderd)!: retire the V0 chat message content decoder #30998 retire the V0 chat message content decoder
  4. refactor(coderd/x/chatd): inline the model config provider identity #31000 inline the model config provider identity
  5. refactor(coderd/x/chatd)!: drop the provenance fallback for unstamped OpenAI reasoning #31001 drop the provenance fallback for unstamped OpenAI reasoning
  6. refactor(coderd/x/chatd)!: drop the context-limit fallback for old compaction summaries #31002 drop the context-limit fallback for old compaction summaries (this PR)
  7. refactor(coderd/x/chatd)!: retire the close_agent tool alias #31003 retire the close_agent tool alias

Xum, an AI agent, opened this PR for @ibetitsmike and wrote this description.

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum, an AI agent, posted this comment for @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T19:01:02.891749Z e5217d1 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: e5217d1399

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

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.

Xum, an AI agent, closed this PR for @ibetitsmike.

@github-actions github-actions Bot locked and limited conversation to collaborators Oct 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release/breaking This label is applied to PRs to detect breaking changes as part of the release process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant