mirror of
https://github.com/jasonxu114514/opencode2api.git
synced 2026-12-05 08:02:53 +00:00
CanonicalSessionID re-encodes a conversation signal from the server key and the seed alone, so the upstream `x-opencode-session` was identical in every process on the same UTC day. The free tier keeps charging that session, so after a 429 a gateway restart no longer changed anything upstream: the same `ses_…` walked into the new exit's bucket and 429'd again. Mix a 16-byte nonce, minted once per process, into the hash. A running gateway still derives one stable session per conversation, while a restart re-mints the ids and starts a fresh upstream identity. Official client sessions are still forwarded verbatim. Refs #159, #158