Skip to content

feat: Report the auto-configuration stream's health in the status resource - #870

Merged
keelerm84 merged 2 commits into
v8from
mk/SDK-3096/autoconfig-status
Sep 15, 2026
Merged

keelerm84 merged 2 commits into
v8from
mk/SDK-3096/autoconfig-status

Conversation

@keelerm84

@keelerm84 keelerm84 commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

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 connectionStatus looks 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:

"autoConfigStatus": {
  "state": "INTERRUPTED",
  "stateSince": 1757000000000,
  "lastError": { "kind": "ERROR_RESPONSE", "statusCode": 503, "time": 1757000000000 }
}

It reuses interfaces.DataSourceState and ConnectionErrorRep, matching v9, so the stream 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

v9 already has this field; v8 did not. Without it a failing stream shows up as a bare ERROR_RESPONSE with no way to tell a 401 from a 503, 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 VALID requires 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's failureGeneration/markValid mechanism; 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 autoConfigStatus to the Relay status JSON when running in automatic configuration mode, using the same DataSourceState / connectionStatus shape 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.

StreamManager now 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.

ConnectionErrorRep gains optional statusCode, populated for both the new auto-config block and existing per-environment lastError fields.

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.

…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
keelerm84 marked this pull request as ready for review September 15, 2026 19:05
@keelerm84
keelerm84 requested a review from a team as a code owner September 15, 2026 19:05
@keelerm84
keelerm84 merged commit 5c1e3ee into v8 Sep 15, 2026
17 checks passed
@keelerm84
keelerm84 deleted the mk/SDK-3096/autoconfig-status branch September 15, 2026 19:53
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants