Skip to content

Commit 74aa8dd

Browse files
committed
fix(config): remove duplicate description annotation on timeout/chunkTimeout
The inner Union schema already carried the description. The outer Schema.optional annotation re-applied it, producing duplicate entries in SDK codegen output. Collapses to a single annotation. Regression test: test/config/provider-schema.test.ts asserts each description substring appears exactly once in the schema AST. Addresses audit finding F1 (Opus diamond review, 2026-04-22).
1 parent b2cc4ac commit 74aa8dd

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

packages/opencode/src/config/provider.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,13 @@ export const Info = Schema.Struct({
9494
description:
9595
"Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.",
9696
}),
97-
).annotate({
98-
description:
99-
"Timeout in milliseconds for requests to this provider. Default is 300000 (5 minutes). Set to false to disable timeout.",
100-
}),
97+
),
10198
chunkTimeout: Schema.optional(
10299
Schema.Union([PositiveInt, Schema.Literal(false)]).annotate({
103100
description:
104101
"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.",
105102
}),
106-
).annotate({
107-
description:
108-
"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.",
109-
}),
103+
),
110104
}),
111105
[Schema.Record(Schema.String, Schema.Any)],
112106
),
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { describe, expect, test } from "bun:test"
2+
import { ConfigProvider } from "../../src/config/provider"
3+
4+
describe("ConfigProvider schema", () => {
5+
test("chunkTimeout has exactly one description annotation", () => {
6+
const json = JSON.stringify(ConfigProvider.Info.ast)
7+
const needle = "Timeout in milliseconds between streamed SSE chunks"
8+
const count = json.split(needle).length - 1
9+
expect(count).toBe(1)
10+
})
11+
12+
test("timeout has exactly one description annotation", () => {
13+
const json = JSON.stringify(ConfigProvider.Info.ast)
14+
const needle = "Timeout in milliseconds for requests to this provider"
15+
const count = json.split(needle).length - 1
16+
expect(count).toBe(1)
17+
})
18+
})

0 commit comments

Comments
 (0)