Repository navigation
fix(probe): give probes and the Playground bench their own identity - #162
Merged
jasonxu114514 merged 1 commit intoOct 29, 2026
Merged
Conversation
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.
This was referenced Oct 29, 2026
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.
What
Two identity paths that were never conversations stop presenting one:
internal/gateway/probe.go— the hourly free-model probe now sends a fresh canonical session and a random project id per probe instead ofproject = "opencode2api:default-project"plussession = CanonicalSessionID("availability:" + model).internal/admin/debug.go— the Playground bench now setsx-opencode-sessionto a fresh canonical session per click.Why
The free tier meters per project id × egress, and a pinned session reads as one continuous conversation. Both paths therefore reused a single bucket:
429 FreeUsageLimitErrorand cached the model unavailable for an hour while live traffic on the same process and egress succeeded;DeriveRequestIDsfell back toconversationSeed— system prompt plus first user turn. Replaying the same prompt on every click produced the same session forever.Neither path benefits from reuse: the probe result is cached for the next interval, and a Playground click is one-shot. Canonical ids are forwarded verbatim, so the scope mixin does not apply and the id that goes out already has the shape the free tier accepts.
Verification
Temporary instance with the admin UI enabled, login → CSRF →
POST /api/debug/inferencewith the same body each time, sessions read from therequest_routedlog line:ses_ea4eb1680ffe0B8cZBh0nKJ03A×3ses_eb2c888f1ffe4Y0DodMQdwvu6c,ses_ed8748efdffe2ez6IH352OdMpVAll clicks returned
200on this exit both before and after — the bucket was not charged today, which is consistent with the report: the failure appears once the shared bucket is charged. Probes on this build measured 8/8probe_succeededwith a freshly deleted availability cache, also 8/8-would-be before it, so this change is hardening for the case in the issue rather than a reproduction of it.go build ./...,go vet ./...,go test ./...pass. Coverage:internal/gateway/probe_test.gopins fresh, complete and canonical probe identity;internal/admin/debug_test.gopins a fresh canonical session per bench click.Notes
DeriveRequestIDsstill derives one session per conversation fromconversationSeed, which is what keeps a multi-turn conversation on one session and one prompt cache.Closes #156.