Skip to content

fix(ai): encode system messages as input text#6549

Open
xianjianlf2 wants to merge 1 commit into
Effect-TS:mainfrom
xianjianlf2:fix/openai-system-input-text-cache-6342
Open

fix(ai): encode system messages as input text#6549
xianjianlf2 wants to merge 1 commit into
Effect-TS:mainfrom
xianjianlf2:fix/openai-system-input-text-cache-6342

Conversation

@xianjianlf2

@xianjianlf2 xianjianlf2 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #6342

Summary

  • encode OpenAI Responses API system/developer messages as typed input_text content
  • keep existing role selection for reasoning models
  • update request-shape tests for both system and developer roles

Tests

  • pnpm test packages/ai/openai/test/OpenAiLanguageModel.test.ts
  • pnpm lint-fix
  • pnpm check

Summary by CodeRabbit

  • Bug Fixes
    • System messages sent through the OpenAI Responses API are now encoded in the expected typed input-text format.
    • Improved compatibility for both standard and reasoning models.

@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Jul 23, 2026
@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8e21605

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 27 packages
Name Type
@effect/ai-openai Patch
effect Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8b18314f-0238-418d-8f83-51fae272e72c

📥 Commits

Reviewing files that changed from the base of the PR and between 4e0be58 and 8e21605.

📒 Files selected for processing (3)
  • .changeset/fix-openai-system-input-text.md
  • packages/ai/openai/src/OpenAiLanguageModel.ts
  • packages/ai/openai/test/OpenAiLanguageModel.test.ts

📝 Walkthrough

Walkthrough

OpenAI Responses system messages now use typed input_text content arrays. Tests verify the updated system and developer message shapes, and a patch changeset documents the provider change.

Changes

OpenAI system input text

Layer / File(s) Summary
Typed input text encoding
packages/ai/openai/src/OpenAiLanguageModel.ts, packages/ai/openai/test/OpenAiLanguageModel.test.ts, .changeset/fix-openai-system-input-text.md
System message content is wrapped as an OpenAI input_text array, tests assert the updated system and developer request shapes, and a patch changeset records the change.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: bug

Suggested reviewers: tim-smart

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR encodes system and developer messages as typed input_text content while preserving role selection, matching issue #6342.
Out of Scope Changes check ✅ Passed The changes stay focused on Responses API message encoding and matching tests/changeset, with no unrelated code paths altered.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the bug Something isn't working label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

@effect/ai-openai Responses system messages encoded as string prevent prompt cache hits

1 participant