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
refactor(agentkit): raise core HTTP/credential/SDK paths to a logging/exception/timeout standard
Establishes one standard for each of three engineering dimensions on the
inner-loop HTTP/credential/SDK layer, and applies it. Good building blocks
already existed but were unused (get_logger had 0 callers; redact()/mask()
were auth-only).
Foundations (new, dependency-light leaves):
- agentkit/errors.py: single stdlib-only root AgentKitError. toolkit.errors
.AgentKitError and auth.errors.AuthError both reparent onto it, so a caller
can `except agentkit.errors.AgentKitError` to catch any AgentKit failure
while agentkit.auth stays free of any agentkit.toolkit import.
- agentkit/utils/http_defaults.py: single source of truth for timeout/retry
defaults + env vars (AGENTKIT_HTTP_TIMEOUT/RETRIES/STREAM_TIMEOUT), clamped.
- agentkit/utils/redact.py: redact()/mask() moved here; auth/_redact.py is now
a re-export shim. RedactionFilter installed on every log handler.
Logging: swap logging.getLogger()/idioms for get_logger(__name__) in the
scoped core modules; library stays silent-by-default.
Exceptions: wrap transport errors into NetworkError at the HTTP-owning layer;
typed ApiError (with optional error_code) for backend failures; always chain
with `from e`; `raise e` -> bare `raise`; runtime-validation asserts -> raises.
Secret-leak fixes: drop raw response/secret interpolation from identity/auth
(API key), utils/request, cr.py debug log, ve_sign check_error. request() now
re-raises instead of silently returning None on failure.
Timeouts: base_service_client reads http_timeout()/http_retries() instead of
hardcoded 30/30; cli_mount urlopen bounded via http_timeout().
Tests: +22 offline tests (hierarchy, http_defaults clamping, RedactionFilter,
_signed_request/_invoke_api error paths). Full suite: only the 1 pre-existing
failure on main (test_cli_add_harness env leak) remains; 0 new failures.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments