Skip to content

feat: Linux browser tier L5: release gates, provenance, legacy listing and cutover guide (#119) - #171

Merged
chaodu-agent merged 18 commits into
mainfrom
feat/linux-l5-release-cutover-v2
Nov 19, 2026
Merged

chaodu-agent merged 18 commits into
mainfrom
feat/linux-l5-release-cutover-v2

Conversation

@chaodu-agent

@chaodu-agent chaodu-agent commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Head

Head: ce52de0457148830843a90df92f9a7bcda4403b7

Decisions

  • Owner decision A: MCP_UPSTREAM drop-in removal is content-based. The step 5.2 removal block removes an MCP_UPSTREAM drop-in only when it is a regular file, not a symlink, and its content is one [Service] header, one Environment=MCP_UPSTREAM=browser=http://127.0.0.1:8794/mcp line, and otherwise only blank lines and # comment lines (leading whitespace and trailing spaces are allowed). Any other content, including a ; comment, keeps the file. No installer in this repository writes that drop-in, so removal matches content, not provenance. Hosts that still carry the old line keep it until a person runs the manual removal in step 5.2 of docs/linux-cutover.md (Remove the MCP_UPSTREAM line or the drop-in file). The guide states this reading. The review finding that asked for provenance-based removal is closed by this decision.

  • V2: DECIDED (option 1). Accept formally with a narrowed rule. R1.1 is: "no TCP or UDP listener; any Unix listener in the managed tree must be inside the child's private per-run 0700 TMPDIR, owned by the daemon's uid." The status self-check and the release smoke fail, as a blocker, on any TCP or UDP listener in the managed tree, any Unix listener outside that private per-run TMPDIR, a TMPDIR that is not mode 0700, or a TMPDIR not owned by the daemon's uid. A Unix listener inside that directory, owned by the tree's own processes, is expected and passes. Recorded in the owner's decision log for this release (not part of this PR).

  • D7: DECIDED (option 1). Keep the single AppArmor glob as built. Document the residual risk in docs only. No pattern change, no per-version root step. Recorded in the owner's decision log for this release (not part of this PR).

Release gate

The release stays gated on V2 measured on amd64 and arm64. V2 is measured on amd64 and arm64 in CI before any release. This PR does not contain that measurement.

The release smoke workflow has not been dispatched. Dispatching it is a post-merge step on the release candidate, as docs/releasing.md describes.

Owner decision on F3

Removal is content-based. Installers in this repo never write the drop-in that the removal procedure matches, and the owner accepted the content rule (option A). No code change for F3.

Port the L5 files from the reference branch, whole-file, for files that
origin/main has not changed since 106f6a0 (35 files). Three-way apply of
the reference deltas for README.md and poc/reverse-attach-linux/src/external.rs
(comment only; README keeps main's text and takes the reference split of
the 0.12.0 and post-0.12.0 scope). Not built or tested in this commit.

Commands: git checkout origin/feat/linux-l5-release-cutover -- <35 files>;
git apply -3 on the two reference deltas (both applied cleanly).
Finding 1: scripts/check-release-record.sh now requires "pass" (lower-cased)
on every V1 to V13, M1 to M10 and smoke-cell row. n/a, fail, empty, PENDING,
a deleted, duplicated or malformed row all block. The Blocking column no
longer relaxes the rule. docs/release-records/TEMPLATE.md states the same.

Finding 5: gate_real_cell LOG STATUS_JSON. V2 in a real cell passes only with
NAVIGATE ok and SNAPSHOT_HAS_TEXT true in the harness log and a measured,
passing tree; listeners=none alone fails. gate_v2 also requires tmpdir=ok
whenever the word has counts.

Finding 4: root_command strips a leading "sudo " from a root action inside the
Debian 12 container, which has no sudo. The container path and the docker run
line name no sudo; a test checks both.

Tests: scripts/test-release-smoke-linux.sh adds the bypass matrix (V1 to V13,
M1 to M10, six cells, each deleted/duplicated/malformed/failed/n/a, plus the
V2 and D7 rows) and each case edits a copy of a valid record.

Commands and results:
- bash scripts/test-release-smoke-linux.sh on a Debian 13 arm64 node: pass=270 fail=0
  (220 reject cases, 2 accept cases, the rest V2, V4, real-cell and root_command cases)
- Same file on the pre-fix reference scripts: 40 record cases and the real-cell
  and root_command cases fail (shows the tests catch the findings)
- shellcheck: not installed on that node; run in CI (linux-installer job)
- bash -n on each changed shell script (laptop): ok
Finding 2, $OLD: the guide no longer uses an OLD variable. Every systemctl line
names the unit literally: oab-computer-pw-mcp.service on host A,
oab-pw-mcp.service on hosts B to D, with the other name after "#".
Finding 2, single quotes: Environment='MCP_UPSTREAM=...' is detected by the
Rust sets_upstream (legacy_tests.rs) and by the guide's grep -nE, which
scripts/test-cutover-guide.sh runs from the guide text itself.
Finding 2, placeholders: the AppArmor command used <id>, which the shell reads
as a redirection; it is ID now.

Finding 6: step 5.2 and removal step 1 use one block (dropin_is_ours) that
removes an MCP_UPSTREAM drop-in only when it is exactly [Service], comments,
blanks and the one dedicated Environment line, and not a link. Other files are
kept and reported. The block is run by the test under a fake HOME.

Finding 7: step 5.4's rollback links the full Rollback section with BK set.
No rollback line says "browser remove" alone. BK is a path, not <...>.

scripts/test-cutover-guide.sh (new, in CI linux-installer): bash -n on every
sh block, no OLD notation, allowed unit names only, the 5.4 link, the drop-in
fixtures (exact removed; extra setting, other URL, quoted, double-quoted,
two [Service] sections, symlink kept), and the guide's grep -nE fixtures.
scripts/test-name-consistency.sh excludes the new test, which names old units
on purpose (as the other test scripts do).

Commands and results:
- bash scripts/test-cutover-guide.sh on a Debian 13 arm64 node: pass=20 fail=0
- Same test on the pre-fix reference guide: 2 sh blocks fail to parse, $OLD
  notation found, the browser-remove-only rollback found, #rollback missing,
  drop-in block absent (shows the tests catch the findings)
- bash scripts/test-name-consistency.sh on a Debian 13 arm64 node: all checks passed
- markdownlint-cli2 on a Debian 13 arm64 node: this file adds no new finding
  beyond main's MD060 table findings (fixed one MD031 finding from this edit)
is_inside (a lexical prefix test) and plain_parents (a walk of the directories
between the TMPDIR and the socket) are replaced by inside_resolved(path,
private_real). It requires an absolute path, a socket node that still exists
(an unlinked socket is outside), and that the socket's directory, canonicalized
so every link is followed, starts_with the canonical private TMPDIR.
Path::starts_with compares whole components, so a sibling with the same name
prefix is outside. probe.rs canonicalizes the verified TMPDIR once and passes
it in. The Source trait loses parents_are_plain. tmp_state gets a doc comment
saying its verdict is a point-in-time self-report.

Tests (procnet_tests.rs, real directories and real bound sockets): a socket
directly in the private directory is inside; in a real subdirectory is inside;
reached through a link to the private directory is inside; in a subdirectory
that is a link to a directory outside is outside (the finding); a sibling that
shares the name prefix is outside; a socket elsewhere, a relative path, an
abstract name and an empty path are outside; an unlinked socket is outside.
Fixture-level: two inside sockets pass; one outside fails; a socket unlinked
after bind counts outside; no verified TMPDIR makes every Unix listener outside.

Commands and results:
- cargo fmt (applied) then cargo fmt --check on a Debian 13 arm64 node: clean
- cargo clippy --release -- -D warnings on a Debian 13 arm64 node: clean
  (one dead-code error for a test-only method was fixed in the sigstop commit)
- cargo test --release on a Debian 13 arm64 node: 553 passed, 0 failed, 17
  ignored (the ignored tests are the end-to-end harnesses, not run here)
- cargo fmt --check and cargo clippy --release -- -D warnings on a macOS arm64
  node: clean; cargo test --release does not link there (undefined _prctl in
  the Linux seat code, unchanged from main; see the PR's unmet items)
…nknown (round-1 items 9a, 9b)

9a: Supervised::launch discarded a sweep error with .ok() and started the
CLI child anyway. It now maps the result like Supervisor::start (#132): a held
guard proceeds, a busy sweep is refused with sweep_busy, any other sweep error
with sweep_unavailable. The wait is Supervised::with_sweep_wait (test only;
the production default stays 10 s).

9b: legacy.rs listener(): only a missing tcp6 table (NotFound) means no IPv6.
Any other error on tcp6 is unknown. The fixture in legacy_tests.rs returns
NotFound for an absent table, as the real /proc does.

Finding 2, Rust side: legacy_tests.rs tests that a single-quoted, double-quoted
or bare MCP_UPSTREAM assignment is detected, and that comments and
UnsetEnvironment= are not.

Tests: sigstop_tests.rs a_cli_launch_that_cannot_get_the_sweep_lock_is_refused_and_spawns_nothing
(a held lock; the launch would run touch; the marker must not exist).
legacy_tests.rs an_unreadable_ipv6_table_is_unknown_and_only_a_missing_one_is_none;
a_real_directory_holding_a_link_counts_only_the_link (round-1 F6 nested link).

Commands and results:
- cargo test --release on a Debian 13 arm64 node: 553 passed, 0 failed (includes the tests above)
- cargo clippy --release -- -D warnings after gating with_sweep_wait behind
  #[cfg(test)] (the production build had flagged it as dead code): clean
- cargo fmt --check on the same node: clean
…ctions (findings 4, 8)

Finding 8: docs/releasing.md states that this change does not dispatch
linux-release-smoke.yml. The dispatch is a post-merge step on the release
candidate, and the record gate is what blocks a release until then.

Finding 4: docs/releasing.md states that the Debian 12 container install runs
as a non-root user, that its root actions run as root inside the throwaway
container, and that the image has no sudo.

Record rule: docs/releasing.md says every V1 to V13 row needs pass, not only
the blocking ones.

V2 wording (requirement R1.1, ADR security notes, linux-setup.md, the daemon
README): a Unix listener is inside only when its directory, with every link
followed, is the private TMPDIR. The owner decisions (V2 option 1, D7 option 1)
are unchanged.

Commands and results:
- markdownlint-cli2 "docs/**/*.md" on a Debian 13 arm64 node: the branch adds no
  finding beyond main's MD060 set (main has 324 MD060 findings; this branch the same
  plus none from this commit after fixing the two it introduced)
- scripts/check-no-private-identifiers.sh on the laptop: ok, no private identifiers in 300 files
- bash scripts/test-cutover-guide.sh and scripts/test-release-smoke-linux.sh: see the earlier commits
…ure (review round 2)

- check-release-record.sh: an M row whose id cell is only "M1", and a V row whose
  id is unpadded ("|V1|"), were not recognised, so a non-pass duplicate passed.
  The id is now matched as a whole token. Tests added to
  test-release-smoke-linux.sh: M1 bare-id duplicate with result fail, M1 bare-id
  duplicate with an empty result, M1 result empty, V1 unpadded-id duplicate with
  result fail.
- browser status exits 1 when the listeners field is result=fail or unknown
  (review MEDIUM). Test: status_fails_on_a_v2_failure_or_an_unreadable_listener_table.
  When XDG_RUNTIME_DIR is unset in the calling shell, stderr says the result may be
  a false fail (review LOW).
- docs/linux-cutover.md: the MCP_UPSTREAM drop-in is identified by its content, not
  by its provenance, and a hand-written file of that shape is removed too (review
  LOW). Step 6 documents the status exit code.
- test-cutover-guide.sh and test-release-smoke-linux.sh: no ShellCheck findings
  (SC2012, SC2015, SC2016, SC2319), as CI runs them.

Verification, commands and results:
- Debian 13 arm64 node (copy of the worktree in a scratch directory):
  cargo fmt --check: ok.
  cargo clippy --release -- -D warnings: ok.
  cargo test --release: 554 passed, 0 failed, 17 ignored (the systemd-gated tests,
  which the linux-systemd workflow runs).
  bash scripts/test-release-smoke-linux.sh: pass=274 fail=0.
  bash scripts/test-cutover-guide.sh: pass=20 fail=0.
  bash scripts/test-install-linux.sh, test-name-consistency.sh, test-legacy-agent.sh,
  test-pw-mcp-deprecated.sh, test-check-no-private-identifiers.sh: exit 0 each.
- macOS arm64 node (copy of the worktree in a scratch directory):
  cargo fmt --check: ok.
  cargo clippy --release -- -D warnings: ok.
  cargo test --release: does not link. The prctl declaration in
  src/platform/linux/seat.rs is unconditional and is also on origin/main, so this
  predates this change. Not fixed here.
  ShellCheck over the CI file list: exit 0.
  npx markdownlint-cli2@0.18.1 "docs/**/*.md": 0 errors.
- Bypass mutations, before and after: the matrix run against the checker from the
  previous commit accepts the three bare-id bypasses (exit 0). Against this commit
  every bypass is rejected (exit 1).
- scripts/check-no-private-identifiers.sh: ok, 301 files.
The name of the cutover guide step contains ": ", which is not valid in an
unquoted YAML value (.github/workflows/ci.yml, line 126). GitHub rejected the
whole workflow file, so the CI run for the head had conclusion failure and no
jobs.

Verification, command and result:
- Ruby YAML.load_file on each .github/workflows/*.yml, before: ci.yml failed with
  "mapping values are not allowed in this context at line 126"; after: ci.yml
  loads with 8 jobs, and the other seven workflow files load as before.
browser status printed `listeners=none` before it checked the TMPDIR, so a running tree with no
listener and a 0755 or foreign-owned TMPDIR exited 0. The decided V2 rule fails that case. Now
`none` is printed only when the TMPDIR is clean (the verified private directory, or no child
running). Otherwise the counts are printed with `tmpdir=<state> result=fail`, and browser status
exits 1.

Changes:
- probe.rs: listeners_word judges the TMPDIR state for a zero-listener tree.
- probe_tests.rs: a_zero_listener_tree_fails_v2_when_its_tmpdir_is_not_private. It fails on the
  pre-fix probe.rs (left "none", right "tcp=0 udp=0 unix=0 unix_outside=0 tmpdir=mode
  result=fail") and passes after the fix.
- test-release-smoke-linux.sh: two gate_v2 cases for the zero-listener mode and owner words.
- release-smoke-linux.sh: gate_v2 comment states what `none` now guarantees.
- linux-setup.md: XDG_RUNTIME_DIR caveat in the status section, and the zero-listener rule.

The eight findings from the PR #170 reviews were re-checked on this head. Each has a test or a
read-through noted below; no code change was needed for them.
1. check-release-record.sh: test-release-smoke-linux.sh rejects 224 bypass mutations of a copy of
   the valid record and accepts 2 valid cases (pass=276 fail=0).
2. Cutover guide: test-cutover-guide.sh passes; legacy_tests.rs covers the single-quoted
   Environment='MCP_UPSTREAM=...' form.
3. Socket check: procnet_tests.rs resolved-path cases (link out of the private directory, name
   prefix sibling, unlinked socket, relative path, abstract name).
4. Container job without sudo: root_command strips a leading sudo; docs/releasing.md says so.
   Read-through only, no automated test.
5. NAVIGATE required for V2: test-release-smoke-linux.sh gate_real_cell cases pass.
6. Drop-in removal: test-cutover-guide.sh dropin_case cases pass.
7. Rollback: test-cutover-guide.sh rejects a bare `browser remove` rollback line and checks the
   #rollback link.
8. Smoke dispatch is post-merge: documented in docs/releasing.md. Read-through only.

Commands run and results:
- Debian 13 arm64 node, poc/reverse-attach-linux: `cargo test --release` (the CI command):
  555 passed, 0 failed, 17 ignored.
- Debian 13 arm64 node: `cargo test` (debug): 553 passed, 2 failed. Both fail the same way on
  origin/main: proc::tests::a_pid_that_does_not_exist_signals_nothing_and_does_not_panic (a rustix
  debug_assert on a negative pid; release builds compile it out) and
  external::tests::paging::a_server_that_stops_reading_ends_the_request_by_the_deadline (timing).
- Debian 13 arm64 node: test-install-linux.sh, test-name-consistency.sh, test-legacy-agent.sh,
  test-release-smoke-linux.sh, test-cutover-guide.sh, test-pw-mcp-deprecated.sh and
  test-check-no-private-identifiers.sh: all PASS.
- Debian 13 arm64 node: shellcheck (shellcheck-py, installed in a scratch venv) on the 10 files
  in the CI ShellCheck step: clean.
- macOS arm64 node: `cargo check --release --all-targets`: finished. `cargo test --release` does
  not link: undefined `_prctl` in platform/linux/seat.rs, because platform/mod.rs declares the
  linux module without a cfg. origin/main has the same code, and this change touches nothing
  under platform/.
- scripts/check-no-private-identifiers.sh on the tree: clean.
@chaodu-agent

This comment has been minimized.

With no managed tree running, `browser status` printed `listeners=not_running`
and exited 0, whatever the expected TMPDIR held. The V2 decision fails the
status self-check on a TMPDIR that is not 0700 or not owned by the daemon uid,
so an idle tree now reports the V2 word for an unclean directory. A missing or
clean directory still reports `not_running`.

Test:
- Debian 13 arm64 node: cargo test --release: 556 passed, 0 failed, 17 ignored
  (555 before; the new test is the one added).
- Debian 13 arm64 node: cargo test --release a_stale_tmpdir: 1 passed.
- macOS arm64 node: cargo test --release does not link (undefined _prctl in
  platform/linux/seat.rs, the same link error origin/main has; this change does
  not touch platform/). cargo check --release --tests: Finished, exit 0.
- The new unit test does not compile before the fix (idle_listeners_word did not
  exist), so it fails before and passes after.
… release record

Gate CHANGES_REQUESTED on 4206857 (opus5 low, sol low), fixed by docs only:
- linux-cutover.md step 5.2: the two sed removals now allow trailing whitespace, the
  same as the detection grep and the drop-in awk check.
  Ran: sed (no -i) with the new pattern on a temp file holding a trailing-space
  MCP_UPSTREAM line, an exact line and an unrelated line. Result: 0 MCP_UPSTREAM lines
  left, unrelated line kept. Same input with the old pattern: 1 line left.
- releasing.md Linux release checklist step 3: states that docs/release-records/ holds
  only TEMPLATE.md, so the first Linux release fails the record job until the record is committed.

Not run: no build or test targets (docs only).
@chaodu-agent

This comment has been minimized.

…t and cleanup docs

Fixes the review findings on PR 171 (head 80b3b14). Each fix has a test that fails on the base
code and passes after the change. "Before" below means the same test run against the base
80b3b14 (shell: base checker or base docs; Rust: base source files).

- Release record (F1): check-release-record.sh refuses any record that contains "<!--", so a
  row inside an HTML comment no longer counts. scripts/test-release-smoke-linux.sh, run locally:
  - "V1 row deleted and a passing copy hidden in an HTML comment": before exit 0 (FAIL), after
    exit 1 (PASS).
  - "a complete valid record wrapped in one HTML comment": before exit 0 (FAIL), after exit 1
    (PASS).
  - Suite on the base tree: pass=273 fail=0. The new tests on the base checker: pass=273 fail=2.
    After this change: pass=275 fail=0 (273 + 2 new reject cases).

- fd scan (F2): socket_inodes() returns a Result. An unreadable fd directory, an unreadable entry
  or link, or more than FD_LIMIT entries is "unknown", never an empty set. The base code has no
  socket_inodes_in, so its "before" runs use a test-only copy of the base scan under that name
  (same old behaviour: a failed read gives an empty set, errors are skipped).
  Rust, Debian 13 arm64 host, cargo test on a /tmp copy of the crate:
  - an_unreadable_fd_directory_is_unknown_never_no_sockets: before FAIL, after PASS.
  - more_fds_than_the_scan_limit_is_unknown_never_a_partial_set: before FAIL, after PASS.
  - an_fd_table_at_the_scan_limit_is_read_in_full: before PASS, after PASS (boundary).
  - socket_links_are_collected_and_other_fds_are_ignored: before PASS, after PASS.
  - Suite after: 559 passed, 2 failed, 17 ignored. The 2 failures are on the base too:
    external::tests::paging::a_server_that_stops_reading_ends_the_request_by_the_deadline and
    proc::tests::a_pid_that_does_not_exist_signals_nothing_and_does_not_panic.

- Legacy hint (F4): sets_upstream no longer cuts a line at the first # or ;. systemd reads them
  as comments only at the start of a line. The guide's step 5.2 grep -nE follows the same rule.
  Rust (legacy_tests.rs), same run:
  - only_an_active_environment_assignment_of_mcp_upstream_counts: before FAIL (the "FOO=1 # ..."
    and "FOO=1 ; ..." cases), after PASS.
  - a_hash_or_semicolon_inside_a_quoted_value_does_not_hide_the_assignment: before FAIL, after PASS.
  Shell (scripts/test-cutover-guide.sh, the guide's own grep -nE):
  - grep: a # after another setting does not hide the assignment: before FAIL, after PASS.
  - grep: a quoted ; does not hide the assignment: before FAIL, after PASS.
  - grep: a quoted # does not hide the assignment: before FAIL, after PASS.
  Suite: base pass=20 fail=0; after pass=25 fail=0.

- Cleanup procedures (F5): linux-cutover.md "Removing the leftovers" is the one removal
  procedure. It absorbs the two items that only linux-setup.md had: the unsuffixed AppArmor
  profile, and the .proposed files (step 5). linux-setup.md's section is now a link to it and
  repeats no removal commands.
  - setup removal section points to the cutover guide: before FAIL, after PASS.
  - setup removal section repeats no removal commands: before FAIL, after PASS.

- Owner decision (F3): no code change. linux-cutover.md step 5.2 records that removal is by
  content (option A), that the owner decided it and accepted the rule, and that no installer in
  this repository writes that drop-in. No test (docs only).
"Removing the leftovers" step 1 pasted the step 5.2 dropin_is_ours() block a
second time. The two copies could drift, and test-cutover-guide.sh only read
the first, so the second was never tested. Step 1 now points to step 5.2 and
keeps no copy of the block.

Tests run:
- scripts/test-cutover-guide.sh, new "exactly one sh block defines
  dropin_is_ours()": FAIL before the change (2 blocks), PASS after (1 block).
  Full run after the change: pass=26 fail=0.
- scripts/test-release-smoke-linux.sh after the change: pass=275 fail=0.
- git diff --check: clean.
The requirements runbook (section 2.3) said "delete the drop-in" with no
content check, a third removal description that could drift from owner
decision A. Replace it, and the other drop-in removal wording in the
requirements doc and the setup guide's upgrade table, with a pointer to
docs/linux-cutover.md step 5.2. No mechanism is restated.

Checks run:
- bash scripts/test-cutover-guide.sh: pass=26 fail=0 (exit 0)
- bash scripts/test-release-smoke-linux.sh: pass=275 fail=0 (exit 0)
- git diff --check: clean
- git grep for drop-in removal wording in docs: only pointers, location and restore text remain
Step 5.2 said a dedicated drop-in holds "comments and blank lines", but
dropin_is_ours accepts only lines that are blank or whose first
non-blank character is "#". A ";" comment line makes the file kept.
The sentence now lists the accepted lines, the leading-whitespace and
trailing-space rules, and says that a ";" line keeps the file, the safe
direction. No code changed.

Checks run:
- bash scripts/test-cutover-guide.sh: pass=26 fail=0 (exit 0)
- bash scripts/test-release-smoke-linux.sh: pass=275 fail=0 (exit 0)
- git diff --check: clean
The earlier review asked that the owner decision (option A, content-based
drop-in removal) be recorded in the ADR. It was only in step 5.2 and the
PR body. Add a short note under D10 with pointers to step 5.2 and to
PR #171. The note does not restate the rule.

Checks run:
- bash scripts/test-cutover-guide.sh: pass=26 fail=0 (exit 0)
- bash scripts/test-release-smoke-linux.sh: pass=275 fail=0 (exit 0)
- bash scripts/test-check-no-private-identifiers.sh: exit 0 (see result line in output)
- git diff --check: clean
A PID that exits between listing and reading its fd directory must report
unknown, never no sockets. Adds a_pid_that_exits_before_its_fd_scan_is_unknown_never_no_sockets
and documents that a vanished fd or PID is deliberately not special-cased.

Tests run (Debian 13 arm64 host, cargo test on a /tmp copy of the crate):
- cargo test procnet: 33 passed, 0 failed.
- cargo test legacy: 19 passed, 0 failed.
- The new test passes on the code from 6381f43, which already maps a failed
  read_dir to UNKNOWN. It is a regression guard, not a red-to-green fix.
Format job (cargo fmt --check, CI runner stable toolchain):
- poc/reverse-attach-linux/src/legacy_tests.rs: wrap the three
  assert!(set(...)) calls in the sets_upstream test onto multiple lines.
- poc/reverse-attach-linux/src/procnet_tests.rs: wrap the sleep Command
  chain in a_pid_that_exits_before_its_fd_scan_is_unknown_never_no_sockets.
  CI also reported this file, so it is included here.
Both diffs are whitespace-only: with spaces, tabs and newlines removed,
the old and new file contents are identical.

ShellCheck job (linux-installer):
- scripts/test-release-smoke-linux.sh lines 162 and 167: SC2016 (info).
  The single-quoted sed programs contained a literal $a (last-line
  address). Rewritten as double-quoted strings with \$a and \\ line
  continuations. The sed program text is byte-identical, so the test
  inputs do not change. No shellcheck directive was added.

Verification (local worktree):
- shellcheck on the CI file list: clean.
- scripts/test-cutover-guide.sh: pass=26 fail=0.
- scripts/test-release-smoke-linux.sh: pass=275 fail=0.

Verification (Linux build node, copies under /tmp, stable toolchain):
- cargo fmt --check on the crate: exit 0.
- cargo test --no-fail-fast, head: 560 passed, 2 failed.
- cargo test --no-fail-fast, base (merge-base with main): 509 passed,
  2 failed. The same two tests fail on both:
  external::tests::paging::a_server_that_stops_reading_ends_the_request_by_the_deadline
  proc::tests::a_pid_that_does_not_exist_signals_nothing_and_does_not_panic
  No new failures on head.
@chaodu-agent

Copy link
Copy Markdown
Contributor Author

Important

CHANGES REQUESTED ⚠️ - All round-2 blockers are fixed and CI is green, but the release-record checker contradicts the gate policy it enforces, the blocking V2 gate can flake on fd churn, the legacy MCP_UPSTREAM detector misses Environment = ..., and one CI verify step still fails open.

What This PR Does

Ports the Linux browser tier to its L5 stage (#119): a release smoke workflow and per-release record that gate every release, build provenance for the Linux tarball, a read-only "what is left from before" listing in browser status, and a cutover guide for moving existing hosts off the old pw-mcp setup. It also makes the CLI-child sweep fail closed (#132).

How It Works

  • linux-release-smoke.yml (reusable, contents: read, no secrets) runs scripts/release-smoke-linux.sh on Ubuntu amd64/arm64 and Debian 12 containers. The script prints one GATE <id> line per gate; gate_v2 recomputes the V2 listener rule from raw counts instead of trusting result=.
  • release.yml makes both publishing jobs needs: smoke, and scripts/check-release-record.sh refuses a release whose docs/release-records/<tag>.md still has PENDING, HTML comments, malformed rows, or a non-pass V1-V13 row.
  • legacy.rs reports old units, drop-ins that set MCP_UPSTREAM, old paths with sizes (lstat only, capped walk), and a listener on port 8794.
  • procnet.rs now returns unknown for an unreadable fd table instead of a partial set; probe.rs fails V2 on a wrong TMPDIR even with no listener; sigstop.rs refuses a start that could not sweep (sweep_busy / sweep_unavailable).
  • docs/linux-cutover.md is a step-by-step runbook whose shell blocks are executed against fixtures by scripts/test-cutover-guide.sh.

Findings

# Severity Finding Location
1 🟡 The record checker requires pass for all of V1-V13, but releasing.md section 3.5 and the smoke script itself call V3, V9, V11 informational scripts/check-release-record.sh:63-75, scripts/release-smoke-linux.sh:29, docs/releasing.md
2 🟡 The blocking V2 gate can flake: one transient ENOENT during the fd scan of a churning Chromium tree gives listeners=unknown and exit 20 poc/reverse-attach-linux/src/procnet.rs (socket_inodes_in), scripts/release-smoke-linux.sh (gate_v2)
3 🟡 sets_upstream, the guide's grep -nE, and the drop-in check only match Environment= with no space, but systemd accepts Environment = MCP_UPSTREAM=... poc/reverse-attach-linux/src/legacy.rs:183, docs/linux-cutover.md:296
4 🟡 The "nothing left behind" step passes when systemctl itself fails (2>/dev/null | wc -l gives 0) .github/workflows/linux-release-smoke.yml:158-160
5 🟡 Every release, including a macOS-only hotfix, now waits on the Linux smoke and the manual Linux record; this is a policy change that needs an explicit maintainer decision .github/workflows/release.yml:41,207
6 🟡 browser status now exits 1 on a V2 fail/unknown and prints new listeners tokens; neither is in the linux-setup.md reference (open since round 2) poc/reverse-attach-linux/src/browser_cli.rs:292-298, docs/linux-setup.md:357,488
7 🟡 .cache/ms-playwright counts as legacy, so a host that uses Playwright for anything else shows the cutover hint forever poc/reverse-attach-linux/src/legacy.rs:42
8 🟡 Small cleanups: script header says "every gate still runs" though codes 13/14 return early; die uses $* so the exit code is printed in the message; Supervised::new hard-codes 10 s scripts/release-smoke-linux.sh:21,151-152, poc/reverse-attach-linux/src/sigstop.rs:170
9 🟢 Least-privilege workflows: read-only default, write/OIDC/attestations only on publishing jobs, every action SHA-pinned, Debian image digest-pinned, attestation scoped to the tarball .github/workflows/release.yml, linux-release-smoke.yml
10 🟢 Consistent fail-closed runtime: unreadable tables are unknown, the sweep refuses instead of guessing, inside_resolved compares whole canonical components procnet.rs, sigstop.rs, child.rs
11 🟢 The runbook is tested as code, and the record checker refuses HTML-comment hiding, duplicates and rows with the wrong cell count scripts/test-cutover-guide.sh, scripts/check-release-record.sh
Finding Details

🟡 F1: Record checker contradicts the gate policy

The template says section 3.5 of releasing.md wins. Section 3.5 lists V1, V2 and V7 as blocking and V3 as informational, and the header of release-smoke-linux.sh says "V3 ... and V9, V11 are informational and never fail the cell". check-release-record.sh still refuses any V1-V13 row whose result is not pass, with a comment that the Blocking column does not relax this. It is unclear what pass means for an informational timing.

Requested change: pick one rule and enforce it in one place. Either accept info: <value> for non-blocking gates and require pass only for the blocking ones, or make all 13 blocking in section 3.5 and the smoke script. Add a fixture test in test-release-smoke-linux.sh for the chosen rule.

🟡 F2: V2 gate can flake on fd churn

socket_inodes_in maps any read_dir/read_link error, ENOENT included, to unknown. That is the right semantics for a single read. But tree_pids is collected before the fd scan, and renderer/zygote processes come and go, so a process exiting between the two reads produces listeners=unknown, V2 fails with code 20, and the release is blocked.

Requested change: keep the semantics, but retry only on unknown (never on result=fail): either in the smoke (for example 5 reads of browser status --json, 1 s apart, fail if none is definitive) or inside listeners_of_tree_in while the pid set changes between reads. Operators should also expect occasional unknown from interactive status on a busy browser.

🟡 F3: Environment = with spaces is missed

sets_upstream does trim_start().strip_prefix("Environment="), and the guide's detection regex is ^[[:space:]]*Environment=.... systemd's unit parser strips whitespace around =, so Environment = MCP_UPSTREAM=browser=http://127.0.0.1:8794/mcp is a live assignment. On such a host the hint, the runbook grep and the drop-in cleanup all report clean while the unauthenticated upstream stays configured. Round 2 asked for this detector to catch every live assignment; this is the remaining gap.

Requested change: match ^\s*Environment\s*= in sets_upstream, the guide regex and the drop-in ownership check, and add a legacy_tests.rs case plus a cutover fixture with spaces around =.

🟡 F4: Fail-open verify step

left=$(systemctl --user list-units 'oab-l[45]-test-*' --all --no-legend 2>/dev/null | wc -l) yields 0 when systemctl errors (no user manager, bus failure), so the step passes without checking anything.

Requested change: capture the systemctl output and exit status separately and fail the step when the command fails.

🟡 F5: Release coupling needs a maintainer decision

needs: smoke on both the macOS release job and the Linux job means a macOS signing fix cannot ship without four green Ubuntu cells, two Debian cells, the online pins check, and a committed Linux record with manual runs. releasing.md states this is intended. It is a real operational change, so it should be confirmed explicitly rather than land as part of a large PR. If it is not wanted, gate only the linux job on the record.

🟡 F6: browser status contract change is not in the reference

browser_cli.rs returns exit 1 with browser: status_failed class=listeners when V2 fails or is unknown, and the listeners line now carries unix_outside=, tmpdir= and result=. Anything that parsed the old none / tcp=N ... strings or treated exit 0 as "status ran" changes behavior. The cutover guide mentions it; the linux-setup.md flag table and listener paragraph do not.

Requested change: document the exit code and the new tokens in linux-setup.md (and the release notes for this tag).

🟡 F7: Shared Playwright cache is treated as legacy

~/.cache/ms-playwright is Playwright's default browser cache and is used by unrelated tools. Listing it makes legacy_present() true forever on such hosts, and browser status walks up to 200,000 entries of it.

Requested change: report it as a separately labeled shared cache (or not at all) and leave it out of legacy_present() and the cutover hint.

🟡 F8: Small cleanups

  • release-smoke-linux.sh:21 says every gate still runs, but codes 13 and 14 return before the later gates.
  • die() prints $*, so die "msg" 14 prints msg 14; print $1 and use $2 as the code.
  • Supervised::new hard-codes Duration::from_secs(10); reuse the shared sweep-wait constant so the CLI path and Supervisor::start cannot drift.

🟢 F9-F11

See the table. The CI design is least privilege and safe to run before the release environment approval, and the fail-closed posture is consistent across runtime, scripts and record checker.

Baseline Check
  • PR opened: 2026-11-18
  • Reviewed head: 2a2393851ad3888529a86ff77264fbd91807bf63
  • Base: main (not stacked), merge-base cf3fa86b03f51c45279208e5721fef3466ba080d
  • Diff: 39 files, +4281 / -205
  • Main already has: the L1-L4 Linux browser tier, pw-mcp.sh, the release workflow without Linux gates
  • Net-new value: release smoke and record gate, Linux provenance, legacy listing in browser status, cutover guide, fail-closed CLI sweep
Round 2 Follow-up
Round 2 finding Status at this head
R2-1 HTML comments hide record rows ✅ Fixed: the checker refuses any <!--
R2-2 socket_inodes() partial set on error / fd cap ✅ Fixed: now unknown (see F2 for the flake risk this creates)
R2-3 mid-line #/; treated as comments ✅ Fixed: matched as ordinary words, guide and code agree (see F3 for the remaining whitespace gap)
R2-4 cleanup guides drifted ✅ Fixed: linux-setup.md points to the cutover guide step 5.2
R2-5 run_records_full collapsed, 10 s hard-coded Accepted: sweep_unavailable is documented in the README for the CLI path; the hard-coded wait remains as a nit in F8
R2-6 status exit 1 undocumented in linux-setup.md Still open, carried as F6
Reviewer Notes
  • A reported symlink-traversal bug in legacy.rs dir_size was checked and withdrawn: on Unix, DirEntry::metadata() does not follow symlinks (it is equivalent to symlink_metadata), so a symlinked directory is never entered.
  • The browser signin false alarm (unix_outside>0 result=fail while a sign-in window is open) fails closed and is documented in linux-setup.md; accepted.
  • No external (non-team) reviewer feedback on this PR so far.
Validation
  • CI on this head: all checks pass (Linux hands node amd64/arm64, installer units, transient units, Swift build and test, markdown lint, pins, loopback check).
  • Ran locally: scripts/test-release-smoke-linux.sh (278 pass), scripts/test-cutover-guide.sh (26 pass), scripts/test-pw-mcp-deprecated.sh (ok).
  • Not verified: real-runner frequency of F2; whether Chromium binds abstract or unnamed Unix listeners on every runner image.
What's Good (🟢)
  • Every round-2 fail-open finding is fixed with a test pinning the new behavior.
  • Workflows are least privilege, SHA-pinned, and the smoke workflow holds no secrets.
  • gate_real_cell refuses the trivial listeners=none pass, so a cell cannot pass by not starting the browser.
  • The cutover guide's commands are executed in CI, so the runbook cannot drift from the code silently.

5. Three Reasons We Might Not Need This PR

  1. Few hosts to cut over - the 675-line guide serves a small, known set of hosts; a short checklist plus the browser status legacy fields might be enough.
  2. The manual record repeats evidence - the tag-time smoke reruns the same cells, so the per-release record adds cost to every release (macOS included) without much new signal.
  3. The runtime hardening stands alone - the fail-closed sweep (Linux managed Playwright tier: follow-ups from the ADR review (#119) #132) and the V2 listener rule could land on their own; bundling them with release-policy changes makes a 4.2k-line PR harder to review and revert. A split into (a) runtime, (b) release gating, (c) cutover guide would let (b) get its policy decision (F1, F5) separately. This is a suggestion, not a blocker.

@chaodu-agent
chaodu-agent merged commit 4a2f4ce into main Nov 19, 2026
14 of 15 checks passed
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