Files
opencode2api/internal/gateway
CheerC 6bb3487f7f fix(probe): give probes and the Playground bench their own identity (#162)
The hourly free-model probe presented one pinned identity: project
"opencode2api:default-project" together with a session derived from the
model name. The free tier meters per project id and egress, so every
deployment running the same probe shared one bucket; once a popular exit
had charged that bucket, every probe answered 429 FreeUsageLimitError and
the model was cached as unavailable for an hour while live traffic on the
same process and egress succeeded.

The Playground bench pinned a session indirectly: it sent no session
signal, so DeriveRequestIDs fell back to conversationSeed — the system
prompt plus the first user turn — and every click replaying the same
prompt produced the same session.

Neither path is a conversation, so neither should present one. Each now
mints fresh identity per attempt: a canonical session and a random project
id for the probe, a canonical session per Playground click. Canonical ids
are forwarded verbatim, so the scope mixin does not apply and the shape the
free tier accepts is what goes out.

Verified end to end with the admin UI enabled on a temporary instance.
Three Playground clicks before the change logged the same upstream session
three times (ses_ea4eb1680ffe0B8cZBh0nKJ03A); two clicks after logged
ses_eb2c888f1ffe4Y0DodMQdwvu6c and ses_ed8748efdffe2ez6IH352OdMpV, both
200. Probes on this build measured 8/8 probe_succeeded with a fresh
availability cache — they already succeeded on this exit before the change,
so this is hardening for the charged-bucket case in the report, not a
reproduction of it.
2026-10-29 21:40:31 +08:00
..