Skip to content

fix(agenticopenai): upgrade OpenAI SDK to v3.56.0 - #991

Open
m11y wants to merge 2 commits into
cloudwego:mainfrom
m11y:fix/agenticopenai-sse-heartbeat
Open

fix(agenticopenai): upgrade OpenAI SDK to v3.56.0#991
m11y wants to merge 2 commits into
cloudwego:mainfrom
m11y:fix/agenticopenai-sse-heartbeat

Conversation

@m11y

@m11y m11y commented Sep 8, 2026

Copy link
Copy Markdown

What type of PR is this?

fix

Check the PR title.

  • This PR title matches <type>(optional scope): <description>.
  • The description is user-oriented and clear.
  • Compatibility requirements are documented below.

More detailed description

Upgrade agenticopenai from openai-go/v3 v3.35.0 to the latest release, v3.56.0, and adapt the converters to its API changes.

  • Wrap function-result CallID in param.Opt[string] while preserving its JSON wire value.
  • Handle the new MCP error union (protocol / HTTP / tool execution). Project code/message into Eino's error type, and preserve the original error JSON in block extras so multi-turn replay retains the error variant and arbitrary execution-error content. Preserve legacy string errors and unknown future variants; absent/null errors stay absent. Register the extra's concat/serialization type and cover both JSON-persisted and streaming-concatenated history.
  • Inherit the SDK's no-data SSE fix. The previous version stopped Responses streams with unexpected end of JSON input on comment-only keep-alive or retry blocks. Hermetic tests use the real HTTP client, SDK decoder and Responses converter, covering comments, retry directives, CRLF and 1000 repeated keep-alive blocks before/between valid response events.

Compatibility: this SDK/dependency upgrade raises the module's Go requirement from 1.22 to 1.25.0. The module's Eino dependency remains v0.9.5. Azure/gjson/x dependencies are updated by go mod tidy. No local fork or replace directive is used.

Validation (Go 1.25.14):

  • go test -race -gcflags="all=-l -N" ./... — PASS, including examples compilation.
  • go vet ./... — PASS.
  • golangci-lint run --new-from-rev=origin/main ./... — PASS.
  • go mod tidy -diff — clean.
  • Regression tests pin function-result CallID JSON and MCP protocol/HTTP/execution/unknown/legacy errors, including zero code, absent/null errors, JSON persistence and streaming concat before replay.
  • The heartbeat regression was verified to fail in all four cases against the original v3.35.0 SDK; all pass after upgrading.

Downstream verification with this adapter source and SDK v3.56.0 through a temporary modfile (Go 1.26.8, no committed local replace): runtime and provider tests passed; real DeepSeek Responses history replay, long reasoning transport and cache accounting passed:

history_first duration_ms=1376 first_content_ms=371 iterations=1 input=827 miss=187 cached=640 output=88 reasoning_blocks=2 truncated=false
history_replay duration_ms=580 first_content_ms=297 iterations=0 input=501 miss=117 cached=384 output=42 reasoning_blocks=1 truncated=false
replayed_messages=4 reasoning_blocks=2 function_calls=1 function_results=1
reasoning duration_ms=63283 first_content_ms=241 input=128 cached=0 output=8192 terminal=incomplete reason=max_output_tokens
cache_first input=4420 miss=68 cached=4352 output=2
cache_second input=4420 miss=68 cached=4352 output=2

The reasoning run reached the provider's output-budget terminal event without premature SDK EOF; this is transport validation, not a claim that the answer completed or that first-token latency was long. No credentials or model content are included.

m11y and others added 2 commits September 8, 2026 11:11
Co-Authored-By: GPT-6 <noreply@openai.com>
Co-Authored-By: GPT-6 <noreply@openai.com>
@m11y m11y changed the title fix(agenticopenai): tolerate SSE keep-alive blocks fix(agenticopenai): upgrade OpenAI SDK to v3.56.0 Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant