Skip to content

The agent that grows with you

fix(error-surface): name the provider by its display label on every error card

Adolancb8473e446dc
diff --git a/agent/error_surface.py b/agent/error_surface.py
index b1fc822df07..90b81ac3342 100644
--- a/agent/error_surface.py
+++ b/agent/error_surface.py
@@ -90,12 +90,14 @@ def _surface(layer: str, code: str, retryable: bool, provider: str = "", model:
# that actually failed — not whatever the composer points at later.
identity = {k: v for k, v in (("provider", provider), ("model", model)) if v}
surface = {"layer": layer, "code": code, "retryable": bool(retryable), **identity}
+ if provider:
+ # Clients name the failing provider in the card copy ("OpenCode Go did
+ # not answer…"), not by its config slug.
+ surface["provider_label"] = _provider_label(provider)
if layer == LAYER_AUTH and provider:
# OAuth providers are fixed by signing in again; API-key providers by
- # replacing the key. The client's one-click recovery needs to know which
- # and how to name the account it re-opens.
+ # replacing the key. The client's one-click recovery needs to know which.
surface["auth_kind"] = auth_kind(provider)
- surface["provider_label"] = _provider_label(provider)
return surface
diff --git a/tests/agent/test_error_surface.py b/tests/agent/test_error_surface.py
index 2ef491dfa70..458b8e56ab5 100644
--- a/tests/agent/test_error_surface.py
+++ b/tests/agent/test_error_surface.py
@@ -66,6 +66,14 @@ def test_auth_surface_names_oauth_vs_api_key_recovery():
assert "auth_kind" not in build_error_surface_from_result(_failed_result("rate_limit"), provider="nous")
+def test_every_provider_surface_carries_the_display_label():
+ """Card copy names the provider ("OpenCode Go did not answer…"); without the
+ label on non-auth layers clients fell back to the config slug."""
+ surface = build_error_surface_from_result(_failed_result("timeout"), provider="opencode-go")
+ assert surface["provider_label"] == "OpenCode Go"
+ assert "provider_label" not in build_error_surface_from_result(_failed_result("timeout"))
+
+
def test_result_billing_block_wins():
surface = build_error_surface_from_result(
_failed_result("rate_limit", billing_block={"provider": "nous"})
@@ -209,6 +217,7 @@ def test_anthropic_usage_limit_routes_to_billing_recovery():
"code": "billing",
"retryable": False,
"provider": "anthropic",
+ "provider_label": "Anthropic",
"model": "claude-opus-5",
}