Repository navigation
fix: deliver reply for SDK-routed providers - #800
Merged
Merged
Conversation
Providers routed through the WP AI Client SDK (everything except the hardcoded openai/anthropic/google/openai-compat direct paths) call generate_text_result() which is non-streaming. The REST controller's SSE response only commits text the frontend assembled from `token` events, so SDK provider replies were silently dropped on the wire — the user saw the loop complete with iterations_used=1 but no assistant message in the chat. Track whether the streaming direct path already pushed tokens via a `reply_streamed` flag on AgentLoop, exposed via reply_was_streamed(). In handle_stream, after run() returns, push the reply text as a single token before sending `done` whenever streaming did not happen. This is a temporary bridge — see ai-agent#TBD for the full strip of the bespoke direct paths in favour of SDK-only routing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
superdav42
added a commit
that referenced
this pull request
Apr 7, 2026
Removes all direct provider implementations (OpenAI, Anthropic, Google, OpenAI-compatible HTTP fallback) and the SSE streaming layer from AgentLoop and RestController. All requests now route through wp_ai_client_prompt() — provider auth, model resolution, and transport are entirely the SDK's responsibility. The /stream SSE endpoint is replaced by /chat which returns a standard WP_REST_Response. generate_session_title() is updated to use the SDK instead of per-provider HTTP calls. Resolves the merge conflict with #800 by rebasing onto main and applying the PR #801 changes cleanly. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
superdav42
added a commit
that referenced
this pull request
Apr 7, 2026
Removes all direct provider implementations (OpenAI, Anthropic, Google, OpenAI-compatible HTTP fallback) and the SSE streaming layer from AgentLoop and RestController. All requests now route through wp_ai_client_prompt() — provider auth, model resolution, and transport are entirely the SDK's responsibility. The /stream SSE endpoint is replaced by /chat which returns a standard WP_REST_Response. generate_session_title() is updated to use the SDK instead of per-provider HTTP calls. Resolves the merge conflict with #800 by rebasing onto main and applying the PR #801 changes cleanly. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Providers routed through the WP AI Client SDK (everything except the hardcoded openai/anthropic/google/openai-compat direct paths) call generate_text_result() which is non-streaming. The REST controller's SSE response only commits text the frontend assembled from
tokenevents, so SDK provider replies were silently dropped on the wire — the user saw the loop complete with iterations_used=1 but no assistant message in the chat.Track whether the streaming direct path already pushed tokens via a
reply_streamedflag on AgentLoop, exposed via reply_was_streamed(). In handle_stream, after run() returns, push the reply text as a single token before sendingdonewhenever streaming did not happen. This is a temporary bridge — see ai-agent#TBD for the full strip of the bespoke direct paths in favour of SDK-only routing.