Repository navigation
Python: fix LocalShellTool on self-hosted Foundry agents - #8858
Closed
alkaiserItron wants to merge 2 commits into
Closed
alkaiserItron wants to merge 2 commits into
alkaiserItron wants to merge 2 commits into
Conversation
Foundry omits the shell_call local-environment marker, so a registered local shell executor was misclassified as hosted and never ran (400 'No tool output found for shell call'). Override shell-call classification in Foundry to treat a missing environment as local. Fixes #8663
alkaiserItron
temporarily deployed
to
github-app-auth
September 29, 2026 18:22 — with
GitHub Actions
Inactive
alkaiserItron
had a problem deploying
to
github-app-auth
September 29, 2026 18:22 — with
GitHub Actions
Error
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Unmarked hosted calls may cross the local execution boundary, requiring a fix and validation against real Foundry responses.
Review effort: Balanced
Findings: 1
What changed in this PR
This PR aims to restore local shell execution for self-hosted Foundry agents whose responses omit the local environment marker.
Changes:
- Extracts OpenAI’s shell-call classification into an overridable hook and lets Foundry treat unmarked calls as local.
- Adds Foundry tests for unmarked calls, explicitly hosted calls, streaming, and output replay.
| File | Description |
|---|---|
python/packages/openai/agent_framework_openai/_chat_client.py |
Adds the classification hook without changing the OpenAI default. |
python/packages/foundry/tests/foundry/test_foundry_chat_client.py |
Tests Foundry shell-call routing and replay. |
python/packages/foundry/agent_framework_foundry/_chat_client.py |
Routes unmarked shell calls to a registered local executor. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
…utput so they stay hosted instead of being re-run by a registered local executor. Preserves the #8663 fix (env-less calls with no output still execute locally) while preventing duplicate outputs / unapproved local execution. Adds Foundry mixed call/output regression tests.
alkaiserItron
temporarily deployed
to
github-app-auth
September 29, 2026 19:53 — with
GitHub Actions
Inactive
alkaiserItron
temporarily deployed
to
github-app-auth
September 29, 2026 20:23 — with
GitHub Actions
Inactive
Member
|
alkaiserItron Thanks for the contribution. This materially overlaps with the older open #8720 for the same issue, so I’m closing this PR and continuing the work there. |
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
Since agent-framework-openai 1.14.4 (PR #8294), a
shell_callis only routed to local execution when the response item carriesenvironment.type == "local". Self-hosted Foundry responses omit that marker, so a registeredLocalShellToolis misclassified as a hosted shell call, never executes, and the next turn fails with400 - No tool output found for shell call .... This restores local shell execution against a Foundry sandbox for self-hosted Foundry agents, while ensuring a shell call the provider already executed is never re-run locally.Description & Review Guide
What are the major changes?
RawOpenAIChatClientinto an overridable_shell_call_targets_local_executorhook (default behavior unchanged: onlyenvironment.type == "local"is local).RawFoundryChatClientto also treat a missing environment as local, since Foundry omits the marker. Explicit hosted container environments still stay informational.shell_callalready has a matchingshell_call_output(samecall_id) in the same response, it stays a hostedshell_tool_calland is never routed to the local executor. This prevents unapproved local re-execution and duplicate outputs for onecall_idon stateless replay. Applied on the non-streaming path (the full item list isn't available mid-stream, and a delegated call never streams its own output).What is the impact of these changes?
What do you want reviewers to focus on?
Related Issue
Fixes #8663
Contribution Checklist