Repository navigation
Decode run_python code and send_files from tool arguments - #269
Merged
Merged
Conversation
The argument decoder filled ToolStep field by field and had no entries
for code and send_files, so every native run_python call reached the
sandbox with an empty script ("run_python_code_empty" in production).
Map both fields, pass send_files arrays through like file_ids, and add
a test that every tool schema argument survives JSON decoding.
The model also omitted send_files in production, so the argument
description now says that only listed files reach the user.
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.
Problem
After #268 was deployed, a runtime virtual dialog asked for a bar chart. Gemma called
run_pythonwith a full{"code": "..."}argument twice, and both calls failed withrun_python_code_empty. The argument decoder (populate_tool_args) copiesToolStepfields one by one and had no entries forcodeandsend_files, so both were dropped for every call form.The model also omitted
send_files, so even a working run would not have delivered the chart.Change
populate_tool_argsmapscodeandsend_files;populate_json_map_argspassessend_filesarrays through likefile_ids;normalize_and_validate_steptrimssend_filesand drops empty entries.codeis kept byte for byte.run_pythongetscodeas its positional argument.send_filesdescription now gives an example and says that only the listed files reach the user.every_tool_schema_arg_reaches_the_tool_step_from_json_argumentschecks every argument of every tool schema against the decoder, so a new argument cannot be dropped silently again.native_run_python_calls_keep_the_script_and_filescovers the production call shape.Verification
cargo fmt --all --checkcargo clippy --workspace --all-targets -- -D warningscargo test -p openplotva-dialog(106 passed),-p openplotva-llm(218),-p openplotva-app(1432),-p openplotva-prompts(9)After the deploy, a SAFE runtime virtual dialog will repeat the production chart request and the follow-up edit.
Deployment risk
Only the dialog tool decoder and one tool argument description change. The tool schema text change rebuilds the cached prompt prefix once. Rollback: revert this commit, or unset
SANDBOX_URLto remove the tool.