Repository navigation
refactor(coderd/x/chatd)!: drop the provenance fallback for unstamped OpenAI reasoning - #31001
ibetitsmike wants to merge 1 commit into
Conversation
|
@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. Swish! 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). Every released version still writes OpenAI reasoning without the provenance stamp, because #30298 is in no release yet. Retiring the fallback now would stop existing chats from replaying their earlier reasoning. It can be retired after a release that includes #30298. The rest of the deprecation stack continues as stack #31006: #30996, #30997, #30998, #31000 and #31005. #31005 carries the
|
This PR breaks compatibility with old chat histories. It affects OpenAI reasoning parts that carry provider state (a reasoning item ID or encrypted content) but no provenance stamp. That is every such part written before #30298, which no release includes yet, so chats from released versions have them. The sanitizer used to borrow the row's model config as their provenance and replay them on that provider and model. Now OpenAI reasoning state counts as foreign unless its stamp matches the turn. The PR deletes
unstampedReasoningProvenance, its two callers, and the shortcut that skipped native rows without parsing them. 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: on the next turn, turn preparation removes those parts from the prompt. The stored messages do not change, and the UI still shows them. An assistant row that held only such a part leaves the prompt. The model no longer sees that earlier reasoning, which is what already happens after a provider switch. Nothing fails, and no error appears. Plain reasoning text without provider state is still replayed. The encrypted-reasoning rejection fallback and the per-source epochs do not change.
Why it is safe
buildCommitStepMessages), and interrupted partial messages carry reasoning text without provider metadata. Reasoning now ignores its row's origin, so the origin map stores only the provider identity../coderd/x/chatd/withgo test -overlay. The tests catch all 11 mutants: a stamp comparison that ignores model, credential or epoch; plain reasoning treated as state; unstamped state kept; a constant target credential; an epoch that is not restored or not bumped after a rejection; and a lost origin identity.git grep unstampedReasoningProvenancefinds nothing.Review focus
Every assistant row in the history head is now parsed on each turn, because an unstamped part can appear in any row.
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