Implement failure handling so recovery is (1) bounded, (2) never hangs indefinitely, and (3) has explicit validation + deterministic fallback.
Apply this when adding retries, polling for readiness, or supporting boundary-specific execution paths:
// Pattern: on known limit failure, retry with bounded cost by adjusting quota.
match err {
ExceededMaxFileLimit => {
// Retry only what’s needed at shallow depth; avoid consuming the global quota again.
entry.build_tree(max_depth = 1, remaining_file_quota = None)?;
}
other => return Err(other.into()),
}
let ready = tokio::time::timeout(Duration::from_secs(30), wait_for_ready()).await;
match ready {
Ok(Ok(())) => {}
Ok(Err(e)) => return Err(e),
Err(_) => return Err(anyhow::anyhow!("Timed out waiting for follow-up session readiness")),
}
Explicit validation and fallback: for boundary-specific spawning (WSL/MSYS2/remote/local) validate required arguments up front and ensure unsupported paths fail predictably (graceful unsupported-shell fallback) rather than relying on implied behavior.
Enter the URL of a public GitHub repository