Skip to content

feat(browser): retain cleanup evidence for failed Agent Tasks - #139

Draft
seonghobae wants to merge 8 commits into
test/agent-task-pristine-profile-admissionfrom
test/agent-task-failure-cleanup-evidence
Draft

feat(browser): retain cleanup evidence for failed Agent Tasks#139
seonghobae wants to merge 8 commits into
test/agent-task-pristine-profile-admissionfrom
test/agent-task-failure-cleanup-evidence

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Partial implementation of #28, stacked on unchanged exact PR #136 head 1deca80bf6a67394e25a2c914b76d490c2aad960.

Buyer/reliability gap

The controlled Agent Task runner previously discarded temporary-profile cleanup evidence whenever either the ordinary browser pass or forced-close probe failed. Outer loops retained only trial number, failure state, and exception type, while cleanup/isolation checks filtered to successful trials. A failed or interrupted task could therefore lack credential-free teardown evidence even though #28 requires deterministic failure/recovery and no leaked task profile.

Dependency and writer alignment

This Draft targets unchanged exact #136 head 1deca80bf6a67394e25a2c914b76d490c2aad960 and must remain Draft while #136/#132 and their prerequisites remain active. Earlier independent prerequisite movements were incorporated through normal non-destructive two-parent merge commits. Current exact head 499a6499112a11094279a1386238e26987d771d5 contains the current base as ancestry. No force-push, destructive rebase, base mutation, or predecessor evidence transfer occurred.

TDD and RCA sequence

  1. Exact aligned ordinary-trial test head 7e1db77e82dae1d43fdf57c20c54337678f3799c required _run_agent_task_trial to retain bounded cleanup evidence after a controlled browser-pass failure and required an all-trial cleanup gate. CI 31655752094, Rust contracts 94309699104, failed exactly the two intended Python boundaries: the mocked RuntimeError escaped and aggregate cleanup proof did not exist. This is the first valid RED.
  2. Production head c6c491ff794323bec5de19d7ece415f89d708d28 added bounded ordinary-trial failure evidence and all-trial cleanup gating; merge-alignment head 56ed81c52395ff6e61ab9efd76493fea32445af1 was exact-green in CI 31656517616 and MV3 31656517683.
  3. A fresh lifecycle audit found the same defect in _run_agent_task_forced_close_trial. Test head b6583d54d5ccbf2d8028e51035fb5fe20100d6a9 added forced-close failure and cleanup-gate requirements. CI 31656775065, Rust contracts 94312873184, passed repository setup and failed exactly because the forced-close exception still escaped and the dedicated evidence/gate were absent. This is the second valid RED.
  4. Production head 4b474260e777c84335636b2fbd732a00e48159d4 added forced-close failure cleanup evidence and a separate all-trial forced-close cleanup gate; CI 31657248055 and MV3 31657248068 succeeded.
  5. Current exact head 499a6499112a11094279a1386238e26987d771d5 adds only the truthful Unreleased changelog entry covering ordinary and forced-close failure cleanup evidence.

Implemented contract

Both _run_agent_task_trial and _run_agent_task_forced_close_trial now:

  • catch only the reviewed browser-run failure classes (OSError, ValueError, RuntimeError, json.JSONDecodeError) inside the TemporaryDirectory lifecycle;
  • retain only bounded failure type, never exception message or browser/page content;
  • verify profile removal after the context exits;
  • fail with a dedicated cleanup error if the profile remains;
  • return trial number, passed: false, failure type, profile_cleaned: true, and duration when browser work fails but teardown succeeds;
  • preserve full successful-trial evidence plus profile_cleaned: true; and
  • leave unexpected exception classes unnormalized.

Aggregate evidence now computes cleanup across every ordinary and forced-close trial, emits both cleanup results, and applies distinct fail-closed ordinary and forced-close cleanup gates before repeatability/recovery acceptance. An outer failure without cleanup proof therefore fails closed rather than inventing teardown success.

Exact-head proof

On unchanged exact head 499a6499112a11094279a1386238e26987d771d5 against unchanged exact prerequisite 1deca80bf6a67394e25a2c914b76d490c2aad960:

  • CI 31657489713: success;
  • Rust contracts 94315047896: repository contracts, formatting, locked workspace/all-target check, full tests, strict Clippy, and rustdoc success;
  • Production coverage 94315047798: exact owned production function/line/region/branch enforcement success;
  • Manifest V3 Compatibility 31657489637: success;
  • CodeRabbit exact-head status: success;
  • GitHub reports the Draft mergeable against its unchanged prerequisite base; and
  • no inline review threads are currently returned.

No predecessor-head, prerequisite, synthetic-merge, skipped, cancelled, absent, pending, or stale evidence is promoted as current proof.

Truth boundary

This lane records controlled temporary-profile teardown evidence only. It does not prove process termination, adversarial filesystem erasure, deletion of every browser artifact, operating-system keychain cleanup, renderer-crash attribution, arbitrary-task recovery, browser/adapter authenticity, policy authorization, durable incident evidence, or #28 completion. A production runtime still needs trusted task/process ownership, durable recovery evidence, and separately reviewed cleanup/retention semantics.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 73ead784-6e84-4829-ae15-9d17a19a07e9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae seonghobae changed the title test(browser): require failed Agent Task cleanup evidence feat(browser): retain cleanup evidence for failed Agent Tasks Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant