Skip to content

test(browser): retain Agent Task process teardown evidence after failure - #143

Draft
seonghobae wants to merge 2 commits into
test/agent-task-browser-process-termination-evidencefrom
test/agent-task-failure-process-termination-evidence
Draft

test(browser): retain Agent Task process teardown evidence after failure#143
seonghobae wants to merge 2 commits into
test/agent-task-browser-process-termination-evidencefrom
test/agent-task-failure-process-termination-evidence

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Partial implementation of #28, stacked on exact current PR #142 head a66fb27532a689e2e2458c7ff3cb79b340d113ce.

Buyer/reliability gap

PR #142 proves PID-reuse-safe termination of the exact Chrome root process after a successful controlled Agent Task, but an earlier browser-pass exception could escape through cleanup before that post-shutdown identity check ran. A failed task could therefore retain profile-cleanup evidence while losing whether its original browser root actually terminated.

Dependency

This Draft targets exact current #142 head a66fb27532a689e2e2458c7ff3cb79b340d113ce and must remain Draft while #142 and its prerequisite stack remain active. No prerequisite check, review, status, coverage, mergeability, synthetic-merge, predecessor-head, skipped, cancelled, queued, or absent evidence transfers.

TDD / RCA sequence

  1. Exact test-only head e847d0768d7006771b6ee10d56c52e555c0fc168 required failure-path teardown retention before production support existed.
  2. CI run 31667834902, Rust contracts job 94346126016, checked out that exact head and failed in Python repository contracts with the intended missing failure-teardown boundaries. This is the valid RED.
  3. Current exact production head d2dbf3bbee883b91812690089bb33bd274a4687a retains only a bounded failure type plus exact root-process termination evidence after browser identity capture, while preserving fail-closed behavior when identity was never captured.

Implemented contract

_run_agent_task_browser_pass now:

  • captures the ChromeDriver-issued browser PID together with its Linux /proc/<pid>/stat start-time identity before controlled task work proceeds;
  • catches only the reviewed browser-run failure classes (OSError, ValueError, RuntimeError, json.JSONDecodeError) after that identity exists;
  • never converts a failure that occurs before identity capture into invented process-termination evidence;
  • performs the normal WebDriver-session and ChromeDriver cleanup before checking process exit;
  • after shutdown, checks the exact PID/start-time identity so PID reuse counts as exit of the original process while a surviving exact identity remains false;
  • on failed browser work returns only failure_type plus browser_process_terminated, without retaining raw exception messages or page content;
  • on successful browser work still fails closed with Agent Task browser process did not terminate unless the exact root identity exited; and
  • emits browser_process_terminated: true only after that post-shutdown proof.

_run_agent_task_trial now validates and propagates the bounded failure result after temporary-profile cleanup, preserving both true and false process-termination outcomes instead of indexing the success-only result shape or inventing cleanup.

Exact-head proof

On unchanged exact head d2dbf3bbee883b91812690089bb33bd274a4687a against unchanged exact prerequisite #142 head a66fb27532a689e2e2458c7ff3cb79b340d113ce:

  • CI run 31669405222: success;
  • Rust contracts job 94350746789: exact checkout, 154 Python repository-contract tests OK, Rust 1.97.1, canonical formatting, locked workspace/all-target check, full tests, strict Clippy, and rustdoc success;
  • Production coverage job 94350746682: exact owned production function/line/region/branch enforcement success;
  • Manifest V3 Compatibility run 31669405239: success;
  • GitHub reports the Draft mergeable against its exact current prerequisite base; and
  • no formal reviews or inline review threads are currently returned.

Truth boundary

This lane remains limited to the Chrome root PID/start-time identity already introduced by #142. It does not yet prove renderer/GPU/utility descendant termination, arbitrary process ownership, authenticated Chromium/ChromeDriver provenance, OS-wide orphan absence, crash recovery beyond the controlled runner, or completion of #28. The next test-first descendant lane separately targets termination of the exact Chromium process set sampled before shutdown; that active branch is not promoted to this PR's implemented truth.

@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: 1fb1823d-124c-4c00-80ac-09828dfefced

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.

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