fix(cache): keep polling for a replay's destination path until its timeout

Merged
AM
21d ago
+33-2

What and why

  • endScreen in step-cache.ts stopped polling when END_PATH_DELAYS_MS ran out (~5 s), so END_PATH_TIMEOUT_MS (15 s) never applied and a navigation that commits after 5 s handed off as end-mismatch.
  • It now repeats the last delay until the timeout, the same line pollSettled uses.
  • Trade-off: a replay whose route never matches hands off after up to 15 s instead of 5 s, and that wait counts against the step's timeout. 15 s is the bound the constant already documents.

Issue

Fixes #1356

Verified

Ran it locally: yes

  • Scratch project, scripted executor (no model): a button whose navigation commits 8 s after the tap. Recorded once, then e2e run --strict-cache on the same entry with each build:
mainthis branch
--strict-cache replayREPLAY_STALE (end-mismatch) at 5.69 sCache 1 replayed, 8.37 s
  • New unit test in step-cache.test.ts ("keeps looking past the backoff…"): fails on main (expected undefined to be 'passed'), passes here.
  • pnpm bench:ab -- tests-agent/control-inventory.e2e.ts --config e2e.agent.config.ts (Linux, Node 26, committed recordings replayed, no model calls, 12 pairs, then 10 with a second seed): every test ran the same steps with the same outcome on both builds; suite time same (-0.8%, 95% CI -2.6% to +1.5%; a second seed -1.2%, -4.4% to +1.7%). The events navigation counter read 8-10 on this branch in one run and 10 in the other; it read 9-10 on main in another bench, so it varies on main too (most likely the initial page load event racing app.open).

Checklist

  • Changeset added (pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.
  • Breaking change: title carries !, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).
  • Docs updated in the same PR: the docs/**/*.mdx page for the behavior, and skills/e2e/ if the skill describes it. (No page describes this wait.)
  • Contract change: emitted .d.ts reviewed, tests/types/sdk-types.ts updated; wire change edits the schema and both fixtures.
  • Engine contract change (e2e/engine): changesets for e2e, @e2e-dev/web, and @e2e-dev/mobile.

Written with AI help (Claude Opus 5.5, OpenAI Sol 6.1, DeepSeek V4.1 Flash); the runs above are real.