Repository navigation
fix(command-code): fallback to /alpha/generate for Go plan without Provider API access - #11455
Merged
diegosouzapw merged 1 commit intoAug 26, 2026
Conversation
…ovider API access Go plan keys are rejected on the documented /provider/v1/chat/completions endpoint (403 upgrade_required) yet succeed on the CLI /alpha/generate endpoint. Add transparent fallback in both the executor and the API key validator so validation and chat both succeed for Go plan, preserving the new provider API for Provider tier and falling back only on 403/404. Fixes dashboard Invalid API Key on command-code login for Go plan accounts.
diegosouzapw
force-pushed
the
fix/command-code-go-plan-fallback
branch
from
August 26, 2026 00:15
a85b4c1 to
a0f2b4e
Compare
diegosouzapw
merged commit Aug 26, 2026
6eb7bf0
into
diegosouzapw:release/v3.8.51
4 of 7 checks passed
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…ovider API access (diegosouzapw#11455) Validated in a combined sub-batch worktree off release/v3.8.51 tip. This PR's branch also carried ~88 already-merged commits from a stale rebase (phantom-diff); cherry-picked only the genuine value commit. That commit's own test file (command-code-executor.test.ts) predated diegosouzapw#11421's async getExecutor() change and had 7 test failures from unresolved-Promise call sites (`.execute()` on a still-pending getExecutor() Promise, and in one case on execute() itself not being awaited) — fixed all 7 call sites to properly await both async calls, verified 16/16 pass, and pushed both the cherry-pick and the fix to this branch. - Focused tests: command-code-executor.test.ts (16/16) + provider-validation-specialty.test.ts — 140/140 combined, part of sub-batch's full run - typecheck:core, file-size, changelog-integrity, complexity, cognitive-complexity — all OK - Full-repo lint: 228 pre-existing dashboard react-hooks/* findings, unrelated to this diff Thanks for tracing the Go-plan 403 to the v3.8.50 endpoint migration and building a clean fallback that preserves the new Provider-tier path while restoring CLI compatibility for Go plan.
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.
Summary
Go plan keys are rejected on the documented
/provider/v1/chat/completionsendpoint (403 upgrade_required) yet succeed on the CLI/alpha/generateendpoint. Add transparent fallback in both the executor and the API key validator so validation and chat both succeed for Go plan, preserving the new provider API for Provider tier and falling back only on403/404.Root cause
v3.8.50migrated command-code from CLI/alpha/generate→ documented/provider/v1/chat/completions(b6412c6fefeat(providers): use official provider API (/provider/v1) instead of CLI-only /alpha/generate for command-code chat #10265). The new endpoint requires Provider tier; Go plan returns403 Go plan doesn't include API accesswhich the validator mapped toInvalid API Key.Fix
open-sse/executors/commandCode.ts: Try/provider/v1/chat/completionsfirst; on403/404fallback to/alpha/generatewith CLI headers (x-command-code-version,x-cli-environmentetc.) and/alphaCLI body (config/paramsenvelope + tool/message conversion). Restores CLI stream parsers (createStreamResponse/createJsonResponse) for the fallback path only;/providerpath stays passthrough OpenAI SSE/JSON.src/lib/providers/validation/openaiFormat.ts:validateCommandCodeProvidertries/providerfirst; on403/404probes/alpha/generate(insufficient credits400etc. counts as valid).Tests
tests/unit/command-code-executor.test.ts: +3 tests (streaming fallback, non-stream JSON fallback, both-fail surface)tests/unit/provider-validation-specialty.test.ts: +1 test (validator fallback on Go plan)command-code-executor(13→16),provider-validation-specialty(143→144),executor-command-code(7)Scope
Only 4 files, no secrets, no .env, no DB data. Base:
release/v3.8.50.