Splits the two largest hand-written source files into area modules, as pure moves. Public paths, doc comments, reply text and behavior are unchanged.
crates/aft-shell/src/bash_background/registry.rs (30,057 lines) becomes a facade plus 14 area modules (launch, kill, completion, recovery, garbage collection, task index, watch delivery and others) and 10 test files. The largest new file is 2,881 lines.
crates/aft-subc/src/subc/mod.rs (22,495 lines) drops to 358 lines. The new modules group transport (daemon_attach, writer, shutdown), root and route lifecycle (root_maintenance, root_reaping, route_bind, route_state, route_trust) and requests (request_decode, tool_dispatch, management_dispatch, active_calls, deferred_responses), coordinated by frame_loop. The largest new file is 3,323 lines.
The two source guards that read the registry source (the child-environment funnel and the artifact-path check) now list each registry module and check that list against the folder at run time, so a module added later can't escape them. That check also brought in eight existing registry/ submodules the old guard never read; they pass.
Verification: a static move audit matched 818 function declarations and their bodies for the registry. Linux unit tests for the registry (843) and aft-subc (2,368) passed, as did the Windows GNU compile checks, rustfmt and file sizes. The 13 native secret-bash fixtures in aft-subc need Yama ptrace_scope, which the build server doesn't expose; CI runs them. The removed size pins are for the two split files.
Summary by cubic
Splits the two largest hand-written source files into area modules as pure moves and replays the shell sandbox levels: relaxed is retired, workers default to standard, and heads stay off.
crates/aft-shell/src/bash_background/registry.rs (30,057 lines) becomes a facade plus 14 area modules and 10 test files; the largest new file is 2,881 lines.
crates/aft-subc/src/subc/mod.rs (22,495 lines) drops to 358 lines, with modules grouped by transport, root/route lifecycle, and requests.
The source guards that read the registry now list each module and check that list against the folder at runtime, bringing eight previously unguarded registry/ submodules under the check.
Moved comments are spelled out in full instead of internal shorthand.
The removed size pins are for the split files; search fixtures mark the change non-ranking.
Sandbox levels and escapes
credentials and standard replace relaxed in config, schema, and user-visible text; existing relaxed values migrate to standard.
Person-approved one-command escapes get a gated approval flow via the daemon; standalone schemas omit the escape tool entirely. Escapes append to additive sandbox_escape_records audit rows outside the numbered schema, so older binaries opening the same database ignore them.
Linux Standard uses a fixed per-UID worker-jail canary anchor that does not depend on a writable home.
Bubblewrap binds follow symlinks, so a protected control reached through a symlink could be replaced from a writable directory; the snapshot now refuses such launches and reports control_symlink_replaceable_on_bwrap, Strict keeps link aliases next to their targets, and additional home startup paths are denied on Linux and macOS.
A new sandbox-acceptance CI workflow probes bubblewrap on the hosted image and runs outside pull requests; its bubblewrap memory case is excluded from the systemd scope gate.
Verification
A static move audit matched 818 registry function declarations and their bodies; Linux unit tests (843 registry, 2,368 aft-subc), Windows GNU compile checks, and rustfmt passed.
The 13 native secret-bash fixtures in aft-subc need Yama ptrace_scope, which the build server doesn't expose, so CI runs them.
Confidence Score: 5/5
No new blocking issue was established in the reviewed changes.
Summary
Splits the background-task registry and sidecar loop into smaller area modules. The PR also adds sandbox levels and person-approved shell escapes.
Background task code now lives in smaller area modules.
The subc daemon code now sits in modules grouped by work area.
Sandbox levels and worker confinement now use the new policy names and launch rules.
A local Bash command can ask for one-time approval to leave its sandbox.
CI now runs sandbox acceptance checks on supported platforms.
No new actionable issue was established.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Request[Shell request] --> Escape{Escape requested?}
Escape -- No --> Policy[Build sandbox policy]
Policy --> Launcher[Run platform launcher]
Escape -- Yes --> Check[Check local head and sandbox level]
Check --> Approval[Ask the person]
Approval --> Grant[Use one-command host grant]
Grant --> Run[Run approved command]
Run --> Audit[Save outcome]