feat: Report the auto-configuration stream's health in the status resource - #870
Merged
Merged
Conversation
…ource v9 reports this and v8 does not, so a Relay Proxy whose auto-configuration key has been rejected reports itself healthy: every environment it already knows about is fine, and the stream's state appears nowhere in the status document. The only signal is a log line. Back-port v9's shape rather than inventing one. The stream reuses interfaces.DataSourceState and ConnectionErrorRep, so it reports the same states and error kinds as the per-environment connectionStatus and a reader only has to learn one vocabulary. ConnectionErrorRep gains the HTTP status code, which v9 already had. Without it a rejected stream showed up as a bare error kind with no way to tell a 401 from a 503. The per-environment error carries it too, so the field is not half populated. An interruption while the stream has never connected keeps the initializing state, matching the SDK data source status: a first connection that never succeeded must not report that it was once working. Reporting VALID takes a handled event, not a connection. Dispatching an event creates environments, starts SDK clients and writes the cache, and the connection can die while that runs, so the failure count is read before the dispatch and success is recorded only if nothing failed in the meantime. A rejected key reports OFF here, because on this line the stream stops and the process exits. The auto-configuration retry work stacked on top of this changes that to an interruption, since the stream then keeps trying.
The test handed the harness an initial event, which the stream delivers as soon as it connects. Asserting that the state is still initializing right after the connection therefore depended on beating the supervisor goroutine to the dispatch, and CI lost that race on one job of the matrix. Start the stream with nothing queued instead, read the state, and only then enqueue the event. Nothing can mark the stream valid before the event exists, so the assertion no longer depends on timing.
keelerm84
marked this pull request as ready for review
September 15, 2026 19:05
jsonbailey
approved these changes
Sep 15, 2026
keelerm84
pushed a commit
that referenced
this pull request
Sep 17, 2026
🤖 I have created a release *beep* *boop* --- ## [8.22.0](v8.21.0...v8.22.0) (2026-09-16) ### Features * Adopt go-server-sdk v7.17.0 so an upstream 401 retries ([#856](#856)) ([e152af7](e152af7)) * Back off big segment synchronization on a rejected SDK key ([#857](#857)) ([6ede85b](6ede85b)) * Classify transport failures as normal, including certificate failures ([#873](#873)) ([c3b6850](c3b6850)) * Keep retrying a rejected auto-configuration key ([#866](#866)) ([4bf3bb9](4bf3bb9)) * Report the auto-configuration stream's health in the status resource ([#870](#870)) ([5c1e3ee](5c1e3ee)) ### Bug Fixes * **autoconfig:** refresh stored environment defaults on update (SEC-9484) ([#842](#842)) ([e04e3e2](e04e3e2)) * **deps:** bump golang.org/x/crypto to v0.55.0 for CVE-2026-56854 ([#848](#848)) ([360d624](360d624)) * **deps:** bump golang.org/x/crypto to v0.56.0 for CVE-2026-78662 and CVE-2026-56855 ([#854](#854)) ([6d5d346](6d5d346)) * **deps:** bump supported Go versions to 1.27.0 and 1.26.7 ([#837](#837)) ([9b4fb46](9b4fb46)) * **deps:** bump supported Go versions to 1.27.1 and 1.26.8 ([#852](#852)) ([4b06ed6](4b06ed6)) * emit Vary: Origin on CORS responses (SEC-9501) ([#844](#844)) ([78a8f05](78a8f05)) * Report an incomplete DynamoDB auto-config cache write ([#874](#874)) ([0964dc0](0964dc0)) * **security:** redact all credential-bearing URL components in status dbServer ([#846](#846)) ([20effc5](20effc5)) * **streams:** treat a nil replay result as no event instead of panicking ([#845](#845)) ([7d7eace](7d7eace)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Summary
A back-port of v9's auto-configuration status reporting, so the two lines report the same thing the same way.
v8's status resource says nothing about the auto-configuration stream. A Relay Proxy whose auto-configuration key has been rejected therefore reports itself healthy: every environment it already knows about is fine, per-environment
connectionStatuslooks normal, and the stream's own state appears nowhere in the document. The only signal an operator has is a log line.This adds
autoConfigStatus, present only in automatic configuration mode:It reuses
interfaces.DataSourceStateandConnectionErrorRep, matching v9, so the stream reports the same states and error kinds as the per-environmentconnectionStatusand a reader only has to learn one vocabulary.ConnectionErrorRepgains the HTTP status codev9 already has this field; v8 did not. Without it a failing stream shows up as a bare
ERROR_RESPONSEwith no way to tell a401from a503, which is exactly the distinction an operator needs. It is populated for the per-environment error as well, not only the new one, so the field is not half-filled.Two behaviors worth reviewing
An interruption while the stream has never connected keeps
INITIALIZING. This matches the SDK data source status: a first connection that never succeeded must not report that it was once working. The error is still recorded, so the reason is visible.Reporting
VALIDrequires a handled event, not a connection. Dispatching an event creates environments, starts SDK clients and writes the cache, and the connection can die while that runs — so an event is not by itself evidence the stream still works. The failure count is read before the dispatch and success recorded only if nothing failed in the meantime. This is v9'sfailureGeneration/markValidmechanism; I would not have arrived at it independently.Scope
Stream behavior is unchanged. A rejected key still reports
OFF, because on this line the stream stops and the process exits.The auto-configuration retry work (#866) is stacked on top of this and changes that one state to an interruption, since the stream then keeps trying instead of giving up. That PR had grown its own ad-hoc version of this reporting; it has been dropped in favour of v9's shape, and splitting it out here keeps both diffs to one idea each.
Note
Overview
Adds
autoConfigStatusto the Relay status JSON when running in automatic configuration mode, using the sameDataSourceState/connectionStatusshape as per-environment streams so operators can see when Relay has stopped learning new environment config (e.g. rejected key or stream errors) even if existing envs still serve flags.StreamManagernow tracks connection state (initializing, valid, interrupted, off), records failures with HTTP status codes where applicable, and only moves to VALID after an SSE event is fully handled—via a failure-generation check so a disconnect during dispatch cannot falsely report a healthy stream. Interruptions before the first successful event stay INITIALIZING, matching SDK data-source semantics.ConnectionErrorRepgains optionalstatusCode, populated for both the new auto-config block and existing per-environmentlastErrorfields.Unit tests cover valid-after-event, HTTP 503/401 handling, and terminal OFF on close or bad key.
Reviewed by Cursor Bugbot for commit 69aa10c. Bugbot is set up for automated code reviews on this repo. Configure here.