fix(kosong): skip empty OpenAI-compatible reasoning stream values - #2508
fix(kosong): skip empty OpenAI-compatible reasoning stream values#2508mangeshraut712 wants to merge 1 commit into
Conversation
Gateways that keep reasoning_content: "" after thinking ends were journaling thousands of no-op think parts. Still observe the key for dialect detection; only yield think parts with non-empty text (fixes MoonshotAI#2506).
🦋 Changeset detectedLatest commit: 1ce0e7e The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ce0e7ec0f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const reasoning = reasoningKeyDialect.observe(delta); | ||
| if (reasoning !== undefined) { | ||
| if (reasoning) { |
There was a problem hiding this comment.
Apply the empty-reasoning guard to agent-core-v2
When requests run through kimi web, kap-server, or an explicitly enabled v2 CLI, this change is bypassed because those paths use packages/agent-core-v2/src/kosong/provider/bases/openai/openai-legacy.ts, whose stream conversion still yields a think part whenever reasoning !== undefined; the v2 Kimi provider also composes this OpenAI base. Consequently, gateways that emit reasoning_content: "" after thinking still bloat the journal in these product paths despite the Kimi Code changeset, so the equivalent guard and coverage need to be added to the v2 implementation.
AGENTS.md reference: AGENTS.md:L28-L28
Useful? React with 👍 / 👎.
commit: |
Summary
thinkparts when OpenAI-compatible streams keepreasoning_content: ""after thinking ends (fixes [kosong] OpenAI-compatible stream parser journals an empty think part per chunk carrying reasoning_content: "" #2506).openai-legacyandkimiproviders.Test plan
pnpm exec vitest run test/openai-legacy.test.ts test/kimi.test.tsinpackages/kosong(178 passed)Fixes #2506