Skip to content

feat(providers): canonical tool profiles and honest retry accounting - #655

Open
guyu233 wants to merge 2 commits into
caigee-cmd:mainfrom
guyu233:pr/provider-tool-profiles
Open

guyu233 wants to merge 2 commits into
caigee-cmd:mainfrom
guyu233:pr/provider-tool-profiles

Conversation

@guyu233

@guyu233 guyu233 commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

What this adds

Providers consume the canonical tool profiles from internal/toolcall instead of each adapter keeping its own list, and adapter-level retries are reported upward instead of being hidden.

  • Providers register a ToolProfile derived from the canonical package, so a model's declared tool capabilities and reasoning levels come from one catalog contract (§ toolprofile.go, voiding the per-adapter ToolProfile glue).
  • ChatOutcome / ResolvedChat / provider errors gain InternalRetries, so an attempt retried inside the adapter is visible in terminal accounting instead of looking like one clean dispatch.
  • retry_after.go / retry_count.go: honour upstream Retry-After, replay strictly transient failures in place with a hard cap, and report the count.
  • Terminal-frame tests for qoder / trae / workbuddy assert that a stream which ends without a terminal frame is a failure, not a success.

Stack

PR 2 of 3, based on #654 (pr/toolcall-contract-core). This branch already contains that commit, so merging in order needs no rebase. The console PR in this set is independent.

Verification

  • go build ./...
  • go vet ./...
  • go test ./...
  • python3 scripts/release-notes.py validate

Introduce internal/toolcall as the single model of tool declarations,
tool choice, argument repair, native call identity and rendering.

translate.ValidateChatRequest now delegates tool_choice validation to
toolcall.ParseRequest, which keeps an orphan `auto` degrading to
unspecified while a `required` or named choice fails instead of being
silently dropped.

translate's own tool-argument helpers stay in place until the delivery
path switches to the new package in a follow-up change.
Adapters now derive their tool payload from the canonical toolcall
profile instead of each package reshaping tools on its own, so declared
tools, tool_choice and parallel_tool_calls reach the upstream request
body unchanged.

Adapters also replay a transient failure in place and report the internal
retry count upward, keep the upstream Retry-After hint, and fail a
stream that ends without a terminal frame instead of relaying it as
success.
@guyu233
guyu233 force-pushed the pr/provider-tool-profiles branch from 891098d to ee93142 Compare December 4, 2026 08:01
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