feat: sticky session for conversation continuity (#162 by @you922)
* feat: sticky session for multi-turn conversation continuity Add account/sticky-session.js module that binds (callerKey, modelKey) to a specific upstream account so multi-turn conversations stay on the same account throughout their lifetime. Without this, the pool selects a different account for every request and the cascade_id from the previous turn becomes invalid — context is lost mid-task. Integration: - auth.js getApiKey() now accepts optional callerKey and checks sticky binding before falling through to normal pool selection - chat.js handler calls setStickyBinding() after successful response completion, binding the caller to the account that just handled their last message Configuration (opt-in): STICKY_SESSION_ENABLED=1 # default: 0 (off) STICKY_SESSION_TTL_MS=1800000 # default: 30 minutes STICKY_SESSION_MAX=10000 # default: 10000 max bindings Fixes: #93, #133 (context loss mid-task) * fix: add sticky binding in streaming response path (Oracle review) The sticky session binding was only set in nonStreamResponse, missing the primary streaming path used by Claude Code, Cursor, and all OpenAI stream:true clients. Added setStickyBinding call in streamResponse success path (after poolCheckin, guarded by isStickyEnabled()). --------- Co-authored-by: Chen Jiangjiang <chenjiangjiang@kt51.cc>
Y
you922 committed
dd6e1bf46cc9536cf811ec38df5a604f24c33a79
Parent: 81e249b
Committed by GitHub <noreply@github.com>
on 5/12/2026, 2:47:12 AM