Skip to content

Gateway: reconcile streamed output to final payload#3

Open
brian-chenyang wants to merge 2 commits into
v2026.3.11-fix-by-kevin-20260609from
fix/brian-chen/openresponses-final-answer-reconciliation
Open

Gateway: reconcile streamed output to final payload#3
brian-chenyang wants to merge 2 commits into
v2026.3.11-fix-by-kevin-20260609from
fix/brian-chen/openresponses-final-answer-reconciliation

Conversation

@brian-chenyang

@brian-chenyang brian-chenyang commented Jul 22, 2026

Copy link
Copy Markdown

What Problem This Solves

OpenResponses currently streams assistant text from tool-call turns into response.output_text.delta. If the final answer is a plain paragraph, OpenMAI can persist and display tool narration such as “Let me check the skill” before the actual answer.

This change reconciles the stream with the authoritative final agent payload before terminal completion, so consumers receive a canonical replacement instead of persisting mixed tool narration.

Changes

  • emit response.output_text.replaced when streamed assistant text differs from the authoritative final payload
  • update pending terminal output before response.completed
  • cover tool-call narration followed by a plain-text final answer

Evidence

  • regression test failed before implementation because no replacement event was emitted
  • pnpm tsgo
  • pnpm build
  • pnpm exec vitest run src/gateway/openresponses-http.test.ts src/gateway/openresponses-parity.test.ts (21 passed)
  • targeted oxfmt and oxlint checks
  • git diff --check

无需QA测试

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