fix(provider): keep compacted Anthropic tool histories user-led - #31052
fix(provider): keep compacted Anthropic tool histories user-led#31052codeg-dev wants to merge 2 commits into
Conversation
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
b96e71d to
083778d
Compare
|
Rebased onto latest |
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.
083778d to
aada8db
Compare
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
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