Skip to content

fix(agenticopenai): fall back to EasyInput for synthetic assistant text without item id/status - #998

Open
hxxxi-malog wants to merge 1 commit into
cloudwego:mainfrom
hxxxi-malog:fix/agenticopenai-synthetic-text-easyinput
Open

hxxxi-malog wants to merge 1 commit into
cloudwego:mainfrom
hxxxi-malog:fix/agenticopenai-synthetic-text-easyinput

Conversation

@hxxxi-malog

Copy link
Copy Markdown

What

assistantGenTextToInputItem now falls back to the plain EasyInput form ({"role":"assistant","content":"..."}) when the block carries neither an openai-item-id nor an openai-item-status extra, instead of always emitting an output message with empty id/status fields.

Why

Synthetic assistant messages (e.g. injected few-shot examples) carry no Responses API item metadata, so the current encoding sends "id":"" and status:"". Some OpenAI-compatible providers (e.g. BytePlus Ark) reject that with HTTP 400 InvalidParameter: ... unknown status: ., as reported in the issue. The reporter also verified that the same request succeeds once the item is sent in EasyInput form.

Explicit operation_id from endpoint metadata and messages converted back from real Responses API output (which always carry item id/status extras) keep the existing output-message encoding.

Fixes #977

How I tested

  • New cases in TestAssistantGenTextToInputItem:
    • synthetic text without item id/status -> encoded as an EasyInput assistant message (no output message);
    • item id only (no status) -> still an output message, preserving current behavior for partial metadata.
  • Ran go test ./... for components/model/agenticopenai:
    • targeted tests pass on Go 1.26.8 and Go 1.25.6 (the CI version);
    • note: on my Windows host, 33 mockey-based tests crash identically on pristine main and on this branch (a pre-existing local environment issue - CI runs them on Linux); all remaining tests pass.

@CLAassistant

CLAassistant commented Sep 12, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

bug(agenticopenai): synthetic assistant text is encoded as output message with empty id/status

2 participants