How are failures, retries and self-healing handled?
Error classes caught; retries; replanning; caching of successful actions or workflows; timeouts.
Verdict
For long unattended runs, browser-use and Skyvern have the most recovery code. For flows that repeat, HyperAgent, Stagehand on Browserbase and Ulka replay saved actions. agent-desktop, Cua and mobile-jev are best at telling the caller exactly what failed.
Recovery inside the loop. browser-use sets 180 s timeouts, switches once to a fallback_llm on 429, 5xx or truncated output, and an ActionLoopDetector adds escalating hints. Skyvern retries a failed step up to five times with a fresh scrape; its cross-run cache is only a cloud hook. Cua’s agent retries transient model errors with backoff.
Replay and caching. HyperAgent caches every run’s actions for replay, with an optional LLM fallback per step. Stagehand’s selfHeal re-infers once, and its action cache needs a Browserbase session. Ulka replays cached clicks and selects without a model call and gives its planner three recovery attempts after a failed verification. Workflow Use retries steps three times, but StepVerifier is off and the agent fallback is commented out.
Guard and stop. Jev Ultrafast consumes each decision before executing it, so a retry cannot double-click. jev-browser has no retries: a repeated no-op switches to the next-best choice, and a Cloudflare wall ends the run as blocked. typesafe-computer-use stops after three idle actions and restores a field when a typed-value check fails. jev-use logs a stale target as “NOT performed” and re-decides from a fresh capture. agent-desktop returns one of five delivery dispositions. Cua Driver refuses stale tokens. dsh-browser cancels timed-out calls so a late approval cannot run them. browser-harness never retries actions.
Outliers. mobile-jev retries only stale observations and never repeats a mutation after a transport error. openjev-sglang does not apply beyond mapping backend failures to 503 or 504.
Pick: browser-use or Skyvern for long runs that must keep going on their own. Pick: HyperAgent, or Stagehand on Browserbase, to turn a working run into a cheap replay. Pick: agent-desktop, Cua or mobile-jev when your own code decides retries and needs honest results.
Per-project answers
browser-use/browser-use
answeredError classification. Agent._handle_step_error() (browser_use/agent/service.py:1258-1314) categorizes exceptions into: InterruptedError (user pause/stop — silent), ConnectionError/WebSocket-closed errors (browser disconnect — triggers reconnection), and all other exceptions (counted as consecutive failures). _is_connection_like_error() checks error strings for patterns like 'websocket connection closed', 'browser has been closed'. Browser-closed errors set self.state.stopped = True and exit the loop.
Retries for empty actions. _get_model_output_with_retry() (browser_use/agent/service.py:1670-1704) wraps the LLM call: if the model returns an empty or all-empty action list, it sends a clarification message and retries once. If the retry also returns empty, it inserts a synthetic done(success=false) action.
Consecutive failure counting. Single-action steps that error increment consecutive_failures (capped at max_failures, default 5). Multi-action steps with errors are handled by loop detection instead (not counted as failures). When consecutive_failures >= max_failures, a final recovery response is attempted (if final_response_after_failure=True), then the agent stops.
Step-level timeout. _execute_step() (browser_use/agent/service.py:2438-2498) wraps the entire step() in asyncio.wait_for(timeout=self.settings.step_timeout) (default 180s). On timeout, it increments failures and continues. LLM calls have their own llm_timeout (auto-detected per model: 30s for Groq, 90s for Claude/DeepSeek/o3, 75s default).
Action timeout. Tools.act() applies asyncio.wait_for(timeout=action_timeout) (env BROWSER_USE_ACTION_TIMEOUT_S, default 180s) to prevent hung CDP calls. The timeout is above the 120s extract action LLM cap (browser_use/tools/service.py:99-110).
Fallback LLM. If the primary LLM fails with a rate limit (429), auth error (401/402), server error (500-504), or truncated output, and a fallback_llm is configured, the agent switches providers mid-run (browser_use/agent/service.py:1983-2025). This is a one-way switch; once on fallback, the agent stays there.
Connection recovery. BrowserSession has WebSocket reconnection logic (browser_use/browser/session.py:585-593) with 3 attempts, delays (1+2+4s), 54s total wait timeout. When _handle_step_error detects a connection error during reconnection, it waits for the reconnect event. If reconnection succeeds, the step is retried; otherwise, it's treated as a terminal browser-closed error.
Loop detection. ActionLoopDetector (browser_use/agent/views.py:157-248) tracks the last 20 action hashes for repetition and page fingerprints for stagnation. At thresholds (5/8/12 repeated actions, 5 stagnant pages), escalating nudges are injected into the LLM context. Wait/done/go_back actions are exempt from tracking. This is advisory only — never blocks actions.
CAPTCHA handling. CaptchaWatchdog (browser_use/browser/watchdogs/captcha_watchdog.py) listens for CDP captchaSolverStarted/Finished events from the browser proxy. The agent's step() checks wait_if_captcha_solving() at the start and blocks until resolution or timeout. The result (success/failed/timeout) is injected into the action result for the LLM. Cloud browsers include proxy rotation and stealth fingerprinting to reduce CAPTCHA incidence.
Message compaction. Old conversation history is summarized by an LLM every 25 steps when the prompt exceeds ~10K tokens (MessageCompactionSettings). This prevents context windows from overflowing while preserving key information.
trycua/cua
answeredRetries. The agent loop wraps every predict_step call in _predict_step_with_retry (libs/python/agent/cua_agent/agent.py:213-247) which provides exponential backoff (base 2s, doubling) on transient errors. Retryable errors include asyncio.TimeoutError, RateLimitError, ServiceUnavailableError, APIConnectionError, InternalServerError, and messages containing "timeout", "rate limit", "503", "502", "429", or "connection" (libs/python/agent/cua_agent/agent.py:186-210). Default max_retries is 3. Non-transient errors are raised immediately.
Driver-level protection. The driver's action tools have a PidOnlyWindowTargetGuard that resolves PID-only calls: if a pid has no windows it returns NotFound, if one window it targets it, if multiple it returns Ambiguous(...) with the candidates so the agent can disambiguate (libs/cua-driver/rust/crates/cua-driver-core/src/window_target.rs:28-51). Element tokens have staleness detection — using a stale token returns a structured "element_token is stale" refusal (libs/cua-driver/rust/crates/cua-driver-core/src/element_token.rs:5-6).
Driver-owned browsers. The browser engine re-proves every identity before mutation — revalidate_for_mutation checks the full chain (process fingerprint → native ownership/bounds → endpoint → CDP target type/window) before any input, and frame_session_for_mutation additionally re-proves frame identity. Missing or changed identities are refused, never guessed (libs/cua-driver/rust/crates/cua-driver-core/src/browser/engine.rs:1-23).
Timeouts. Session idle TTL defaults to 5 minutes, configured via DEFAULT_SESSION_IDLE_TTL (libs/cua-driver/rust/crates/cua-driver-core/src/session.rs:30). Window observation after actions has a configurable deadline (default ~500ms, max 10s, min poll interval 5ms) (libs/cua-driver/rust/crates/cua-driver-core/src/window_observation.rs:23-38). Post-action observation detects menus/dialogs the action may have opened.
Caching/session recovery. The capture_registry retains recent screenshots by capture_id so re-parsing doesn't need re-capture. The SnapshotStore keeps an LRU per-pid (8 entries) for element snapshots (libs/cua-driver/rust/crates/cua-driver-core/src/element_token.rs:4). The TypeScript agent client has a classifyError method that categorizes errors (timeout, http, parse, network, peer) for appropriate handling (libs/typescript/agent/src/client.ts:135-156).
browserbase/stagehand
answeredSelf-healing: When a deterministic action fails (any non-TimeoutError exception), and selfHeal: true is set at init, actService.ts re-captures the full page snapshot and re-asks the LLM for a new action decision (selfHealAction). This handles cases where the DOM changed between capture and execution. TimeoutError is NOT caught — it propagates up to the caller as a fatal timeout.
Error classes (errors.ts): TimeoutError, StagehandProtocolCompatibilityError, DuplicatePageEventSubscriptionError, ShadowRootEvaluationError, ShadowRootEvaluationUnavailableError.
Caching (cacheService.ts): Uses the Browserbase API's stateless cache routes. On each act()/observe()/extract():
- The raw CDP accessibility tree(s) are collected (
collectCdpTree) - A cache key is computed server-side from the CDP tree + request params
- On hit: the cached action array is replayed deterministically — if replay fails (e.g., stale selectors), it falls back to execution
- On miss: the LLM inference runs and the result is persisted
- The cache has a hit-count threshold and supports
bypassfor requests with locator scoping - Cache read/write failures are best-effort: they log warnings but never break the operation
- No caching of successful workflows; caching is per single act/observe/extract
Timeouts: Each act()/observe()/extract() has a configurable timeout (passed through options.timeout). The Progress class in progress.ts enforces a deadline and provides an abort signal. waitForDomNetworkQuiet uses a 500ms quiet-after-last-network-request heuristic with a 2s stale-request sweep. The timeoutConfig.ts and DEFAULT_LOCATOR_TIMEOUT_MS set baseline defaults.
DOM settle: Before each snapshot capture, waitForDomNetworkQuiet uses CDP Network events (Network.requestWillBeSent, Network.loadingFinished, etc.) to wait until no requests are in-flight for 500ms. Stalled requests older than 2s are force-completed.
Skyvern-AI/skyvern
answeredReliability is handled at multiple layers with a rich exception hierarchy and explicit retry mechanics.
Error classes. Skyvern defines dozens of exception types (skyvern/exceptions.py), including MissingElement, MultipleElementsFound, InteractWithDisabledElement, FailToClick, ScrapingFailed, ActionExecutionTimeout, CaptchaSolveError, LLMProviderError, and SkyvernPageAnalysisTimeout. Each action handler wraps its operation and raises typed exceptions, which are caught by the step loop.
Retries within a step. The action handler returns ActionResult objects (responses.py), which have a success flag and optional exception_type. The step engine evaluates these: on failure, it retries the step (up to max_retries_per_step, default 3). The step has an explicit retry_index field (set in agent.py:3676). The entire step retry loop re-scrapes the page and re-calls the LLM. Scraping itself has retry logic (scrape_website, scraper.py:285-410): up to MAX_SCRAPING_RETRIES (currently 0 in prod) with an intermediate 3s wait and page reload.
Replanning. On step failure, the agent can escalate to a "recovery" step or, in workflow context, the WorkflowService triggers replanning with different credential parameters (e.g. a fresh login). The failure_classifier.py module categorises errors into FailureCategory values (LLM_ERROR, CAPTCHA_SOLVE_FAILURE, etc.), which feed into the retry/recovery decision.
Caching. The extraction cache (skyvern/forge/sdk/cache/) caches LLM extraction responses for up to 4 weeks (cache expiry = timedelta(weeks=4), base.py:6), keyed by page content hash, so identical pages reuse prior extraction results. It supports both local in-memory and Redis backends. The extraction shadow maintains a parallel write-through cache for consistency verification.
Self-heal tracking (services/self_heal_reliability_service.py) tracks workflow reliability metrics: it collects recent workflow run outcomes and "heal episodes" (instances where a recovery action was taken), computing a WorkflowReliability score per workflow over the RELIABILITY_WINDOW. This is a reporting/observability system rather than an automatic healing mechanism.
Timeouts. Multiple timeout layers exist: BROWSER_LOADING_TIMEOUT_MS for page loads, SkyvernPageAnalysisTimeout for page analysis, ActionExecutionTimeout for individual actions, task-level timeouts (TaskAlreadyTimeout), and workflow-level timeout. The Task V3 loop adds wall-clock, token, and tool-call budget caps (engine.py:91-94).
browser-use/jev-ultrafast
answeredReliability is enforced at four layers: pre-execution page freshness, model response validation, retry loops for transient failures, and no-progress detection.
Pre-execution freshness. Before any action, Browser.fresh() checks whether the observed DOM still matches the current page using a marker hash (browser.py:88-98). If not, StalePage is raised and the decision is discarded (consumed to prevent double-execution; agent.py:91). The prediction in act() validates that the target element's node ID still maps to the same guard (role, name, value, disabled state, aria-expanded; browser.py:93-97). The decision is consumed before any model call or mutation — a retry cannot double-click (agent.py:91).
Model validation. validate_choice() (model.py:30-45) rejects any TypeSafe response where probabilities sum to other than 1.0 (within 0.02 tolerance), contain NaN/negative values, or assign the choice to a non-maximum element. Invalid text-helper output (wrong JSON shape, empty, >2000 chars) raises ValueError("nothing typed") (model.py:187-193).
Retry loops. HTTP requests to the TypeSafe API retry on 429/503/529 with exponential backoff (0.5s, 1s; model.py:16-27). Observation retries up to 10 times on StalePage with 20ms waits (browser.py:77-86). Stale page during a tick causes automatic reobservation and a fresh prediction without executing the stale decision (agent.py:59-64).
No-progress detection. If 3 consecutive non-wait actions produce no page fingerprint change, status transitions to "blocked" (agent.py:153-158). Generated text for TYPE_TEXT is cached in pending_text and reused only if the entire field-context matches — stale-page retries with the same page state avoid a redundant text helper call (agent.py:109-115). There is no caching of successful actions or workflows beyond this text reuse.
browser-use/browser-harness
answeredReliability is handled through daemon self-healing, connection retry with escalation, and IPC-level error propagation — not through retries of failed actions, caching of successful actions, or replanning.
Daemon self-healing:
ensure_daemon()inadmin.py:525-708is the core reliability function. It is idempotent and handles: stale daemon (detected via CDP health check — ifTarget.getTargetsreturns no"result", the daemon is recycled); Chrome not running (launches the browser automatically via_launch_browser()at line 1274); remote debugging not enabled (openschrome://inspect/#remote-debuggingwith a 180s reopen throttle at line 1387); and the Chrome Allow popup (prints instructions, raises"permission-blocked"without retrying). It uses a_spawn_lock(line 256-316) with file locking to prevent concurrent daemon creation.Connection retry:
ensure_daemon()loops up to 3 times (line 561) with escalating strategies: each iteration can launch Chrome, open the inspect page, or wait for approval. If a local daemon dies during handshake, the PID file is cleaned under lock and a new attempt is made — but if the popup was denied, it raises"permission-blocked"and stops.Error propagation: Every helper wraps CDP calls via
_send()which can raise_IPCResponseTimeout(aTimeoutErrorsubclass, line 48) andRuntimeErrorfor CDP errors (line 68-69). These propagate to the caller (the agent or MCP client) as exceptions. The MCP server catches all exceptions with a bareexcept Exception(mcp_server.py:132-133) and converts them toToolError.CDP session recovery: In
daemon.py:767-808, when a CDP request hits "Session with given id not found", the daemon automatically re-attaches to the current page and retries the request once against the replacement session. This is the only built-in retry of a failed CDP operation.IPC timeouts: Default IPC response timeout is 5s (
DEFAULT_IPC_RESPONSE_TIMEOUT_SECONDS, helpers.py:44). Screenshots get a longer 60s timeout (SCREENSHOT_IPC_RESPONSE_TIMEOUT_SECONDS, line 45). The IPC connect timeout is 5s (IPC_CONNECT_TIMEOUT_SECONDS, line 41).No action caching or replanning: The harness does not cache successful actions or replan on failure. Those are the calling agent's responsibilities.
browser-use/workflow-use
answeredError categories and retries: The SemanticWorkflowExecutor._execute_with_verification_and_retry method (semantic_executor.py:1901–2117) implements a retry loop with configurable max_retries=3, max_global_failures=5, and max_verification_failures=3. It tracks consecutive_failures (after 3, raises immediately) and consecutive_verification_failures (after max_verification_failures, raises). Before each retry attempt, the semantic mapping is refreshed and a 1-second delay is applied (line 1928–1930). Errors caught include Playwright Element not found, Timeout, No such element patterns, form validation errors via _detect_form_validation_errors (which inspects the page for patterns like "required", "invalid", "must"), and general execution exceptions. After all retries exhaust, failure counters increment and a comprehensive ErrorReport is generated.
Self-healing — multi-strategy element finding: The ElementFinder (element_finder.py:20) tries strategies in priority order: semantic strategies (text_exact, role_text, aria_label, placeholder, title, alt_text, text_fuzzy) against browser-use's selector map (a dict of index → DOM node), then XPath via JavaScript document.evaluate as fallback. The SelectorGenerator (healing/selector_generator.py:47) generates these strategies at workflow-creation time, ordered by reliability: ID selectors → data attributes → name attributes → exact text → ARIA labels → role+text → placeholder → class+text → fuzzy text → XPath. XPath alternatives are further optimized by XPathOptimizer.
Caching and verification: The _execute_with_verification_and_retry method uses an optional StepVerifier (step_verifier.py:66) with deterministic checks (DOM inspection, URL changes) and optional AI-assisted verification. On success, all failure counters reset. The ErrorReporter (error_reporter.py:79) logs each failure with strategy attempt records, page screenshots (saved to .workflow_screenshots/), and generates root-cause analysis and suggestions (e.g., if all semantic strategies failed, XPath might work). Workflow-level retries that happen in _execute_step (service.py) are disabled — the fallback-to-agent code path is commented out. However, the CLI's run-workflow and run-stored-workflow commands do not wrap the entire run in retry logic; the retries are per-step only.
lahfir/agent-desktop
answeredagent-desktop has an extensive reliability architecture across multiple layers:
Error hierarchy: AppError (top-level, wraps AdapterError, IO, JSON, internal) → AdapterError (carries ErrorCode, message, suggestion, platform_detail, details, DeliverySemantics, retryability). 16 error codes total (error_code.rs:5-22), including STALE_REF, AMBIGUOUS_TARGET, TIMEOUT, ELEMENT_NOT_FOUND, APP_UNRESPONSIVE, POLICY_DENIED.
Delivery semantics: A 5-level model tracks action disposition — NotDelivered, DeliveryUncertain, DeliveredUnverified, DeliveredVerified, Unknown — each with a mapped RetryDisposition (Safe/Unsafe/Unknown) (delivery_semantics.rs:6-55). Errors with Safe retry (StaleRef, SnapshotNotFound, AppUnresponsive) get a recovery hint in the envelope with strategy, retryability, and required snapshot freshness.
Auto-wait polling: When timeout_ms > 0, ref_action_poll.rs:26-63 polls element resolution + actionability preflight before dispatching. The preflight checks visibility, enabled state, and bounds stability (sampling at 16ms intervals). Deadlines are propagated throughout.
Retry handling: is_retryable_resolution_failure() (adapter_error.rs:59-67) identifies error codes that are retryable (StaleRef, AmbiguousTarget, Timeout, AppUnresponsive), gated by explicit retryable: true in the error's details — a test matrix at adapter_error.rs:236-269 verifies every code. Retry is caller-side; agent-desktop returns the disposition, the calling agent decides.
Post-action verification: For stateful actions (TypeText, SetValue, Check, Uncheck, Toggle, Expand, Collapse, Clear), execute_verified_action (post_action.rs:7-113) re-reads live element state after dispatch and checks the postcondition. It polls for up to 400ms (50ms intervals) for the state to settle before concluding failure.
Stability detection: stable_preflight() (ref_action.rs:225-268) polls element bounds until they stabilize before cursor-driven dispatch. Uses a StabilitySampler — when bounds change mid-wait, it resets and re-stabilizes.
Renderer accessiblity activation: When a renderer has not published its tree yet, core backs off with exponential retry from 25ms to 400ms max (renderer_accessibility.rs:13-14).
hyperbrowserai/HyperAgent
answeredReliability is handled through multiple layers of retries, error classification, and action caching. The general-purpose retry() utility (src/utils/retry.ts:2) provides exponential backoff (2^i * 1000ms) with up to 3 attempts — used for LLM invocations, DOM state capture, and scroll info retrieval. DOM capture has its own retry loop (src/agent/shared/dom-capture.ts:105) with 3 attempts for transient CDP errors ("Execution context was destroyed", "Cannot find context", "Target closed"), plus a placeholder-snapshot detector via isPlaceholderSnapshot() that retries on "Error: Could not extract accessibility tree".
LLM structured output failures get 3 attempts per step with Zod validation errors fed back as corrective user messages (src/agent/tools/agent.ts:424-508). Schema errors accumulate across steps (last 3 tracked) and are injected into future step messages to guide the model (src/agent/tools/agent.ts:400-413). The consecutive failure/waits counter terminates tasks after 5 consecutive waits or action failures, with a clear error message (src/agent/tools/agent.ts:267, 575-624).
Action caching records each step's XPath, frame index, method, and arguments via buildActionCacheEntry() (src/agent/shared/action-cache.ts:95). Successful tasks produce an ActionCacheOutput that can be replayed via runFromActionCache() (src/agent/index.ts:519-834), which replays cached actions by dispatching through perform* helpers with XPath retry support and fallback to instruction-based execution. Element resolution has its own recovery: if DOM.resolveNode fails with "Could not find node with given id", the system falls back to XPath-based recovery via recoverBackendNodeId() (src/cdp/element-resolver.ts:228) which evaluates the XPath in the correct frame's execution context, then calls DOM.describeNode to get a fresh backendNodeId. Page context switching is detected and triggers retry with a 500ms delay (src/agent/index.ts:1537-1558).
awlevin/typesafe-computer-use
answeredJev uses deterministic code-side checks and escalation rules rather than action-level retries.
Stall detection (the primary reliability mechanism): Every step computes a signature — (app, URL, focused field, (text, row) tuples). same_screen() allows at most 1 differing text line and that line must be ≤1-in-10, so a clock tick or OCR jitter doesn't mask a stall. After 3 idle actions (screen unchanged — a refused click, a wait, a scroll at the bottom) or 2 repeated actions (same action on same screen — a cycle) the run stops with outcome stalled. After 3 stalls with no new page between them, the run escalates to stuck, which the writer cannot hand back from. (runner.py:24–27, 372–391, 399–417, models.py:91–117)
Error classes caught: Missed is raised when a click's pointer never reached the target — the action line says "click refused: … was not clicked". Abort (mouse in top-left corner or Ctrl-C) stops the loop, as does KeyboardInterrupt. The osworld adapter additionally catches BaseException in its worker thread and hands it back to predict. (models.py:36–41, macos.py:37–40, osworld/agent.py:195–221)
Popup auto-close: When an item sits under a popup (tracked by ax_walk as the covering window), click_item closes the popup first — using its close button when available, otherwise Escape — then clicks the item. Chrome's "Restore pages?" bubble is identified by name and never closed with its Restore button. Popup tracking only works via the OSWorld accessibility tree (the macOS tree doesn't report covering windows). (perception.py:114–119, actions.py:52–86)
Text verification and recovery: After typing into a field, verify_typed runs a TypeSafe Noul asking "did the typing succeed, and is the value sensible?". Below 0.5, restore_field sets the original value back through the same AX element, but only if it still holds exactly what was just typed — no keystroke fallback, since focus may have moved. (actions.py:191–199, 126–136, decide.py:259–276)
No retries, no caching of successful actions: There is no retry-on-failure — a refused action is recorded in history and counts toward the idle limit. The OCR cache (OcrCache) caches raw OCR lines across unchanged tiles, not action outcomes. The already_tried_on_this_screen list prevents re-picking the same fruitless action. The critic is the next capture: nothing in the action description says what came of it, so every action is verified by the screen it produced. (runner.py:393–396, perception.py:164–227)
omdsh-dev/dsh-browser
answeredFailure handling spans three layers. Bridge layer: BridgeServer.requestTool() sets a per-call timer (server.ts:220-223) and wraps cancellation via AbortSignal. On timeout it sends tool.cancel and rejects with BridgeToolError(timeout) (server.ts:221-222). Socket replacement settles all pending tools as bridge-closed (server.ts:514-518). The BridgeClient (background/bridge.ts:111-230) implements exponential-backoff reconnection: base 500ms, x2 per attempt, capped at 10s, jittered 0.5-1x (bridge.ts:225-229). Extension layer: dispatchToolCall() (background/tools.ts:671-797) handles content-script failures. When sendAction catches Receiving end does not exist (tools.ts:166-167), it auto-injects the content script via injectContentScript() (tools.ts:134-148) and retries the dispatch (tools.ts:756-796). TabManagementContext.commitAction/rollbackActionCommit (background/index.ts:1074-1078) track whether a state-changing operation can be withdrawn. validateElementTarget() (background/tools.ts:809-818) rejects stale element references by comparing frame document keys. Server layer: session-purge.ts (session-purge.ts:76-154) handles durable storage errors with typed codes. Session deferral provides 30-minute TTL for abandoned sessions (session-deferral.ts:62-69). The MutationObserver settle detection (actions.ts:53-120) has hard caps so continuously-animated pages cannot stall tools.
droidrun/mobile-jev
answeredError classes: A single custom class — StaleObservationError (device.mjs:8). It is thrown by assertFresh() (device.mjs:31-81) when the current observation doesn't match the one used for decision-making.
Retries: Only StaleObservationError triggers a retry. The agent catches it (agent.mjs:116-119), increments staleRetries, re-observes, and re-decides. After 3 consecutive stale errors, the loop terminates with unstable_screen (agent.mjs:124). Non-stale errors (transport failures, invalid actions, API HTTP errors) are never retried — they propagate immediately (agent.mjs:117), because a device mutation might have partially executed. This is a deliberate design principle: "Never retry uncertain mutations" (agent.mjs:117).
Freshness / self-healing: assertFresh() validates the observation before any action dispatch. It checks: device ID match, observedAt age (<30s default, maxAgeMs), package name, screen dimensions, and action-specific target semantics. For tap-element, it checks the target node's text/label/checked/selected haven't changed (device.mjs:46-49). For type, it checks the focused input has the same identity and meaning (device.mjs:50-55). For global navigation, it checks all clickable/editable controls plus headings haven't changed (device.mjs:56-69). For swipe with regionId, it checks the scrollable region still exists with the same resourceId (device.mjs:70-73). If any check fails, StaleObservationError is thrown and re-observation + re-decision occurs automatically (agent.mjs:123-127).
Input verification: After accepted-mode typing, confirmInput() (input-verification.mjs:46-65) polls the screen every 60ms until the field shows the exact expected text. Timeout defaults to 2500ms. If verification fails, the run stops with input_unverified (agent.mjs:159-171) — it never modifies the field again based on an unverified value.
Caching: Device readiness is cached for 30 seconds (device.mjs:271). Model transport reuses the HTTPS connection via a maxSockets: 2 keepAlive agent (http.mjs:5). Post-action polling is bounded by settleTimeoutMs (default 400ms) with 60ms intervals (agent.mjs:174-183). No workflow-level caching exists.
Timeouts: settleMs (extra fixed wait after actions, default 0), settleTimeoutMs (400ms, polling budget for transition), waitTimeoutMs (15s, consecutive WAIT budget), and inputTimeoutMs (2500ms, text verification timeout). All validated at entry (agent.mjs:24-31).
jkudish/jev-browser
answeredReliability is addressed through several layered mechanisms, but there is no explicit retry loop or caching of successful actions. The design philosophy is "code owns control flow; Jev owns the judgments" (src/navigate.ts:1), so failures are handled deterministically.
Error classes caught (src/navigate.ts:1013-1017): Playwright action errors (timeouts, element not found), typing generator failures, and InvalidJevAnswer (malformed second-stage responses). Deadline/timer errors propagate via AbortController.signal (src/navigate.ts:552). InvalidJevAnswer from the primary call is not caught in the action handler — it propagates to the outer try/catch and stops the run. Typing failures produce structured warnings (src/navigate.ts:589-604).
Repeat-no-op recovery (src/navigate.ts:846-857): when the same action repeats with no visible effect (page unchanged, or a fill happened), the code switches to the next-best option from the Choice distribution via pickAlternate() (src/lib.ts:169-180). There is deliberately no low-confidence override — split probability across similar elements is treated as several acceptable alternatives, not uncertainty (README:419-420).
Stop gates run before execution (src/navigate.ts:827-841): done, goal_done > 0.85, and stuck > 0.85 (after step 2) are checked pre-action, so the run stops before spending time on a doomed step.
Timeouts (src/navigate.ts:552-570): a wall-clock deadline timer is set at run start; an AbortController feeds an AbortSignal through Jev calls, typing generation, and every Playwright timeout. Each bounded timeout is capped by remaining() (src/navigate.ts:570), so no single wait can outlive the run budget. Default maxSeconds is 180 (src/navigate.ts:473).
Bot-protection detection (src/lib.ts:378-515 and src/navigate.ts:718-776): DOM-only marker-based Cloudflare interstitial detection. If an interstitial appears, the run gets a short settle window (8s) to auto-pass before being declared blocked. Markers include branded challenge titles, Ray IDs, error codes, and body phrases — requires page-level evidence to stop, never just a response header. Post-action the final page gets the same settle check to catch walls that appeared during judgment.
What is NOT implemented: there is no retry queue for failed actions, no caching of successful action sequences, no replay of prior workflows, no explicit self-healing beyond the repeat-no-op alternate-picking. Credential runs suppress screenshots and refuse video recording so secrets cannot leak through pixels (src/navigate.ts:1113-1115).
savka777/jev-use
answeredError classes caught: DesktopError with a stale flag (Desktop.swift:6-11), DecisionError.invalidResponse (Decision.swift:388-393), ServiceError for TypeSafe HTTP errors (Decision.swift:373-385), PlannerError for OpenRouter failures (Planner.swift:156-173), CancellationError for user Escape. Retries: When stale=true fires on a DesktopError, the cycle retries the same action after a fresh capture, up to 2 times (JevDesktopApp.swift:931-933). In executePlanned(), if grounding returns no candidate, it retries up to 2 times with a 700 ms sleep (JevDesktopApp.swift:571-581). If stale fires during Desktop.perform(), the step re-captures and retries up to 2 times (JevDesktopApp.swift:601-607). In the fallback loop, unavailable retries twice (JevDesktopApp.swift:1146-1152). Screen-change detection: fingerprint() (Desktop.swift:203-218) gives a structural hash checked before and after each action. waitForChange() (Desktop.swift:242-250) polls it for change. waitForQuiet() (Desktop.swift:229-238) waits for the fingerprint to stabilise. Before execution, Desktop.perform() hit-tests the target centre point to confirm nothing is covering it (Desktop.swift:1176-1186). Chain replay: When Jev judges the goal applies to every window, replay() (JevDesktopApp.swift:1021-1086) repeats the recorded chain across all other windows without further model calls, matching targets by name, kind, place, and ordinal; a missing target after 12 attempts is reported, not guessed. Timeout: The TypeSafe HTTP request has a 20-second timeout (Decision.swift:309).
runCycles a stale-target error is not retried as the same action; it is recorded as 'NOT performed' and the next cycle captures again and lets Jev re-decide, bounded only by the 14-cycle cap and the no-change/same-pick stops. The cited 'fallback loop' (execute) is never called.razaanstha/ulka
answeredError classes caught: The runner catches StaleDecisionError (element changed, detached, or occluded since snapshot), TextTargetMismatchError (wrong field for text), TextGenerationUnavailableError, and VerificationUnavailableError. The FX agent additionally catches gateway-specific errors: JevGatewayUnavailableError, JevGatewayRejectedError, JevGatewayInvalidResponseError, tab-closed errors, and debugger-conflict errors (fx-agent.ts:182-203). Retries: The Jev decision engine retries malformed evaluation output once (vercel-jev.ts:144-151). Gateway SDK failures (status 5xx, retryable gateway errors) trigger a single HTTP fallback attempt (vercel-jev.ts:116-133). The outcome verifier retries once on transient service errors or malformed responses, with increased maxOutputTokens on schema failures (outcome-verifier.ts:82-119). Text generation repairs malformed or rejected content once via a second model call (text-generator.ts:114-149). The observer tries up to 20 times (50ms apart) for a document to be ready (observer.ts:298). The FX outer loop has 3 recovery attempts if verification fails (fx-agent.ts:281). Replanning: Stale targets trigger feedback with evidence text guiding the Jev model to re-observe and choose differently (agent-runner.ts:189-198). Failed verification sets excludeDone=true and passes evidence as feedback for the next decision. Blocked subgoals are counted — after 2 consecutive blocks the FX planner stops (fx-agent.ts:157-158). Action caching (action-cache.ts): Successful CLICK and SELECT actions that produced a page change are cached by semantic key (goal + URL + operation + role + label + ordinal + page precondition state). On fresh runs, findCachedAction() replays a matching cached action without a model call (agent-runner.ts:88,94). Timeouts: Page settling during waitForChange() uses a 3-second budget (10s for explicit WAIT) (agent-runner.ts:215). Navigation waits up to 30s (navigation.ts:28-68). Model connection tests timeout at 10s. The observer's observe() retries for up to ~1 second. Consecutive-error stops: 3 consecutive stale targets, 3 consecutive ineffective actions (no page change), 3 consecutive tool errors, or 2 consecutive blocked subgoals all abort the run.
ekzhang/openjev-sglang
not applicableOpenJev's error handling is limited to infrastructure-level retries and client disconnect cleanup. SGLang timeouts are raised as BackendError(504), connection failures as BackendError(503), and non-OK HTTP statuses are mapped to error codes with Retry-After: 1 for 429/503/529. The service layer wraps the full evaluation in a top-level asyncio.timeout; exceeded deadlines raise 504. If a client disconnects mid-request, the server cancels all outstanding SGLang tasks and issues an abort request. The only retry is in the health-check polling during startup (runtime.py:101-108, polls every 1 second for up to 1200 seconds) and the smoke test's retry loop (smoke.py:17-28, polls every 2 seconds). There is no retry of failed inference calls for a single request, no self-healing, no caching of successful actions, and no replanning — the system is single-shot, not an agent.
← How is the agent loop / planning implemented? · Which models are supported and how are they called? →