Repository navigation
Python: fix(tools): persist parsed shell results - #9715
Danny Ward (dannyward630) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The narrow conversion addresses the reported serialization failure, and the regression test covers output and metadata preservation with no unresolved findings.
No open issues 🎉
What changed in this PR
Fixes #9696 by normalizing parsed shell output to a plain string so FileSessionStore can persist it without losing structured metadata.
Changes:
- Converts only model-facing text to
str, leaving shell metadata unchanged. - Adds a session-store round-trip regression test covering output, exit code, truncation, and timeout metadata.
| File | Description |
|---|---|
python/packages/tools/tests/test_shell_result.py |
Verifies parsed shell output and metadata survive session persistence. |
python/packages/tools/agent_framework_tools/shell/_types.py |
Normalizes parsed text to a serializable plain string. |
Review effort: Balanced
|
Danny Ward (@dannyward630) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Motivation & Context
LocalShellToolattaches a_ShellResultTextsubclass to text content.FileSessionStorerejects that subclass during session serialization, so a tool-using checkpoint fails after the command has already run.Description & Review Guide
_parse_shell_resultnow storesstr(result)in text content and keeps structured shell fields inadditional_properties. The regression test saves and reloads the parsed function result throughFileSessionStore.Related Issue
Fixes #9696
AI Assistance
AI assistance details:
Codex (GPT-6, high reasoning effort) assisted with investigation, implementation, the regression test, and this PR description. The change was verified by running the tools package unit suite (160 passed, 9 skipped, 3 expected failures) and Ruff checks.
Contribution Checklist