Skip to content

fix(agent): run next_turn_params only for calls whose tool body succeeded - #41

Merged
alexb-openrouter merged 2 commits into
mainfrom
devin/1796053022-next-turn-params-succeeded-calls
Nov 30, 2026
Merged

alexb-openrouter merged 2 commits into
mainfrom
devin/1796053022-next-turn-params-succeeded-calls

Conversation

@alexb-openrouter

@alexb-openrouter alexb-openrouter commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Ports the TypeScript SDK fix that limits nextTurnParams to calls whose tool body actually ran and succeeded.

In the tool loop, hook-blocked and invalid-JSON calls were already skipped, but a call that failed input_schema validation or whose execute raised still reached executed_calls. Its next_turn_params callbacks then ran with the rejected arguments and could change the next request (instructions, model, input, ...).

  outputs.append(output)
- executed_calls.append(effective_call)
+ if result.get("error") is None:
+     executed_calls.append(effective_call)

tests/unit/test_next_turn_params_executed_calls.py covers success (applied) and hook-blocked, schema-rejected, raised, and invalid-JSON calls (not applied). The schema-rejected and raised cases fail on main.

…eded

A call whose arguments failed input_schema validation, or whose execute
raised, still ran its next_turn_params callbacks and could change the
next request. Only add a call to executed_calls when its result has no
error, matching hook-blocked and invalid-JSON calls, which were already
skipped.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

devin-ai-integration Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

@alexb-openrouter
alexb-openrouter merged commit 5c1ea4f into main Nov 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant