Skip to content

fix(providers): fall back to public Code Suggestions endpoint on GitLab Duo direct_access 401 (#10365) - #10499

Merged
diegosouzapw merged 2 commits into
release/v3.8.50from
fix/10365-gitlab-duo-401-fallback
Aug 18, 2026
Merged

diegosouzapw merged 2 commits into
release/v3.8.50from
fix/10365-gitlab-duo-401-fallback

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Closes #10365

GitLab Duo's /code_suggestions/direct_access exchange can return 401 (token invalid/revoked); previously that aborted the request with an opaque 401 instead of trying the public /code_suggestions/completions endpoint — the same resilience already wired for the 403-disabled case. @codex-composer

Root cause: GitlabExecutor handled 401 from direct_access as terminal (target: null + error response), so a revoked/invalid Duo token surfaced immediately with no fallback despite the public completions endpoint being available.

Fix: on direct_access 401, retry the monolith endpoints.publicCompletionsUrl via buildMonolithHeaders (mirrors the existing 403-disabled fallback). errorResponse: null on the direct exchange — the fallback is the real response.

Regression test (RED→GREEN): tests/unit/executor-gitlab.test.ts — new case falls back … when direct_access returns 401 asserts the call sequence direct_access → completions and that the completions body is returned (7/7 pass).

Gates: typecheck:core exit 0 · eslint (suppressions) exit 0 · check-file-size OK · check-complexity OK · check-cognitive-complexity OK · check-changelog-integrity OK · executor-gitlab.test.ts 7/7 GREEN.

⚠️ base-red inherited: #9985

@diegosouzapw

Copy link
Copy Markdown
Collaborator Author

The executor-side 401 fallback is sensible for normal requests, but the reported failure also occurs when clicking Retest. In PR head, OAUTH_TEST_CONFIG still probes only /code_suggestions/direct_access, and the generic test handler still treats a 401 as “Token invalid or revoked”; it never invokes GitlabExecutor, so this PR cannot change that behavior. Please extend the fallback to the connection-test path and add a regression test for it. I ran the focused executor suite only on the review workspace (6/6); PR-head execution was not performed.

… path (#10365)

The chat-completion path (open-sse/executors/gitlab.ts) already falls back to
the public Code Suggestions completions endpoint when the direct_access
exchange is rejected with 401, but testOAuthConnection() / the dashboard
Retest button still reported the connection unhealthy on the same 401 —
even though a real chat request through that connection would have
succeeded via the fallback. Apply the identical fallback contract to the
connection-test path (first attempt and the post-refresh retry), sharing the
predicate with the executor via shouldFallbackToPublicCodeSuggestions.
@diegosouzapw
diegosouzapw merged commit da42ed6 into release/v3.8.50 Aug 18, 2026
11 checks passed
diegosouzapw pushed a commit that referenced this pull request Aug 19, 2026
…pool and the ESLint gate (#10726)

* fix(tests): drain the auto/glm base-red left by the Cloudflare Playground backend

provider-family-combos asserted a fixed provider list for auto/glm and started
failing on release/v3.8.50 once the Cloudflare AI Playground no-auth backend
landed: its registry advertises zai-org/glm-5.2 and zai-org/glm-4.7-flash, so the
virtual combo legitimately spans it.

The test already documents the rule it is failing on — a no-auth backend that
genuinely serves a family model IS a member of the family pool — and carries that
justification for auggie, devin-cli-agentic and zcode. Add cloudflare-playground
to the expectation with the same kind of source-cited note.

* fix(tests): green the ESLint gate left red by two untracked any casts

lint:json --max-warnings 0 failed on release/v3.8.50 because the suppression
counts drifted behind the tree: cli-oauth-commands carried 20 no-explicit-any
violations against a registered 18 (#10491 added two Commander-mock casts) and
executor-gitlab carried 5 against a registered 4 (#10499 added one).

The GitLab test casts are fixable, so they are fixed rather than suppressed: all
five now read the translated payload through a declared GitLabResponseBody
instead of any, and the file leaves the suppression list entirely.

The CLI OAuth casts target bin/cli/commands/oauth.mjs, which ships no types, so
the Commander mock has nothing to cast to; that entry only gets its count
corrected to the 20 already in the tree.
@diegosouzapw
diegosouzapw deleted the fix/10365-gitlab-duo-401-fallback branch August 19, 2026 18:47
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…ab Duo direct_access 401 (cheaper-inference#10365) (cheaper-inference#10499)

* fix(providers): fall back to public Code Suggestions endpoint on GitLab Duo direct_access 401 (cheaper-inference#10365)

* fix(providers): extend GitLab Duo 401 fallback to the connection-test path (cheaper-inference#10365)

The chat-completion path (open-sse/executors/gitlab.ts) already falls back to
the public Code Suggestions completions endpoint when the direct_access
exchange is rejected with 401, but testOAuthConnection() / the dashboard
Retest button still reported the connection unhealthy on the same 401 —
even though a real chat request through that connection would have
succeeded via the fallback. Apply the identical fallback contract to the
connection-test path (first attempt and the post-refresh retry), sharing the
predicate with the executor via shouldFallbackToPublicCodeSuggestions.

---------

Co-authored-by: adevwithpurpose <adevwithpurpose@users.noreply.github.com>
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…pool and the ESLint gate (cheaper-inference#10726)

* fix(tests): drain the auto/glm base-red left by the Cloudflare Playground backend

provider-family-combos asserted a fixed provider list for auto/glm and started
failing on release/v3.8.50 once the Cloudflare AI Playground no-auth backend
landed: its registry advertises zai-org/glm-5.2 and zai-org/glm-4.7-flash, so the
virtual combo legitimately spans it.

The test already documents the rule it is failing on — a no-auth backend that
genuinely serves a family model IS a member of the family pool — and carries that
justification for auggie, devin-cli-agentic and zcode. Add cloudflare-playground
to the expectation with the same kind of source-cited note.

* fix(tests): green the ESLint gate left red by two untracked any casts

lint:json --max-warnings 0 failed on release/v3.8.50 because the suppression
counts drifted behind the tree: cli-oauth-commands carried 20 no-explicit-any
violations against a registered 18 (cheaper-inference#10491 added two Commander-mock casts) and
executor-gitlab carried 5 against a registered 4 (cheaper-inference#10499 added one).

The GitLab test casts are fixable, so they are fixed rather than suppressed: all
five now read the translated payload through a declared GitLabResponseBody
instead of any, and the file leaves the suppression list entirely.

The CLI OAuth casts target bin/cli/commands/oauth.mjs, which ships no types, so
the Commander mock has nothing to cast to; that entry only gets its count
corrected to the 20 already in the tree.
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] GitLab Duo: Token invalid or revoked

2 participants