fix: harden managed readiness status#195
Merged
Merged
Conversation
Managed proxies previously ran with no management server at all, and a proxy served requests with whatever pipeline it had - including the empty pre-first-sync pipeline - passing placeholder credentials upstream un-transformed. - allow management.listen in managed mode: it now serves GET /v1/status (the applied control-plane state: config hash, principal, last sync) and POST /v1/sync (request an immediate out-of-band sync). /v1/reload stays standalone-only since there is no file to re-read. - IRON_MANAGEMENT_LISTEN env override, matching the other IRON_* vars. - the sync poller records a status snapshot (config_hash, principal_id, principal_status, synced_once, last_sync_at) and accepts a non-blocking Poke() that wakes the poll loop early. - fail closed during startup: proxy.Options.Ready gates request handling with 503 until the first control-plane config has been applied, so a freshly started or restarted managed proxy can never leak placeholder credentials to upstream APIs. The motivating incident: a sandbox control plane reassigned a proxy's principal and routed traffic immediately; the first LLM call beat the proxy's next 5s sync poll by ~350ms and went upstream with a placeholder key (401). With this change the control plane can POST /v1/sync and poll GET /v1/status until principal_id matches before routing traffic. Amp-Thread-ID: https://ampcode.com/threads/T-019eb82e-5bc9-707f-9d5c-cdb6c9d16926 Co-authored-by: Amp <amp@ampcode.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.
Builds on PR #190 and keeps the original managed-mode API commit in history, then hardens the readiness and status behavior found during review. Failed sync applies no longer advance applied status, readiness denials now audit consistently, and the fail-closed gate covers HTTP, tunnels, and SNI-only passthrough. Validated with
go test ./....