Proposal: Make multi-phase flows resumable + resilient (health checks, circuit breaker, checkpointing)
Summary
Multi-phase tasks (e.g., Generate Plan, verification, long agent chains) fail hard when an intermediate step crashes or the LLM endpoint hiccups.
On failure, Traycer restarts from scratch (repo discovery, indexing, etc.)
- causes redundant API calls and wasted compute. Please consider health checks, circuit breaking, and checkpointed resumes so work isn’t lost and retries are sane.
Environment
Traycer VSCode: 2.9.11-win32-x64
Editor: Cursor (Windows 11)
Workspace: large repo(s); sometimes on slower/remote storage
Symptoms in logs:
ripgrep process timed out / exited with code 2
SQLITE_BUSY + JSON parse errors on ReviewThreads/LostReviewThreads
PlanGenerationFailedError: The LLM provider is unavailable
Repro (typical)
Start Generate Plan on a large repo.
Traycer does N multi-step phases (discovery, indexing, agents run).
IO stalls (ripgrep timeout) or LLM transient outage occurs.
Task fails → UI resets → user must start over.
All prior progress is discarded; repeated runs spam the LLM/API and local indexers.
Actual behavior
No health checks before heavy phases.
No circuit breaker when IO/LLM is flaky.
No checkpoint/journaling → on failure, full re-run from phase 0.
Retries re-trigger the same expensive steps and API calls.
Expected behavior
Resilience:
Pre-flight health check (IO + LLM availability) before plan generation.
Circuit breaker: back off when ripgrep/SQLite/LLM are failing; show “degraded” mode instead of crashing.
Progress preservation:
Checkpointed phases: persist phase outputs (discovery results, partial indexes, agent reports).
On retry, resume from last good checkpoint, not from scratch.
Idempotent, bounded retries with exponential backoff and jitter.
Impact
User time lost; repeated cold-starts.
Excess API spend from redundant LLM calls.
Higher likelihood of DB corruption / flakiness due to hammering during degraded IO.
Proposed changes
1) Health checks (pre-flight + periodic)
IO check: small ripgrep probe with 2s timeout on repo root; if it times out, prompt to reduce scope or continue in degraded mode.
LLM check: /models (or light inference) with 2s timeout; surface provider status before kicking off multi-phase flows.
2) Circuit breaker
Trigger when any of:
≥3 ripgrep timeouts in 30s
SQLITE_BUSY streak > N
LLM 5xx/timeout > M in rolling window
Behavior:
Stop new LLM calls temporarily.
Allow local phases to proceed (or pause with UI notice).
Retry after exponential backoff (e.g., 5s, 15s, 45s).
.... See attached text file for code snippets and futher information.
Ran it though 5o just to make sure ti made sense
https://cdn.discordapp.com/attachments/1404541239319330927/1404541239470194832/message.txt?ex=689e3376&is=689ce1f6&hm=e0ec22d0cebae8bdc839104ec68cb9877b4bf3608500cef111d44c0c6f430a3f&