Skip to content

fix: route Playground ChatTab Send to the selected endpoint (#10592) - #10913

Merged
diegosouzapw merged 1 commit into
release/v3.8.50from
fix/10592-playground-endpoint-selector
Aug 21, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.50from
fix/10592-playground-endpoint-selector

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Closes #10592

Root cause

ChatTab.tsx (the "Send"-style chat UI in the main Playground) hardcoded every
request to POST /api/v1/chat/completions and never read configState.endpoint,
even though StudioConfigPane's "Endpoint" selector exposes 13 real API endpoints
(chat.completions, search, web.fetch, etc. via ENDPOINT_OPTIONS /
endpointToPath() in src/lib/playground/codeExport.ts). Search providers
(exa-search, tavily-search, serper-search) have no chat-model catalog entries,
so StudioConfigPane falls back to a free-text model field, letting a user type
exa-search/web and hit "Send" — which still POSTed to chat.completions and 404'd
with No active credentials for provider: exa-search, because chat credential
resolution has no notion of search-provider credentials.

Fix

ChatTab.tsx now resolves the request path from configState.endpoint via the
existing endpointToPath() helper, and for non-chat-shaped endpoints (currently
search and web.fetch) builds a query/url-based request body instead of the
messages[] shape, then renders the raw (JSON-pretty-printed when possible)
response instead of assuming an SSE chat-completions delta stream. The
chat.completions path (the default/most common case) is untouched — same
request body builder, same SSE decode loop.

New module: src/app/(dashboard)/dashboard/playground/components/tabs/chatTabEndpointRequest.ts
(kept ChatTab.tsx's diff minimal and gives the endpoint-routing logic its own
testable seam).

Regression test (TDD)

tests/unit/ui/playground-chat-tab-search-endpoint-10592.test.tsx — renders
ChatTab with configState.endpoint: "search", types a query, clicks Send, and
asserts the captured fetch() URL is /api/v1/search (not
/api/v1/chat/completions).

  • RED on origin/release/v3.8.50 (confirmed in the analysis pass and re-confirmed
    on this fresh worktree before the fix): AssertionError: expected '/api/v1/chat/completions' to be '/api/v1/search'.
  • GREEN after the fix: npx vitest run --config vitest.config.ts tests/unit/ui/playground-chat-tab-search-endpoint-10592.test.tsx → 1 passed.

Gates run

  • npx vitest run --config vitest.config.ts tests/unit/ui/playground-chat-tab-search-endpoint-10592.test.tsx → pass
  • npm run typecheck:core → exit 0
  • npx eslint --suppressions-location config/quality/eslint-suppressions.json <changed files> → clean
  • node scripts/check/check-file-size.mjs → OK
  • node scripts/check/check-complexity.mjs → OK (2573 violations vs baseline 2774)
  • node scripts/check/check-cognitive-complexity.mjs → OK (1157 violations vs baseline 1223)
  • node scripts/check/check-changelog-integrity.mjs → OK

Scope note

CompareTab.tsx has an independent hardcoded fetch(${configState.baseUrl}/v1/chat/completions, ...) call with the same class of issue, but it's a separate component/test surface — out of scope for this fix and left for a follow-up issue rather than widening this PR's diff.

@diegosouzapw
diegosouzapw merged commit 050c7c0 into release/v3.8.50 Aug 21, 2026
11 checks passed
@diegosouzapw
diegosouzapw deleted the fix/10592-playground-endpoint-selector branch August 21, 2026 15:32
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…yground-endpoint-selector

fix: route Playground ChatTab Send to the selected endpoint (diegosouzapw#10592)
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.

[BUG] Main Playground fails to resolve configured search provider credentials

2 participants