超时字段支持 0 = 不设限 - #99
Merged
Merged
Conversation
0 在 setTimeout/AbortSignal.timeout 里是立即开火不是永不,所以 schema 放行 之外,runtime 的头超时、总预算、两段流式看门狗、joinFlight、forwardAuth deadline 都要先把 0 拦下来。UI 边界与帮助文案同步注明语义。 Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
背景
LLM 长流式调用在既有上限(尤其
totalTimeoutMs300s)下仍会中断。需要「永不超时」。关键事实
setTimeout(fn, 0)是下一个 tick 立即开火,不是永不。所以这不是把 UI 的min=1改成min=0就完事——0 必须三层一起认账:config.ts):五个超时字段positive()→min(0),注释写明 0=禁用;跨字段校验(timeoutMs > totalTimeoutMs)在任一为 0 时跳过——关掉的时限不可能被超过。forward.ts:remaining()返回Infinity(否则负数预算会在第一次尝试前就跳出 walk);head deadline 不设 timer(runtime 会把超大setTimeout延迟钳到 ~1ms,「永不」变「立即」)。stream-watch.ts:首字节/空闲看门狗 0 时不 arm。response-cache.ts:joinFlight0 时直接await flight.done。auth.ts:AbortSignal.timeout(0)会立即 abort,改为不传 signal。NUMERIC_BOUNDS):五个超时字段min: 1→min: 0,帮助文案补「填 0 表示不设限」。面板 worker 复用 jouska 的configSchema,无第二份 schema。测试
config.test.ts:0 被接受、timeoutMs: 60_000+totalTimeoutMs: 0不再误报矛盾。stream-watch.test.ts:双 0 下静默 150ms 的流活到最后 complete。streaming.test.ts(集成):全 0 配置下带间隙的 SSE 完整透传、无 abort——这是「0 不是立即超时」的直接证明。npm run check(CI 同款)全绿:lint 0 error,4 工作区 1224 tests passed。🤖 Generated with Claude Code