Skip to content

fix: accept OpenAI tool results without optional name - #2

Open
thorethy1 wants to merge 1 commit into
Eunho-J:mainfrom
thorethy1:fix/optional-tool-result-name
Open

fix: accept OpenAI tool results without optional name#2
thorethy1 wants to merge 1 commit into
Eunho-J:mainfrom
thorethy1:fix/optional-tool-result-name

Conversation

@thorethy1

Copy link
Copy Markdown

Problem

OpenAI-compatible clients may send a tool-result message with role: "tool", tool_call_id, and content but without name. name is optional in the OpenAI message schema, yet the Python and Rust Message validators required it and rejected an otherwise valid tool-result follow-up.

Fix

  • Require tool_call_id for tool messages, but allow name to remain omitted in Python.
  • Apply the same validation semantics to Rust; TypeScript already had the desired behavior.
  • Keep rejecting tool messages that omit tool_call_id.
  • Add regression coverage at the message, provider-conversion, and real /v1/chat/completions HTTP boundaries.

Validation

  • Python: 516 passed; MyPy reports no issues in 10 source files.
  • TypeScript: build succeeds; 261 passed.
  • Rust: cargo fmt --check; 254 passed.
  • Ruff: the branch and upstream/main both report the same 22 pre-existing findings; this change introduces 0 new findings.
  • git diff --check passes.

Checklist

  • The diff is limited to tool-message validation and focused regression tests.
  • tool_call_id remains mandatory.
  • Optional name behavior is consistent across Python, TypeScript, and Rust.
  • A complete assistant tool-call → tool-result HTTP roundtrip without name is covered.
  • Python, TypeScript, and Rust test suites pass.
  • Formatting, typing, whitespace, and added-line secret/debug scans pass.
  • No generated build artifacts, credentials, or unrelated changes are included.

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