Skip to content

provider.*.options.timeout config is not applied to API requests #30252

Closed as not planned

Description

@mormubis

Summary

provider.anthropic.options.timeout is documented as configurable via OPENCODE_CONFIG_CONTENT but the Go server does not apply it. API requests always time out at 300s (5 minutes) regardless of the config value.

Reproduction

import { createOpencode } from "@opencode-ai/sdk";

async function main() {
  const start = Date.now();
  const elapsed = () => `${((Date.now() - start) / 1000).toFixed(1)}s`;

  const opencode = await createOpencode({
    config: {
      provider: {
        anthropic: { options: { timeout: 600000 } }, // 10 minutes
      },
    },
    port: 0,
    timeout: 30_000,
  });

  const session = await opencode.client.session.create({
    body: { title: "timeout-test" },
  });
  const sessionId = session.data!.id as string;

  try {
    await opencode.client.session.prompt({
      body: {
        parts: [{ text: "Use the bash tool to run: sleep 360 && echo done\n\nDo NOT use pty_spawn. Wait for the command to complete.", type: "text" }],
      },
      path: { id: sessionId },
    });
    console.log(`[${elapsed()}] Completed`);
  } catch (error) {
    console.log(`[${elapsed()}] Failed: ${error}`);
  }
}

main();

Expected

The session should survive past 5 minutes since timeout: 600000 (10 min) is set.

Actual

TypeError: fetch failed at exactly 302-303 seconds every time.

Tested values

Config Result
timeout: false Fails at 302.9s
timeout: 600000 Fails at 302.5s
timeout: 600000 + global headers merged Fails at 302.9s
No timeout config (default) Fails at 302-303s

All produce TypeError: fetch failed at the same ~303s mark.

Context

The TypeScript SDK types document this field correctly:

options?: {
  timeout?: number | false; // "Default is 300000 (5 minutes). Set to false to disable timeout."
  chunkTimeout?: number;
};

The config is serialized to OPENCODE_CONFIG_CONTENT and passed to opencode serve. The Go server appears to not read provider.*.options.timeout when configuring its internal HTTP client.

Impact

Any programmatic use of the SDK where a session needs to run longer than 5 minutes (e.g., agentic pipelines with many tool calls) hits this wall. The only workaround is keeping individual sessions under 5 minutes.

Environment

  • OpenCode: 1.15.11
  • SDK: @opencode-ai/sdk 1.14.38
  • macOS, Node 26.1.0

Activity

  1. github-actions commented on Jun 1, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is distinct or provides additional context not covered in those reports, feel free to keep this open and link to the related issues.

  2. github-actions commented on Aug 1, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions