Skip to content

fix(agent-runtime): do not treat TLS authentication wording as unauthorized - #1874

Merged
vastsa merged 3 commits into
vastsa:mainfrom
xpeng5278-web:fix/tls-auth-misclassify
Oct 25, 2026
Merged

vastsa merged 3 commits into
vastsa:mainfrom
xpeng5278-web:fix/tls-auth-misclassify

Conversation

@xpeng5278-web

Copy link
Copy Markdown
Contributor

fix(agent-runtime): do not treat TLS authentication wording as unauthorized

Fixes #1873

What

Narrows status-less credential detection in classifyAgentError so bare authentication is no longer enough. TLS / SSL / handshake / certificate wording is classified as retriable NETWORK_ERROR (networkCategory: tls) before the credential check. API-key, unauthorized, and permission denied stay terminal; authentication counts as a credential failure only beside a key / bearer / credentials, or as a short provider phrase such as authentication 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. Bare authentication matches the stem inside those phrases; the credential fallback only needs real key/unauthorized wording.

How tested

  • New cases in agent-errors.test.ts fail 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 --noEmit clean.

Scope

agent-errors.ts and its tests only. No retry-budget or adapter changes.

xpeng5278-web and others added 2 commits October 25, 2026 17:40
…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.
@vastsa
vastsa merged commit c5e53d3 into vastsa:main Oct 25, 2026
2 checks passed

This branch was previously deployed

1 inactive deployment
Preview — 919e5c4a Deployed Oct 25, 2026 by vercel[bot]
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] TLS/handshake wording with "authentication" is classified as PROVIDER_UNAUTHORIZED (no retry)

2 participants