fix(run): bound failure evidence to one 5 s capture per attempt

Merged
OK
2mo ago
+48-5
  • A failed attempt captures the screen and screenshot for failure evidence with a 5 s budget. When the capture came back empty (hung app), the runner tried again at every later capture point (packages/e2e/src/run/execute.ts body catch, settle catch, finally), so a hung app paid 5 s per point: measured 11.3 s attempt for a 1.1 s step in agent-act, 11.7 s in engine-contract.
  • captureFailureEvidence awaited observe and screenshot without racing the budget, so an engine that ignores cancellation held the attempt forever.
  • Fix: capture once per attempt (evidenceTried), and abandon each engine call when the budget's signal fires (withAbort). The original failure is kept; evidence is just absent.

Verified

Ran it locally: yes

  • New fake-engine tests in failure-evidence.test.ts (hung observe that honors / ignores cancellation): on main the first takes 10.5 s with 2 observes, the second hangs to the 30 s test timeout. Branch: 1 observe, ~5.3 s each. Mutation-checked each half of the fix.
  • Existing slow tests: engine-contract "observation outlives the deadline" 11.7 s -> 6.6 s, agent-act "page that never settles" 11.3 s -> 6.3 s.
  • Real web engine, testbed scratch test: app.open() to a local server that never responds, { timeout: 3_000 }:
mainthis branch
× fails on a page that never loads (timed-out) 13.08s× fails on a page that never loads (timed-out) 8.08s

Side finding, not in scope: on the web engine, app.open() to a never-responding server and a locator tap() on a frozen renderer (busy loop) both wait for the test timeout, not actionTimeout.