Repository navigation
Python: Fix stale Foundry Toolbox call IDs - #9059
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits intoOct 6, 2026
Merged
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
Conversation
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
October 5, 2026 14:29 — with
GitHub Actions
Inactive
Copilot started reviewing on behalf of
Eduard van Valkenburg (eavanvalkenburg)
October 5, 2026 14:29
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
October 5, 2026 14:30 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Skill resource reads can silently omit headers required by a caller-provided dynamic header provider.
Review effort: Balanced
Findings: 1
What changed in this PR
Fixes stale Foundry Toolbox call IDs by rebinding MCP sessions and skill resources to the current request identity.
Changes:
- Moves platform-header propagation to MCP operation boundaries.
- Serializes identity transitions and isolates skill caches by identity.
- Adds concurrency regressions and updates sample guidance.
| File | Description |
|---|---|
python/packages/foundry_hosting/agent_framework_foundry_hosting/_toolbox.py |
Implements identity-aware sessions and resources. |
python/packages/foundry_hosting/tests/test_toolbox.py |
Adds header, concurrency, and cache tests. |
python/packages/foundry_hosting/README.md |
Documents long-lived Toolbox behavior. |
python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox/README.md |
Updates lifecycle guidance. |
python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox/main.py |
Revises factory documentation. |
python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/README.md |
Documents identity-scoped skill operations. |
python/samples/04-hosting/foundry-hosted-agents/responses/foundry_toolbox_mcp_skills/main.py |
Revises lifecycle documentation. |
python/samples/04-hosting/foundry-hosted-agents/responses/files/README.md |
Updates Toolbox lifecycle explanation. |
python/samples/04-hosting/foundry-hosted-agents/responses/files/main.py |
Clarifies resource ownership. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Eduard van Valkenburg (eavanvalkenburg)
force-pushed
the
fix-toolbox-call-id
branch
from
October 5, 2026 14:38
09286aa to
c6bca24
Compare
Eduard van Valkenburg (eavanvalkenburg)
temporarily deployed
to
github-app-auth
October 5, 2026 14:38 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
enabled auto-merge
October 5, 2026 17:04
Jose Alvarez (jpalvarezl)
approved these changes
Oct 6, 2026
Jose Alvarez (jpalvarezl)
left a comment
Member
There was a problem hiding this comment.
Reviewed the full diff, linked issue, CI, and existing resolved thread. The session rebinding, operation serialization, runtime-only header rejection for skill/resource reads, and identity-scoped skill caching address the stale call-ID scenarios with focused regression coverage.
Eduard van Valkenburg (eavanvalkenburg)
deleted the
fix-toolbox-call-id
branch
October 6, 2026 08:24
This branch was previously deployed
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.

Motivation & Context
FoundryToolboxresolved platform headers from the MCP writer's connection-time task context, so a long-lived Toolbox could forward the first request'sx-agent-foundry-call-idfor later callers. This change binds Toolbox MCP sessions and skill-resource operations to the current request identity instead.Description & Review Guide
httpx.Authto the MCP dynamic-header boundary, reconnect the MCP session when effective request identity changes, scope skill-resource reads through the same operation lock, and isolate cached skill objects to one header identity at a time. Focused loopback regressions cover contextless initialization, concurrent callers, custom header providers, and tool/skill/resource calls.Related Issue
Fixes #7690
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after a language prefix) — a workflow keeps the label and title prefix in sync automatically.