[claude] Implement graceful degradation test scenarios (#919) #1291

Merged
claude merged 1 commits from claude/issue-919 into main 2026-03-24 01:49:58 +00:00

1 Commits

Author SHA1 Message Date
Alexander Whitestone
b10afc0676 test: add graceful degradation test scenarios (#919)
Some checks failed
Tests / lint (pull_request) Failing after 22s
Tests / test (pull_request) Has been skipped
Implements the missing test coverage called out in issue #919. Creates
tests/infrastructure/test_graceful_degradation.py covering:

* Ollama health-check failure modes (connection refused, timeout, HTTP 503/500, generic exception)
* requests library unavailable → optimistic availability for Ollama and vllm-mlx
* End-to-end cascade: Ollama fails → Anthropic/cloud fallback used
* Circuit-breaker lifecycle: CLOSED → OPEN (threshold failures) → HALF_OPEN (recovery timeout) → CLOSED (test successes)
* Disabled provider skipped without touching circuit state
* All providers fail → RuntimeError listing individual provider errors
* ClaudeBackend: no key / API error → graceful degraded messages; health_check
* GrokBackend: no key / API error → graceful degraded messages; health_check
* Chat store: SQLite directory auto-creation, concurrent-write safety, pruning, ordering

Fixes #919

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 21:49:03 -04:00