Repository navigation
fix(agent): give to_model_output and next_turn_params parsed input, and map unsent results - #42
Merged
alexb-openrouter merged 2 commits intoNov 30, 2026
Conversation
…nd map unsent results
Contributor
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
alexb-openrouter
requested review from
LukasParke and
mattapperson
and removed request for
mattapperson
November 30, 2026 16:59
alexb-openrouter
marked this pull request as ready for review
November 30, 2026 17:00
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.
Summary
Python port of upstream
typescript-agent#155, plus the same fix fornext_turn_params.executegetsvalidate_schema(input_schema, call.arguments), butto_model_output(input) andnext_turn_paramscallbacks got the rawcall.arguments. A mapper or callback that relies on schema defaults or coercions ({"count": "3"}→{"count": 3, "mode": "safe"}) saw different values thanexecute. Both now getparsed_tool_input(tool, arguments): the same parse approval predicates already use (_parse_tool_arguments, Pydantic models dumped to dicts), falling back to the raw arguments if validation fails._execute_calls_to_unsent_results(calls auto-executed before an approval pause) stored the raw tool result, andunsent_results_to_api_formatserialized it on resume withoutto_model_output. The model then got the full raw result, including fields the mapper drops. Results are now mapped before they are stored:_tool_result_to_outputnow uses the same_model_output_valuehelper, so the main loop, the approved-call resume and the unsent path all map results the same way.Overlap with #41
#41 (draft) changes which calls are added to
executed_callsinmodel_result.py. This PR doesn't touch that list. It only changes the argumentsexecute_next_turn_params_functionspasses to each callback, so the two PRs should merge cleanly in either order.Tests
tests/unit/test_to_model_output_parity.pyadds 3 tests. All 3 fail onmainand pass with this change. The full unit suite passes (162), andruffandmypyare clean.