Skip to content

fix(multiagent): avoid false empty output on interleaved tool streams - #385

Merged
Ed1s0nZ merged 1 commit into
AIPentest:mainfrom
Sycun:codex/fix-eino-interleaved-tool-stream
Nov 8, 2026
Merged

Ed1s0nZ merged 1 commit into
AIPentest:mainfrom
Sycun:codex/fix-eino-interleaved-tool-stream

Conversation

@Sycun

@Sycun Sycun commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

When an OpenAI-compatible gateway emits text between parallel tool-call deltas, the pinned eino-ext converter can give different content-block types the same StreamingMeta.Index. ConcatAgenticMessages then fails, and ADK's retry inspection discards the concat error and treats the response as empty. Tool cards can appear before the run reports empty_model_output / model output rejected by ShouldRetry at attempt 1, even though the model produced tool calls.

Fixes #285. Related: #286 and cloudwego/eino-ext#975.

This implements the model-boundary workaround on current main, with stable ordered remapping and full ContentBlockType discrimination. Each source-index/type pair keeps one assigned index across continuation chunks; replacement indices cannot collide with later blocks. The wrapper preserves text, tool IDs/arguments, response metadata, and provider-owned input objects. Valid indices, including gaps and out-of-order arrivals, pass through unchanged. It wraps both OpenAI-compatible and native Claude agentic factories, including models built for failover. Generate and the empty-output retry policy remain unchanged.

Regression coverage replays four TaskCreate calls followed by exec through the real HTTP transport, SDK, converter and native ADK retry/tool loop. The unwrapped backend reproduces the rejection; the repaired path executes five stub calls exactly once, forwards their results to the next model turn, and completes without retries. Additional cases cover reasoning/text collisions, continuation grouping, later-index collisions, repeated streams, metadata, immutability and provider errors.

Validation:

  • go test ./internal/multiagent ./internal/openai ./internal/handler -count=1 -timeout=5m
  • Targeted go test -race ./internal/multiagent covering the new stream regressions, factories and retry policies
  • go vet ./internal/multiagent
  • go build ./...
  • git diff --check

All passed. Validation uses deterministic SSE replays and stub tools; no live provider session was exercised. The community screenshot alone does not establish that every occurrence of this error has the same cause.

@Ed1s0nZ
Ed1s0nZ merged commit b43bdb9 into AIPentest:main Nov 8, 2026
3 checks passed
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.

fix: agentic 流式路径在并行工具调用时因 provider 交错文本帧聚合失败,误报 empty_model_output

2 participants