fix(provider): keep compacted Anthropic tool histories user-led#31052
Open
codeg-dev wants to merge 1 commit into
Open
fix(provider): keep compacted Anthropic tool histories user-led#31052codeg-dev wants to merge 1 commit into
codeg-dev wants to merge 1 commit into
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This was referenced Jun 6, 2026
Strip unsupported Claude assistant prefill and prepend a synthetic user boundary when a compacted Anthropic history starts with a fully matched assistant tool-call exchange. Constraint: Anthropic rejects assistant-prefill and assistant-led tool histories for affected Claude 4.6-4.8 paths. Rejected: Rewrite session compaction | provider-bound normalization is narrower and leaves non-Anthropic histories unchanged. Confidence: medium Scope-risk: moderate Directive: Keep this provider-specific; do not apply synthetic boundaries to providers that support assistant-led histories. Tested: v1.16.2-codeg.20260606 custom artifact built and deployed; GPT-5.5 and tool-failure smoke passed on mtb/fob/ops/hq. Not-tested: Full upstream dev test suite for this focused branch.
b96e71d to
083778d
Compare
Author
|
Rebased onto latest |
This was referenced Jun 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #31048
Type of change
What does this PR do?
Normalizes Anthropic-bound message histories in two narrowly scoped cases:
This keeps Anthropic request histories user-led where required while leaving non-Anthropic providers unchanged. Assistant tool-call prefill is preserved when thinking mode still needs it.
Prepared with AI assistance.
How did you verify your code works?
git diff --check -- packages/opencode/src/provider/transform.tsopenai/gpt-5.5normal smoke and tool-failure recovery on all custom hosts; hq also verified the Windows desktop backend/,/agent, and/configreturned 200.Screenshots / recordings
Not a UI change.
Checklist