Skip to content

The agent that grows with you

fix(desktop): the error card names a WAF block and the User-Agent fix instead of 'retry in a moment'

teknium11fc8887c6e14
diff --git a/agent/error_surface.py b/agent/error_surface.py
index d03512c26e8..f0a10c46da4 100644
--- a/agent/error_surface.py
+++ b/agent/error_surface.py
@@ -54,7 +54,7 @@ _FREE_TIER_RETRYABLE_KINDS = {"rate_limited", "at_capacity", "outage"}
_NON_RETRYABLE_REASONS = {
"auth", "auth_permanent", "billing", "billing_unverified", "content_policy_blocked",
"provider_policy_blocked", "model_not_found", "format_error", "ssl_cert_verification",
- "context_overflow", "interpreter_shutdown",
+ "context_overflow", "interpreter_shutdown", "upstream_blocked",
}
# Providers whose base_url is user-supplied rather than a known vendor.
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 6192d915d2a..95aa2c735a2 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -4057,6 +4057,11 @@ export const en: Translations = {
title: 'The reply was cut off',
body: 'The connection dropped before the reply finished. Retry to send it again.'
},
+ upstream_blocked: {
+ title: 'A firewall blocked the request',
+ body: provider =>
+ `A firewall or CDN in front of ${provider} blocked the request before it reached the model — your key is probably fine. Set a User-Agent header via the provider's extra_headers in Settings, or switch provider, then send your message again.`
+ },
ssl_cert_verification: {
title: 'Secure connection failed',
body: provider =>
diff --git a/apps/desktop/src/lib/error-surface.test.ts b/apps/desktop/src/lib/error-surface.test.ts
index 9bab5937b7a..a85e693fd31 100644
--- a/apps/desktop/src/lib/error-surface.test.ts
+++ b/apps/desktop/src/lib/error-surface.test.ts
@@ -108,7 +108,8 @@ describe('error copy never names a hidden Retry', () => {
'format_error',
'ssl_cert_verification',
'context_overflow',
- 'interpreter_shutdown'
+ 'interpreter_shutdown',
+ 'upstream_blocked'
])
const surfaces: ErrorSurface[] = [
@@ -137,6 +138,16 @@ describe('error copy never names a hidden Retry', () => {
const surface: ErrorSurface = { authKind: 'api_key', code: 'auth', layer: 'auth', provider: 'openai', retryable: false }
expect(errorRecoveryPlan(surface).retry).toBe(true)
})
+
+ it('a WAF block names the firewall and the User-Agent fix, not the key and not a retry', () => {
+ const surface = parseErrorSurface({ code: 'upstream_blocked', layer: 'provider', provider: 'custom', retryable: false })!
+ const { body, title } = errorCardText(thread, surface)
+ expect(title).toBe(en.assistant.thread.errorCodes.upstream_blocked.title)
+ expect(body).toMatch(/firewall/i)
+ expect(body).toMatch(/User-Agent/)
+ expect(body).not.toBe(thread.errorLayerBodies.provider)
+ expect(errorRecoveryPlan(surface).retry).toBe(false)
+ })
})
describe('free-tier refusals', () => {
diff --git a/apps/desktop/src/lib/error-surface.ts b/apps/desktop/src/lib/error-surface.ts
index 189f29e642f..c1902eb02c8 100644
--- a/apps/desktop/src/lib/error-surface.ts
+++ b/apps/desktop/src/lib/error-surface.ts
@@ -35,6 +35,9 @@ export const ERROR_CODE_KEYS = [
'timeout',
'stream_drop',
'ssl_cert_verification',
+ // A firewall/CDN in front of the endpoint refused the request (usually by
+ // User-Agent) before it reached the model: not a key problem, and not retryable.
+ 'upstream_blocked',
'context_overflow',
'payload_too_large',
'model_not_found',