# Supervised legacy Case calls implementation plan Goal: finish row253 F5 on base48e450ce8, brief docs/plans/2026-10-22_case-sudo-legacy-followup.md (b0d0b7f76), row276/#1781. Reviewer Duckworth. No live host, units, config, ports or credentials. Tests and Node wait for Sage CLEAR; publication waits for a gap. Architecture: keep TESTER_SUPERVISOR byte-identical in both scripts. A case1 legacy launcher uses the validated system Bash/setsid/sleep tools after sudo drops uid, with a separate trusted GNU-timeout outer bound and private notice channel. stdout stays streamed to the caller, stderr stays separate. No root import of copy code. All five original calls are covered; no exception remains. Bounds (inner/outer seconds): talk320/330, with its unchanged --wait300 conversation and concurrent F5 scan; precheck200/210, preserving its existing timeout180 Claude probe; Claude version5/7; PM launches10/12; Node version5/7. Test extraction substitutes shorter bounds, with tests pinning the production values. Root stderr notice distinguishes outer-timeout from child137. Existing supervisor codes/reasons apply. Exit-status compatibility (Duckworth0182 B1): the inline builtin-only Node runner exits with its command's own status. Supervisor0 is the only success authority. On87 (inner-command), root may parse a final stderr trailer only to save a display code for ffail text; legacy_run still returns87 even if that trailer says0. A missing/bad trailer gives display87 plus the fixed inner-command reason, never pass. All other supervisor reasons ignore the trailer. Root saves display-only status in a private WORK file so background talk/command substitutions can report original exit numbers without changing their pass condition. F3/F4 use that number only in existing failure text; no old assertion changes. Trailer grammar: one last, newline-terminated line `MOSAIC_LEGACY_STATUS=` with canonical decimal0..255 (0 or nonzero-leading up to3 digits). The runner writes it after command stderr and exits with the actual status. A child/escaped descendant may spoof display diagnostics, but can never change supervisor failure into success. Tests cover an earlier forged0 then actual7, an appended forged0 after a real7, malformed/missing records and statuses137/81. Root bounds trailer processing to the last65536bytes through a root-validated system tail; oversized diagnostics are explicitly truncated. stdout remains streamed. stderr's retained tail is emitted without only the final valid trailer. On supervisor0 the trailer is ignored as status; on87 it can alter display only. F6/F7/F10 now check supervisor rc before considering stdout, while retaining their original successful output. They capture stderr privately; F4 merges emitted stdout and stripped stderr at its existing capture, so stderr is emitted after buffered capture. Talk keeps its two files. The NODE runner executes only after uid drop. Its existing F9 root-only path check means uid ownership/no group-or-other write, not owner-only execute; activation's executable mode remains required. Tests pin executable-as-user behavior. Files: scripts/case1-accept.sh (launcher, five call sites, header); scripts/case2-unit.sh (setuid-member header note only); packages/cli/tests/case-sudo-fixture.mjs (fake-mode cases/seams); packages/cli/tests/case1-accept.test.mjs (per-call tests and extraction); docs/plans/DEFERRED.md (bounded closure when acceptance passes). Row276 packet keeps manifest, mutants and test scope. Existing assertions remain. - [ ] Extend fake-only tests for all5 calls under exec and hop: healthy stdout/stderr and exit status, blocking descendants, PID/SID ownership, exact inner reason, no leftover; stalled supervisor outer reason and explicit fixture cleanup residual; status/trailer invalid refusal. Talk retains300s argv and separate diagnostics, background scan. - [ ] Implement legacy launcher and five call sites; remove the remaining AS_USER array. Preserve all row253 supervisor bytes and root-only command fences. - [ ] Add root-side capture/tools counterparts for case1 (row253 N1), header setuid-member inner-cleanup refusal (N2), and exact timeout-vs-child137 tests. - [ ] Prepare mutants: drop talk supervision; drop outer bound on one diagnostic; bypass individual call, wrong/unchecked SID, trailer0 turns failed supervision into success, missing stream/display-code preservation; case1 tools/capture mutants. Unique target and byte-identical restore checks. - [ ] Duckworth reads candidate/manifest/mutants. On Sage CLEAR, intended RED/GREEN, each touched test whole, all mutants with passing controls and no timeout counted as kill, ten whole shell suites under recorded3x bounds. Report counts,timing,skips,sweep; stop on unexpected red/survivor/timeout for ruling. Review focus: instant command exit retains fail-closed inner-session residual532; hostile same-uid setsid-away or killed/stalled supervisor remains row253 R3, never claimed cleanup; a member changing uid yields inner-cleanup; no stdout is treated as authority; no outer-timeout parsed from caller stderr.