◉CLAUDE LABJP
●2.1.296 — Subagents can set their own autoCompactWindow, and an env var pins the model used by workflow agents●AGENTS — Managed Agents gain dynamic workflows in beta: an agent can build a run for work with many pieces (Oct 9)●SONNET 4.5 — Retires on the Claude API on 11/30, 48 days left. Migrate to Sonnet 5.5●Q&A — A write-up shows how to stop a streaming call midway so a closed tab stops being billed●WORKTREE — Running claude --worktree on one repo in parallel: what to settle first, as one write-up lays it out●NEW — Stop making it reread the whole notes file: look up one section by number●2.1.296 — Subagents can set their own autoCompactWindow, and an env var pins the model used by workflow agents●AGENTS — Managed Agents gain dynamic workflows in beta: an agent can build a run for work with many pieces (Oct 9)●SONNET 4.5 — Retires on the Claude API on 11/30, 48 days left. Migrate to Sonnet 5.5●Q&A — A write-up shows how to stop a streaming call midway so a closed tab stops being billed●WORKTREE — Running claude --worktree on one repo in parallel: what to settle first, as one write-up lays it out●NEW — Stop making it reread the whole notes file: look up one section by number
Articles/Claude.ai
◉ Claude.ai/2026-07-11Advanced

When a Connector Starts Slowing Down at Night: A Health-Aware Circuit Breaker for Solo Automation

Seeing connector errors and latency is only half the job — the other half is deciding when to route around them. This is my implementation of a circuit breaker that opens on error rate and p95, with runnable Python and notes on wiring it into nightly jobs.

MCP54connectors3circuit-breaker4automation109indie-dev14

✦ Premium Article

The week after I added instrumentation, the same connector started slowing down again.

Last time it had failed silently for two nights before I noticed. This time it wasn't erroring at all — the latency just crept upward. The p95 climbed from its usual 900ms to somewhere near 12,000ms. The nightly job wasn't crashing, but every single item was clinging to the edge of a timeout. The logs made the trouble obvious. But that night, I was asleep.

Seeing a number and acting on a number turned out to be two different things. Observability gave me a dashboard, yet without someone at the wheel when the needle swings into the red, the run just keeps stacking up the same failure until dawn. This time I wanted the "turning the wheel" part to run on its own, with no one watching.

The instrumentation itself I wrote up earlier, in bringing nightly connector observability into a solo setup. This piece is the sequel: turning those collected signals into a decision about whether to route around the connector.

Plain retries backfire on a slow night

The first thing I reached for was a naive retry. On failure, wait a moment and call again. That works when the failure mode is a hard error. But when a connector fails the way this one did — slow instead of down — retrying made things worse.

If a call clings on for 12 seconds and then fails, and you retry three times, you've burned 48 seconds on that one item. When you're running dozens of items in sequence overnight, everything downstream gets pushed out, and the whole night's batch quietly comes up empty. The harder you push against a slow connector, the more you drag perfectly healthy downstream work down with it.

What I needed wasn't a "keep trying" decision but a "stay away for now" decision. While the connector is unwell, hold back the calls, divert the work to a fallback, and ease back in to check once there's a sign of recovery. That is exactly the old idea of a circuit breaker. I decided to slip one of these breakers into my solo nightly jobs.

Three signals for measuring health

Whether to open the breaker is decided from three numbers taken over a recent observation window (I use 15 minutes).

SignalMeaningMy starting threshold
Error rateFailures / total calls within the windowOpen above 0.5
p95 latencyThe practical ceiling, dropping the slowest 5%Open above 8,000ms
Minimum samplesHold off deciding below this count8 calls

Watching p95 rather than the mean was the crucial part. When most responses are fast, the mean dilutes the slow ones and hides the state where only a fraction are near timeout. On the night above, the mean sat comfortably around 3 seconds while the p95 had reached 12. The p95 is the more honest way to capture a heavy tail.

The minimum-sample floor exists so I don't jump to conclusions on the first few calls. Nightly jobs tend to be shaky right after they start, and if the first two happen to be slow, tripping the breaker there would shut out a perfectly healthy connector.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦If a slowing connector has been quietly wasting your nightly runs until morning, you'll be able to decide automatically — from error rate and p95 — whether to route around it right now
✦You'll get the Closed / Open / Half-Open three-state machine and its rolling window as Python you can copy and run as-is
✦You'll learn how to carry connector health across process boundaries in scheduled jobs, and to confirm recovery without trusting a single lucky success
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

Related Articles

◉ Claude.ai2026-05-04
Claude Desktop in 2026 — Projects, MCP, and Extended Thinking in Daily Use
Notes from using Claude Desktop daily as an indie developer — when Projects, MCP, extended thinking, and Computer Use actually pay off, and how the desktop app compares to the web version in 2026.
⟐ Claude Code2026-07-27
Whose Environment Expands That Variable? Fingerprinting Your Effective Managed MCP Policy
Variable references in the Managed MCP allowlist and denylist now resolve from the startup environment and the managed-settings env block. I rebuilt both resolution orders locally to see where verdicts diverge, then wrote a preflight check that reduces the effective policy to a comparable fingerprint.
⬡ API & SDK2026-05-16
Automating Multilingual App Review Replies with Claude API — Living with the App Store's Undocumented Limits
An indie developer running a portfolio of wallpaper and healing apps shares the full implementation of Claude API-powered multilingual review reply automation — including App Store's undocumented 8-second rule, session limits, and the three traps that can get you banned.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links