fix(desktop-browser): give a wait's closing snapshot a full budget and confirm ref reuse names the same element

Merged
WA
2d ago
+57-21

Summary

Final-review follow-ups for the browser-agent changes in this release:

  • browser_wait_for now ends with a snapshot, but its native watchdog still allowed only 5s after the wait. A wait that ran to its timeout on a heavy page could lose its closing observation and invalidate refs, where before it returned found: false with refs intact. The watchdog now adds a standalone snapshot's 20s budget; the renderer's wait budget (queue wait + timeout + 15s) still covers it
  • Ref reuse also requires the stored entry to point at the same element (defensive: a page's id counter only grows per document, so this should be unreachable today; it keeps reuse correct if that ever changes)
  • Rename a local in browser_wait_for that shadowed the module-level elementTarget

Type of Change

  • Bug fix

Testing

  • Red/green: 'gives a wait that runs to its timeout a full snapshot budget for its closing observation' fails on staging with the observation timed out, passes with the fix; watchdog expectations updated for the new budget
  • 548 browser-agent tests pass, desktop type-check clean

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)