feat: support Codex/PI session headers for session affinity

Amp-Thread-ID: https://ampcode.com/threads/T-019dce25-c070-773a-ac52-11c541220b30
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
XYenon
2026-04-27 17:08:49 +08:00
parent 34027da7f1
commit 3ac39dcc7d
4 changed files with 91 additions and 15 deletions
+3 -1
View File
@@ -226,7 +226,9 @@ type RoutingConfig struct {
// SessionAffinity enables universal session-sticky routing for all clients.
// Session IDs are extracted from multiple sources:
// X-Session-ID header, Idempotency-Key, metadata.user_id, conversation_id, or message hash.
// metadata.user_id (Claude Code session format), X-Session-ID, Session_id (Codex),
// X-Amp-Thread-Id (Amp CLI thread), X-Client-Request-Id (PI), metadata.user_id,
// conversation_id, or message hash.
// Automatic failover is always enabled when bound auth becomes unavailable.
SessionAffinity bool `yaml:"session-affinity,omitempty" json:"session-affinity,omitempty"`