Repository navigation
feat(gateway): add optional per-key proxy binding with fail-closed routing (#149) - #170
Merged
jasonxu114514 merged 1 commit intoNov 5, 2026
Conversation
…uting (fixes jasonxu114514#149) - Allow operators to associate Zen and Go credentials with configured proxy routes via optional proxy_bindings in config. - Keys are mapped to their 16-hex fingerprint during normalization so secrets are never stored twice or exposed in diagnostics. - Bound credentials fail closed: when their assigned proxy becomes unavailable, they do not silently migrate to other proxies or fall back to direct egress. - When an assigned proxy recovers, traffic resumes immediately without changing bindings. - Removed or invalid proxy references fail config validation, leaving the previous running runtime untouched on failed reloads. - Unbound configurations, anonymous routing, and session affinity continue to behave exactly as before. - Note in config documentation that binding to a #pool proxy endpoint pins the transport route and does not guarantee a static public egress IP. - Add unit and acceptance tests covering binding resolution, fail-closed isolation, persistence, and secret masking.
jasonxu114514
added a commit
that referenced
this pull request
Nov 5, 2026
#169 called anonymousNodes.CursorForOffset, warp.Pool.ReportWithRetryAfter and warp.Pool.HasUntriedActive without defining them, so main did not compile. Add the three methods: an attempt offset shifts the anonymous start node, a longer Retry-After extends the egress cooldown, and HasUntriedActive matches the pool's egress keys. Also: - rewrite title.go in house style: named limits, a prompt table, no issue numbers in comments, and a titleFallback helper shared by both lanes - document the held-back tool-call helpers in protocol/stream.go - gofmt internal/admin/server.go - drop the _test.go files from #169, #170 and #171
jasonxu114514
pushed a commit
that referenced
this pull request
Nov 5, 2026
Resolved against #170 so a relay pin clears the per-attempt WARP choice (attemptUseWARP). The relay list is now credential-redacted, and a pin may name a relay by its redacted URL.
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
Implements opt-in per-key proxy binding with fail-closed routing as requested in #149.
Key Capabilities
proxy_bindingsinconfig.jsonor WebUI config.Fingerprint(key). Raw secrets are never stored twice in configuration or exposed in diagnostics.proxy_bindingscontinue to use existing round-robin distribution and dynamic proxy rebinding without any behavioral change. Anonymous traffic is completely unaffected.#poolfragment pins requests to that proxy transport endpoint and does not guarantee a static public egress IP if the underlying provider rotates exits.Verification & Testing
Added comprehensive unit and acceptance tests covering all acceptance criteria from #149:
internal/config/binding_test.go:TestNormalizeProxyBindings_Valid: verifies canonicalization to fingerprint and raw key resolution.TestNormalizeProxyBindings_UnknownKeyRejected: verifies rejection of unknown credential references.TestNormalizeProxyBindings_UnknownProxyRejected: verifies rejection of unknown proxy references.TestNormalizeProxyBindings_SecretNotExposedInJSON: verifies raw secrets never leak intoproxy_bindingsserialization.TestNormalizeProxyBindings_ReorderingKeysPreservesBindings: verifies stability across key reordering.TestClone_PreservesProxyBindings: verifies config cloning isolation.internal/gateway/binding_test.go:TestNodePool_PerKeyBinding: verifies bound vs unbound assignment, fail-closed non-migration during proxy outage, and immediate resumption on proxy recovery.TestNodePool_ReorderingKeysPreservesBindings: verifies binding persistence regardless of array order.TestKeyStatuses_ReportsBoundFieldWithoutSecrets: verifiesBound: truereporting in diagnostics with masked IDs and zero secret exposure.TestGateway_BoundKeyFailsClosed: verifies end-to-end fail-closed routing in Gateway instance.TestGateway_AnonymousUnaffectedByBindings: verifies anonymous pool independence.go test -count=1 -v ./...: PASS.go vet ./...: Clean.go build ./cmd/opencode2api: Clean.