Skip to content

[codex] Add core tool call contract validation#28

Draft
gold-silver-copper wants to merge 3 commits into
mainfrom
codex/core-tool-contract-pr1
Draft

[codex] Add core tool call contract validation#28
gold-silver-copper wants to merge 3 commits into
mainfrom
codex/core-tool-contract-pr1

Conversation

@gold-silver-copper

Copy link
Copy Markdown
Owner

Summary

Adds the PR1 core validation layer for Rig tool calls without changing provider request serializers.

  • Adds a request-side ToolCallContract, provider capability profile, and validation errors for invalid or unknown tool calls.
  • Validates completion requests before dispatch so unsupported tool_choice settings and impossible forced-tool policies fail before provider calls.
  • Validates provider-emitted tool calls before prompt hooks or local tool execution, including streaming deltas.
  • Prevalidates all local tool calls before starting non-streaming buffered tool execution so a valid side-effecting tool cannot run before an unknown tool error.
  • Adds focused tests around undeclared tools, disallowed tools, provider-native function declarations, hosted provider tools, required-without-tools, non-streaming prevalidation, and streaming malformed tool-call deltas.

Why

PR 27 had grown provider-specific serialization fixes and core contract behavior into one large change. This PR isolates the core contract and execution-safety layer so provider serializer/capability alignment can be handled separately in PR2.

Validation

  • cargo fmt
  • cargo test -p rig-core --lib
  • cargo check -p rig-core
  • git diff --check

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