Repository navigation
feat(core): keep web search providers sticky per session - #47334
Merged
Merged
Conversation
ilya-bogin-keenable
added a commit
to keenableai/opencode
that referenced
this pull request
Sep 8, 2026
Follow anomalyco#47334: release the rate-limited HTTP request before its error is cached, and join the abort-signal test that enumerates the bundled providers.
ilya-bogin-keenable
added a commit
to keenableai/opencode
that referenced
this pull request
Sep 18, 2026
Follow anomalyco#47334: release the rate-limited HTTP request before its error is cached, and join the abort-signal test that enumerates the bundled providers.
jinhuang712
pushed a commit
to jinhuang712/opencode
that referenced
this pull request
Sep 26, 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.
Issue for this PR
User-requested improvement; no linked issue.
Type of change
What does this PR do?
Makes the existing
websearch.provider: "random"mode sticky per session: pick a random provider on the first search, keep using it, and retain a replacement after HTTP 429. Concurrent failures reuse the session's healthy replacement. Cooldowns honorRetry-Afteror default to 60 seconds. Each provider is attempted at most once per query; searches fail promptly when all providers are cooling down.Keeps the existing configuration name, permissions, consent, and provider labels. Fixed/explicit providers do not fail over. Preferred providers are session-local; cooldowns remain shared per Location. API/plugin callers without session context retain Location affinity. Ordinary default inspection does not select or change affinity.
In the TUI, a live retry transitions just the provider name with a short fade-through instead of abruptly replacing it. First paint, new calls, completion-only changes, and loading history do not start animations. The label and metadata still identify the actual provider. Animations stop when a row leaves view and respect the existing animation setting.
The trusted tool context supplies the session ID through an internal option. Affinity stays in memory and is cleaned up on session deletion/movement or Location disposal; moving a session resets its preference. No new public API or durable schema changes, and no new generated-file changes for the scope update.
Includes concurrent-failover and consent regression fixes, scoped HTTP cleanup, shared HTTP test helpers, docs, and regenerated clients/OpenAPI. Regeneration also picks up existing compaction fields missing from the checked-in OpenAPI snapshots.
How did you verify your code works?
websearch.test.ts,tool-websearch.test.ts,config/websearch.test.ts, andplugin/websearch.test.ts, including independent peers, shared cooldowns, concurrent initial/fallback routing, late successes, and in-flight cleanup on deletion/movement.Screenshots / recordings
Private Drive recordings cover session affinity and the retry-only provider-name transition at normal and narrow widths. Initial rendering, ordinary calls, completion, and reopened history remain unanimated. Core routing and metadata are unchanged by the animation.
Separate follow-up
Cooldowns are still keyed only by provider ID. Credential changes do not explicitly invalidate them in this module (code review only, not runtime-verified). A focused follow-up should invalidate the affected provider's cooldown on an active-credential change and add a regression test; this PR does not expand into credential handling.
Checklist