Python: Isolate Anthropic request parsing state - #8237
Python: Isolate Anthropic request parsing state#8237Eduard van Valkenburg (eavanvalkenburg) wants to merge 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The modified non-streaming concurrency path lacks the regression coverage required by the function-loop specification.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Introduces per-request Anthropic parsing state to prevent concurrent responses from sharing tool metadata.
Changes:
- Moves tool-call and alias metadata into
_AnthropicRequestState. - Adds concurrent streaming regressions for failures and approvals.
File summaries
| File | Description |
|---|---|
_chat_client.py |
Threads request-local state through preparation and response parsing. |
test_anthropic_client.py |
Updates parsing tests and adds concurrency regressions. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: No findings
Scope: full PR (1 commit(s)): 905a605d25f2
Model: gpt-5.6-sol-fast
Overview
The PR replaces reusable-client parsing fields with state allocated and threaded per Anthropic request for both streaming and non-streaming paths. The same state follows tool preparation, event parsing, recursive MCP parsing, stream finalization, and approval generation, while deterministic concurrency tests cover interleaved failure and colliding call IDs. No publishable Critical, High, or Medium defect remains after reconciling the changed lifecycle against its callers and tests.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Motivation & Context
Concurrent requests through a reusable Anthropic client should parse independently.
Description & Review Guide
Related Issue
None.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.