Skip to content

Add a global per-iteration / per-task watchdog around the agent loop #516

@lmorchard

Description

@lmorchard

Summary

The agent's main loop (WebAgent.runMainLoop / execute) has no overarching watchdog: a single hung operation in any iteration blocks the entire task forever, with no upper bound on wall-clock time.

Individual hangs are being fixed point-by-point (aria-tree frame.evaluate in #511; see also the unbounded waitForLoadState and streamText stream issues), but a defense-in-depth backstop would catch the next unbounded operation we haven't found yet.

Suggested approach

Add a per-iteration (and/or per-task) timeout via an AbortController + timer that aborts the iteration and surfaces a clear, recoverable error (or moves to the next step) instead of hanging indefinitely. Make the bound configurable, generous by default.

Why it matters

Turns "indefinite freeze" failure modes into bounded, observable errors — better UX and far easier to diagnose than a silent hang.

Context

Identified while diagnosing #511. This is the defense-in-depth complement to the targeted per-operation timeouts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions