An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Honor unlimited agent question timeout https://github.com/siyuan-note/siyuan/issues/19666
Daniel5cee102376ff
diff --git a/kernel/agent/agent.go b/kernel/agent/agent.goindex 8181d2a26a..569fde2d26 100644--- a/kernel/agent/agent.go+++ b/kernel/agent/agent.go@@ -1904,7 +1904,7 @@ func resolveBrowserCapabilityTimeout(confirmTimeout time.Duration) time.Duration// resolveQuestionTimeout 解析 question 工具等待用户作答的时长:确认超时时间为 0 时一直等待,// 其余情况沿用确认超时时间(调用方已把负数兜底为默认值),因此默认配置下为 600 秒。func resolveQuestionTimeout(confirmTimeout time.Duration) time.Duration {- if confirmTimeout <= 0 {+ if confirmTimeout < 0 {return fallbackQuestionTimeout}return confirmTimeoutdiff --git a/kernel/agent/tools_test.go b/kernel/agent/tools_test.goindex cb45e01c54..405f5231cc 100644--- a/kernel/agent/tools_test.go+++ b/kernel/agent/tools_test.go@@ -430,8 +430,11 @@ func TestAgentConfirmationDeadlineZeroHasNoLimit(t *testing.T) {}func TestQuestionTimeoutReusesConfirmTimeout(t *testing.T) {- if timeout := resolveQuestionTimeout(0); timeout != fallbackQuestionTimeout {- t.Fatalf("zero confirmation timeout did not use the fallback question timeout: %v", timeout)+ if timeout := resolveQuestionTimeout(0); timeout != 0 {+ t.Fatalf("zero confirmation timeout created a question timeout: %v", timeout)+ }+ if timeout := resolveQuestionTimeout(-time.Second); timeout != fallbackQuestionTimeout {+ t.Fatalf("negative confirmation timeout did not use the fallback question timeout: %v", timeout)}if timeout := resolveQuestionTimeout(90 * time.Second); timeout != 90*time.Second {t.Fatalf("positive confirmation timeout was not reused by question: %v", timeout)@@ -442,7 +445,7 @@ func TestQuestionWithoutDeadlineWaitsForAnswer(t *testing.T) {events := make(chan AgentEvent, 1)resultCh := make(chan string, 1)go func() {- resultCh <- handleQuestion(context.Background(), map[string]any{"questions": []any{}}, "test-round", events, 0)+ resultCh <- handleQuestion(context.Background(), map[string]any{"questions": []any{}}, "test-round", events, resolveQuestionTimeout(0))}()event := <-events