GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — AI Assistant: OpenAI streaming tool calls split into two entries (function_call_arguments.delta correlated on the wrong field) · Issue #10348 · pgadmin-org/pgadmin4

AI Assistant: OpenAI streaming tool calls split into two entries (function_call_arguments.delta correlated on the wrong field) #10348

New issue
Copy link
New issue
Copy link
Closed
Closed
AI Assistant: OpenAI streaming tool calls split into two entries (function_call_arguments.delta correlated on the wrong field)#10348
Copy link
Labels
Bug

Description

@dpage
dpage
opened on Aug 26, 2026
Issue body actions

Describe the bug

In web/pgadmin/llm/providers/openai.py, chat_stream() accumulates streamed function-call arguments in a tool_calls_data dict keyed by call_id:

elif event_type == 'response.output_item.added':
    item = data.get('item', {})
    if item.get('type') == 'function_call':
        call_id = item.get('call_id', '')
        tool_calls_data[call_id] = {'name': item.get('name', ''), 'arguments': ''}

elif event_type == 'response.function_call_arguments.delta':
    call_id = data.get('call_id', '')
    if call_id not in tool_calls_data:
        tool_calls_data[call_id] = {'name': '', 'arguments': ''}
    tool_calls_data[call_id]['arguments'] += data.get('delta', '')

But per OpenAI's Responses API streaming event reference, response.function_call_arguments.delta events carry item_id, output_index, delta and sequence_number — there is no call_id field on that event type (source). So data.get('call_id', '') always evaluates to ''.

That means every response.function_call_arguments.delta event fails the call_id not in tool_calls_data check (since the real call_id entry was already created by response.output_item.added), creates a second dict entry keyed by the empty string, and accumulates all the argument deltas there instead. The result: a tool call comes back as two separate ToolCall entries — one with the correct name and empty arguments, and another with empty name and the actual (accumulated) arguments — rather than one complete tool call.

To Reproduce

  1. Configure the AI Assistant / SQL Chat feature with an OpenAI provider and a model exposed via the Responses API (/v1/responses).
  2. Ask a question that triggers a streamed tool/function call.
  3. Inspect the resulting tool calls: the name and arguments arrive in two separate entries instead of one.

Expected behavior

The delta events should be correlated using item_id (matching item.id from the response.output_item.added event, not item.call_id) so all argument deltas accumulate against the same entry that was seeded with the function name, and the final ToolCall is emitted with both name and arguments populated correctly.

Found while re-verifying #9795 (which is otherwise correctly fixed for the "unsupported model" fallback to /v1/responses) — this is a separate, follow-up defect in that same streaming path.

Activity

  1. dpage
    added
    Bug
    on Aug 26, 2026
  2. dpage
    added 2 commits that reference this issue on Sep 23, 2026

    Fix OpenAI streaming tool calls being split across two entries

    This issue will close once commit 8c0b925 is merged into the 'master' branch.
    8c0b925

    Fix OpenAI streaming tool calls being split across two entries

    This issue will close once commit 56e6b5f is merged into the 'master' branch.
    56e6b5f
  3. dpage
    added 3 commits that reference this issue on Oct 12, 2026

    Fix OpenAI streaming tool calls being split across two entries

    This issue will close once commit b556f0e is merged into the 'master' branch.
    b556f0e

    Fix OpenAI streaming tool calls being split across two entries

    This issue will close once commit 61318ef is merged into the 'master' branch.
    61318ef

    Fix OpenAI streaming tool calls being split into two entries. #10348 (#…

    This issue will close once commit 3a6f86a is merged into the 'master' branch.
    3a6f86a
  4. dpage commented on Oct 12, 2026

    @dpage
    dpage
    on Oct 12, 2026
    ContributorAuthor
    More actions

    Fixed by #10352 (3a6f86a).

  5. dpage
    closed this as completedon Oct 12, 2026
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

    Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.