fix(anthropic): update prefill regex for Claude 4.7+ and guard trailing tool_use (#7217) - #7246
fix(anthropic): update prefill regex for Claude 4.7+ and guard trailing tool_use (#7217)#7246rrfunde wants to merge 2 commits into
Conversation
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ae915784b
ℹ️ 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".
| for i, group in enumerate(groups): | ||
| # Trailing tool calls in the last group without outputs are unresolved/pending | ||
| if i == len(groups) - 1 and group.tool_calls and not group.tool_outputs: | ||
| continue |
There was a problem hiding this comment.
Scope dangling tool-call preservation to Anthropic
When a context ends with an unresolved FunctionCall, this shared helper now preserves it for every provider, not only Anthropic. The OpenAI formatters in _provider_format/openai.py consume this helper and serialize the group as a final assistant tool_calls message without the required tool response, so retrying or falling back with an in-flight call can be rejected as invalid history. Preserve this group only when requested by the Anthropic formatter, or add provider-specific handling for the other consumers.
Useful? React with 👍 / 👎.
|
Addressed feedback: scoped unresolved tool call retention to Anthropic via |
Fixes #7217