Repository navigation
Conversation
This was referenced Dec 4, 2026
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.
guyu233
force-pushed
the
pr/toolcall-contract-core
branch
from
December 4, 2026 08:01
23f152a to
47389a5
Compare
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.
What this adds
A single canonical model of the tool-call contract: declarations, tool choice, argument repair, native call identity and rendering move out of
internal/translateinto a newinternal/toolcallpackage, instead of every protocol re-implementing the same rules.internal/toolcallcarries request parsing, name/argument reduction, native call identity and rendering, with its own tests.internal/translatedelegatestools/tool_choice/parallel_tool_callsto it, so an orphanautodegrades to unspecified whilerequiredor a named choice fails instead of silently dropping the tool request.internal/translatekeeps its existing argument helpers for now; the delivery path still uses them until the follow-up PR switches the call sites over. Nothing is removed here, which keeps this PR additive and easy to review.Why it is split out
The two PRs that follow (provider tool profiles, dispatch/terminal accounting) both need the same tool-call model. Landing it alone keeps the review small and the tests focused.
Stack
PR 1 of a 3-part backend stack. It applies cleanly to current
main; the next PR is based on this branch, so please merge in order. The console PR in this set is independent.Verification
go build ./...go vet ./...go test ./...python3 scripts/release-notes.py validateNo console source or
internal/webui/staticchanges, so the frontend CI job and the static consistency check stay green.