Skip to content

Regression: Tool Name Lost in Streaming Chat Completions After PR #6996 #7579

Closed

Description

@ivanmurashko

Error:

Invalid 'input[3].name': empty string. Expected a string with minimum length 1, but got an empty string instead.

Cause: PR #6996 introduced a regression in SSE streaming response parsing. When the Chat Completions API streams tool calls, the first delta contains the function name while subsequent deltas contain empty names at my case. The original code used get_or_insert_with() to preserve existing names, but the new code in codex-api/src/sse/chat.rs unconditionally overwrites with = Some(fname.to_string()), causing valid names to be replaced with empty strings.

Proposed Fix: Add !fname.is_empty() check before updating the tool name:

  if let Some(fname) = func.get("name").and_then(|n| n.as_str()) {
      if !fname.is_empty() {
          call_state.name = Some(fname.to_string());
      }
  }

Activity

  1. added
    bug
    tool-calls
    on Dec 4, 2025
  2. github-actions commented on Dec 4, 2025

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  3. scotty2 commented on Dec 5, 2025

    @scotty2

    Can confirm this bug has existed for me since 0.64.0

  4. etraut-openai commented on Dec 5, 2025

    @etraut-openai
    Contributor

    Thanks for the bug report.

    The fix is in prerelease version 0.66.0-alpha.5 and will be included in 0.66.0 once it's published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtool-calls

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions