Skip to content

Commit 0a3711c

Browse files
bgagentclaude
andcommitted
fix(linear): annotate circuit breaker globals so ty doesn't narrow
`ty check` infers `_consecutive_auth_failures = 0` as `Literal[0]` and `_auth_circuit_open = False` as `Literal[False]`, which then rejects the legitimate runtime flips (and the test fixture that resets them between cases). Adding explicit `int` / `bool` annotations widens the inferred type and fixes the CI typecheck failure introduced in `f4633be`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a713c62 commit 0a3711c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

agent/src/linear_reactions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@
9898
#: 2xx response resets the counter. The lock guards the read-modify-write
9999
#: against the daemon sweep thread.
100100
_AUTH_FAILURE_THRESHOLD = 3
101-
_consecutive_auth_failures = 0
102-
_auth_circuit_open = False
101+
# Annotated explicitly so ty doesn't narrow the initial values to
102+
# `Literal[0]` / `Literal[False]` — that narrowing would reject the
103+
# legitimate flips below (and any test that resets them).
104+
_consecutive_auth_failures: int = 0
105+
_auth_circuit_open: bool = False
103106
_auth_state_lock = threading.Lock()
104107

105108

0 commit comments

Comments
 (0)