Repository navigation
Announce the two state changes that had no event - #17
Merged
Merged
Conversation
Every event on the bus so far has hung off a request. Two pieces of
state that the UI displays do not, and the only way to observe them was
to ask for the whole picture again on a timer:
· a provider's breaker opening or closing — reachable only by
re-reading /overview, which returns the entire configuration
· a file on the client config face changing — reachable only by
re-scanning the user's home directory
A desktop client watching those had no choice but to poll. On an idle
gateway that is a question asked over and over about something nobody
touched, and the answer has to be diffed by the caller to find out
whether anything happened at all.
HealthChanged reports only transitions, never every failure — a caller
subscribing to it wants "what changed", not a second request stream.
The breaker now returns its state change from record_success and
record_failure, so the decision about what counts as a change lives
with the thing that knows: a failure while already open is not one,
and a failure after the cooldown ran out is, because the interval in
between really was "allowed to try again".
Recovery gets its own timer. It is the one transition no call triggers
— the cooldown simply runs out — and without it a client would show
"tripped" until some request happened to hit that provider again. The
timer re-checks before it speaks, so a provider that recovered early
(or tripped again) is not announced twice.
ClientsChanged is deliberately not ScanAlert. That one means "something
suspicious appeared" and is worth interrupting someone over; this one
means "those files moved" and is worth a quiet refresh. Editing
ANTHROPIC_BASE_URL back to its original value is not suspicious, but a
client that has adopted the gateway needs to notice.
Neither event is recorded to storage: both describe what is true now,
and that table holds what happened.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Thanks for the PR. One thing before review: this targets
No need to close and reopen: click Edit next to the PR title and change the base branch to See CONTRIBUTING.md and CONTRIBUTING.md for the branch contract. |
This was referenced Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds two events to the bus:
HealthChanged(a provider's breaker opened or closed) andClientsChanged(a file on the client config face moved).Why
Every event so far hangs off a request. These two pieces of state do not, so a desktop client displaying them had no way to learn about a change except to ask for the whole picture on a timer —
/overviewreturns the entire configuration, and the clients list means re-scanning the user's home directory. On an idle gateway that is the same question asked over and over, with the caller diffing the answers to find out whether anything happened.Notes
HealthChangedreports transitions only.Health::record_success/record_failurenow return the state change, so what counts as one lives with the code that knows: a failure while already open is not a change; a failure after the cooldown expired is, because the interval in between really was "allowed to try again".ClientsChangedis notScanAlert: that one means "something suspicious appeared" and interrupts; this one means "those files moved" and prompts a quiet refresh.Gates
cargo fmt --all -- --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace(61 binaries green),./scripts/smoke.sh(46 passed, 0 failed).🤖 Generated with Claude Code