fix: stop sending every tool strict; surface provider error reasons (0.1.0-RC.5) #13

Merged
KofTwentyTwo merged 1 commits from feature/strict-tools-grammar-fix into develop 2026-10-13 18:29:57 +00:00
1 Commits
Author SHA1 Message Date
james.maesandClaude Opus 5.5 38bb123140 fix: stop sending every tool strict; surface provider error reasons
Every kof22 turn failed on its first model call with Anthropic 400
invalid_request_error "The compiled grammar is too large ... reduce the
number of strict tools". All ten read tools were strict, and the API
compiles every strict schema of a request into one grammar.

- Tools are not strict by default; hosts opt in with strictToolNames.
  The kernel validates every tool input (INVALID_INPUT) anyway.
- If a provider still refuses strict schemas, the turn retries once
  without strict tools and logs a warning.
- Provider errors carry the API error type, a sanitized message and the
  request id: logged at WARN on 4xx, request id kept on the usage row,
  the reason shown to assistant.admin holders and in Test connection.
- TurnEngine also catches Errors, so a turn never ends silently.
- AnthropicRequestContractTest checks the exact request against the
  Messages API constraints and a conservative strict-tool budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 13:25:28 -05:00