Stream display reasoning independently through sessions - #1
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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".
| case .reasoningDelta(let delta): | ||
| guard !delta.isEmpty else { continue } | ||
| reasoning = (reasoning ?? "") + delta | ||
| try onUpdate?(text, reasoning) |
There was a problem hiding this comment.
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 👍 / 👎.
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.