Skip to content

fix: handle reasoning model output in OpenAI Responses API#68

Merged
WZ merged 2 commits intomainfrom
feat/tls-skip-verify
Mar 20, 2026
Merged

fix: handle reasoning model output in OpenAI Responses API#68
WZ merged 2 commits intomainfrom
feat/tls-skip-verify

Conversation

@WZ
Copy link
Owner

@WZ WZ commented Mar 20, 2026

Summary

  • Skip type: "reasoning" output blocks in OpenAI Responses API extraction — reasoning models (e.g. gpt-oss-120b) return chain-of-thought in a separate output block before the actual message, both using output_text content type
  • Add extractJSONArray fallback to parseSectionClassifiedResponse and parseCriticResponse for OpenAI-compatible endpoints that ignore json_schema structured output constraints
  • Log a warning when JSON extraction fallback is used

Test Coverage

All new code paths have test coverage:

  • TestExtractJSONArray — 5 subtests (pure array, reasoning prefix, reasoning both sides, no array, only open bracket)
  • TestParseSectionClassifiedResponse_WithReasoning — end-to-end parsing with chain-of-thought preamble
  • TestExtractResponsesOutputText_ReasoningWithOutputText — reasoning output with output_text content type is skipped

Pre-Landing Review

No issues found.

Documentation

  • README.md: added tls_skip_verify to YAML config example, env var example, and config description
  • CLAUDE.md: added tls_skip_verify to Configuration section under Network

Test plan

  • All Go tests pass (11 packages, 0 failures)
  • Build succeeds

🤖 Generated with Claude Code

Codex and others added 2 commits March 20, 2026 16:09
Reasoning models (e.g. gpt-oss-120b) return a "reasoning" output block
before the "message" output, both using "output_text" content type.
extractResponsesOutputText now skips reasoning outputs and prefers the
message output. As defense-in-depth, both parseSectionClassifiedResponse
and parseCriticResponse fall back to extracting the outermost JSON array
when the response contains chain-of-thought preamble.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@WZ WZ merged commit 1389ea6 into main Mar 20, 2026
1 check passed
@WZ WZ deleted the feat/tls-skip-verify branch March 20, 2026 23:29
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.

1 participant