Skip to content

fix(command-code): fallback to /alpha/generate for Go plan without Provider API access - #11455

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
Chewji9875:fix/command-code-go-plan-fallback
Aug 26, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
Chewji9875:fix/command-code-go-plan-fallback

Conversation

@Chewji9875

Copy link
Copy Markdown
Contributor

Summary

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.

Root cause

Fix

  • open-sse/executors/commandCode.ts: Try /provider/v1/chat/completions first; on 403/404 fallback to /alpha/generate with CLI headers (x-command-code-version, x-cli-environment etc.) and /alpha CLI body (config/params envelope + tool/message conversion). Restores CLI stream parsers (createStreamResponse/createJsonResponse) for the fallback path only; /provider path stays passthrough OpenAI SSE/JSON.
  • src/lib/providers/validation/openaiFormat.ts: validateCommandCodeProvider tries /provider first; on 403/404 probes /alpha/generate (insufficient credits 400 etc. 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)
  • Existing suites green: 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.

@diegosouzapw
diegosouzapw changed the base branch from release/v3.8.50 to release/v3.8.51 August 25, 2026 22:51
…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
diegosouzapw force-pushed the fix/command-code-go-plan-fallback branch from a85b4c1 to a0f2b4e Compare August 26, 2026 00:15
@diegosouzapw
diegosouzapw merged commit 6eb7bf0 into diegosouzapw:release/v3.8.51 Aug 26, 2026
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.
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.

2 participants