<!-- Authored per the the-loop:writing skill. -->
Tasks: roll running sessions onto a refreshed environment
Phase 4 of 4. Derived mechanically from design.md and testing-plan.md. A DAG: tasks at the same indent are independent.
- [x] 1.
the_loop/envstate.py—declared,fingerprint,process_environ,compare. No value reaches a log line or a return value in clear except through the mappingdeclaredreturns. Requirements: R1.1, R1.7, R2.1, R2.3, R5.2Test: T1- [x] 1a.
tests/test_envstate.py— the pure comparisons, the fresh re-read, the real/procread, and theNonepaths. Test: T1
- [x] 1a.
- [x] 2.
TmuxRunner.respawn_in—respawn-pane -k -t … -c … -e … -- <resume argv>. Requirements: R1.4 Test: T2 - [x] 3.
TmuxRunner(env_provider=…)— fold the provider's names intospawn_in's-elist behind_supports_env; the-loop's own three names last; defaultNoneleaves today's argv untouched. Requirements: R4.1, R4.2, R4.3, R5.1 Test: T2- [x] 3a. Wire the provider at the two real construction sites (the dispatcher and the standing-session runner) so a spawn re-reads the file. Requirements: R4.1
- [x] 3b.
tests/test_tmux_runner.py— argv assertions for 2, 3 and 3a. Test: T2
- [x] 4.
core.sessions.environment_drift— the read half: per session, its live pids, what they hold, and the names that differ. Requirements: R3.1, R3.4Test: T4 - [x] 5.
core.sessions.restart_sessions— selection, liveness, resumability, respawn, probe, verification, rows and exit code. Requirements: R1.1–R1.7, R2.1–R2.4 Test: T3 - [x] 6.
sessions restartsubcommand —--all,<work-item>,--dry-run,--format json; renders core's rows. Requirements: R1.1, R1.2, R1.3, R2.4Test: T3, T5 - [x] 7.
statusreports drift —sessionEnvironmentinlifecycle.status_all, one line in each of the two renderers,okuntouched. Requirements: R3.1–R3.5Test: T4 - [x] 8. Tests —
tests/test_sessions_restart_integration.pycovering T3, T4 and the redaction assertions of T6. Test: T3, T4, T6 - [x] 9. Docs —
docs/cli/commands/sessions.md(the subcommand, and the argv exposure stated plainly),docs/cli/commands/status.md(the new line),docs/capabilities/interactive-sessions.md(the capability). Test: T5 - [x] 10. Evidence — verification (including the real-tmux transcript, T7), security review, self-review, documentation. Test: T7, T8