-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
switch_context retries on all errors, including permanent failures, because its retry predicate is unconditional.
Affected code
src/kubernetes/client.rs(switch_contextusesretry_with_backoffwith|_: &anyhow::Error| true)
Problem
Current behavior retries permanent errors (config/auth/validation) the same as transient network errors. This causes avoidable delay, log noise, and poorer UX.
Why this matters
- Slower fail-fast behavior in REPL/CLI context switching.
- Misleading retry logs for non-retryable failures.
- Unnecessary delay in scripts/automation.
Proposed fix
- Add retry classification for
switch_contextpath:- retry only transient failures (timeouts, transport errors, 429/5xx, temporary unavailability)
- do not retry permanent failures (invalid context, auth/RBAC, deterministic config errors)
- Keep exponential backoff for retryable classes.
- Improve logging to indicate retryable vs non-retryable decision.
Tests to add
- Permanent error case: verify no retries (or minimal retries as explicitly intended).
- Transient error case: verify retries occur and respect max attempts.
- Ensure final aggregated error reporting remains clear across multiple contexts.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels