Skip to content

[Follow-up] Preserve empty tool completion turns in OpenAI prompt normalization#139

Merged
CJackHwang merged 1 commit intodevfrom
codex/fix-issues-from-codex-review
Mar 21, 2026
Merged

[Follow-up] Preserve empty tool completion turns in OpenAI prompt normalization#139
CJackHwang merged 1 commit intodevfrom
codex/fix-issues-from-codex-review

Conversation

@CJackHwang
Copy link
Owner

Motivation

  • A recent normalization change dropped tool/function messages when their normalized content was empty, which removes the signal that a tool call completed and can trigger repeated tool calls or missing final answers.

Description

  • Restore preservation of tool/function turns in normalizeOpenAIMessagesForPrompt by emitting a "null" placeholder when normalizeOpenAIContentForPrompt returns an empty string for those roles instead of skipping the message.
  • Keep tool/function messages mapped to the user role as before so tool results remain part of the prompt stream.
  • Add a regression unit test TestNormalizeOpenAIMessagesForPrompt_EmptyToolContentPreservedAsNull in internal/adapter/openai/message_normalize_test.go that verifies empty tool output is preserved as the "null" placeholder.

Testing

  • Ran go test ./internal/adapter/openai and the package tests passed (ok).

Codex Task

@vercel
Copy link

vercel bot commented Mar 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ds2api Ready Ready Preview, Comment Mar 21, 2026 5:19pm

@CJackHwang CJackHwang merged commit 8fa1f99 into dev Mar 21, 2026
3 checks passed
@CJackHwang CJackHwang deleted the codex/fix-issues-from-codex-review branch March 21, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant