Add CLI arg override for REVIEW_FILTER_TASK
Problem Statement
Right now the REVIEW_FILTER_TASK timeout is hardcoded to 180s, when using a local LLM with high concurrency, sometimes it might hit the timeout.
When it times out, it displays: [ocr] Subtask error for filepath: context deadline exceeded [ocr] Plan phase failed for filepath: plan request: context deadline exceeded
Proposed Solution
Could we add a CLI arg for filter task timeout so we can increase it to > 180s?
Alternatives Considered
No response
Affected Area
Review Rules
Additional Context
No response
I agree
@lizhengfeng101 @hyudryu can take a crack at this. My plan would be to add a --filter-task-timeout flag (or maybe REVIEW_FILTER_TASK_TIMEOUT as an env var) that takes a duration like 300s or 5m. Default would stay at 180s so nothing breaks for people who don't touch it — it'd just plug into the existing deadline/context used for the plan-phase request.
Should fix the context deadline exceeded issue for local LLM setups that need more breathing room under concurrency. Happy to open a PR if this sounds good — let me know if the naming works or if you had something else in mind.
@kunaaaalcodes thanks a lot for offering to pick this up — really appreciate it! Before you open a PR, let me share where I'd like this to land, because after digging into the code I think there's a cleaner fix than a dedicated flag.
Today there are already two timeout layers, and they apply to every task type:
OCR_LLM_TIMEOUT(seconds, default 300s) → the per-request HTTP timeout on the shared LLM client. It's a global override that applies to every LLM call — MAIN / PLAN / REVIEW_FILTER / RE_LOCATION / MEMORY_COMPRESSION.--timeout(minutes, default 10) → the per-file overall budget, mainly there to stop the main tool-call loop from running forever.
The catch: REVIEW_FILTER_TASK is the only task that also wraps its LLM call in an extra inner context.WithTimeout using the template's timeout: 180 value. Since 180s < the 300s request timeout, that inner deadline always fires first — which is exactly the context deadline exceeded you're hitting. Neither OCR_LLM_TIMEOUT nor --timeout can lift it, because it's a smaller deadline nested inside.
Worth noting: the timeout fields on PLAN_TASK / MAIN_TASK / RE_LOCATION_TASK in the template are actually never applied in code — only the filter task reads its template timeout. So the Plan phase failed ... context deadline exceeded line in the original report is a different symptom: that one is hitting OCR_LLM_TIMEOUT (300s), and can already be relaxed by raising it.
So rather than adding a new flag, I'd prefer to just remove that inner 180s deadline on the filter task and let it flow through the same two knobs as everything else. Rationale:
- It collapses everything to a single, consistent model — two knobs cover request-level and per-file timeouts for all task types. No new surface area, and no risk of a
--timeout(minutes) vs--filter-task-timeout(seconds) naming/unit clash. - The filter task is an optional, fail-open enhancement — if it errors or times out, the error is logged and silently ignored and all comments are kept as-is. So letting it run up to
OCR_LLM_TIMEOUTinstead of a hard 180s costs a bit more wall-clock in the worst case, but never produces a wrong result.
The change is small: drop the ft.Timeout block in internal/agent/agent.go, and clean up the now-dead timeout fields in the template JSON so they don't mislead anyone into thinking they're tunable. Docs live under pages/src/content/docs/ (not the READMEs) if we want to note the behavior.
Does this direction sound reasonable to you? If so, it's all yours — happy to review a PR along these lines. If you think there's a real need for per-task granularity beyond the global request timeout, let's talk it through first.
Ty @kunaaaalcodes @lizhengfeng101