Repository navigation
fix(agent-runtime): do not treat TLS authentication wording as unauthorized - #1874
Merged
Merged
Conversation
…orized TLS handshake failures such as "mutual TLS authentication failed" and "authentication handshake timed out" contain "authentication" but are transport errors. The status-less credential check treated that word as an API-key rejection, so the turn was not retried and the UI showed an unauthorized error. Classify handshake, TLS/SSL, and certificate wording as a network failure before that check. Keep API-key, unauthorized, and permission failures terminal, and treat "authentication" as a credential failure only beside a key, bearer token, or credentials, or as a short provider phrase that is not a handshake.
This branch was previously deployed
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.
fix(agent-runtime): do not treat TLS authentication wording as unauthorized
Fixes #1873
What
Narrows status-less credential detection in
classifyAgentErrorso bareauthenticationis no longer enough. TLS / SSL / handshake / certificate wording is classified as retriableNETWORK_ERROR(networkCategory: tls) before the credential check. API-key,unauthorized, andpermission deniedstay terminal;authenticationcounts as a credential failure only beside a key / bearer / credentials, or as a short provider phrase such asauthentication failed. Certificate-verification errno stays non-retriable.Why
Handshake failures that say “authentication” (
mutual TLS authentication failed,authentication handshake timed out) were classified as API-key rejection, skipped the shared provider retry budget, and showed unauthorized in the UI. Bareauthenticationmatches the stem inside those phrases; the credential fallback only needs real key/unauthorized wording.How tested
agent-errors.test.tsfail on unmodified main (mutual TLS authentication failed→PROVIDER_UNAUTHORIZED) and pass with this change.packages/agent-runtime:vitest run src/agent-errors.test.ts→ 56/56 pass;tsc -p tsconfig.json --noEmitclean.Scope
agent-errors.tsand its tests only. No retry-budget or adapter changes.