Skip to content

fix(openai): keep the complete chat input and cached and reasoning token counts - #662

Merged
nik13 merged 1 commit into
devfrom
fix/openai-chat-input-usage-on-dev
Nov 10, 2026
Merged

nik13 merged 1 commit into
devfrom
fix/openai-chat-input-usage-on-dev

Conversation

@nik13

@nik13 nik13 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

What was broken

  • Chat traces flattened multi-turn conversations: the exported input lost roles, tool calls and multimodal parts, and a conversation with only image parts had no input value at all.
  • Cached input token and reasoning token counts were missing from regular and streamed chat spans.

What changed

  • Chat Completions spans record the complete conversation (every message with its role, tool calls and content parts) as the input messages, unless input hiding is on.
  • input.value joins the text of every message. A conversation with only non-text parts is exported as [non-text content], and input.mime_type describes the value actually exported.
  • Cached input tokens and reasoning tokens are recorded, including zero values, for regular and streamed, sync and async chat completions. SDK responses and stream behavior are unchanged.

Verification

Paired run against dev on a clean, offline sandbox:

  • All 48 new regression tests fail on dev and pass with this change.
  • Package suite: dev 1,753 passed, 33 skipped; this branch 1,821 passed, 33 skipped; no failures on either.
  • Matching core tests: 13 passed on both, including the three existing input-format tests, unchanged.

Compatibility

No dependency, version or Python range change. Only python/frameworks/openai changes.

…ken counts

- Chat Completions spans record the complete conversation (every
  message with its role, tool calls and content parts) as the input
  messages, unless input hiding is on.
- input.value joins the text of every message, a conversation with only
  non-text parts is exported as "[non-text content]" instead of being
  dropped, and the MIME type describes the exported value.
- Cached input tokens and reasoning tokens are recorded, including zero
  values, for regular and streamed, sync and async chat completions.
@nik13
nik13 merged commit 20bf9a6 into dev Nov 10, 2026
57 checks passed
@nik13
nik13 deleted the fix/openai-chat-input-usage-on-dev branch November 10, 2026 13:07
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