diff --git a/packages/opencode/src/config/provider.ts b/packages/opencode/src/config/provider.ts index ae4f4b9b5454..a0412663f7fa 100644 --- a/packages/opencode/src/config/provider.ts +++ b/packages/opencode/src/config/provider.ts @@ -94,19 +94,13 @@ export const Info = Schema.Struct({ description: "Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.", }), - ).annotate({ - description: - "Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.", - }), + ), chunkTimeout: Schema.optional( Schema.Union([PositiveInt, Schema.Literal(false)]).annotate({ description: "Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted. Defaults to 120000 (120s) for most providers, 600000 (10min) for Anthropic-family providers (to accommodate extended thinking). Set to false to disable.", }), - ).annotate({ - description: - "Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted. Defaults to 120000 (120s) for most providers, 600000 (10min) for Anthropic-family providers (to accommodate extended thinking). Set to false to disable.", - }), + ), }), [Schema.Record(Schema.String, Schema.Any)], ), diff --git a/packages/opencode/test/config/provider-schema.test.ts b/packages/opencode/test/config/provider-schema.test.ts new file mode 100644 index 000000000000..f9efba6938a7 --- /dev/null +++ b/packages/opencode/test/config/provider-schema.test.ts @@ -0,0 +1,18 @@ +import { describe, expect, test } from "bun:test" +import { ConfigProvider } from "../../src/config/provider" + +describe("ConfigProvider schema", () => { + test("chunkTimeout has exactly one description annotation", () => { + const json = JSON.stringify(ConfigProvider.Info.ast) + const needle = "Timeout in milliseconds between streamed SSE chunks" + const count = json.split(needle).length - 1 + expect(count).toBe(1) + }) + + test("timeout has exactly one description annotation", () => { + const json = JSON.stringify(ConfigProvider.Info.ast) + const needle = "Timeout in milliseconds for requests to this provider" + const count = json.split(needle).length - 1 + expect(count).toBe(1) + }) +})