feat(ops): track broker balance worker failure lifecycle and backoff

Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-09-12 13:33:12 +00:00
committed by GitHub
co-authored by genichin
parent 59bb492883
commit 084e05a97d
9 changed files with 453 additions and 27 deletions
+5 -2
View File
@@ -52,10 +52,11 @@ class AccountSnapshotUnavailable(RuntimeError):
"read_failed",
})
def __init__(self, code: str) -> None:
def __init__(self, code: str, *, detail_code: str | None = None) -> None:
if code not in self._CODES:
raise ValueError(f"unsupported account snapshot error code: {code}")
self.code = code
self.detail_code = detail_code
super().__init__(f"account snapshot unavailable ({code})")
@@ -217,7 +218,9 @@ class AccountSnapshotService:
return self._broker.get_balance()
except BrokerBalanceError as exc:
if exc.code != "transport_failed":
raise AccountSnapshotUnavailable("live_read_failed") from None
raise AccountSnapshotUnavailable(
"live_read_failed", detail_code=exc.code
) from None
snapshot = self._load_current()
age = self._age(snapshot.holdings_captured_at, self._sell_max_age)
_log.warning(