Files
Saim ShafiqueandVincent Koc aa78851b85 fix(browser): return completed scenario capture when cleanup is unconfirmed (#6381)
* fix(browser): return completed scenario capture when cleanup is unconfirmed

When every scenario action completed but session cleanup timed out or
failed, capture_browser_scenario reported a hard cleanup_incomplete
failure and retained the finished observation only as a raw partial
with no evidence_id, so the caller lost a result that had succeeded.

Model capture and cleanup separately: the capture schema now admits
cleanup "incomplete" for a completed capture, and the Playwright
provider returns the completed capture in that case, with the cleanup
reason and the resources that may remain reported as a limitation.
The cleanup lease stays retained, so provider close and the next
capture still retry and surface unconfirmed cleanup. Captures whose
operation failed keep the existing cleanup error and partial
observation behavior.

Fixes #6166

Co-authored-by: Saim Shafique <128062316+sx4im@users.noreply.github.com>

* test(browser): update the retained-cleanup CLI test for the completed-capture behavior

When every action completed but cleanup is unconfirmed, the one-shot CLI
now returns the completed capture as Evidence instead of failing with
cleanup_incomplete and exit 1. The retained-cleanup test still asserts the
retry (provider close once, browser close retried, profile removed once)
but now expects the success output: the capture with browser.cleanup
"incomplete", both steps completed, and the unconfirmed-cleanup limitation.

* fix(browser): preserve typed cleanup failure reasons

* test(browser): model capture finalization in session mock

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-11-26 19:04:14 +08:00
..