Repository navigation
Python: Clear stale Foundry toolbox request context - #8717
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused fix correctly handles request reuse and is covered in both authentication flows.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents stale Foundry caller context when toolbox requests are reused.
Changes:
- Clears existing call-ID headers before applying current context.
- Adds sync and async regression tests.
| File | Description |
|---|---|
_toolbox.py |
Clears stale call-ID headers. |
test_toolbox.py |
Tests reused requests without context. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Python Python / code-coverage/pythonThe overall line coverage in commit 15cde98 in the Show a line coverage summary of the most covered files.
|
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: No findings
Scope: full PR (1 commit(s)): 15cde98ed1f4
Model: gpt-5.6-sol-fast
Overview
The change clears the managed Foundry call-ID header before reapplying headers from the current request context, keeping reused requests aligned with the active caller. The shared helper covers both synchronous and asynchronous authentication flows, and sequential-request regression tests verify stale-to-absent transitions in both paths. The dependency floor publicly exports the new constant, and no publishable correctness, compatibility, architectural, or security concern remains.
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.
Motivation & Context
Foundry toolbox authentication reads platform caller context for each outbound request. When an
httpx.Requestinstance is retried or reused after carrying a platform call ID, a later request without a current call ID must not retain the earlier header.This change keeps outbound toolbox caller context aligned with the current hosting request.
Description & Review Guide
Related Issue
No public issue. This hardening change is intentionally submitted without a GitHub issue.
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.