Back to Signal Feed
CodeTracked since May 21, 2026

Fix empty-ID OpenAI tool-call replays to prevent ghost calls

The PR fixes a replay-path correctness issue in Pi’s OpenAI-compatible provider layer by normalizing tool-call IDs during chat-completions/Responses replay: it merges argument-only streaming deltas into the active tool call, assigns deterministic non-empty IDs when ids are missing or pipe-prefixed, and drops orphan tool outputs without a matching emitted assistant tool call.

OpenAI-compatible providertool-call replaychat-completionsResponses

What Happened

  • The PR fixes a replay-path correctness issue in Pi’s OpenAI-compatible provider layer by normalizing tool-call IDs during chat-completions/Responses replay: it merges argument-only streaming deltas into the active tool call, assigns deterministic non-empty IDs when ids are missing or pipe-prefixed, and drops orphan tool outputs without a matching emitted assistant tool call.
  • The PR fixes a replay-path correctness issue in Pi’s OpenAI-compatible provider layer by normalizing tool-call IDs during chat-completions/Responses replay: it merges argument-only streaming deltas into the active tool call, assigns deterministic non-empty IDs when ids are missing or pipe-prefixed, and drops orphan tool outputs without a matching emitted assistant tool call.
  • 1 evidence item attached for review.

What is Different

Before

Scattered source updates, isolated context, and manual follow-up across multiple feeds.

Now

Implemented deterministic replay normalization for tool-call identifiers and call reconstruction, covering both chat-completions and Responses flows, and added regression tests for empty-id ghost calls and pipe-prefixed IDs.

Why Track This

Why It Matters

Operators of agent workflows using Pi with OpenAI-compatible APIs can avoid unexpected failures when replaying tool calls across turns, because empty or malformed replay IDs no longer produce requests that the API rejects. Concretely, the provider now rewrites missing or pipe-prefixed identifiers into stable non-empty IDs, merges orphaned argument-only deltas into the current call context, and filters unmatched orphan outputs before sending request payloads; this should reduce intermittent broken turns in function-calling systems. Watch for any rare fallback-ID collision or over-filtering case where a valid delayed output might be dropped and requires retry behavior from the caller.

Impact

Operators of agent workflows using Pi with OpenAI-compatible APIs can avoid unexpected failures when replaying tool calls across turns, because empty or malformed replay IDs no longer produce requests that the API rejects. Concretely, the provider now rewrites missing or pipe-prefixed identifiers into stable non-empty IDs, merges orphaned argument-only deltas into the current call context, and filters unmatched orphan outputs before sending request payloads; this should reduce intermittent broken turns in function-calling systems. Watch for any rare fallback-ID collision or over-filtering case where a valid delayed output might be dropped and requires retry behavior from the caller.

What To Watch Next

  • Watch whether OpenAI-compatible provider becomes a repeated pattern.
  • Track follow-up changes around Tool Calling.
  • Compare future signals against this evidence trail.
  • Re-check risk flags: fallback_id_collision_across_turns, over_eager_orphan_output_dropping.
Open Topic TimelineOpen Technical EventOpen Original Sourcefallback_id_collision_across_turns / over_eager_orphan_output_dropping / provider_specific_id_format_drift

Supporting Evidence