-
Notifications
You must be signed in to change notification settings - Fork 91
fix(openai-responses): emit reasoning blocks from responses stream #1156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9d194bb
fix(openai-responses): emit reasoning blocks from responses stream
acoliver b32af10
fix(openai-responses): capture reasoning summary events
acoliver 7ca2ba9
fix: use separate buffers for reasoning_text and reasoning_summary_te…
acoliver 7fed2d2
feat(openai-responses): add text.verbosity setting for Codex thinking…
acoliver 37318d5
fix(openai-responses): respect reasoning.includeInResponse setting an…
acoliver 8c191ae
fix(interactive): prevent duplicate thinking blocks in UI streaming
acoliver 268aa73
fix(coderabbit): address all CodeRabbit review comments
acoliver 75be1cb
fix(coderabbit): guard against undefined thought in reasoning summary
acoliver 508c975
chore: lint fixes and package-lock regeneration
acoliver cb389aa
Merge origin/main into issue922
acoliver e0b23fc
fix(ui): clear thinking blocks after commit to prevent pyramid accumu…
acoliver bd2fb76
fix(test): add getModelBehavior mock to codex.malformedCallId test
acoliver ba82d58
fix: address CodeRabbit review comments
acoliver 8d3401a
fix(ui): deduplicate thought events in useGeminiStream
acoliver c6112a7
fix: preserve reasoning items in Codex mode for better model performance
acoliver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
packages/cli/src/providers/providerAliases.codex.reasoningSummary.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2025 Vybestack LLC | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * TDD tests for codex.config reasoning.summary default | ||
| * @issue #922 - GPT-5.2-Codex thinking blocks not visible | ||
| */ | ||
|
|
||
| import { describe, it, expect } from 'vitest'; | ||
| import * as fs from 'fs'; | ||
| import * as path from 'path'; | ||
| import { fileURLToPath } from 'url'; | ||
| import { loadProviderAliasEntries } from './providerAliases.js'; | ||
|
|
||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = path.dirname(__filename); | ||
|
|
||
| describe('codex.config reasoning.summary default @issue:922', () => { | ||
| it('should have a codex.config file', () => { | ||
| const codexConfigPath = path.join(__dirname, 'aliases', 'codex.config'); | ||
| expect(fs.existsSync(codexConfigPath)).toBe(true); | ||
| }); | ||
|
|
||
| it('should set reasoning.summary=auto in ephemerals', () => { | ||
| const aliases = loadProviderAliasEntries(); | ||
| const codexAlias = aliases.find((a) => a.alias === 'codex'); | ||
|
|
||
| expect(codexAlias).toBeDefined(); | ||
| expect(codexAlias?.config.ephemeralSettings).toBeDefined(); | ||
| expect(codexAlias?.config.ephemeralSettings?.['reasoning.summary']).toBe( | ||
| 'auto', | ||
| ); | ||
| }); | ||
|
|
||
| it('should set reasoning.effort in ephemerals (existing behavior)', () => { | ||
| const aliases = loadProviderAliasEntries(); | ||
| const codexAlias = aliases.find((a) => a.alias === 'codex'); | ||
|
|
||
| expect(codexAlias).toBeDefined(); | ||
| // Codex should have some default effort level | ||
| expect( | ||
| codexAlias?.config.ephemeralSettings?.['reasoning.effort'], | ||
| ).toBeDefined(); | ||
| }); | ||
| }); |
29 changes: 29 additions & 0 deletions
29
packages/cli/src/runtime/runtimeSettings.reasoningSummary.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2025 Vybestack LLC | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * TDD tests for reasoning.summary profile save/load | ||
| * @issue #922 - GPT-5.2-Codex thinking blocks not visible | ||
| */ | ||
|
|
||
| import { describe, it, expect } from 'vitest'; | ||
| import { PROFILE_EPHEMERAL_KEYS } from './runtimeSettings.js'; | ||
|
|
||
| describe('reasoning.summary profile save/load @issue:922', () => { | ||
| it('should include reasoning.summary in PROFILE_EPHEMERAL_KEYS', () => { | ||
| expect(PROFILE_EPHEMERAL_KEYS).toContain('reasoning.summary'); | ||
| }); | ||
|
|
||
| it('should include all reasoning.* keys in PROFILE_EPHEMERAL_KEYS', () => { | ||
| // Verify all reasoning settings are saveable | ||
| expect(PROFILE_EPHEMERAL_KEYS).toContain('reasoning.enabled'); | ||
| expect(PROFILE_EPHEMERAL_KEYS).toContain('reasoning.includeInContext'); | ||
| expect(PROFILE_EPHEMERAL_KEYS).toContain('reasoning.includeInResponse'); | ||
| expect(PROFILE_EPHEMERAL_KEYS).toContain('reasoning.format'); | ||
| expect(PROFILE_EPHEMERAL_KEYS).toContain('reasoning.stripFromContext'); | ||
| expect(PROFILE_EPHEMERAL_KEYS).toContain('reasoning.effort'); | ||
| expect(PROFILE_EPHEMERAL_KEYS).toContain('reasoning.maxTokens'); | ||
| expect(PROFILE_EPHEMERAL_KEYS).toContain('reasoning.summary'); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
packages/cli/src/settings/ephemeralSettings.reasoningSummary.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2025 Vybestack LLC | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * TDD tests for reasoning.summary ephemeral setting | ||
| * @issue #922 - GPT-5.2-Codex thinking blocks not visible | ||
| */ | ||
|
|
||
| import { describe, it, expect } from 'vitest'; | ||
| import { | ||
| isValidEphemeralSetting, | ||
| ephemeralSettingHelp, | ||
| } from './ephemeralSettings.js'; | ||
|
|
||
| describe('reasoning.summary ephemeral setting @issue:922', () => { | ||
| describe('ephemeralSettingHelp', () => { | ||
| it('should include reasoning.summary in descriptions', () => { | ||
| expect(ephemeralSettingHelp['reasoning.summary']).toBeDefined(); | ||
| }); | ||
|
|
||
| it('should mention OpenAI in the description', () => { | ||
| const description = ephemeralSettingHelp['reasoning.summary']; | ||
| expect(description?.toLowerCase()).toContain('openai'); | ||
| }); | ||
|
|
||
| it('should mention valid values in the description', () => { | ||
| const description = ephemeralSettingHelp['reasoning.summary']; | ||
| expect(description).toContain('auto'); | ||
| expect(description).toContain('concise'); | ||
| expect(description).toContain('detailed'); | ||
| expect(description).toContain('none'); | ||
| }); | ||
| }); | ||
|
|
||
| describe('isValidEphemeralSetting validation', () => { | ||
| it('should accept reasoning.summary=auto', () => { | ||
| expect(isValidEphemeralSetting('reasoning.summary', 'auto')).toBe(true); | ||
| }); | ||
|
|
||
| it('should accept reasoning.summary=concise', () => { | ||
| expect(isValidEphemeralSetting('reasoning.summary', 'concise')).toBe( | ||
| true, | ||
| ); | ||
| }); | ||
|
|
||
| it('should accept reasoning.summary=detailed', () => { | ||
| expect(isValidEphemeralSetting('reasoning.summary', 'detailed')).toBe( | ||
| true, | ||
| ); | ||
| }); | ||
|
|
||
| it('should accept reasoning.summary=none', () => { | ||
| expect(isValidEphemeralSetting('reasoning.summary', 'none')).toBe(true); | ||
| }); | ||
|
|
||
| it('should reject reasoning.summary=invalid', () => { | ||
| expect(isValidEphemeralSetting('reasoning.summary', 'invalid')).toBe( | ||
| false, | ||
| ); | ||
| }); | ||
|
|
||
| it('should reject reasoning.summary=true (wrong type)', () => { | ||
| expect(isValidEphemeralSetting('reasoning.summary', true)).toBe(false); | ||
| }); | ||
|
|
||
| it('should reject reasoning.summary=123 (wrong type)', () => { | ||
| expect(isValidEphemeralSetting('reasoning.summary', 123)).toBe(false); | ||
| }); | ||
| }); | ||
| }); |
63 changes: 63 additions & 0 deletions
63
packages/cli/src/settings/ephemeralSettings.textVerbosity.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2025 Vybestack LLC | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import { describe, expect, it } from 'vitest'; | ||
| import { | ||
| parseEphemeralSettingValue, | ||
| ephemeralSettingHelp, | ||
| } from './ephemeralSettings.js'; | ||
|
|
||
| describe('text.verbosity ephemeral setting', () => { | ||
| describe('parseEphemeralSettingValue', () => { | ||
| it('should accept "low" as valid verbosity', () => { | ||
| const result = parseEphemeralSettingValue('text.verbosity', 'low'); | ||
| expect(result.success).toBe(true); | ||
| if (result.success) { | ||
| expect(result.value).toBe('low'); | ||
| } | ||
| }); | ||
|
|
||
| it('should accept "medium" as valid verbosity', () => { | ||
| const result = parseEphemeralSettingValue('text.verbosity', 'medium'); | ||
| expect(result.success).toBe(true); | ||
| if (result.success) { | ||
| expect(result.value).toBe('medium'); | ||
| } | ||
| }); | ||
|
|
||
| it('should accept "high" as valid verbosity', () => { | ||
| const result = parseEphemeralSettingValue('text.verbosity', 'high'); | ||
| expect(result.success).toBe(true); | ||
| if (result.success) { | ||
| expect(result.value).toBe('high'); | ||
| } | ||
| }); | ||
|
|
||
| it('should normalize case to lowercase', () => { | ||
| const result = parseEphemeralSettingValue('text.verbosity', 'HIGH'); | ||
| expect(result.success).toBe(true); | ||
| if (result.success) { | ||
| expect(result.value).toBe('high'); | ||
| } | ||
| }); | ||
|
|
||
| it('should reject invalid verbosity values', () => { | ||
| const result = parseEphemeralSettingValue('text.verbosity', 'invalid'); | ||
| expect(result.success).toBe(false); | ||
| if (!result.success) { | ||
| expect(result.message).toContain('must be one of: low, medium, high'); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| describe('ephemeralSettingHelp', () => { | ||
| it('should have help text for text.verbosity', () => { | ||
| expect(ephemeralSettingHelp['text.verbosity']).toBeDefined(); | ||
| expect(ephemeralSettingHelp['text.verbosity']).toContain('verbosity'); | ||
| expect(ephemeralSettingHelp['text.verbosity']).toContain('OpenAI'); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add reasoning.verbosity to the “all reasoning. keys” assertion.*
The test promises full reasoning coverage but omits
reasoning.verbosity, so a regression could slip through unnoticed.✅ Proposed fix
expect(PROFILE_EPHEMERAL_KEYS).toContain('reasoning.maxTokens'); expect(PROFILE_EPHEMERAL_KEYS).toContain('reasoning.summary'); + expect(PROFILE_EPHEMERAL_KEYS).toContain('reasoning.verbosity');📝 Committable suggestion
🤖 Prompt for AI Agents