You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(gitlab): make the authentication fallback actually run
_get_auth_headers guesses between Bearer and PRIVATE-TOKEN from the shape of the
token, and retries once under the other scheme on a 401 so a wrong guess does not
fail the run. That retry has never executed.
Three things had to line up and none of them did:
- The retry caught requests.exceptions.HTTPError, but CliClient translates every
requests error into APIFailure before it gets there.
- CliClient discarded the HTTP status, so even a caught failure could not be
identified as a 401. is_transient_error was equally blind for the same reason.
- There are two APIFailure classes -- the CLI's own and the SDK's -- and they
were independent Exception subclasses. CliClient raises the CLI's; every
handler in socketsecurity.core imports the SDK's. None of those eight handlers
has ever caught a CliClient failure.
The CLI's APIFailure now subclasses the SDK's, so a handler written against either
catches both, and the status code travels with the exception.
The two tests covering the fallback were skipped rather than fixed, with a reason
that no longer described the failure -- the constructor they blamed is used by the
two passing tests in the same file. They now drive the exception the way CliClient
actually raises it, and fail if any of the three links above is broken again.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments