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): back off repeated SharedCache failures and honor Retry-After by hearnadam · Pull Request #66678 · anomalyco/opencode

Conversation

@hearnadam

@hearnadam hearnadam commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Follows and is based on #66676 (shared-cache-retries). Only the top commit is new on top of #66676.

Observed Problem

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

  • During sustained PlanetScale stalls (e.g., 2026-11-25 07:40–07:55 UTC: 118 500s; 11:35:30–11:36:00 UTC: 260 500s), Worker requests hang up to ~30s before failing, and Console returns Retry-After: 60 on 429.

Diagnosis

packages/core/src/shared-cache.ts:

  1. Records last.time at load start rather than completion, so slow timed-out attempts eat into the cooldown window.
  2. Has no backoff across consecutive transient failures, so sustained outages keep probing at the full base cadence (and cold loads with repeated transient failures keep retrying in-flight).
  3. Ignores HTTP Retry-After response headers, retrying 429 immediately and ignoring server-requested cooldowns even when longer than the caller's interval.

Changes

  • packages/core/src/shared-cache.ts:
    • Record last.time at load completion on failure (keeping start time on success) so the full cooldown elapses after slow timed-out attempts.
    • Track consecutive transient failures per key and exponentially back off cooldown (1x -> 2x -> 4x -> ..., capped at 30 minutes, reset on success or non-transient failure, bypassed by force: true); skip cold-load in-flight retries once a key has already failed transiently.
    • Parse and honor HTTP Retry-After (delta seconds or HTTP date, clamped to 15 minutes), skipping fast cold-load retries when Retry-After is present.
  • Tests:
    • packages/core/test/shared-cache.test.ts: added tests for consecutive transient backoff + completion-based cooldown + recovery reset, and Retry-After handling (no fast retry, overrides shorter caller interval).
    • packages/core/test/plugin/provider-opencode.test.ts: extended the Console stall test to cover sustained-outage backoff and recovery.

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

Expected Impact

  • Cuts sustained outage / database-stall probe traffic exponentially (1x -> 2x -> 4x -> ..., up to 30m) and ensures clients respect 429 Retry-After.

Verification

  • bun run script/test.ts test/shared-cache.test.ts test/plugin/provider-opencode.test.ts test/plugin/provider-azure.test.ts test/plugin/provider-digitalocean.test.ts test/plugin/provider-github-copilot.test.ts in packages/core: 128 pass, 0 fail.
  • bun run script/test.ts test/shared-cache.test.ts test/plugin/provider-opencode.test.ts --rerun-each 10 --randomize in packages/core: 640 pass, 0 fail.
  • Verified both new SharedCache tests go red when cooldown backoff or retryAfterMs is disabled.
  • bun typecheck and bun run typecheck:tsc in packages/core: passed.
  • Pre-push bun run check across all packages: passed.

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 hearnadam mentioned this pull request Nov 26, 2026
fix(core): poll Console config every 5 minutes with jitter #66673
Merged
hearnadam added 2 commits November 26, 2026 19:27
@hearnadam
fix(core): skip in-flight retries on warm SharedCache refreshes
5b74c1b
@hearnadam
fix(core): back off repeated SharedCache failures and honor Retry-After
552fc6d
@hearnadam
hearnadam force-pushed the shared-cache-backoff branch from 7835fd3 to 552fc6d Compare November 27, 2026 03:33

This branch has not been deployed

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

Reviewers

No reviews

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.