From 9989062ba800028f30cc56c7528370ad4ce478c5 Mon Sep 17 00:00:00 2001 From: Kunal Jaiswal Date: Fri, 24 Jul 2026 01:09:47 +0530 Subject: [PATCH 1/2] fix: remove hardcoded 180s timeout from REVIEW_FILTER_TASK The filter task had a hidden inner timeout (ft.Timeout) that always fired before the global OCR_LLM_TIMEOUT (300s) could apply. Removing it lets the task flow through the same two timeout knobs (OCR_LLM_TIMEOUT / --timeout) as every other task type. Also cleaned up unused timeout fields from task_template.json that were never read in production code. --- internal/agent/agent.go | 6 ------ internal/config/template/task_template.json | 5 ----- internal/config/template/template_test.go | 4 ++-- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/internal/agent/agent.go b/internal/agent/agent.go index ba287c1d..cb5491c0 100644 --- a/internal/agent/agent.go +++ b/internal/agent/agent.go @@ -662,12 +662,6 @@ func (a *Agent) executeReviewFilter(ctx context.Context, d model.Diff, newPath s messages = append(messages, llm.NewTextMessage(m.Role, content)) } - if ft.Timeout > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, time.Duration(ft.Timeout)*time.Second) - defer cancel() - } - fs := a.session.GetOrCreateFileSession(newPath) rec := fs.AppendTaskRecord(session.ReviewFilterTask, messages) startTime := time.Now() diff --git a/internal/config/template/task_template.json b/internal/config/template/task_template.json index 3c38eb07..8a9c1dd3 100644 --- a/internal/config/template/task_template.json +++ b/internal/config/template/task_template.json @@ -1,34 +1,29 @@ { "MAIN_TASK": { - "timeout": 120, "messages": [ { "role": "system", "prompt_file": "main_task_system.md" }, { "role": "user", "prompt_file": "main_task_user.md" } ] }, "PLAN_TASK": { - "timeout": 180, "messages": [ { "role": "system", "prompt_file": "plan_task_system.md" }, { "role": "user", "prompt_file": "plan_task_user.md" } ] }, "MEMORY_COMPRESSION_TASK": { - "timeout": 120, "messages": [ { "role": "system", "prompt_file": "memory_compression_task_system.md" }, { "role": "user", "prompt_file": "memory_compression_task_user.md" } ] }, "REVIEW_FILTER_TASK": { - "timeout": 180, "messages": [ { "role": "system", "prompt_file": "review_filter_task_system.md" }, { "role": "user", "prompt_file": "review_filter_task_user.md" } ] }, "RE_LOCATION_TASK": { - "timeout": 180, "messages": [ { "role": "system", "prompt_file": "re_location_task_system.md" }, { "role": "user", "prompt_file": "re_location_task_user.md" } diff --git a/internal/config/template/template_test.go b/internal/config/template/template_test.go index f2f87279..44cddae0 100644 --- a/internal/config/template/template_test.go +++ b/internal/config/template/template_test.go @@ -65,8 +65,8 @@ func TestLoadDefault_FieldsPopulated(t *testing.T) { t.Errorf("MainTask.Messages[%d].Content is empty", i) } } - if tpl.MainTask.Timeout != 120 { - t.Errorf("MainTask.Timeout = %d, want 120", tpl.MainTask.Timeout) + if tpl.MainTask.Timeout != 0 { + t.Errorf("MainTask.Timeout = %d, want 0 (unset in template JSON)", tpl.MainTask.Timeout) } if tpl.PlanTask == nil { t.Fatal("PlanTask is nil, expected non-nil") From 6c9c83989ddcd2c6382ca67058c5825f4a3d170d Mon Sep 17 00:00:00 2001 From: Kunal Jaiswal Date: Fri, 24 Jul 2026 10:21:34 +0530 Subject: [PATCH 2/2] fix: remove dead timeout block from RE_LOCATION_TASK per review feedback --- internal/diff/relocation.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/internal/diff/relocation.go b/internal/diff/relocation.go index d1afff59..ad65eb9a 100644 --- a/internal/diff/relocation.go +++ b/internal/diff/relocation.go @@ -30,12 +30,6 @@ func ReLocateComment( return false, nil, nil } - if task.Timeout > 0 { - var cancel context.CancelFunc - ctx, cancel = context.WithTimeout(ctx, time.Duration(task.Timeout)*time.Second) - defer cancel() - } - messages := make([]llm.Message, 0, len(task.Messages)) for _, m := range task.Messages { content := m.Content