Repository navigation
Conversation
M-Hietala
marked this pull request as ready for review
October 28, 2026 16:39
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Service-side continuation and mixed-tool batches still discard synthetic shell-tool output, which can cause requests to fail with unresolved shell calls.
1 open issue
What changed in this PR
This PR addresses #9697 by pairing empty local shell calls with synthetic empty outputs, preventing orphaned calls in stateless conversation history without executing commands or requesting approval.
Changes:
- Generate empty results for valid empty calls targeting a configured local executor.
- Support replay of synthetic results while preserving
max_output_length. - Add 17 regression cases and document the no-op behavior; shell checkpoint persistence remains out of scope.
| File | Description |
|---|---|
python/packages/openai/tests/openai/test_openai_chat_client.py |
Adds parser, streaming, replay, and unaffected-case regression coverage. |
python/packages/openai/agent_framework_openai/_chat_client.py |
Creates synthetic empty shell results and supports their replay. |
docs/specs/004-python-function-calling-loop.md |
Defines empty local shell semantics and maps regression tests. |
Review effort: Balanced
Comment on lines
+2608
to
+2612
| Content.from_shell_tool_result( | ||
| call_id=shell_call_id, | ||
| outputs=[], | ||
| max_output_length=shell_max_output, | ||
| ) |
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Oct 28, 2026
This branch was successfully 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
Empty local shell calls (
commands=[]) currently leave a shell call without a matching output in conversation history. Stateless continuation can then fail with HTTP 400: “No tool output found for shell call.”This change treats an empty command list as a no-op and returns a matching empty output without executing a shell command.
A live Azure OpenAI check using a gpt-6.1-sol deployment confirmed that replaying the empty shell call without an output returns HTTP 400 (“No tool output found for shell call”). The same request with the matching shell_call_output containing output=[] completed successfully. No shell commands were executed.
Description & Review Guide
What are the major changes?
Pair empty shell calls for a configured local executor with
shell_call_outputcontainingoutput=[]. Support replay of the synthetic result, preservemax_output_length, and document the behavior in the function-loop specification. Add 17 regression cases covering both parsers, streaming finalization, replay, and unaffected cases.What is the impact of these changes?
Empty local shell calls no longer leave orphaned calls in stateless history. Hosted, unconfigured, and malformed calls retain their existing handling. The separate shell checkpoint-persistence issue (Python: [Bug]: LocalShellTool result text cannot be persisted by FileSessionStore #9696) is outside this change.
The core and OpenAI unit-test suites passed. A live Azure OpenAI check using a
gpt-6.1-soldeployment reproduced the missing-output error without the result and completed successfully with the paired empty output.What do you want reviewers to focus on?
The no-op interpretation, call/result pairing, and preservation of the local-versus-hosted shell boundary. No local execution or approval is entered for the empty command list.
Related Issue
Fixes #9697
AI Assistance
AI assistance details: Copilot assisted with implementation, tests, documentation, focused validation, the live-test diagnostic, and this PR description.
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.