mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-22 06:42:19 +03:00
Root cause: shouldFallbackToPublicCodeSuggestions() only treated a direct_access 403 as recoverable when the body contained GitLab's exact "direct connections are disabled" tenant-config message (#10365/#10499). An entitlement/scope-resolution 403 GitLab returns for an API-only client is a different failure class, so the public-completions fallback was never attempted even though the reporter's same token was accepted by that endpoint. Separately, the connection-test path read res.text() twice for gitlab-duo (once for the fallback decision, once for the error body), so the second read of an already-drained stream silently collapsed to "" and the real upstream error was replaced with a generic "Access denied". Fix: broaden the fallback predicate to any 401/403, remove the isGitLabDirectAccessDisabled() gate on the chat-path executor's hard-403 branch, and reuse the single body read in testOAuthConnection() so a 403 that fails both endpoints now surfaces GitLab's real (sanitized, capped) error text. Regression test: tests/unit/issue-12958-gitlab-duo-403-entitlement-fallback.test.ts (RED on unfixed code: fallback not attempted, body collapses to "Access denied"; GREEN after the fix). Extended tests/unit/executor-gitlab.test.ts with the same entitlement-403 case for the chat-path executor.