Skip to content

Stream display reasoning independently through sessions - #1

Merged
qoli merged 2 commits into
mainfrom
codex/display-reasoning
Sep 24, 2026
Merged

qoli merged 2 commits into
mainfrom
codex/display-reasoning

Conversation

@qoli

@qoli qoli commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Provider-public reasoning now streams independently from answer text through LanguageModelSession, accumulating across tool rounds. Structured output parsing and opaque terminal replay remain separate; reasoning-only snapshots reach consumers even when answer text is unchanged.

Adopts the owner-maintained qoli/AnyLanguageModel/main fork at 9265b9d8b8d3ffbf1d28cbf5ad147105a8198f11. The upstream contribution huggingface/AnyLanguageModel#264 is no longer a release dependency. Both Core/Smoke resolution snapshots also bind published pi-ai-swift/main 93fcae3a6a4c11c29dcc6f02f0f4e0ca02bf33f1. No local package override.

Validation on the real remote graph: 45 tests passed, recursive Swift formatting and whitespace checks passed, Core and Smoke generic iOS Simulator builds succeeded. Xcode used command-only -skipMacroValidation after verifying unchanged macro sources. Coverage includes reasoning-only updates, final collection, tool replay/execution count, structured output, cancellation, stopped tools, and terminal validation. Scalar partial types defer reasoning until an answer is representable. No live provider calls.

@qoli
qoli marked this pull request as ready for review September 24, 2026 16:46
@qoli
qoli merged commit 914b943 into main Sep 24, 2026
0 of 2 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T16:49:15.117889Z 61b61e9 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 61b61e9ffa

ℹ️ 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".

Comment on lines +340 to +343
case .reasoningDelta(let delta):
guard !delta.isEmpty else { continue }
reasoning = (reasoning ?? "") + delta
try onUpdate?(text, reasoning)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Accept completed reasoning-only responses

When a reasoning model exhausts its output budget before producing answer text, the provider can validly emit reasoningDelta events followed by a terminal reasoning-only snapshot and .length. This branch records and streams that reasoning, but the later !text.isEmpty || !calls.isEmpty guard still throws invalidProviderResponse, so respond and stream collection discard the new reasoning result after consumers may already have seen snapshots. Treat non-nil display reasoning as content here; structured response conversion can still reject an absent structured answer afterward.

Useful? React with 👍 / 👎.

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