Skip to content

Fix AI SDK multi-turn warnings - #284

Merged
konard merged 3 commits into
mainfrom
issue-279-ae8e3ffcdb93
Jul 27, 2026
Merged

Fix AI SDK multi-turn warnings#284
konard merged 3 commits into
mainfrom
issue-279-ae8e3ffcdb93

Conversation

@konard

@konard konard commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #279.

  • route Agent-owned system prompts through AI SDK 6's dedicated system option
    in normal generation, compaction, and title generation
  • upgrade @ai-sdk/openai-compatible to the Language Model v3 adapter and pin
    AI SDK to the release that reports unsafe system-role placement
  • add a credential-free, two-turn OpenAI-compatible regression that captures
    AI SDK's console.warn/stderr warning path
  • add a patch changeset

Reproduction and root cause

The regression performs two streamText turns against a local mocked
OpenAI-compatible SSE response.

Before the adapter upgrade, it captured the compatibility warning twice:

The feature "specificationVersion" is used in a compatibility mode. Using v2 specification compatibility mode.

With the v3 adapter but system-role entries still inside messages, it captured
the system-message warning twice:

System messages in the prompt or messages fields can be a security risk...

The two root causes were therefore independent:

  1. the direct OpenAI-compatible dependency was still v1 / Language Model v2;
  2. trusted prompts constructed by Agent were passed as ordinary message history.

The fix uses AI SDK's dedicated system input at every Agent generation
boundary and updates the adapter to its AI SDK 6-compatible v3 implementation.
Warnings remain enabled globally, so future SDK warnings are still visible.

Verification

  • bun test ./tests/ai-sdk-warnings.ts — 1 pass
  • npm test — 610 pass, 4 todo, 0 fail
  • npm run check — ESLint, Prettier, and file-size checks pass
  • cargo test — all Rust unit, integration, and doc tests pass
  • git diff --check — pass

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #279
@konard konard self-assigned this Jul 27, 2026
@konard konard changed the title [WIP] AI SDK 6 warnings on every multi-turn Agent CLI run Fix AI SDK multi-turn warnings Jul 27, 2026
@konard
konard marked this pull request as ready for review July 27, 2026 04:01
@konard

konard commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Working session summary

Implemented and finalized PR #284.

Key changes:

  • Moved trusted system prompts to AI SDK’s dedicated system option.
  • Upgraded the OpenAI-compatible adapter to Language Model v3.
  • Added a credential-free two-turn warning regression test.
  • Added a patch changeset.
  • Merged the latest main and resolved its .gitkeep deletion conflict.

Verification:

  • JavaScript: 610 passed, 0 failed.
  • Rust tests: all passed.
  • Lint, formatting, file-size, and package-install checks passed.
  • Fresh CI run passed on all platforms.
  • Working tree is clean, PR is mergeable, and it is ready for review.

This summary was automatically extracted from the AI working session output.

@konard

konard commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: GPT-5.6 Sol
  • Provider: OpenAI
  • Public pricing estimate: $6.981880

📊 Context and tokens usage:

  • 150.2K / 200K (75%) input tokens, 12.8K / 128K (10%) output tokens

Total: (150.2K + 4.9M cached) input tokens, 12.8K output tokens, $6.981880 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-5.6-sol
  • Thinking level: low (~7999 tokens)
  • Model: GPT 5.6 Sol (gpt-5.6-sol)

📎 Log file uploaded as Gist (1944KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
konard merged commit acd21f2 into main Jul 27, 2026
10 checks passed
@konard

konard commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

🎉 Auto-merged

This pull request has been automatically merged by hive-mind.

  • All CI checks have passed

Auto-merged by hive-mind with --auto-merge flag

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.

AI SDK 6 warnings on every multi-turn Agent CLI run

1 participant