Skip to content

chore(loop): remove --max-turn-secs wall-clock turn budget - #479

Merged
huichen merged 1 commit into
mainfrom
claude/remove-max-turn-secs
Sep 3, 2026
Merged

huichen merged 1 commit into
mainfrom
claude/remove-max-turn-secs

Conversation

@huichen

@huichen huichen commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

What

Remove the --max-turn-secs flag from future loop run.

Why

The per-turn wall-clock budget conflated turn duration with turn liveness:

  • A healthy xhigh run can legitimately stream reasoning well past any fixed cap (the exact case that triggered the real-world timeout — 1200s exceeded while the model was still thinking).
  • A genuinely dead stream is already caught by the agent's own idle timeouts: STREAM_IDLE_TIMEOUT_SECS=45 (LLM layer) and idle_timeouts_for (run_loop layer, high/xhigh = 180s/60s).

Worse, the timeout never actually aborted the underlying agent run — tokio::time::timeout only drops the loop's stream subscription, while the agent-side run is an independent spawned task that keeps running to completion. So "relaunch to continue" really meant "requeue behind the still-running turn" (enqueue_if_busy).

Change

Kill-time decisions belong to the orchestrator — monitor_poll + worker stop already expose the observe-then-kill primitives. So the flag is removed rather than fixed:

  • Drop the flag from run, the run_turns signature, and the usage/help text.
  • Simplify the turn-await to a direct turn_future.await (the transport-error branch is preserved).
  • Remove the now-dead timeout tests + mock/doc references.

Default behavior (0 = unlimited) is unchanged — this removes an opt-in knob, not the default path.

Checks

  • cargo fmt -p future-loop --check ✅
  • cargo clippy -p future-loop --all-targets -- -D warnings ✅
  • cargo test -p future-loop (affected test targets) ✅

The per-turn wall-clock budget conflated "turn duration" with
"turn liveness": a healthy xhigh run can stream reasoning well past
any fixed cap, while a genuinely dead stream is already caught by the
agent's idle timeouts (STREAM_IDLE_TIMEOUT_SECS=45 and
idle_timeouts_for). The timeout also never actually aborted the
underlying agent run — it only dropped the loop's stream subscription,
so "relaunch to continue" really meant "requeue behind the still-running
turn".

Kill-time decisions belong to the orchestrator (monitor_poll + worker
stop already expose the observe-then-kill primitives), so the flag is
removed rather than fixed. Default (0 = unlimited) behavior is unchanged.
@huichen
huichen enabled auto-merge (squash) September 3, 2026 06:50
@huichen
huichen merged commit 507b119 into main Sep 3, 2026
12 checks passed
@huichen
huichen deleted the claude/remove-max-turn-secs branch September 3, 2026 06:54
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