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(sdk,core): prevent unrecoverable "Failed to fetch" on long sessions · Krypto-Whitehat/opencode@14a6c83

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • core/src/util
      • retry.ts
    • sdk/js/src
      • client.ts
      • v2
        • client.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/core/src/util/retry.ts‎

Copy file name to clipboardExpand all lines: packages/core/src/util/retry.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function isTransientError(error: unknown): boolean {
2525
}
2626

2727
export async function retry<T>(fn: () => Promise<T>, options: RetryOptions = {}): Promise<T> {
28-
const { attempts = 3, delay = 500, factor = 2, maxDelay = 10000, retryIf = isTransientError } = options
28+
const { attempts = 5, delay = 1000, factor = 2, maxDelay = 30000, retryIf = isTransientError } = options
2929

3030
let lastError: unknown
3131
for (let attempt = 0; attempt < attempts; attempt++) {
Collapse file

‎packages/sdk/js/src/client.ts‎

Copy file name to clipboardExpand all lines: packages/sdk/js/src/client.ts
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ function rewrite(request: Request, directory?: string) {
3333
export function createOpencodeClient(config?: Config & { directory?: string }) {
3434
if (!config?.fetch) {
3535
const customFetch: any = (req: any) => {
36+
// Use a 5-minute timeout instead of disabling it entirely.
37+
// Disabling the timeout causes fetch to hang forever when the backend
38+
// becomes unresponsive, leading to unrecoverable "Failed to fetch" errors
39+
// in the renderer (see #28702).
3640
// @ts-ignore
37-
req.timeout = false
41+
req.timeout = 300_000
3842
return fetch(req)
3943
}
4044
config = {
Collapse file

‎packages/sdk/js/src/v2/client.ts‎

Copy file name to clipboardExpand all lines: packages/sdk/js/src/v2/client.ts
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,12 @@ function rewrite(request: Request, values: { directory?: string; workspace?: str
4747
export function createOpencodeClient(config?: Config & { directory?: string; experimental_workspaceID?: string }) {
4848
if (!config?.fetch) {
4949
const customFetch: any = (req: any) => {
50+
// Use a 5-minute timeout instead of disabling it entirely.
51+
// Disabling the timeout causes fetch to hang forever when the backend
52+
// becomes unresponsive, leading to unrecoverable "Failed to fetch" errors
53+
// in the renderer (see #28702).
5054
// @ts-ignore
51-
req.timeout = false
55+
req.timeout = 300_000
5256
return fetch(req)
5357
}
5458
config = {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — 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.