Skip to content

fix(ai): retry tool calls after argument validation failure - #389

Merged
EyJunge1 merged 1 commit into
tickernelz:mainfrom
EyJunge1:fix/388-tool-validation-retry
Oct 6, 2026
Merged

EyJunge1 merged 1 commit into
tickernelz:mainfrom
EyJunge1:fix/388-tool-validation-retry

Conversation

@EyJunge1

@EyJunge1 EyJunge1 commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • On tool-argument validation failure in OpenAIChatCompletionProvider.executeToolCall, break into the existing retry loop instead of returning immediately
  • Lets the model correct invalid tool JSON (e.g. workflows: "none") within maxIterations instead of aborting the whole user-profile-learning idle cycle
  • Adds a regression test covering invalid → valid sequential responses

Fixes #388

Test plan

  • bun test tests/openai-chat-completion-provider.test.ts
  • bun run typecheck
  • Smoke: trigger profile learning with a model that occasionally returns non-array workflows and confirm a second iteration recovers

Checklist

  • Branch is based on main (do not open PRs from commits already on main)
  • bun test passes (or N/A)
  • bun run typecheck passes (or N/A)
  • bun run check passes (format + lint + typecheck; or N/A)
  • Docs / README updated when behavior or contribution process changes (N/A)

Validation errors in executeToolCall returned immediately and skipped the
built-in retry loop, aborting user-profile-learning for the idle cycle.
Break out of the tool-call loop instead so the model can fix invalid JSON
within maxIterations.

Fixes tickernelz#388
@EyJunge1
EyJunge1 merged commit 1832bff into tickernelz:main Oct 6, 2026
7 checks passed
@EyJunge1 EyJunge1 mentioned this pull request Oct 6, 2026
2 of 8 tasks
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.

executeToolCall returns immediately on tool-response validation failure instead of using the built-in retry loop

1 participant