Skip to content

fix(work): stop killing headless SDD dispatches at a 300s idle-timeout - #549

Merged
getappz merged 1 commit into
masterfrom
task/143-idle-timeout-inherit-hard-cap
Aug 18, 2026
Merged

fix(work): stop killing headless SDD dispatches at a 300s idle-timeout#549
getappz merged 1 commit into
masterfrom
task/143-idle-timeout-inherit-hard-cap

Conversation

@getappz

@getappz getappz commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • DEFAULT_IDLE_TIMEOUT_SECS defaulted to 300s and was used unconditionally by WorkItemExecutor::execute (the daemon's own in-process SDD dispatch path), independent of the 21600s (6h) hard-cap timeout.
  • Headless CLI agents (cursor-agent/claude in print mode) emit no incremental stdout — only one blob once the whole turn finishes — so "no new output for 300s" can't distinguish a hung process from one legitimately still computing (e.g. running cargo build/cargo test mid-turn).
  • Confirmed live this session: items feat(review): multi-agent review consensus engine (verify + dedup + tag) #143, perf(memory): approximate nearest neighbor vector search (Phase 4) #150, Headless agent invocation: run a prompt non-interactively and capture the reply #151 in this project's own work-item queue failed identically 8 times in a row, each killed by this exact idle-timeout mid-turn, never a different error.
  • Fix: DEFAULT_IDLE_TIMEOUT_SECS now equals DEFAULT_TIMEOUT_SECS (6h) instead of a separate, much shorter value — the hard-cap timeout remains the real backstop against a genuinely runaway process. --idle-timeout is still available as an explicit opt-in for callers who know their agent/mode actually streams output.

Test plan

  • cargo build -p agentflare --bin agentflare — clean
  • cargo test -p agentflare --bin agentflare cli::work:: — 43/43 passing
  • cargo test -p agentflare --bin agentflare idle_timeout — existing idle-timeout unit tests still pass (they pass explicit durations, unaffected by the constant change)
  • cargo fmt --check — clean

Summary by CodeRabbit

  • Bug Fixes
    • Updated the default idle timeout to six hours, aligning it with the maximum execution timeout.
    • Improved timeout guidance for headless operations that may not produce continuous output.

Headless CLI agents run in print mode and emit no incremental stdout —
only one blob once the whole turn finishes — so idle detection can't
tell a hung process from one legitimately still computing (e.g. a
cargo build/test mid-turn). DEFAULT_IDLE_TIMEOUT_SECS defaulted to 300,
so any real SDD turn taking longer than 5 minutes died every time,
confirmed live via items #143/#150/#151 failing identically 8 times in
a row. It now defaults to the same 21600s (6h) ceiling as --timeout,
the only backstop that still means what its doc comment says.

Agentflare-Agent: claude-code
Agentflare-Branch: task/143-idle-timeout-inherit-hard-cap
Agentflare-Item: 143
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 926a30a7-0576-4486-8afd-cea42d8d2c58

📥 Commits

Reviewing files that changed from the base of the PR and between 9353468 and b729f13.

📒 Files selected for processing (1)
  • src/cli/work.rs

Included review availability: 0 reviews are currently available. Based on recent review activity, included reviews refill at 2 per hour.


📝 Walkthrough

Walkthrough

The CLI now sets the default idle timeout to six hours, matching the hard timeout. Help text explains headless-agent output behavior and the risks of shorter idle timeouts.

Changes

CLI timeout alignment

Layer / File(s) Summary
Align idle timeout default and documentation
src/cli/work.rs
DEFAULT_IDLE_TIMEOUT_SECS now uses DEFAULT_TIMEOUT_SECS. The --timeout and --idle-timeout help text documents the matching six-hour defaults and headless-agent behavior.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to b729f

The change aligns the default idle timeout with the existing six-hour hard cap so headless work executions are not stopped during legitimate long-running turns; no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: preventing headless SDD dispatches from using the 300-second idle timeout.
Description check ✅ Passed The description includes a clear summary, rationale, and test results, but omits the Notes for reviewers section and two template test items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/143-idle-timeout-inherit-hard-cap

Comment @coderabbitai help to get the list of available commands.

@getappz
getappz merged commit a47da74 into master Aug 18, 2026
18 checks passed
@getappz
getappz deleted the task/143-idle-timeout-inherit-hard-cap branch August 18, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant