[proxy 11/13] resilience.py: per-backend circuit breaker with cooldown #15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Spec: this implements ONE small step of #2 (the locked reliability-proxy build, aosh leg 04). Do not redesign. Stay tightly scoped to this single step.
Before you start:
git checkout main && git pullso you build on the latest landed step.Extend
app/resilience.pywith a per-backend circuit breaker. Build on steps 09-10.dispatch_resilientskips that backend and goes straight to fallback. HALF-OPEN on cooldown expiry: one trial request decides re-close or re-open.app.obs.llm_circuit_state(0 closed / 1 open / 2 half-open), labelled by backend.Acceptance: a pytest trips the breaker with repeated failures (asserts gauge == open and the backend is skipped), then after a patched/short cooldown asserts it allows a trial.
When done:
pre-commit run --all-files(or the repo's gate) must pass, commit your work, and push to canonicalmain(this is an ephemeral feature container - finish the merge, do not leave it for a human).docs/FEATURES.mdfromplannedtolandedfor this feature, in the same push.ward agent engineer coilyco-flight-deck/agent-proxy#16 --driver goose🔒 Reserved by
ward agent --driver goose— containerengineer-goose-agent-proxy-15on host366b54d82a69is carrying this issue (reserved 2026-07-02T16:59:14Z). Concurrentward agentruns are blocked until it finishes or the reservation goes stale (2h0m0s TTL);--forceoverrides.— Goose, via
ward agent🔒 Reserved by
ward agent --driver claude— containerengineer-claude-agent-proxy-15on hostkais-macbook-pro-2.localis carrying this issue (reserved 2026-07-02T17:48:24Z). Concurrentward agentruns are blocked until it finishes or the reservation goes stale (2h0m0s TTL);--forceoverrides.— Claude (she/her), via
ward agent🔓 Reservation released by
ward container reap— containeragent-proxy(--driver claude) exited without launching the agent (smoke-test death, ward#222/#264), so the hold it took is retracted. A plainward agentretry no longer needs--force.— Claude (she/her), via
ward agent🔒 Reserved by
ward agent --driver claude— containerengineer-claude-agent-proxy-15on hostkais-macbook-pro-2.localis carrying this issue (reserved 2026-07-02T17:49:12Z). Concurrentward agentruns are blocked until it finishes or the reservation goes stale (2h0m0s TTL);--forceoverrides.The pre-flight judged this issue GO for an unattended run. Its justification:
pre-flight read (GO)
Context to front-load: Before my first edit I will read, in the fresh clone: (1)
app/resilience.pyin full — the existingdispatch_resilientdispatch/fallback flow and whatever failure-tracking or per-backend structures steps 09-10 landed, since I must extend not rewrite it; (2) theapp.obsmodule to learn how gauges/metrics are declared and labelled, sollm_circuit_statematches the existing observability wiring convention (Prometheus client style, label naming); (3) the existing test layout undertests/for the resilience suite, to match fixture/patch conventions (how cooldown/time is patched, how backends are stubbed); (4)docs/FEATURES.mdto find the exactplannedline to flip tolanded; (5) the repo gate (pre-commit/ward) config. These are all locatable from the issue's own references and I will actually read each before editing.Main risk: This step is explicitly built on steps 09-10, so the real unknown is whether those landed and left the expected seams (a per-backend failure counter, a
dispatch_resilientwith a clean fallback branch, and anobsgauge-registration pattern). If 09-10 are onmainthe work is mechanical and the acceptance test is straightforward (trip breaker → assert gauge==open + backend skipped → patch cooldown → assert half-open trial). The scope is small, reversible, self-contained, and fully verifiable by the specified pytest, with no destructive or external-facing action beyond the standard push-to-main this build cadence already uses.GO
— Claude (she/her), via
ward agentLanded. app/resilience.py carries the per-backend circuit breaker (closed/open/half-open with cooldown), the llm_circuit_state gauge is exported, and tests/test_circuit.py covers the trip-then-recover path. Closing as done.