Skip to content

[Bug]: Ultimate mode spends 88% of tool time in AgentWait - 6-8 hour tasks are mostly waiting #4011

Open

Description

@Beautiful0407

Summary

In Ultimate mode, long tasks routinely take 6-8 hours even when the model itself is fast. Measuring 31 Ultimate sessions from the on-disk session files shows the time is not spent on reasoning: 88% of all tool time is AgentWait waiting for delegated subagents, and 17% of those waits run to their full timeout and return nothing usable.

This looks like a harness-level problem rather than a model problem, so I am reporting it here rather than just changing my own prompting.

Area

Desktop app

Reproduction or evidence

Method: parsed turns/turn-*.json in the session directory. Every turn has startTime/endTime; every model round has durationMs/ttftMs/attemptCount; every tool item has startTime/endTime. Execution time below excludes idle gaps where the user was away.

Aggregate over 31 Ultimate sessions:

Metric Value
In-turn execution time 95.95 h
Tool call time 66.40 h
- of which AgentWait 58.23 h (88%)
Model streaming time 21.72 h
AgentSpawn calls 275
AgentWait calls 392
Waits that ran to full timeout 66 (24.45 h returned nothing)
Same bg_task_id awaited >= 2 times 18 groups, 12.05 h

Representative sessions:

Session shape In-turn time AgentWait
Media pipeline debugging, 8 turns 8.22 h 6.97 h / 22 calls, 10 hit timeout
User asked a single status question 7.78 h 6.66 h / 26 calls, 28 subagents spawned
Screen-recording fix 7.39 h 6.35 h / 24 calls
One turn of a development task 11.13 h 5.76 h / 53 calls

Worst repeated pattern: a single subagent task id was awaited 5 times in one session for 133 minutes total, with the parent re-waiting the same id at the 30-minute cap instead of checking its state or changing approach.

What looks wrong

  1. timeout_seconds accepts millisecond values. Observed in real calls: 1800000 (= 500 h) x20, 180000 (= 50 h) x1, 30000 (= 8.3 h) x2. 1800000 is exactly 1800 s expressed in milliseconds, so the unit is being confused. There appears to be no clamp or validation, so a stuck subagent can park the parent for an unbounded time.
  2. No useful default ceiling. 237 calls used 1800 (30 min) and 47 used 3600 (60 min). Because AgentWait blocks the parent turn, the parent cannot make progress while waiting.
  3. Re-waiting the same bg_task_id is not detected. Awaiting the same task 2-5 times at full timeout is treated as normal rather than as a stuck task.
  4. No per-turn work budget. Two observed turns ran 369 rounds / 700 tool calls (5.74 h) and 392 rounds / 493 tool calls (6.27 h). Context grew to roughly 750k input tokens, so every later round re-reads it and the turn degrades over time.

Suggested fixes

  • Clamp timeout_seconds to a sane maximum (e.g. 600) and treat values >= 30000 as a unit error instead of honoring them.
  • On timeout, return the subagent's actual state rather than only "timeout", so the caller can decide instead of blindly re-waiting.
  • Detect repeated waits on the same bg_task_id and surface it as a stuck task.
  • Consider a budget signal (rounds / tool calls) that lets the harness stop or checkpoint a turn instead of silently continuing for hours.

Environment, if relevant

  • OpenBitFun 1.0.11 (git 453b507), stable channel, Windows 11
  • Sessions span 2026-11-08 to 2026-11-20
  • Models involved: deepseek-v4.1-flash-2, gpt-6.1-sol, gpt-6.2-sol, kimi-k3.1-pro

I have the parsing scripts locally and can share the logic or a sanitized dataset if that helps reproduce the numbers.

Activity

  1. wsp1911 commented on Nov 20, 2026

    @wsp1911
    Collaborator

    Thanks for the detailed report. The long runtimes are worth investigating, but a few points need clarification based on the implementation, including the referenced commit 453b507:

    1. AgentWait already clamps its timeout. timeout_seconds is clamped to 1,800–3,600 seconds, with a default of 1,800 seconds. Values such as 1800000 therefore become 3,600 seconds; they do not cause a 500-hour wait. Those arguments may indicate unit confusion, but the claim that there is no runtime clamp is incorrect.

    2. The timeout is a ceiling, not a fixed delay. The 30-minute minimum applies to the timeout parameter. AgentWait returns early when all selected tasks reach a terminal state, including completion, cancellation, or failure. It wakes on state changes rather than waiting until the deadline to check. A longer timeout reduces unnecessary timeout-and-retry round trips through the parent model.

    3. Time spent in AgentWait cannot be counted directly as wasted time. Subagents may be reasoning, executing tools, or otherwise progressing while the parent waits. A high proportion of parent tool time attributed to AgentWait does not, by itself, establish idle time or harness overhead. That requires examining the corresponding subagent activity and task dependencies.

    4. Ultimate is a swarm orchestration mode. The parent decomposes work, delegates it, and integrates results. Tasks with little opportunity for independent work may gain little from this approach, while still incurring coordination costs. Standard mode is generally a better fit for such tasks.

    5. Waiting is interruptible, and repeated timeouts do not prove a stuck task. The parent normally waits when its next steps depend on delegated results, although the tool does not enforce that decision. User steering can end the wait early so the parent can handle new instructions while subagents continue running. Repeated timeouts indicate that at least one selected task remains nonterminal in the tracked state; they do not distinguish slow progress, permission waits, retries, or an actual stall. Timeout counts alone are therefore not a reliable stuck-task detector.

    The reported runtimes remain useful evidence, but identifying the cause requires correlating parent waits with subagent execution, rather than treating the entire waiting duration as avoidable delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions