AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
fix(aien-cli): browser mirror answers screenshots on aarch64 and reaps every Chrome helper (#661)
merged5da34e6b05e8132e #688 · opened 2026-10-19 22:35 UTC · closed 2026-10-31 18:55 UTC · merged 2026-10-31 18:55 UTC
Imported from GitHub aien-dev/aien-sovereign-core-mv#688, by drakestapleton
Base 4349511118a563dfba4a42c4e223c7be7f0530a0 · Head 8d1d3f16027867cbbf931dc0bcb6a26bfbfe31b1
Merged on GitHub as 4b17ca34380d41d6155c0eab92313d362b716f00; reachable from main 007ac4ac5ee5edc6f79f411b1706752293604044 (observed 2026-11-18T16:35:46Z)
drakestapleton wrote on 2026-10-19 22:35 UTC
Fixes #661.
Browser mirror (crates/aien-cli/src/browser_mirror.rs). Main already passes --disable-gpu --use-gl=disabled --disable-software-rasterizer and already depends on libc; this PR changes only Chrome teardown.
Before: dropping the Chrome handle killed only the main process, so GPU, renderer, zygote, utility and crash-reporter helpers kept running (the watchdog ORPHANS alarm).
Now every spawn carries a per-spawn AIEN_BROWSER_MIRROR_TAG environment tag and a private profile directory created with mode 0700. Drop finds every process that carries the exact tag, or (for Chrome tasks that clear their environment and rewrite argv) a Chrome image with the exact executable prefix and the complete --user-data-dir= flag. It pins each one with a pidfd, revalidates its identity, signals it through the pidfd and repeats until the main child is reaped and nothing owned remains, for at most 5 s.
Linux signals only pidfds, never a numeric PID or process group, so a recycled PID cannot be hit. Chrome stays in the caller's process group, so a Ctrl-C or a harness group kill that ends the caller before Drop runs also reaches Chrome.
Requires Linux pidfd signaling (kernel 5.3 or later). Without it the tool refuses to spawn Chrome rather than fall back to numeric signals.
On other Unix platforms Chrome leads its own process group and teardown signals that group and the child; this path is not qualified.
A cleanup timeout prints a diagnostic and keeps the private profile instead of blocking or deleting possibly active browser data.
Known limit: on Linux a main Chrome process that no longer carries the tag or the profile flag is never signalled (the old child.kill() was removed because its numeric PID may already belong to someone else once reaped elsewhere). Real Chrome 153 keeps both, and every run below left 0 processes.
Tests (unit, in aien-cli):
dropping_chrome_reaps_every_helper: counts the live Chrome family (negative control: at least 3 found), drops the handle, asserts none is left and no tagged process remains.
tag_sweep_matches_only_its_own_tag: with sleep fixtures, a different tag, a prefix of the tag or no tag is never matched.
cleanup_with_inherited_ignored_sigchld (ignored by default; run under an inherited SIGCHLD=SIG_IGN with AIEN_CHROME set).
The two Chrome tests report a pass without doing anything when no Chrome is installed.
Evidence (EXERCISED on the DGX Spark, aarch64, Chrome 153.0.8010.36, no GPU): evidence/sc661-browser-mirror-spark-20261031/receipt.md.
Ctrl-C replay: the caller runs as leader of its own process group with SIGINT at default (its SigIgn mask is logged), then SIGINT goes to the group. In both arms the caller died (status 130). Tagged processes still alive 4 s later: 17 at 4965d44c (main Chrome, crashpad handlers, zygotes, GPU, utility, renderers and two tagged cat processes) and 0 at 9f745160.
At PR head f7c9e2bb (code identical to 9f745160): browser_mirror tests 8 passed, 1 ignored; the inherited-SIGCHLD case 1 passed; 0 processes carrying AIEN_BROWSER_MIRROR_TAG before or after.
Full cargo test --locked -j1 -p aien-cli under a 3 GiB memory cap at 4965d44c and at 9f745160: 223 passed, 0 failed, 21 ignored both times.
Not run: x86 Chrome, other Chrome versions, non-Linux Unix.
drakestapleton wrote on 2026-10-23 14:38 UTC
The #714 unrestricted preflight reproduced the existing aien-cli screenshot failure (websocket read: Resource temporarily unavailable). This remains in #661/#688's existing scope. GitHub currently reports #688 conflicting with its base and failed AIEN/Spark verification.
The Qwen3.8 review has retained the raw preflight evidence, without treating native CPU checks as a repository pass. The next step for this branch is base reconciliation plus replay of screenshot and helper-cleanup tests. No competing patch, process termination or source approval was made in this review.
drakestapleton wrote on 2026-10-24 06:38 UTC
Pinned Crumb verification: 16/16 current; diff checks PASS. The merge desk published 22b2b8f8562d3ae84782bfb6ac484dfa131e0cfd, tree fc033fe4e12681238d710a4a24e6bb25b21f663d, and verified the branch ref.
This integrates main 2f28ee89 and carries the existing reviewed browser repair from 8da7ac4ea2ef7129d797a768274f59f2a3600ba1 / qualification source 32b30d4ed27101f11470e34ed6d0bab9d01f7b40. The browser source is byte-identical to that qualified source after removing main's license prefix. The self-improvement note now records its actual cleanup limits. The original nine-path PR scope is retained; package versions, checksums and verification policy are unchanged. #728 remains the separate dependency-advisory repair.
Linux cleanup now pins process identities before revalidating the exact tag/private-profile identity and signaling through pidfds. It has a bounded teardown and retains the profile if cleanup is uncertain. The old unconditional helper-cleanup promise is not the current behavior.
Preflight was attempted and failed because Cargo is absent here. Browser/runtime checks on this new integrated head are NOT_RUN. Historical source and whole-repository receipts remain bound to their original commits; the broader 4ced1cea PASS is not assigned to this candidate. Next: exact-head preflight, browser cleanup checks including the isolated inherited-SIGCHLD case, signed Spark verification, and final independent review.
Refs #661, #724 and aien-dev/aien-architecture-mv#190.
drakestapleton reviewed (COMMENTED) on 2026-10-30 11:17 UTC
Triage: needs changes.
This PR conflicts with main and needs a rebase.
The claims about Chrome 153 behavior on DGX Spark aarch64 rest only on a handoff file that lives on the Spark and is not in the repo. Please commit the actual Spark run output.
Hardware evidence: not in repo.
Triage only; no approval or merge implied.
Fetch it
A git bundle of the pull request's head, 46110 bytes.
diff --git a/crates/aien-cli/src/browser_mirror.rs b/crates/aien-cli/src/browser_mirror.rs
index ddfa5881..d70c525d 100644
--- a/crates/aien-cli/src/browser_mirror.rs
+++ b/crates/aien-cli/src/browser_mirror.rs
@@ -27,13 +27,17 @@
//! * `screenshot` Open any URL, capture a PNG, record the document title.
//! * `eval` Open any URL and evaluate a JavaScript expression (value returned as JSON).
//!
-//! Every mode spawns its own Chrome with a private profile directory and kills it
-//! when done, whatever happened in between.
+//! Every mode spawns its own Chrome with a private profile directory. Linux
+//! cleanup requires pidfd support to stop tagged detached helpers without a
+//! recycled-PID race. Detached-helper cleanup on other Unix is not qualified.
use serde_json::{json, Value};
use std::fs;
use std::io::{Read, Write};
use std::net::TcpStream;
+use std::os::unix::fs::DirBuilderExt;
+#[cfg(not(target_os = "linux"))]
+use std::os::unix::process::CommandExt;
use std::path::{Path, PathBuf};
use std::process::{Child, Command, Stdio};
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
@@ -47,6 +51,11 @@ const CHROME_BOOT_TIMEOUT: Duration = Duration::from_secs(20);
const CDP_REPLY_TIMEOUT: Duration = Duration::from_secs(30);
/// Largest websocket message we accept (screenshots are a few MB).
const MAX_WS_MESSAGE: usize = 64 * 1024 * 1024;
+/// How long dropping a browser may take to see every one of its processes gone.
+const REAP_TIMEOUT: Duration = Duration::from_secs(5);
+/// Environment variable carrying a per-browser tag. Chrome's crash reporters detach into
+/// their own session, so they escape the process group; the inherited tag still finds them.
+const TAG_VAR: &str = "AIEN_BROWSER_MIRROR_TAG";
/// Where screenshots and reports land when no `--out-dir` is given.
pub fn default_out_dir() -> PathBuf {
@@ -401,17 +410,36 @@ struct ChromeProcess {
child: Child,
profile_dir: PathBuf,
port: u16,
+ /// Value of `TAG_VAR` in every process this browser started (unique per spawn).
+ tag: String,
+ /// Once reaped, its numeric PID/PGID is no longer an ownership handle.
+ main_reaped: bool,
}
impl ChromeProcess {
fn spawn(binary: &str, url: &str) -> Result<Self, String> {
- let profile_dir = std::env::temp_dir().join(format!(
- "aien-browser-mirror-{}-{}",
- std::process::id(),
- now_nanos()
- ));
- fs::create_dir_all(&profile_dir).map_err(|e| format!("profile dir: {}", e))?;
- let child = Command::new(binary)
+ #[cfg(target_os = "linux")]
+ if !TaggedProcess::available() {
+ return Err("safe Chrome cleanup requires Linux pidfd signaling".to_string());
+ }
+ let tag = format!("aien-browser-mirror-{}-{}", std::process::id(), now_nanos());
+ let profile_dir = std::env::temp_dir().join(&tag);
+ fs::DirBuilder::new()
+ .mode(0o700)
+ .create(&profile_dir)
+ .map_err(|e| format!("profile dir: {}", e))?;
+ let mut command = Command::new(binary);
+ command.env(TAG_VAR, &tag);
+ // Linux teardown signals only pidfds, never numeric PID/PGID targets, so
+ // Chrome stays in the caller's process group: a Ctrl-C or a harness
+ // group kill that ends the caller before Drop runs also reaches Chrome.
+ // Other Unix teardown signals the group, so Chrome leads its own there.
+ #[cfg(not(target_os = "linux"))]
+ command.process_group(0);
+ // --use-gl=disabled --disable-software-rasterizer: with --disable-gpu alone, Chrome 153
+ // headless on aarch64 (DGX Spark, no display) falls back to a SwiftShader GPU process and
+ // Page.captureScreenshot then gets no reply at all (sovereign-core #661; main 92df274c).
+ let spawned = command
.arg("--headless=new")
.arg("--remote-debugging-port=0")
.arg(format!("--user-data-dir={}", profile_dir.display()))
@@ -420,8 +448,6 @@ impl ChromeProcess {
.arg("--no-default-browser-check")
.arg("--disable-dev-shm-usage")
.arg("--disable-gpu")
- // Chrome 153 headless on the Spark (GB10, no display) never answers Page.captureScreenshot
- // with the default software GL path; with GL off and no software rasterizer it does.
.arg("--use-gl=disabled")
.arg("--disable-software-rasterizer")
.arg("--no-sandbox")
@@ -430,12 +456,20 @@ impl ChromeProcess {
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
- .spawn()
- .map_err(|e| format!("spawn {}: {}", binary, e))?;
+ .spawn();
+ let child = match spawned {
+ Ok(c) => c,
+ Err(e) => {
+ fs::remove_dir_all(&profile_dir).ok();
+ return Err(format!("spawn {}: {}", binary, e));
+ }
+ };
let mut me = ChromeProcess {
child,
profile_dir,
port: 0,
+ tag,
+ main_reaped: false,
};
// Chrome writes "<port>\n<browser ws path>" once the debugger listens.
let deadline = Instant::now() + CHROME_BOOT_TIMEOUT;
@@ -452,6 +486,7 @@ impl ChromeProcess {
}
}
if let Ok(Some(status)) = me.child.try_wait() {
+ me.main_reaped = true;
return Err(format!("chrome exited early: {}", status));
}
if Instant::now() >= deadline {
@@ -486,11 +521,187 @@ impl ChromeProcess {
}
}
+/// Candidate PIDs whose environment holds the exact tag. Numeric PIDs are
+/// only discovery hints: pin identity and revalidate before signaling.
+#[cfg(test)]
+fn tagged_pids(tag: &str) -> Vec<u32> {
+ owned_pids(tag, None)
+}
+
+fn has_browser_identity(pid: u32, tag: &str, profile: Option<&Path>) -> bool {
+ let needle = format!("{}={}", TAG_VAR, tag);
+ let tagged = fs::read(format!("/proc/{}/environ", pid))
+ .map(|env| env.split(|b| *b == 0).any(|kv| kv == needle.as_bytes()))
+ .unwrap_or(false);
+ if tagged {
+ return true;
+ }
+ // Chrome scrubs the tag on some tasks, but retains the exact private
+ // profile argument. Never accept a substring or a prefix match.
+ profile.is_some_and(|path| {
+ let arg = format!("--user-data-dir={}", path.display());
+ fs::read(format!("/proc/{}/cmdline", pid))
+ .map(|cmd| {
+ if cmd.split(|b| *b == 0).any(|v| v == arg.as_bytes()) {
+ return true;
+ }
+ // Chrome replaces argv with a single space-joined process
+ // title and clears the original environment. Accept that
+ // representation only for a Chrome image, with its exact
+ // executable prefix and a complete profile flag token.
+ use std::os::unix::ffi::OsStrExt;
+ let Ok(exe) = fs::read_link(format!("/proc/{}/exe", pid)) else {
+ return false;
+ };
+ let chrome = matches!(
+ exe.file_name().and_then(|v| v.to_str()),
+ Some("chrome" | "chromium" | "chromium-browser")
+ );
+ let parts: Vec<_> = cmd.split(|b| *b == 0).filter(|v| !v.is_empty()).collect();
+ if !chrome || parts.len() != 1 {
+ return false;
+ }
+ let title = parts[0];
+ let prefix = [exe.as_os_str().as_bytes(), b" "].concat();
+ let needle = [b" ", arg.as_bytes()].concat();
+ title.starts_with(&prefix)
+ && title.windows(needle.len()).enumerate().any(|(i, w)| {
+ w == needle
+ && (i + needle.len() == title.len() || title[i + needle.len()] == b' ')
+ })
+ })
+ .unwrap_or(false)
+ })
+}
+
+fn owned_pids(tag: &str, profile: Option<&Path>) -> Vec<u32> {
+ let Ok(entries) = fs::read_dir("/proc") else {
+ return Vec::new();
+ };
+ entries
+ .filter_map(|e| e.ok()?.file_name().to_str()?.parse::<u32>().ok())
+ .filter(|pid| has_browser_identity(*pid, tag, profile))
+ .collect()
+}
+
+/// A Linux process identity, not a numeric PID that can be recycled.
+#[cfg(target_os = "linux")]
+struct TaggedProcess(std::os::fd::OwnedFd);
+
+#[cfg(target_os = "linux")]
+impl TaggedProcess {
+ fn pin(pid: u32) -> Option<Self> {
+ use std::os::fd::FromRawFd;
+ let raw = unsafe { libc::syscall(libc::SYS_pidfd_open, pid, 0u32) };
+ if raw < 0 {
+ return None;
+ }
+ Some(Self(unsafe {
+ std::os::fd::OwnedFd::from_raw_fd(raw as i32)
+ }))
+ }
+
+ fn available() -> bool {
+ Self::pin(std::process::id()).is_some_and(|p| p.signal(0))
+ }
+
+ #[cfg(test)]
+ fn open(pid: u32, tag: &str) -> Option<Self> {
+ Self::open_owned(pid, tag, None)
+ }
+
+ fn open_owned(pid: u32, tag: &str, profile: Option<&Path>) -> Option<Self> {
+ // Pin before checking the environment. If the task exits and the
+ // number is recycled, this descriptor still names only the old task.
+ let process = Self::pin(pid)?;
+ if !has_browser_identity(pid, tag, profile) {
+ return None;
+ }
+ Some(process)
+ }
+
+ fn kill(&self) -> bool {
+ self.signal(libc::SIGKILL)
+ }
+
+ fn signal(&self, signal: i32) -> bool {
+ use std::os::fd::AsRawFd;
+ unsafe {
+ libc::syscall(
+ libc::SYS_pidfd_send_signal,
+ self.0.as_raw_fd(),
+ signal,
+ std::ptr::null::<libc::siginfo_t>(),
+ 0u32,
+ ) == 0
+ }
+ }
+}
+
+#[cfg(test)]
+fn kill_tagged_pid(pid: u32, tag: &str) -> bool {
+ #[cfg(target_os = "linux")]
+ {
+ TaggedProcess::open(pid, tag).is_some_and(|p| p.kill())
+ }
+ #[cfg(not(target_os = "linux"))]
+ {
+ let _ = (pid, tag);
+ false
+ }
+}
+
+impl ChromeProcess {
+ /// Linux teardown pins tasks and revalidates their exact tag or private
+ /// profile identity before fd signaling. Rewritten Chrome titles require
+ /// a Chrome image, its exact executable prefix and a complete profile flag.
+ /// Returns true only after the child is reaped and no owned task remains.
+ /// A timeout returns false without a final unbounded child wait.
+ fn reap(&mut self) -> bool {
+ let deadline = Instant::now() + REAP_TIMEOUT;
+ // Linux uses only pinned identities; numeric groups are never a
+ // signal target, even if another reaper already collected the child.
+ #[cfg(not(target_os = "linux"))]
+ if !self.main_reaped {
+ unsafe { libc::kill(-(self.child.id() as libc::pid_t), libc::SIGKILL) };
+ self.child.kill().ok();
+ }
+ loop {
+ let tagged = owned_pids(&self.tag, Some(&self.profile_dir));
+ for &pid in &tagged {
+ #[cfg(target_os = "linux")]
+ if let Some(task) =
+ TaggedProcess::open_owned(pid, &self.tag, Some(&self.profile_dir))
+ {
+ task.kill();
+ }
+ }
+ match self.child.try_wait() {
+ Ok(Some(_)) => self.main_reaped = true,
+ Err(e) if e.raw_os_error() == Some(libc::ECHILD) => self.main_reaped = true,
+ _ => {}
+ }
+ if self.main_reaped && tagged.is_empty() {
+ return true;
+ }
+ if Instant::now() >= deadline {
+ return false;
+ }
+ std::thread::sleep(Duration::from_millis(20));
+ }
+ }
+}
+
impl Drop for ChromeProcess {
fn drop(&mut self) {
- self.child.kill().ok();
- self.child.wait().ok();
- fs::remove_dir_all(&self.profile_dir).ok();
+ if self.reap() {
+ fs::remove_dir_all(&self.profile_dir).ok();
+ } else {
+ eprintln!(
+ "browser cleanup timed out; retained private profile {}",
+ self.profile_dir.display()
+ );
+ }
}
}
@@ -959,4 +1170,319 @@ mod tests {
assert_eq!(ev["status"], "ok", "{}", ev);
assert_eq!(ev["value"], "mirror:42");
}
+
+ /// `(state, ppid, starttime)` from `/proc/<pid>/stat`, or `None` once the pid is gone.
+ fn proc_stat(pid: u32) -> Option<(char, u32, u64)> {
+ let stat = fs::read_to_string(format!("/proc/{}/stat", pid)).ok()?;
+ // Fields after "(comm)": state ppid pgrp session tty tpgid flags ... starttime is the 20th.
+ let rest: Vec<&str> = stat.rsplit_once(')')?.1.split_whitespace().collect();
+ Some((
+ rest.first()?.chars().next()?,
+ rest.get(1)?.parse().ok()?,
+ rest.get(19)?.parse().ok()?,
+ ))
+ }
+
+ /// Every process the browser started, as `(pid, starttime)`: the descendants of `root`
+ /// plus the crash reporters they name with `--crashpad-handler-pid`, which detach into
+ /// their own session and so are nobody's child.
+ fn chrome_family(root: u32) -> Vec<(u32, u64)> {
+ let all: Vec<u32> = fs::read_dir("/proc")
+ .unwrap()
+ .filter_map(|e| e.ok()?.file_name().to_str()?.parse().ok())
+ .collect();
+ let mut family: Vec<u32> = vec![root];
+ let mut grew = true;
+ while grew {
+ grew = false;
+ for &p in &all {
+ if !family.contains(&p)
+ && proc_stat(p).is_some_and(|(_, ppid, _)| family.contains(&ppid))
+ {
+ family.push(p);
+ grew = true;
+ }
+ }
+ }
+ let mut named: Vec<u32> = Vec::new();
+ for &p in &family {
+ let cmd = fs::read(format!("/proc/{}/cmdline", p)).unwrap_or_default();
+ for arg in cmd.split(|b| *b == 0) {
+ if let Some(n) = arg.strip_prefix(b"--crashpad-handler-pid=") {
+ if let Some(n) = std::str::from_utf8(n).ok().and_then(|s| s.parse().ok()) {
+ named.push(n);
+ }
+ }
+ }
+ }
+ family.extend(named);
+ family.sort_unstable();
+ family.dedup();
+ family
+ .into_iter()
+ .filter_map(|p| proc_stat(p).map(|(_, _, start)| (p, start)))
+ .collect()
+ }
+
+ /// True while `pid` is the same process (same start time) and not a zombie.
+ fn still_running(pid: u32, start: u64) -> bool {
+ proc_stat(pid).is_some_and(|(state, _, s)| s == start && state != 'Z' && state != 'X')
+ }
+
+ /// Dropping the Chrome handle must leave none of its processes behind: not the GPU
+ /// process, not the renderers, not the crash reporters that detach from the group.
+ #[test]
+ fn dropping_chrome_reaps_every_helper() {
+ let Some(binary) = find_chrome() else {
+ eprintln!("skipping dropping_chrome_reaps_every_helper: no Chrome binary found");
+ return;
+ };
+ let dir = tempfile::tempdir().expect("tempdir");
+ let page = dir.path().join("stub.html");
+ fs::write(&page, "<!doctype html><title>reap</title><h1>reap</h1>").unwrap();
+ let chrome = ChromeProcess::spawn(&binary, &format!("file://{}", page.display()))
+ .expect("spawn chrome");
+ chrome.page_ws_url().expect("page target");
+ // The tag reaches the processes that leave the group (crash reporters).
+ let tag = chrome.tag.clone();
+ let tagged = tagged_pids(&tag);
+ assert!(!tagged.is_empty(), "no process carries the tag");
+ let mut family = chrome_family(chrome.child.id());
+ family.extend(
+ tagged
+ .iter()
+ .filter_map(|&p| proc_stat(p).map(|(_, _, s)| (p, s))),
+ );
+ family.sort_unstable();
+ family.dedup();
+ // Short-lived helpers may exit on their own between listing and checking.
+ let family: Vec<(u32, u64)> = family
+ .into_iter()
+ .filter(|&(p, s)| still_running(p, s))
+ .collect();
+
+ // Negative control: the detector sees the live helpers, so "none left" below is a
+ // real observation and not a detector that cannot see anything.
+ assert!(
+ family.len() >= 3,
+ "detector found too few chrome processes: {:?}",
+ family
+ );
+
+ drop(chrome);
+ // Orphaned zombies are reaped by init; give that a moment, never the processes.
+ let deadline = Instant::now() + Duration::from_secs(2);
+ let mut left: Vec<(u32, u64)> = family.clone();
+ while !left.is_empty() && Instant::now() < deadline {
+ std::thread::sleep(Duration::from_millis(100));
+ left.retain(|&(p, s)| still_running(p, s));
+ }
+ let names: Vec<String> = left
+ .iter()
+ .map(|(p, _)| {
+ let comm = fs::read_to_string(format!("/proc/{}/cmdline", p)).unwrap_or_default();
+ format!(
+ "{} {}",
+ p,
+ comm.replace('\0', " ").chars().take(80).collect::<String>()
+ )
+ })
+ .collect();
+ assert!(
+ left.is_empty(),
+ "chrome processes left running: {:#?}",
+ names
+ );
+ assert_eq!(
+ tagged_pids(&tag),
+ Vec::<u32>::new(),
+ "tagged processes left"
+ );
+ }
+
+ /// The tag sweep finds exactly the processes spawned with its tag. Negative control:
+ /// a process with a different tag, and one with none, are never matched (so drop can
+ /// never kill a stranger).
+ #[test]
+ fn tag_sweep_matches_only_its_own_tag() {
+ let tag = format!("sweep-test-{}-{}", std::process::id(), now_nanos());
+ let spawn = |value: Option<&str>| {
+ let mut c = Command::new("sleep");
+ c.arg("30").stdin(Stdio::null()).stdout(Stdio::null());
+ if let Some(v) = value {
+ c.env(TAG_VAR, v);
+ }
+ c.spawn().expect("spawn sleep")
+ };
+ let mut mine = spawn(Some(&tag));
+ let mut prefix = spawn(Some(&tag[..tag.len() - 1]));
+ let mut other = spawn(Some("sweep-test-someone-else"));
+ let mut none = spawn(None);
+ // A freshly forked child may still hold the parent's environment until exec.
+ let deadline = Instant::now() + Duration::from_secs(5);
+ let mut found = tagged_pids(&tag);
+ while found.is_empty() && Instant::now() < deadline {
+ std::thread::sleep(Duration::from_millis(20));
+ found = tagged_pids(&tag);
+ }
+ let ids = [mine.id(), prefix.id(), other.id(), none.id()];
+ for c in [&mut mine, &mut prefix, &mut other, &mut none] {
+ c.kill().ok();
+ c.wait().ok();
+ }
+ assert_eq!(found, vec![ids[0]], "sweep must match only {:?}", ids);
+ assert!(tagged_pids(&tag).is_empty());
+ }
+
+ #[cfg(target_os = "linux")]
+ #[test]
+ fn stale_candidates_and_exited_pidfds_cannot_signal_a_stranger() {
+ let tag = format!("pidfd-test-{}-{}", std::process::id(), now_nanos());
+ let spawn = |value: &str| {
+ Command::new("sleep")
+ .arg("30")
+ .env(TAG_VAR, value)
+ .spawn()
+ .expect("spawn owned fixture")
+ };
+ let mut mine = spawn(&tag);
+ let mut prefix = spawn(&tag[..tag.len() - 1]);
+ let mut other = spawn("pidfd-test-other");
+ let deadline = Instant::now() + Duration::from_secs(5);
+ let pinned = loop {
+ if let Some(p) = TaggedProcess::open(mine.id(), &tag) {
+ break Some(p);
+ }
+ if Instant::now() >= deadline {
+ break None;
+ }
+ std::thread::sleep(Duration::from_millis(10));
+ };
+ // Simulate a stale discovery list that now names a foreign task:
+ // validation must happen after opening the identity handle.
+ let refused_prefix = !kill_tagged_pid(prefix.id(), &tag);
+ let refused_other = !kill_tagged_pid(other.id(), &tag);
+ let owned_signaled = pinned.as_ref().is_some_and(|p| p.kill());
+ if !owned_signaled {
+ mine.kill().ok();
+ }
+ mine.wait().ok();
+ let dead_handle_refused = pinned.as_ref().is_some_and(|p| !p.kill());
+ let neighbors_alive =
+ matches!(prefix.try_wait(), Ok(None)) && matches!(other.try_wait(), Ok(None));
+ for c in [&mut prefix, &mut other] {
+ c.kill().ok();
+ c.wait().ok();
+ }
+ assert!(
+ pinned.is_some(),
+ "kernel pidfd support and exact-tag pin required"
+ );
+ assert!(
+ owned_signaled
+ && refused_prefix
+ && refused_other
+ && dead_handle_refused
+ && neighbors_alive
+ );
+ }
+
+ #[cfg(target_os = "linux")]
+ #[test]
+ fn undetected_child_does_not_extend_drop_past_cleanup_deadline() {
+ let dir = tempfile::tempdir().unwrap();
+ let profile = dir.path().join("private-profile");
+ fs::create_dir(&profile).unwrap();
+ let child = Command::new("sleep")
+ .arg("8")
+ .env_remove(TAG_VAR)
+ .spawn()
+ .unwrap();
+ let pid = child.id();
+ // Keep an owner-controlled pinned handle even when the production
+ // detector intentionally cannot recognize this synthetic child.
+ let control = TaggedProcess::pin(pid).unwrap();
+ let chrome = ChromeProcess {
+ child,
+ profile_dir: profile.clone(),
+ port: 0,
+ tag: format!("undetected-{}-{}", std::process::id(), now_nanos()),
+ main_reaped: false,
+ };
+ let start = Instant::now();
+ drop(chrome);
+ let elapsed = start.elapsed();
+ let retained = profile.exists();
+ control.kill();
+ unsafe {
+ libc::waitpid(pid as libc::pid_t, std::ptr::null_mut(), 0);
+ }
+ assert!(
+ elapsed < REAP_TIMEOUT + Duration::from_secs(2),
+ "drop exceeded deadline: {elapsed:?}"
+ );
+ assert!(
+ retained,
+ "uncertain teardown must retain its private profile"
+ );
+ }
+
+ #[cfg(target_os = "linux")]
+ #[test]
+ #[ignore = "explicit isolated inherited-SIGCHLD qualification"]
+ fn cleanup_with_inherited_ignored_sigchld() {
+ // Run via exec under SIGCHLD=SIG_IGN, not through chrome_binary():
+ // its --version probe cannot wait for auto-reaped children.
+ let mut action = std::mem::MaybeUninit::<libc::sigaction>::uninit();
+ assert_eq!(
+ unsafe { libc::sigaction(libc::SIGCHLD, std::ptr::null(), action.as_mut_ptr()) },
+ 0
+ );
+ assert_eq!(unsafe { action.assume_init() }.sa_sigaction, libc::SIG_IGN);
+ let binary = std::env::var("AIEN_CHROME").expect("explicit Chrome path required");
+ let chrome = ChromeProcess::spawn(&binary, "data:text/html,owned-sigchld-fixture").unwrap();
+ let tag = chrome.tag.clone();
+ let profile = chrome.profile_dir.clone();
+ drop(chrome);
+ assert!(owned_pids(&tag, Some(&profile)).is_empty());
+ assert!(!profile.exists());
+ }
+
+ #[cfg(target_os = "linux")]
+ #[test]
+ fn exact_private_profile_identifies_a_task_without_its_tag() {
+ let dir = tempfile::tempdir().unwrap();
+ let profile = dir.path().join("private-profile");
+ let tag = format!("profile-fixture-{}-{}", std::process::id(), now_nanos());
+ let spawn = |path: &Path| {
+ Command::new("sh")
+ .args(["-c", "kill -STOP $$", "profile-fixture"])
+ .arg(format!("--user-data-dir={}", path.display()))
+ .env_remove(TAG_VAR)
+ .spawn()
+ .unwrap()
+ };
+ let mut mine = spawn(&profile);
+ let mut neighbor = spawn(&profile.with_extension("other"));
+ let deadline = Instant::now() + Duration::from_secs(5);
+ let pinned = loop {
+ if let Some(p) = TaggedProcess::open_owned(mine.id(), &tag, Some(&profile)) {
+ break Some(p);
+ }
+ if Instant::now() >= deadline {
+ break None;
+ }
+ std::thread::sleep(Duration::from_millis(10));
+ };
+ let rejected = TaggedProcess::open_owned(neighbor.id(), &tag, Some(&profile)).is_none();
+ let signaled = pinned.as_ref().is_some_and(|p| p.kill());
+ if !signaled {
+ mine.kill().ok();
+ }
+ mine.wait().ok();
+ let neighbor_alive = matches!(neighbor.try_wait(), Ok(None));
+ neighbor.kill().ok();
+ neighbor.wait().ok();
+ assert!(pinned.is_some() && signaled && rejected && neighbor_alive);
+ }
}
diff --git a/evidence/sc661-browser-mirror-spark-20261031/aien-cli-tests-4965d44c.log b/evidence/sc661-browser-mirror-spark-20261031/aien-cli-tests-4965d44c.log
new file mode 100644
index 00000000..0a29a958
--- /dev/null
+++ b/evidence/sc661-browser-mirror-spark-20261031/aien-cli-tests-4965d44c.log
@@ -0,0 +1,26 @@
+# cargo test --locked -j1 -p aien-cli on the tree of 4965d44c, 3 GiB scope; summary lines; cargo exit status 0
+ Running unittests src/lib.rs (/tmp/prfix/t688-target/debug/deps/aien_cli-740e8e57e1f1e529)
+test result: ok. 8 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 5.01s
+ Running unittests src/bin/aien-browser-mirror.rs (/tmp/prfix/t688-target/debug/deps/aien_browser_mirror-abe93f9b875094f9)
+test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running unittests src/main.rs (/tmp/prfix/t688-target/debug/deps/aien_cli-c8d9172c7065ecfc)
+test result: ok. 199 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 7.85s
+ Running tests/allen_concurrency_test.rs (/tmp/prfix/t688-target/debug/deps/allen_concurrency_test-01a10a3052cd4e0b)
+test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/compose_memory_recall_test.rs (/tmp/prfix/t688-target/debug/deps/compose_memory_recall_test-e5b8db85b0d08b40)
+test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/compose_ordinary_flow_test.rs (/tmp/prfix/t688-target/debug/deps/compose_ordinary_flow_test-7e50bf87d6ef5af3)
+test result: ok. 0 passed; 0 failed; 3 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/cpu_only_switch_test.rs (/tmp/prfix/t688-target/debug/deps/cpu_only_switch_test-7d335b1957e5e653)
+test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
+ Running tests/desk_required_startup_test.rs (/tmp/prfix/t688-target/debug/deps/desk_required_startup_test-66a2e5b5b0402b41)
+test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.33s
+ Running tests/objective_record_test.rs (/tmp/prfix/t688-target/debug/deps/objective_record_test-06201f436c30ceee)
+test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
+ Running tests/provenance_link_live_test.rs (/tmp/prfix/t688-target/debug/deps/provenance_link_live_test-c6c9f3a39819c580)
+test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/recovery_matrix_test.rs (/tmp/prfix/t688-target/debug/deps/recovery_matrix_test-d7c972bbb99a24a8)
+test result: ok. 0 passed; 0 failed; 12 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/test_cli_runtime_ipc.rs (/tmp/prfix/t688-target/debug/deps/test_cli_runtime_ipc-64b93dd255a8441e)
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s
+test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
diff --git a/evidence/sc661-browser-mirror-spark-20261031/aien-cli-tests-9f745160.log b/evidence/sc661-browser-mirror-spark-20261031/aien-cli-tests-9f745160.log
new file mode 100644
index 00000000..6186ef8f
--- /dev/null
+++ b/evidence/sc661-browser-mirror-spark-20261031/aien-cli-tests-9f745160.log
@@ -0,0 +1,26 @@
+# cargo test --locked -j1 -p aien-cli on the tree of 9f745160 (browser_mirror.rs blob d70c525d), 3 GiB scope; summary lines; cargo exit status 0
+ Running unittests src/lib.rs (/tmp/prfix/t688-target/debug/deps/aien_cli-740e8e57e1f1e529)
+test result: ok. 8 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 5.03s
+ Running unittests src/bin/aien-browser-mirror.rs (/tmp/prfix/t688-target/debug/deps/aien_browser_mirror-abe93f9b875094f9)
+test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running unittests src/main.rs (/tmp/prfix/t688-target/debug/deps/aien_cli-c8d9172c7065ecfc)
+test result: ok. 199 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 7.80s
+ Running tests/allen_concurrency_test.rs (/tmp/prfix/t688-target/debug/deps/allen_concurrency_test-01a10a3052cd4e0b)
+test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/compose_memory_recall_test.rs (/tmp/prfix/t688-target/debug/deps/compose_memory_recall_test-e5b8db85b0d08b40)
+test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/compose_ordinary_flow_test.rs (/tmp/prfix/t688-target/debug/deps/compose_ordinary_flow_test-7e50bf87d6ef5af3)
+test result: ok. 0 passed; 0 failed; 3 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/cpu_only_switch_test.rs (/tmp/prfix/t688-target/debug/deps/cpu_only_switch_test-7d335b1957e5e653)
+test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s
+ Running tests/desk_required_startup_test.rs (/tmp/prfix/t688-target/debug/deps/desk_required_startup_test-66a2e5b5b0402b41)
+test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.33s
+ Running tests/objective_record_test.rs (/tmp/prfix/t688-target/debug/deps/objective_record_test-06201f436c30ceee)
+test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s
+ Running tests/provenance_link_live_test.rs (/tmp/prfix/t688-target/debug/deps/provenance_link_live_test-c6c9f3a39819c580)
+test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/recovery_matrix_test.rs (/tmp/prfix/t688-target/debug/deps/recovery_matrix_test-d7c972bbb99a24a8)
+test result: ok. 0 passed; 0 failed; 12 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/test_cli_runtime_ipc.rs (/tmp/prfix/t688-target/debug/deps/test_cli_runtime_ipc-64b93dd255a8441e)
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
+test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
diff --git a/evidence/sc661-browser-mirror-spark-20261031/aien-cli-tests.log b/evidence/sc661-browser-mirror-spark-20261031/aien-cli-tests.log
new file mode 100644
index 00000000..2a593235
--- /dev/null
+++ b/evidence/sc661-browser-mirror-spark-20261031/aien-cli-tests.log
@@ -0,0 +1,27 @@
+### 2026-10-31T02:47:10Z head f81de1178021e7b9ce2544b69627ddbb10604bdd load 17.41 16.50 16.60 :: cargo test --locked -j2 -p aien-cli
+ Running unittests src/lib.rs (/tmp/prfix/CoreLane-target/debug/deps/aien_cli-740e8e57e1f1e529)
+test result: ok. 8 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 5.01s
+ Running unittests src/bin/aien-browser-mirror.rs (/tmp/prfix/CoreLane-target/debug/deps/aien_browser_mirror-abe93f9b875094f9)
+test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running unittests src/main.rs (/tmp/prfix/CoreLane-target/debug/deps/aien_cli-c8d9172c7065ecfc)
+test result: ok. 199 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 8.46s
+ Running tests/allen_concurrency_test.rs (/tmp/prfix/CoreLane-target/debug/deps/allen_concurrency_test-01a10a3052cd4e0b)
+test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/compose_memory_recall_test.rs (/tmp/prfix/CoreLane-target/debug/deps/compose_memory_recall_test-e5b8db85b0d08b40)
+test result: ok. 0 passed; 0 failed; 2 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/compose_ordinary_flow_test.rs (/tmp/prfix/CoreLane-target/debug/deps/compose_ordinary_flow_test-7e50bf87d6ef5af3)
+test result: ok. 0 passed; 0 failed; 3 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/cpu_only_switch_test.rs (/tmp/prfix/CoreLane-target/debug/deps/cpu_only_switch_test-7d335b1957e5e653)
+test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
+ Running tests/desk_required_startup_test.rs (/tmp/prfix/CoreLane-target/debug/deps/desk_required_startup_test-66a2e5b5b0402b41)
+test result: ok. 7 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.72s
+ Running tests/objective_record_test.rs (/tmp/prfix/CoreLane-target/debug/deps/objective_record_test-06201f436c30ceee)
+test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
+ Running tests/provenance_link_live_test.rs (/tmp/prfix/CoreLane-target/debug/deps/provenance_link_live_test-c6c9f3a39819c580)
+test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/recovery_matrix_test.rs (/tmp/prfix/CoreLane-target/debug/deps/recovery_matrix_test-d7c972bbb99a24a8)
+test result: ok. 0 passed; 0 failed; 12 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ Running tests/test_cli_runtime_ipc.rs (/tmp/prfix/CoreLane-target/debug/deps/test_cli_runtime_ipc-64b93dd255a8441e)
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s
+test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
+### EXIT 0 2026-10-31T02:48:51Z disk 15G
diff --git a/evidence/sc661-browser-mirror-spark-20261031/aien-cli-tests.rc b/evidence/sc661-browser-mirror-spark-20261031/aien-cli-tests.rc
new file mode 100644
index 00000000..573541ac
--- /dev/null
+++ b/evidence/sc661-browser-mirror-spark-20261031/aien-cli-tests.rc
@@ -0,0 +1 @@
+0
diff --git a/evidence/sc661-browser-mirror-spark-20261031/browser-mirror-tests.log b/evidence/sc661-browser-mirror-spark-20261031/browser-mirror-tests.log
new file mode 100644
index 00000000..111375e7
--- /dev/null
+++ b/evidence/sc661-browser-mirror-spark-20261031/browser-mirror-tests.log
@@ -0,0 +1,31 @@
+### 2026-10-31T03:08:04Z head f81de1178021e7b9ce2544b69627ddbb10604bdd
+### host: Linux 7.0.0-1019-nvidia aarch64; Google Chrome 153.0.8010.36 ; /usr/bin/google-chrome
+ Finished `test` profile [unoptimized + debuginfo] target(s) in 2m 01s
+ Executable unittests src/lib.rs (/tmp/prfix/CoreLane-target/debug/deps/aien_cli-740e8e57e1f1e529)
+### test binary: aien_cli-740e8e57e1f1e529
+### cmd: <lib test binary> browser_mirror --test-threads=1 --nocapture
+
+running 9 tests
+test browser_mirror::tests::base64_roundtrip ... ok
+test browser_mirror::tests::cleanup_with_inherited_ignored_sigchld ... ignored, explicit isolated inherited-SIGCHLD qualification
+test browser_mirror::tests::dropping_chrome_reaps_every_helper ... ok
+test browser_mirror::tests::exact_private_profile_identifies_a_task_without_its_tag ... ok
+test browser_mirror::tests::stale_candidates_and_exited_pidfds_cannot_signal_a_stranger ... ok
+test browser_mirror::tests::stub_page_screenshot_and_eval ... ok
+test browser_mirror::tests::tag_sweep_matches_only_its_own_tag ... ok
+test browser_mirror::tests::undetected_child_does_not_extend_drop_past_cleanup_deadline ... browser cleanup timed out; retained private profile /tmp/.tmpQeS3Ht/private-profile
+ok
+test browser_mirror::tests::unknown_action_is_an_error ... ok
+
+test result: ok. 8 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 7.93s
+
+### EXIT 0
+### cmd: perl -e '$SIG{CHLD}="IGNORE"; exec @ARGV' <lib test binary> browser_mirror::tests::cleanup_with_inherited_ignored_sigchld --exact --ignored --nocapture (AIEN_CHROME=/usr/bin/google-chrome)
+
+running 1 test
+test browser_mirror::tests::cleanup_with_inherited_ignored_sigchld ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 8 filtered out; finished in 0.57s
+
+### EXIT 0
+### chrome processes still carrying a mirror tag or fixture profile: 0
diff --git a/evidence/sc661-browser-mirror-spark-20261031/browser-mirror-tests.rc b/evidence/sc661-browser-mirror-spark-20261031/browser-mirror-tests.rc
new file mode 100644
index 00000000..573541ac
--- /dev/null
+++ b/evidence/sc661-browser-mirror-spark-20261031/browser-mirror-tests.rc
@@ -0,0 +1 @@
+0
diff --git a/evidence/sc661-browser-mirror-spark-20261031/receipt.md b/evidence/sc661-browser-mirror-spark-20261031/receipt.md
new file mode 100644
index 00000000..96fc7560
--- /dev/null
+++ b/evidence/sc661-browser-mirror-spark-20261031/receipt.md
@@ -0,0 +1,27 @@
+# sovereign-core #661 / #688 browser mirror on the DGX Spark
+
+Host for every run: DGX Spark, `Linux 7.0.0-1019-nvidia aarch64`, `Google Chrome 153.0.8010.36` at `/usr/bin/google-chrome`. Runs used CPU cores 5-9 and 15-19 at nice 19; no GPU, no model, no live service.
+
+## First run, head `f81de1178021e7b9ce2544b69627ddbb10604bdd`
+
+- Branch `fix/661-browser-mirror-reap` after merging main `9612b7787fcca2463b1b9737a7faebe91a72552a`. The two commits that add this directory also regenerated the root `.crumb`; they change no code.
+- `browser-mirror-tests.log`: the library test binary's `browser_mirror` tests with `--test-threads=1 --nocapture`. 8 passed, 1 ignored (the isolated SIGCHLD case), exit 0. `stub_page_screenshot_and_eval` captured a screenshot from real Chrome 153 (the aarch64 hang of #661 does not occur with `--disable-gpu --use-gl=disabled --disable-software-rasterizer`). `dropping_chrome_reaps_every_helper` ran against real Chrome. `tag_sweep_matches_only_its_own_tag` spawns `sleep` fixtures, not Chrome.
+- Same log, second run: `cleanup_with_inherited_ignored_sigchld` executed through `perl -e '$SIG{CHLD}="IGNORE"; exec @ARGV'` with `AIEN_CHROME=/usr/bin/google-chrome`, so the test process inherited SIGCHLD=SIG_IGN as the test requires. 1 passed, exit 0.
+- The leftover check after both runs, `pgrep -fc 'aien-mirror|profile-fixture|owned-sigchld-fixture'`, counted 0, but its first alternative cannot match the real tag `aien-browser-mirror-<pid>-<nanos>`, so it did not check for leftover Chrome. The second run below uses the corrected pattern.
+- `aien-cli-tests.log`: `cargo test --locked -j2 -p aien-cli` at the same head, summary lines only. Exit 0, 0 failed.
+
+## Second run, head `9f7451605fd4f001fbe987e1f07dc1f15cf2fa92`
+
+Review of `4965d44c` (main merged) found that Linux started Chrome in its own process group although Linux teardown never signals a group. `9f745160` keeps Chrome in the caller's group on Linux.
+
+- `reverify-f7c9e2bb.log` (scripts `reverify.sh` and `sigint-replay.sh`), run at PR head `f7c9e2bb` with no code change against it, inside `systemd-run --user --scope -p MemoryMax=3G -p MemorySwapMax=0`. The log records that the working `crates/aien-cli/src/browser_mirror.rs` blob equals the blob at `9f745160` (`d70c525d`).
+ - Build: no compiler warning from `aien-cli`. `browser_mirror` tests: 8 passed, 1 ignored. Isolated inherited SIGCHLD=SIG_IGN case: 1 passed.
+ - Leftover count: processes whose environment carries `AIEN_BROWSER_MIRROR_TAG=`. It was 0 before the tests, 0 after them and 0 at the end.
+ - Ctrl-C replay: `aien-browser-mirror --eval` (a 60 s pending promise) is started with `setsid` as leader of its own process group, the way a terminal foreground job or a harness timeout group runs it. SIGINT is reset to default before exec, and the log shows its `SigIgn` mask `0000000001001004`, which has the SIGINT bit (0x2) clear. Then `/bin/kill -s INT -- -<pgid>`. Processes are counted by the exact tag `aien-browser-mirror-<leader pid>-` in environment or command line, which also catches the crashpad handlers.
+ - At `4965d44c` (binary `/tmp/prfix/abm-4965d44c`), 15 owned processes were running before the signal. 4 s after it the caller was gone (wait status 130), and 17 owned processes were still alive: main Chrome, both crashpad handlers, both zygotes, GPU, network, storage, renderers and two tagged `cat` processes. They are listed in the log.
+ - At `9f745160`, the caller was gone (130) and 0 owned processes were left.
+ - The replay kills only the processes it counted.
+- An earlier replay, run before this receipt, launched the caller from dash with `&`, so the caller inherited SIGINT as ignored and survived the signal. That replay did not test the "caller killed before Drop" path. Its logs were removed from this directory and are superseded by `reverify-f7c9e2bb.log`.
+- `aien-cli-tests-4965d44c.log` and `aien-cli-tests-9f745160.log`: the full `cargo test --locked -j1 -p aien-cli` under the same 3 GiB cap, on the tree of `4965d44c` and on the tree of `9f745160`. Summary lines only. Both times: 223 passed, 0 failed, 21 ignored over 13 test runs (12 test binaries plus doc-tests). Cargo's exit status was 0 both times; it was read in the shell and typed into each log's header line, not captured to a `.rc` file.
+
+Not covered: Chrome on other architectures, other Chrome versions, and non-Linux Unix cleanup (not compiled or run here; not qualified, as `skills/self-improvement/SKILL.md` says).
diff --git a/evidence/sc661-browser-mirror-spark-20261031/reverify-f7c9e2bb.log b/evidence/sc661-browser-mirror-spark-20261031/reverify-f7c9e2bb.log
new file mode 100644
index 00000000..206e5991
--- /dev/null
+++ b/evidence/sc661-browser-mirror-spark-20261031/reverify-f7c9e2bb.log
@@ -0,0 +1,57 @@
+== start 2026-10-31T18:39:29Z HEAD f7c9e2bb9e2d0e7dd092e3a3c281ee24e0f885ac
+== crates/aien-cli/src/browser_mirror.rs working blob d70c525d88dba31a6ea4bebb03215ca8e2fdbccc, at 9f745160d70c525d88dba31a6ea4bebb03215ca8e2fdbccc
+== code changes vs HEAD: 0
+== processes with a mirror tag before: 0
+warning: aien-omega-gpu@0.1.0: aien-omega-gpu: no AIEN_OMEGA_DIR or AIEN_OMEGA_GPU_LIB, building the CPU stub
+warning: aien-omega-compose@0.1.0: aien-omega-compose: no AIEN_OMEGA_COMPOSE_DIR, AIEN_OMEGA_DIR or AIEN_OMEGA_COMPOSE_LIB, building the stub
+ Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.81s
+== browser_mirror tests (real Chrome, --test-threads=1)
+warning: aien-omega-gpu@0.1.0: aien-omega-gpu: no AIEN_OMEGA_DIR or AIEN_OMEGA_GPU_LIB, building the CPU stub
+warning: aien-omega-compose@0.1.0: aien-omega-compose: no AIEN_OMEGA_COMPOSE_DIR, AIEN_OMEGA_DIR or AIEN_OMEGA_COMPOSE_LIB, building the stub
+test browser_mirror::tests::base64_roundtrip ... ok
+test browser_mirror::tests::cleanup_with_inherited_ignored_sigchld ... ignored, explicit isolated inherited-SIGCHLD qualification
+test browser_mirror::tests::dropping_chrome_reaps_every_helper ... ok
+test browser_mirror::tests::exact_private_profile_identifies_a_task_without_its_tag ... ok
+test browser_mirror::tests::stale_candidates_and_exited_pidfds_cannot_signal_a_stranger ... ok
+test browser_mirror::tests::stub_page_screenshot_and_eval ... ok
+test browser_mirror::tests::tag_sweep_matches_only_its_own_tag ... ok
+test browser_mirror::tests::undetected_child_does_not_extend_drop_past_cleanup_deadline ... ok
+test browser_mirror::tests::unknown_action_is_an_error ... ok
+test result: ok. 8 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 6.78s
+== isolated inherited SIGCHLD=SIG_IGN case
+test browser_mirror::tests::cleanup_with_inherited_ignored_sigchld ... ok
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 8 filtered out; finished in 0.25s
+== processes with a mirror tag after tests: 0
+== SIGINT replay, before: /tmp/prfix/abm-4965d44c sha256 574b2d38f7641c40
+caller pid 2079200, SigIgn: 0000000001001004
+owned processes while running: 15
+caller state 4 s after SIGINT to its group: gone
+owned processes left: 17
+2079302 /opt/google/chrome/chrome --headless=new --remote-debugging-port=0 --user-data-dir=/tmp/aien-browser-mirror-2079200-1793
+2079315 cat
+2079316 cat
+2079367 /opt/google/chrome/chrome_crashpad_handler --monitor-self --monitor-self-annotation=ptype=crashpad-handler --database=/h
+2079371 /opt/google/chrome/chrome_crashpad_handler --no-periodic-tasks --monitor-self-annotation=ptype=crashpad-handler --databa
+2079380 /opt/google/chrome/chrome --type=zygote --no-zygote-sandbox --no-sandbox --headless=new --crashpad-handler-pid=2079367 -
+2079384 /opt/google/chrome/chrome --type=zygote --no-sandbox --headless=new --crashpad-handler-pid=2079367 --enable-crash-report
+2079502 /opt/google/chrome/chrome --type=gpu-process --no-sandbox --disable-dev-shm-usage --headless=new --ozone-platform=headle
+2079511 /opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-
+2079606 /opt/google/chrome/chrome --type=utility --utility-sub-type=storage.mojom.StorageService --lang=en-US --service-sandbox-
+2079717 /opt/google/chrome/chrome --type=renderer --top-chrome-webui --crashpad-handler-pid=2079367 --enable-crash-reporter=, --
+2079772 /opt/google/chrome/chrome --type=renderer --crashpad-handler-pid=2079367 --enable-crash-reporter=, --noerrdialogs --user
+2079845 /opt/google/chrome/chrome --type=renderer --crashpad-handler-pid=2079367 --enable-crash-reporter=, --noerrdialogs --user
+2080042 /opt/google/chrome/chrome --type=renderer --crashpad-handler-pid=2079367 --enable-crash-reporter=, --noerrdialogs --user
+2085778 /opt/google/chrome/chrome --type=renderer --crashpad-handler-pid=2079367 --enable-crash-reporter=, --noerrdialogs --user
+2085786 /opt/google/chrome/chrome --type=renderer --crashpad-handler-pid=2079367 --enable-crash-reporter=, --noerrdialogs --user
+2085823 /opt/google/chrome/chrome --type=renderer --crashpad-handler-pid=2079367 --enable-crash-reporter=, --noerrdialogs --user
+caller exit status (wait): 130
+owned after cleanup: 0
+== SIGINT replay, this tree: /tmp/prfix/t688-target/debug/aien-browser-mirror
+caller pid 2093650, SigIgn: 0000000001001004
+owned processes while running: 15
+caller state 4 s after SIGINT to its group: gone
+owned processes left: 0
+caller exit status (wait): 130
+owned after cleanup: 0
+== processes with a mirror tag at end: 0
+== end 2026-10-31T18:39:59Z
diff --git a/evidence/sc661-browser-mirror-spark-20261031/reverify.sh b/evidence/sc661-browser-mirror-spark-20261031/reverify.sh
new file mode 100755
index 00000000..63af8a20
--- /dev/null
+++ b/evidence/sc661-browser-mirror-spark-20261031/reverify.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# core#688 re-verification after review. Run from the repository checkout,
+# inside a memory-capped scope. OLD_BIN (optional) is an aien-browser-mirror
+# built at 4965d44c, replayed first as the before arm.
+here=$(cd "$(dirname "$0")" && pwd)
+cd "$(git -C "$here" rev-parse --show-toplevel)" || exit 9
+export AIEN_CHROME=${AIEN_CHROME:-/usr/bin/google-chrome}
+target=${CARGO_TARGET_DIR:-target}
+src=crates/aien-cli/src/browser_mirror.rs
+tagged() { grep -lsa 'AIEN_BROWSER_MIRROR_TAG=' /proc/[0-9]*/environ | grep -vc "^/proc/$$/"; }
+echo "== start $(date -u +%FT%TZ) HEAD $(git rev-parse HEAD)"
+echo "== $src working blob $(git hash-object $src), at 9f745160 $(git rev-parse 9f745160:$src)"
+echo "== code changes vs HEAD: $(git diff --name-only HEAD -- crates skills | wc -l)"
+echo "== processes with a mirror tag before: $(tagged)"
+cargo build --locked -j1 -p aien-cli --bin aien-browser-mirror 2>&1 | grep -E '^(warning|error)|Finished'
+echo "== browser_mirror tests (real Chrome, --test-threads=1)"
+cargo test --locked -j1 -p aien-cli --lib browser_mirror -- --test-threads=1 2>&1 | grep -E '^test |test result|^(warning|error)'
+echo "== isolated inherited SIGCHLD=SIG_IGN case"
+perl -e '$SIG{CHLD}="IGNORE"; exec @ARGV' cargo test --locked -j1 -p aien-cli --lib browser_mirror::tests::cleanup_with_inherited_ignored_sigchld -- --ignored --test-threads=1 2>&1 | grep -E '^test |test result'
+sleep 2
+echo "== processes with a mirror tag after tests: $(tagged)"
+if [ -n "${OLD_BIN:-}" ]; then
+ echo "== SIGINT replay, before: $OLD_BIN sha256 $(sha256sum "$OLD_BIN" | cut -c1-16)"
+ sh "$here/sigint-replay.sh" "$OLD_BIN"
+fi
+echo "== SIGINT replay, this tree: $target/debug/aien-browser-mirror"
+sh "$here/sigint-replay.sh" "$target/debug/aien-browser-mirror"
+echo "== processes with a mirror tag at end: $(tagged)"
+echo "== end $(date -u +%FT%TZ)"
diff --git a/evidence/sc661-browser-mirror-spark-20261031/sigint-replay.sh b/evidence/sc661-browser-mirror-spark-20261031/sigint-replay.sh
new file mode 100755
index 00000000..8ba6f8ca
--- /dev/null
+++ b/evidence/sc661-browser-mirror-spark-20261031/sigint-replay.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Ctrl-C replay for core#688 review finding 1.
+# Starts aien-browser-mirror as leader of a new session/process group (as a
+# terminal foreground job or a harness timeout group would) with SIGINT reset
+# to its default action (a non-interactive sh starts background jobs with
+# SIGINT ignored), sends SIGINT to that group, and counts this run's Chrome
+# processes that remain once the caller is dead.
+# usage: sigint-replay.sh BIN
+BIN=$1
+setsid perl -e '$SIG{INT}="DEFAULT"; exec @ARGV' "$BIN" --url "data:text/html,hi" \
+ --eval "new Promise(r=>setTimeout(r,60000))" >/dev/null 2>&1 &
+leader=$!
+# The tag and profile name are aien-browser-mirror-<caller pid>-<nanos>.
+TAG="aien-browser-mirror-$leader-"
+owned() {
+ for d in /proc/[0-9]*; do
+ p=${d#/proc/}
+ [ "$p" = "$leader" ] && continue
+ e=$(tr '\0' '\n' 2>/dev/null <"$d/environ")
+ c=$(tr '\0' ' ' 2>/dev/null <"$d/cmdline")
+ case "$e
+$c" in
+ *"$TAG"*) echo "$p" ;;
+ esac
+ done
+}
+i=0
+until [ -n "$(owned)" ] || [ $i -ge 100 ]; do sleep 0.2; i=$((i+1)); done
+sleep 2
+echo "caller pid $leader, $(grep -E '^SigIgn' /proc/$leader/status)"
+echo "owned processes while running: $(owned | wc -l)"
+/bin/kill -s INT -- "-$leader"
+sleep 4
+echo "caller state 4 s after SIGINT to its group: $(awk '/^State/{print $2}' /proc/$leader/status 2>/dev/null || echo gone)"
+left=$(owned)
+echo "owned processes left: $(echo "$left" | grep -c .)"
+for p in $left; do printf '%s %s\n' "$p" "$(tr '\0' ' ' </proc/$p/cmdline 2>/dev/null | cut -c1-120)"; done
+# cleanup: only the processes counted above
+[ -n "$left" ] && kill -KILL $left 2>/dev/null
+wait "$leader" 2>/dev/null
+echo "caller exit status (wait): $?"
+sleep 1
+echo "owned after cleanup: $(owned | wc -l)"
+exit 0
diff --git a/skills/self-improvement/SKILL.md b/skills/self-improvement/SKILL.md
index c7f37cd5..981d5615 100644
--- a/skills/self-improvement/SKILL.md
+++ b/skills/self-improvement/SKILL.md
@@ -102,6 +102,8 @@ aien-browser-mirror --eval "<javascript>" --url U # evaluate an expression on
Defaults: `--url http://127.0.0.1:18095` (override with `--url` or `AIEN_COCKPIT_URL`), `--out-dir ~/basecamp/ui-tests`, Chrome found as `google-chrome`, `chromium` or `AIEN_CHROME`. Exit status 0 means PASSED, COMPLETED or ok.
+On Linux with pidfd support, each run starts Chrome with an `AIEN_BROWSER_MIRROR_TAG` environment tag and leaves it in the caller's process group, so a Ctrl-C or a harness group kill that ends the caller also reaches Chrome. Linux cleanup uses only pidfd signaling, never numeric PID or process-group signals. After pinning each candidate, it revalidates an exact environment tag or private-profile argument. Chrome clears tags and rewrites argv on some tasks, so a rewritten title requires a Chrome image (`chrome`, `chromium` or `chromium-browser`), its exact executable prefix and a complete profile flag, not a substring or prefix match. Profiles are created exclusively with mode 0700. Tags and profile arguments distinguish these owned fixtures; they are not an authentication boundary against same-UID processes deliberately copying them. A cleanup timeout emits a diagnostic and retains the private profile rather than blocking indefinitely or deleting potentially active browser data. Unsupported Linux pidfd signaling refuses the spawn. On other Unix platforms Chrome leads its own process group and cleanup signals that group; detached-helper cleanup there is not qualified. Chrome runs with `--disable-gpu --use-gl=disabled --disable-software-rasterizer`: without the last two flags, Chrome 153 on aarch64 falls back to a SwiftShader GPU process that never answers a screenshot (sovereign-core #661).
+
The self-test checks hydration (title, `#chat-input`, navigation controls), a live chat reply sent through `#btn-send` that stops growing, and every `[data-view]` or `[data-tab]` control switching to a present view. Screenshots land as `cockpit_init.png`, `cockpit_chat_stream.png` and `cockpit_actions.png`, next to `report.json`. The mentor run writes `cockpit_mentor_response.png` and `mentor_response.json` (COMPLETED when the reply is longer than 50 characters). The Cockpit must be running for the self-test; against a dead port the report says FAILED with `chat_input: false`.
## 5. Cortex Memory Commitment