GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(core): poll Console config every 5 minutes with jitter by hearnadam · Pull Request #66673 · anomalyco/opencode

Conversation

@hearnadam

@hearnadam hearnadam commented Nov 26, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Part 1 of 4 (split for smaller, independent reviews):

  1. fix(core): poll Console config every 5 minutes with jitter #66673 (this PR): 5-minute Console /v2/config poll interval with 0–1m additive jitter + policy docs
  2. fix(core): skip in-flight retries on warm SharedCache refreshes #66676 (independent, off dev): skip in-flight retries on warm SharedCache refreshes + 2 jittered cold retries
  3. fix(core): back off repeated SharedCache failures and honor Retry-After #66678 (follows & based on fix(core): skip in-flight retries on warm SharedCache refreshes #66676): SharedCache completion-based cooldown, consecutive transient failure backoff, and Retry-After
  4. fix(core): poll Console config hourly while signed out #66677 (follows & based on fix(core): poll Console config every 5 minutes with jitter #66673): exponential backoff for signed-out / 401 Console polls

Observed Problem

From Cloudflare Workers Observability on opencode-console-api-production (24h ending 2026-11-26 ~20:56 UTC):

  • GET /console/api/v2/config receives ~105.7M requests/day (~1,223 req/s, ~70% of all Console API traffic): 94.79M 200, 10.84M 401 (~10.3%), 37.2k 404, 25.4k 403, 2.2k 400, 1.0k canceled, and 500 bursts during PlanetScale stalls.
  • During PlanetScale stalls (e.g., 2026-11-25 07:40–07:55 UTC: 118 500s; 11:35:30–11:36:00 UTC: 260 500s; 11:48:00–11:48:30 UTC: 100 500s), Worker requests hang up to ~30s before returning 500.

Diagnosis

packages/core/src/plugin/provider/opencode.ts:227,577: every connected OpenCode process polls GET /api/v2/config on a fixed Duration.minutes(1) timer with no jitter (every other provider plugin uses SharedCache.interval = 10 minutes, and models-dev uses 5 minutes). Console MCP gateway tokens rotate daily with 24–48h validity, and MemberClient.observe only writes hourly, so nothing requires 60s background polling.

Changes

  • packages/core/src/plugin/provider/opencode.ts:
    • Raise the background Console config poll interval (and default load maxAge) from 1 minute to 5 minutes with 0–1 minute additive jitter (staying >= pollInterval so SharedCache never skips a wake-up as still fresh). Startup, account switches, and rejected-inference explain checks (30s freshness) remain immediate.
  • services/site/src/docs/content/policies.mdx: update the Console policy refresh note from "about once a minute" to "about every five minutes".
  • Tests: updated polling timing steps in packages/core/test/plugin/provider-opencode.test.ts, packages/core/test/plugin/provider-opencode-artifacts.test.ts, and packages/core/test/plugin/provider-opencode-watches.test.ts, and added a deterministic test verifying the 5-minute base interval plus 0–1m additive jitter.

No feature flag is added (per AGENTS.md, fixes do not require a flag).

Expected Impact

  • Cuts steady-state and database-stall GET /console/api/v2/config request volume by 5x (80% reduction, ~106M/day -> ~21M/day, ~1,223 -> ~245 req/s) and desynchronizes polling waves across clients.

Verification

  • bun run script/test.ts test/plugin/provider-opencode.test.ts test/plugin/provider-opencode-artifacts.test.ts test/plugin/provider-opencode-watches.test.ts in packages/core: 108 pass, 0 fail.
  • bun run script/test.ts test/plugin/provider-opencode.test.ts test/plugin/provider-opencode-artifacts.test.ts test/plugin/provider-opencode-watches.test.ts --rerun-each 10 --randomize in packages/core: 1,080 pass, 0 fail.
  • Verified the new jitter test goes red when jitter is removed.
  • bun typecheck and bun run typecheck:tsc in packages/core: passed.
  • Pre-push bun run check across all packages: passed.

Open Questions

  • Policy propagation SLA: Is 5 minutes acceptable for enterprise policy edits to reach already-running sessions (startup, account switch, and rejected inference still refresh immediately), or do we want a different cadence / server-controlled refresh hint?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot added the contributor label Nov 26, 2026
@hearnadam
fix(core): poll Console config every 5 minutes with jitter
2f0815d
@hearnadam
hearnadam force-pushed the console-config-poll branch from 70630c3 to 2f0815d Compare November 26, 2026 21:24
This was referenced Nov 26, 2026
fix(core): skip in-flight retries on warm SharedCache refreshes #66676
Open
fix(core): poll Console config hourly while signed out #66677
Draft
@hearnadam hearnadam changed the title fix(core): reduce Console config poll rate and avoid stall retry storms fix(core): poll Console config every 5 minutes with jitter Nov 26, 2026
@hearnadam
hearnadam marked this pull request as ready for review November 26, 2026 22:18
opencodejr[bot]
opencodejr Bot reviewed Nov 26, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues. The poll now waits 5 minutes plus 0–1 minute of jitter, picked again on every loop, so a wait is never shorter than the cache's freshness window. I checked this against how SharedCache times its entries (from when the load starts). I also worked through the worst cases for the test steps that count exact requests (6-minute steps, failure retries, the clock time drain adds), and they stay in step. The provider-opencode test files pass (108/108, and 285/285 on randomized reruns), and typecheck:tsc passes.

Public API is unchanged: only an internal timer and a docs sentence change.

One note inline, not blocking: account switches and new projects in the same process are not fully immediate.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/core/src/plugin/provider/opencode.ts

// Every project signed in to the same workspace shares one fetch, reused while it is younger than `maxAge`.
const load = Effect.fn("OpencodePlugin.load")(function* (maxAge: Duration.Input = Duration.minutes(1)) {
const load = Effect.fn("OpencodePlugin.load")(function* (maxAge: Duration.Input = pollInterval) {

@opencodejr opencodejr Bot Nov 26, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking, but this default is also what refresh() uses (startup and ProviderRefresh.onSwitch). So switching back to a workspace fetched within the last 5 minutes, or a second project starting in the same process, reuses a Console config/policy snapshot up to 5 minutes old (it was up to 1 minute). That doesn't quite match "account switches remain immediate" in the description. If switches should always see current policies, refresh() could pass a short maxAge (like explain's 30 seconds) and keep pollInterval for the timer only.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hearnadam
hearnadam merged commit 18c4f55 into anomalyco:dev Nov 26, 2026
22 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@hearnadam
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.