mirror of
https://github.com/alibaba/open-code-review.git
synced 2026-10-21 22:30:15 +00:00
* fix(llm): let --timeout raise the per-request HTTP deadline The --timeout flag documents a concurrent-task timeout in minutes, but the per-request HTTP deadline stayed at the client's independent 5-minute default. A review of one slow file therefore failed with classification=timeout at duration_to_headers_ms≈300000 even when the caller granted --timeout 30, and no CLI setting could let the file review finish (issue #1155). ResolveOptions gains a TaskTimeout field: when no env (OCR_LLM_TIMEOUT) or config-file (timeout_sec) request timeout is set, the task budget raises the request deadline so a single request can use the whole task budget. Existing precedence is unchanged — env and config-file timeouts still win, and leaving --timeout at its default keeps the 5-minute client default. ocr review and ocr scan both pass their --timeout value through. Fixes #1155 * fix(cmd): feed the concurrent task timeout into the request deadline main replaced the per-file timeout flag with --timeout binding concurrentTaskTimeout, and the agent applies it as a context deadline across review rounds — but the per-request HTTP deadline stayed at the client's independent 5-minute default, so a single slow file request could still die inside a task that had plenty of budget left (#1155's original symptom). Wire ResolveOptions.TaskTimeout from the live opts.concurrentTaskTimeout (minutes) in both review and scan commands. Precedence is unchanged: env OCR_LLM_TIMEOUT and config-file timeout_sec still win, and an unset task timeout keeps the 5-minute client default. * fix(llm): keep request and task timeouts independent * docs: localize timeout configuration guidance * fix(llm): avoid attributing caller deadlines to task timeout --------- Co-authored-by: Kite <254839944+lizhengfeng101@users.noreply.github.com> Co-authored-by: kite <lizhengfeng.lzf@alibaba-inc.com>
33 lines
865 B
Go
33 lines
865 B
Go
// SPDX-License-Identifier: Apache-2.0
|
|
// Copyright 2026 alibaba/open-code-review Contributors
|
|
|
|
package main
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func TestTaskTimeoutHelp(t *testing.T) {
|
|
for _, name := range []string{"review", "scan"} {
|
|
t.Run(name, func(t *testing.T) {
|
|
cmd := &cobra.Command{Use: name}
|
|
if name == "review" {
|
|
registerReviewFlags(cmd, &reviewOptions{})
|
|
} else {
|
|
registerScanFlags(cmd, &scanOptions{})
|
|
}
|
|
flag := cmd.Flags().Lookup("timeout")
|
|
if flag.DefValue != "15" {
|
|
t.Fatalf("default = %s, want 15", flag.DefValue)
|
|
}
|
|
for _, text := range []string{"minutes", "retries", "0 = unlimited", "independent", "OCR_LLM_TIMEOUT", "timeout_sec", "seconds", "300"} {
|
|
if !strings.Contains(flag.Usage, text) {
|
|
t.Errorf("help %q does not contain %q", flag.Usage, text)
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|