# Hosted runners slice 1a: progress and mutation checks

## Task 1

Retry `poll` on `EINTR` on Linux and Darwin (`internal/runner/containment/poll_unix.go`).

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| `pollRetry` returns on the first `EINTR` (`if e != unix.EINTR \|\| true`) | `go test ./internal/runner/containment -run 'TestPollRetriesEINTR' -count=1` | `poll_unix_test.go:23: interrupted poll not retried: n=0 err=interrupted system call calls=1` | yes, `-run 'TestPollRetr'` passes |
| Extra: the expired deadline reports the `EINTR` instead of a timeout (`return 0, e`) | `go test ./internal/runner/containment -run 'TestPollRetryKeepsDeadline' -count=1` | `poll_unix_test.go:36: retries outlived the timeout: n=0 err=interrupted system call after 120.617911ms` | yes, `-run 'TestPollRetr'` passes |
| Fix round 1: remove the zero-timeout cap (`else if false && tries >= zeroTimeoutTries`) | `go test ./internal/runner/containment -run 'TestPollRetryBoundsZeroTimeout' -count=1` | `poll_unix_test.go:38: endless interruption not bounded: n=0 err=<nil> calls=81` | yes, `-run 'TestPollRetr'` passes |

## Task 2

Tests in `internal/runner/containment` that read the source tree carry the `TestSource` prefix, so a compiled test binary run outside the tree skips them with `-test.skip '^TestSource'`. `TestSourceTestsAreNamed` parses every `*_test.go` in the package and fails if a function outside the prefix passes a relative string literal (directly or as the first part of a `filepath.Join`) to `os.ReadFile`, `os.Open`, `os.OpenFile`, `os.Stat`, `os.Lstat`, `os.ReadDir`, `os.DirFS` or `filepath.Glob`.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| `TestBubblewrapPins` reads `../../../scripts/ci-box.json` again | `go test ./internal/runner/containment -run 'TestSourceTestsAreNamed' -count=1` | `helper_version_test.go:83: tests outside the TestSource prefix open relative paths: bubblewrap_pin_test.go:63 TestBubblewrapPins` | yes, `-run 'TestSourceTestsAreNamed'` passes |

Compiled binary outside the tree: `go test -c` into `mktemp -d "$TMPDIR/hosted-XXXX"`, run from there with `-test.run TestBubblewrapPins -test.skip '^TestSource'`: `--- PASS: TestBubblewrapPins`. Directory removed.

Whole binary outside the tree (fix round 1, HEAD 975997ff). Environment: docs-t1, user paulca, `TMPDIR=/home/paulca/.cache/tmp`, systemd user session present (`XDG_RUNTIME_DIR=/run/user/1001`), `/usr/bin/bwrap` is bubblewrap 0.11.0, sandbox off. Built with `CGO_ENABLED=0 go test -c -o "$d/containment.test" ./internal/runner/containment`, `d=$(mktemp -d "$TMPDIR/hosted-XXXX")` (`hosted-qAHZ`). Each run is `<binary> -test.skip '^TestSource' -test.v`, no `-test.run`; counts are top-level tests (84 ran each time; no `TestSource` test ran; none skipped).

| cwd | binary given as | pass | fail | failures |
| --- | --- | --- | --- | --- |
| `$d` (outside the tree) | `./containment.test` | 81 | 3 | `TestNamespaceParentDeath`, `TestNamespaceRecoveryCrashBeforeExit`, `TestNamespaceOpenCodeBinaryAfterAttestation` |
| `$d` (outside the tree) | `$d/containment.test` | 83 | 1 | `TestNamespaceOpenCodeBinaryAfterAttestation` |
| `internal/runner/containment` (control) | `$d/containment.test` | 83 | 1 | `TestNamespaceOpenCodeBinaryAfterAttestation` |
| `internal/runner/containment` (control, `-test.run` on the two) | relative path to `$d/containment.test` | 0 | 2 | `TestNamespaceParentDeath`, `TestNamespaceRecoveryCrashBeforeExit` |

Reasons, none a source read:
- `TestNamespaceOpenCodeBinaryAfterAttestation/second_name`: `listen unix /home/paulca/.cache/tmp/TestNamespace...second_name1945606201/002/tool/equipo.sock: bind: invalid argument`. The socket path is 109 bytes, over the Unix socket limit, because of the long `TMPDIR`. Environmental; fails the same inside the tree.
- `TestNamespaceParentDeath` and `TestNamespaceRecoveryCrashBeforeExit`: the re-executed child panics `namespace_mount_rejected` in `parentFixture` (`linux_test.go:412`), which passes `RunnerBinary: os.Args[0]`; a relative `os.Args[0]` is refused by the absolute-path mount rule. This follows how the binary is invoked, not where: an absolute path passes outside the tree, a relative path fails inside it. Fixed below.

`rm -r "$d"`; `ls` confirms it is gone.

Fix: `parentFixture` takes `RunnerBinary` from `os.Executable()` (panicking on its error, as the fixture already panics on others), so the run no longer depends on how the binary is started. Re-run on the same environment, new `mktemp -d "$TMPDIR/hosted-XXXX"` (`hosted-WVJD`):

| cwd | binary given as | pass | fail | failures |
| --- | --- | --- | --- | --- |
| `$d` (outside the tree) | `./containment.test` | 83 | 1 | `TestNamespaceOpenCodeBinaryAfterAttestation` (socket path over the limit, environmental, left) |

`--- PASS: TestNamespaceParentDeath (0.11s)`, `--- PASS: TestNamespaceRecoveryCrashBeforeExit (0.11s)`; no `TestSource` test ran; the directory is removed. In the tree, `go test ./internal/runner/containment -run 'TestNamespaceParentDeath|TestNamespaceRecoveryCrashBeforeExit|TestSourceTestsAreNamed' -count=1 -v` passes all three.

## Task 3

`TestNamespaceCgroupMoveKeepsMembership` asks `cgroupSkip` (in `internal/runner/containment/linux_test.go`) whether the `user@UID.service` cgroup exists. Where it does not, as inside a MicroVM, the test skips with `no systemd user session; production containment does not use cgroups`; with `EQUIPO_REQUIRE_USER_SESSION=1` it fails instead. A stat error other than "does not exist" fails either way. `make runner-namespace-test` sets `EQUIPO_REQUIRE_USER_SESSION=1`, so the CI host still fails loudly if its session goes away; `scripts/ci-test.py retried` passes the environment through to `go test` and to its retry.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| `cgroupSkip` ignores `require` (`case require && false:`) | `go test ./internal/runner/containment -run 'TestCgroupSessionRule' -count=1` | `linux_test.go:264: no session required: cgroupSkip = (true, "no systemd user session; production containment does not use cgroups", false), want (false, "EQUIPO_REQUIRE_USER_SESSION=1 but no systemd user session at /sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service: file does not exist", true)` | yes, `-run 'TestCgroupSessionRule'` passes |

On docs-t1 (bubblewrap 0.11.0, session cgroup present): `go test ./internal/runner/containment -run '^TestNamespaceCgroupMoveKeepsMembership$' -count=1 -v` gives `--- PASS: TestNamespaceCgroupMoveKeepsMembership (0.11s)`, and the same with `EQUIPO_REQUIRE_USER_SESSION=1` gives `--- PASS (0.13s)`.

## Task 5

New package `internal/isolatedjob`: the `Runner` interface, `LaunchSpec.Validate`, the state sets, `Clock` with `SystemClock()`, and `NetworkAudit.OK`. An attempt ID is 1 to 64 ASCII letters, digits or `-` (it becomes the AWS client token, which takes up to 128). Validate wraps `ErrInvalid` for every failure except an oversized bootstrap, which wraps `ErrBootstrapTooLarge`.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| `unknown` is terminal (`case StateStopped, StateFailed, StateUnknown:`) | `go test ./internal/isolatedjob -run 'TestStateSets' -count=1` | `isolatedjob_test.go:141: State("unknown").Terminal() = true, want false` | yes, `-run 'TestStateSets'` passes |
| `>=` on the lifetime limit (`s.MaxLifetime >= limit`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:83: Validate = isolatedjob: invalid request: lifetime 8h0m0s must be above zero and at most 8h0m0s, want nil` (also the 1h provider-limit row) | yes, `-run 'TestLaunchSpecValidate'` passes |
| Extra: `OK` ignores missing egress (`missingFrom(want, a.EgressOnly)[:0]`) | `go test ./internal/isolatedjob -run 'TestNetworkAuditOK' -count=1` | `isolatedjob_test.go:195: OK = nil, want an error naming [egress]` (the missing-egress and nothing-seen rows) | yes, whole package passes |

### Task 5 fix round 1

Every guard now has a mutation. `SystemClock` takes its wall and elapsed sources through an unexported seam (`newSystemClock(now, since)`); `TestSystemClockWallJump` moves the wall clock back an hour while elapsed time moves forward, and `TestSystemClock` checks the real start keeps its monotonic reading. Each row was applied by a scratch script that replaced one exact string, ran the command, kept the first assertion line, wrote the original back and ran the command again. No row failed by a build error.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| attempt id: empty accepted (`if len(id) > maxAttemptIDLen {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/attempt_id_empty` | yes, passes |
| attempt id: 65 chars accepted (`len(id) > maxAttemptIDLen+1 {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/attempt_id_65_chars` | yes, passes |
| attempt id: '_' accepted (`... c <= 'Z' \|\| c >= '0' && c <= '9' \|\| c == '-' \|\| c == '_') {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/attempt_id_underscore` | yes, passes |
| attempt id: space accepted (`... c <= 'Z' \|\| c >= '0' && c <= '9' \|\| c == '-' \|\| c == ' ') {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/attempt_id_space` | yes, passes |
| attempt id: non-ASCII bytes accepted (`...c <= 'Z' \|\| c >= '0' && c <= '9' \|\| c == '-' \|\| c >= 0x80) {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/attempt_id_non-ascii` | yes, passes |
| attempt id: '-' refused (`... c <= 'z' \|\| c >= 'A' && c <= 'Z' \|\| c >= '0' && c <= '9') {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:83: Validate = isolatedjob: invalid request: attempt id must be 1 to 64 letters, digits or '-', want nil` in `TestLaunchSpecValidate/good, TestLaunchSpecValidate/attempt_id_64_chars_at_limit and 27 more` | yes, passes |
| image: prefix not required (`if false && !ok \|\| len(hex) != 64 {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/image_no_prefix` | yes, passes |
| image: 65 hex accepted (`len(hex) < 64 {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/image_long` | yes, passes |
| image: 63 hex accepted (`len(hex) > 64 {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/image_short` | yes, passes |
| image: upper-case hex accepted (`... c <= '9' \|\| c >= 'a' && c <= 'f' \|\| c >= 'A' && c <= 'F') {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/image_upper_hex_digit` | yes, passes |
| size: unknown size accepted (`if s.Size.MemoryMiB() < 0 {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/size_empty, TestLaunchSpecValidate/size_medium and 1 more` | yes, passes |
| size: small reports 4096 MiB (`return 4096`) | `go test ./internal/isolatedjob -run 'TestSizeMemory' -count=1` | `isolatedjob_test.go:109: Size("small").MemoryMiB() = 4096, want 2048` | yes, passes |
| lifetime: zero accepted (`s.MaxLifetime < 0 ||`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/lifetime_zero` | yes, passes |
| lifetime: one second over the limit accepted (`s.MaxLifetime > limit+1000000000 {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/lifetime_over_the_provider_limit, TestLaunchSpecValidate/lifetime_28801_s and 1 more` | yes, passes |
| lifetime: limit inclusive broken (>=) (`s.MaxLifetime >= limit {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:83: Validate = isolatedjob: invalid request: lifetime 1h0m0s must be above zero and at most 1h0m0s, want nil` in `TestLaunchSpecValidate/lifetime_at_the_provider_limit, TestLaunchSpecValidate/lifetime_28800_s_at_the_hard_limit and 1 more` | yes, passes |
| lifetime: hard cap ignored (`limit := l.MaxLifetime`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/lifetime_28801_s_over_a_looser_provider` | yes, passes |
| bootstrap: empty accepted (`if false && len(s.Bootstrap) == 0 {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: invalid request` in `TestLaunchSpecValidate/bootstrap_empty, TestLaunchSpecValidate/bootstrap_zero_length` | yes, passes |
| bootstrap: one byte over accepted (`if len(s.Bootstrap) > l.MaxBootstrapBytes+1 {`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = <nil>, want isolatedjob: bootstrap too large` in `TestLaunchSpecValidate/bootstrap_one_byte_over` | yes, passes |
| bootstrap: oversize gives ErrInvalid (`ErrInvalid, len(`) | `go test ./internal/isolatedjob -run 'TestLaunchSpecValidate' -count=1` | `isolatedjob_test.go:88: Validate = isolatedjob: invalid request: bootstrap is 4097 bytes, limit 4096, want isolatedjob: bootstrap too large` in `TestLaunchSpecValidate/bootstrap_one_byte_over, TestLaunchSpecValidate/bootstrap_with_no_provider_limit` | yes, passes |
| state: unknown live (`...tateSuspending, StateSuspended, StateStopping, StateUnknown:`) | `go test ./internal/isolatedjob -run 'TestStateSets' -count=1` | `isolatedjob_test.go:138: State("unknown").Live() = true, want false` | yes, passes |
| state: unknown terminal (`case StateStopped, StateFailed, StateUnknown:`) | `go test ./internal/isolatedjob -run 'TestStateSets' -count=1` | `isolatedjob_test.go:141: State("unknown").Terminal() = true, want false` | yes, passes |
| state: failed not terminal (`case StateStopped:`) | `go test ./internal/isolatedjob -run 'TestStateSets' -count=1` | `isolatedjob_test.go:141: State("failed").Terminal() = false, want true` | yes, passes |
| audit: resolver ignored (`if false && !a.ResolverDisabled {`) | `go test ./internal/isolatedjob -run 'TestNetworkAuditOK' -count=1` | `isolatedjob_test.go:195: OK = nil, want an error naming [resolver]` in `TestNetworkAuditOK/resolver_on, TestNetworkAuditOK/everything_wrong` | yes, passes |
| audit: ingress ignored (`if false && !a.IngressClosed {`) | `go test ./internal/isolatedjob -run 'TestNetworkAuditOK' -count=1` | `isolatedjob_test.go:195: OK = nil, want an error naming [ingress]` in `TestNetworkAuditOK/ingress_open, TestNetworkAuditOK/everything_wrong` | yes, passes |
| audit: route out ignored (`if false && !a.RouteOutAbsent {`) | `go test ./internal/isolatedjob -run 'TestNetworkAuditOK' -count=1` | `isolatedjob_test.go:195: OK = nil, want an error naming [route out]` in `TestNetworkAuditOK/route_out, TestNetworkAuditOK/everything_wrong` | yes, passes |
| audit: extra egress ignored (`extra := missingFrom(a.EgressOnly, want)[:0]`) | `go test ./internal/isolatedjob -run 'TestNetworkAuditOK' -count=1` | `isolatedjob_test.go:195: OK = nil, want an error naming [egress]` in `TestNetworkAuditOK/extra_egress, TestNetworkAuditOK/egress_seen_none_wanted` | yes, passes |
| audit: missing egress ignored (`missing := missingFrom(want, a.EgressOnly)[:0]`) | `go test ./internal/isolatedjob -run 'TestNetworkAuditOK' -count=1` | `isolatedjob_test.go:195: OK = nil, want an error naming [egress]` in `TestNetworkAuditOK/missing_egress, TestNetworkAuditOK/nothing_seen` | yes, passes |
| clock: Mono from wall time (`return c.Wall().Sub(c.start)`) | `go test ./internal/isolatedjob -run 'TestSystemClockWallJump' -count=1` | `isolatedjob_test.go:260: step 1: Mono = -59m55s, want 10s (last 5s)` | yes, passes |
| clock: start loses monotonic reading (`start: now().Round(0), now:`) | `go test ./internal/isolatedjob -run 'TestSystemClock$' -count=1` | `isolatedjob_test.go:234: start = 2026-11-22 16:04:31.981554794 +0000 GMT has no monotonic reading` | yes, passes |
| clock: Wall derived from Mono (`return c.start.Add(c.Mono()).Round(0)`) | `go test ./internal/isolatedjob -run 'TestSystemClockWallJump' -count=1` | `isolatedjob_test.go:264: step 1: Wall = 2026-11-22 12:00:10 +0000 UTC, want 2026-11-22 11:00:05 +0000 UTC` | yes, passes |
| clock: Wall keeps monotonic reading (`return c.now()`) | `go test ./internal/isolatedjob -run 'TestSystemClock$' -count=1` | `isolatedjob_test.go:227: Wall = 2026-11-22 16:04:32.430137707 +0000 GMT m=+0.000216344 carries a monotonic reading` | yes, passes |

## Task 6

`isolatedjob.Fake` (an in-memory `Runner` and `NetworkAuditor`, limits from `SpikeLimits()`) and `isolatedjobtest` (`FakeClock`, `Harness`, `Contract`). Faults are one-shot and queue in order per op. `Tick` steps starting, suspending and stopping on, then the backstop stops VMs whose lifetime since launch (suspended time included while `SuspendUsesLifetime`) has reached their `MaxLifetime`. Resume of a suspended VM is accepted but the VM reports `suspended` until the next `Tick` moves it to running, as AWS keeps SUSPENDED while its /resume hook runs (controller ruling after the first commit); a second Resume in that window is accepted and changes nothing, Stop in it works as usual, and Resume of a running VM is a no-op.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| idempotency keyed on Ref (`f.byAttempt[string(vm.ref)] = vm.ref`) | `go test ./internal/isolatedjob -run 'TestFakeContract/LaunchIdempotentOnAttempt' -count=1` | `contract.go:83: second Launch(contract-91c43af87640-1) = vm-0002, want vm-0001: one attempt must be one VM` | yes, passes |
| Tick leaves suspended time out (`if !f.limits.SuspendUsesLifetime \|\| true {`) | `go test ./internal/isolatedjob -run 'TestFakeFaults' -count=1` | `fake_test.go:212: Get(vm-0001).State = suspended, want stopping` | yes, passes |
| throttle applies the call (`if fl == FaultThrottle && false {`) | `go test ./internal/isolatedjob -run 'TestFakeFaults' -count=1` | `fake_test.go:116: throttled Launch = ("vm-0001", <nil>), want ("", ErrThrottled)` | yes, passes |
| lost reply skips the effect (`if fl == FaultLostReply { return "", ErrLostReply }` before `launchLocked`) | `go test ./internal/isolatedjob -run 'TestFakeFaults' -count=1` | `fake_test.go:134: LiveByAttempt after a lost reply = map[], want a1:1 (the launch happened)` | yes, passes |
| incomplete list ignored (`case FaultIncompleteList + "x":` in List) | `go test ./internal/isolatedjob -run 'TestFakeFaults' -count=1` | `fake_test.go:155: faulted List = ([{vm-0001 starting ...}], <nil>), want (nil, ErrIncomplete)` | yes, passes |
| unknown state ignored (`case FaultUnknownState + "x":` in Get) | `go test ./internal/isolatedjob -run 'TestFakeFaults' -count=1` | `fake_test.go:166: Get(vm-0001).State = running, want unknown` | yes, passes |
| age unknown ignored (`case FaultAgeUnknown + "x":` in Get) | `go test ./internal/isolatedjob -run 'TestFakeFaults' -count=1` | `fake_test.go:175: faulted Get = {... AgeKnown:true}, want AgeKnown false and still running` | yes, passes |
| faults not used up (`f.faults[op] = q[0:]`) | `go test ./internal/isolatedjob -run 'TestFakeFaults' -count=1` | `fake_test.go:121: Launch(a1) = isolatedjob: throttled: fake launch` (and every other row) | yes, passes |
| resume straight to running (`vm.state = StateRunning` in place of `vm.resuming = true` in Resume) | `go test ./internal/isolatedjob -run 'TestFakeLifecycle' -count=1` | `fake_test.go:312: Get(vm-0001).State = running, want suspended` in `TestFakeLifecycle/resume_reports_suspended_until_the_next_tick` | yes, passes |

Fix round 1 (review r1). `Vanish(ref)` makes the fake provider forget a VM: Get, Suspend and Resume return `ErrNotFound`, Stop returns nil, List and `LiveByAttempt` leave it out, `StopsIssued` is untouched, and the client token survives (a replay returns the same Ref, a changed spec conflicts). `Calls(op)` counts calls that reached the fake provider, so a test can show a refused spec made none. `Contract` gains `Harness.ListLag`, and `OversizeBootstrapRefusedBeforeProvider` first waits (bounded by `ListLag`) for a VM it launched to show live in List, so an always-empty List fails. Line numbers in the rows above are as of `5027ce36`; the rows below are from this round.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Get sees vanished VMs (`vm, ok := f.vms[ref]` in Get) | `go test ./internal/isolatedjob -run 'TestFakeLifecycle' -count=1` | `fake_test.go:411: Get of a vanished VM = <nil>, want ErrNotFound` | yes, passes |
| List includes vanished VMs (`f.vms[ref]` in List) | same | `fake_test.go:415: List after vanish = ([{vm-0001 running ...} {vm-0002 running ...}], <nil>), want just vm-0002` | yes, passes |
| LiveByAttempt counts vanished VMs (`if vm.state.Live() {`) | same | `fake_test.go:418: LiveByAttempt after vanish = map[a1:1 a2:1], want a2:1` | yes, passes |
| Vanish drops the client token (`delete(f.byAttempt, vm.spec.AttemptID)`) | same | `fake_test.go:436: Launch replay after vanish = vm-0003, want vm-0001 (the client token outlives the VM)` | yes, passes |
| Vanish records a stop (`f.stops = append(f.stops, ref)`) | same | `fake_test.go:421: StopsIssued after vanish = [vm-0001], want none: the controller stopped nothing` | yes, passes |
| List always empty (`return nil, nil` in List) | `go test ./internal/isolatedjob -run 'TestFakeContract/OversizeBootstrapRefusedBeforeProvider' -count=1` | `contract.go:179: List = [] after 0s, want it to hold running VM vm-0001` | yes, passes |
| Launch validates after the provider call (Validate moved after `begin`) | `go test ./internal/isolatedjob -run 'TestFakeLifecycle' -count=1` | `fake_test.go:384: Launch with a bad size = isolatedjob: throttled: fake launch, want ErrInvalid` | yes, passes |
| lost-reply Resume skips the effect (`if fl != FaultLostReply { vm.resuming = true }`) | `go test ./internal/isolatedjob -run 'TestFakeFaults' -count=1` | `fake_test.go:173: Get(vm-0001).State = suspended, want running` | yes, passes |
| lost-reply Resume suppresses the error (`return finish(fl+"x", OpResume, err)`) | same | `fake_test.go:171: lost-reply Resume(vm-0001) = <nil>, want ErrLostReply and no sentinel` | yes, passes |
| changed spec accepted (`if false && !sameSpec(...)`) | `go test ./internal/isolatedjob -run 'TestFakeContract/ChangedSpecConflicts' -count=1` | `contract.go:104: Launch with the same attempt and a new bootstrap = ("vm-0001", <nil>), want ErrConflict` | yes, passes |
| Suspend ignores state (`case false && vm.state != StateRunning:`) | `go test ./internal/isolatedjob -run 'TestFakeLifecycle' -count=1` | `fake_test.go:293: Suspend while starting = <nil>, want ErrConflict` | yes, passes |
| Resume ignores state (`case false && vm.state != StateSuspended:`) | same | `fake_test.go:296: Resume while starting = <nil>, want ErrConflict` | yes, passes |
| backstop switch ignored (`if (f.backstop \|\| true) && ...`) | same | `fake_test.go:463: Get(vm-0001).State = stopping, want running` | yes, passes |
| Inject takes any pair (`if false && !ok {`) | same | `fake_test.go:531: Inject(OpGet, FaultIncompleteList) did not panic` | yes, passes |
| lost-reply Stop skips the effect (`fl != FaultLostReply &&` in Stop) | `go test ./internal/isolatedjob -run 'TestFakeFaults' -count=1` | `fake_test.go:144: Get(vm-0001).State = starting, want stopping` | yes, passes |

## Task 7

`awsjob.Runner` (Runner and NetworkAuditor over `lambdamicrovms` v1.13.0 and EC2, through the narrow `API` interface), `SNSPublisher`, and `TestProviderTypesStayInAdapter` in `isolatedjob` with the empty `guardfixture` as its target. Rows applied by a scratch script that replaced one exact string, ran the command, kept the first assertion line, wrote the original back and ran the command again. No row failed by a build error (a first try at the throttle row did, and was redone so the code still compiles).

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| role set (`ExecutionRoleArn: aws.String(...)` on the run request) | `go test ./internal/isolatedjob/awsjob -run '^TestRunRequestShape$' -count=1` | `runner_test.go:267: executionRoleArn = "arn:aws:iam::1:role/r", want none` | yes, passes |
| idle policy set (`IdlePolicy: &types.IdlePolicy{AutoResumeEnabled: aws.Bool(true)}`) | same | `runner_test.go:270: idlePolicy = {AutoResumeEnabled:0x... ...}, want none` | yes, passes |
| extra: client token dropped (line deleted) | same | `runner_test.go:276: clientToken = <nil>, want the attempt id "attempt-7"` | yes, passes |
| capabilities check dropped (`if false && !slices.Equal(out.AdditionalOsCapabilities, ...)`) | `go test ./internal/isolatedjob/awsjob -run '^TestImageVersionChecked$' -count=1` | `runner_test.go:419: Launch = <nil>, want ErrInvalid` in `capabilities_missing`, `capabilities_twice`, `capability_unknown` | yes, passes |
| cpu check dropped (`if false && (len(out.CpuConfigurations) != 1 \|\| ...)`) | same | `runner_test.go:419: Launch = <nil>, want ErrInvalid` in `cpu_ARM_64`, `cpu_missing`, `cpu_both` | yes, passes |
| memory check dropped (`if false && (len(out.Resources) != 1 \|\| ...)`) | same | `runner_test.go:419: Launch = <nil>, want ErrInvalid` in `memory_of_the_other_size`, `memory_missing`, `memory_unset`, `a_failure_is_not_cached` | yes, passes |
| unfamiliar state maps to failed (`return isolatedjob.StateFailed, why`) | `go test ./internal/isolatedjob/awsjob -run '^TestStateMapping$' -count=1` | `runner_test.go:524: Get(HIBERNATING).State = failed, want unknown` (also `FAILED` and `""`) | yes, passes |
| age from the local clock (`time.Since(*started)`) | `go test ./internal/isolatedjob/awsjob -run '^TestProviderAge$' -count=1` | `runner_test.go:593: Get = age 7782h22m36.49s known true, want age 1m30s known true` | yes, passes |
| partial pages returned (`return jobs, nil` on a page error) | `go test ./internal/isolatedjob/awsjob -run '^TestListAllPages$' -count=1` | `runner_test.go:883: List = <nil>, want ErrIncomplete` in `page_two_fails`, `page_one_fails` | yes, passes |
| extra: resume conflict always a no-op (`if true \|\| j.State == isolatedjob.StateRunning {`) | `go test ./internal/isolatedjob/awsjob -run '^TestResumeConflict$' -count=1` | `runner_test.go:754: Resume = <nil>, want ErrConflict` | yes, passes |
| extra: terminate not-found not swallowed (`false && errors.Is(err, isolatedjob.ErrNotFound)`) | `go test ./internal/isolatedjob/awsjob -run '^TestErrorMapping$' -count=1` | `runner_test.go:690: stop = awsjob: terminate: isolatedjob: not found: ResourceNotFoundException: gone, want nil` | yes, passes |
| extra: throttling not mapped (`case false && errors.As(err, &throttle), ...`) | same | `runner_test.go:703: launch = awsjob: run: ThrottlingException: slow, want isolatedjob: throttled` | yes, passes |
| extra: audit ignores ingress rules (`a.IngressClosed = true`) | `go test ./internal/isolatedjob/awsjob -run '^TestAuditNetwork$' -count=1` | `network_test.go:208: AuditNetwork = {... IngressClosed:true ...}, want {... IngressClosed:false ...}` | yes, passes |
| extra: audit ignores non-local routes (`if false && (aws.ToString(rt.GatewayId) != "local" \|\| other) {`) | same | `network_test.go:208: AuditNetwork = {... RouteOutAbsent:true ...}, want {... RouteOutAbsent:false ...}` | yes, passes |
| extra: audit takes a network as a host (`if err != nil {` without `IsSingleIP`) | same | `network_test.go:336: AuditNetwork = {... EgressOnly:[... 0.0.0.0:443]}, nil; want an error` | yes, passes |
| guard: `import _ "github.com/aws/aws-sdk-go-v2/aws"` in `guardfixture/doc.go` (`go build ./internal/isolatedjob/guardfixture` succeeds) | `go test ./internal/isolatedjob -run '^TestProviderTypesStayInAdapter$' -count=1` | `providerguard_test.go:84: packages outside amadan.net/oficina/equipo/internal/isolatedjob/awsjob depend on the AWS SDK or the adapter: amadan.net/oficina/equipo/internal/isolatedjob/guardfixture (via github.com/aws/aws-sdk-go-v2/aws)` | yes, passes |
| guard: `guardModule + "/internal/isolatedjob/guardfixture"` added to `providerAllowed` | same | `providerguard_test.go:35: providerAllowed holds amadan.net/oficina/equipo/internal/isolatedjob/guardfixture; only cmd/ composition points may depend on the AWS SDK or awsjob` | yes, passes |
| extra: guard sees test-only imports (scratch `guardfixture/leak_test.go` importing `github.com/aws/smithy-go`, then removed) | same | `providerguard_test.go:84: ... guardfixture (via github.com/aws/smithy-go)` | yes, file removed, passes |


### Task 7 fix round 1

The audit now reads the pinned egress connector through lambdacore `GetNetworkConnector`. `Config.ConnectorID` must be a version-qualified ARN. The guard judges test variants by `ForTest`, and Launch refuses a non-ASCII bootstrap. Rows were applied by the same kind of scratch script. The first try at the connector-ARN row panicked (index out of range), so it was redone as below; every recorded row failed by assertion.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| audit ignores the connector's subnet (`if false && !slices.Equal(c.SubnetIds, ...)`) | `go test ./internal/isolatedjob/awsjob -run '^TestAuditNetwork$' -count=1` | `network_test.go:437: AuditNetwork = {ResolverDisabled:true IngressClosed:true RouteOutAbsent:true EgressOnly:[10.0.1.10:3128 10.0.1.11:443]}, nil; want an error` in `connector_in_another_subnet`, `connector_with_an_extra_subnet` | yes, passes |
| audit ignores an extra group (`if false && !slices.Equal(c.SecurityGroupIds, ...)`) | same | same line, in `connector_with_another_group`, `connector_with_an_extra_group` | yes, passes |
| extra: audit skips the connector (`...checkConnector(ctx); false && err != nil {`) | same | same line, in all 12 connector rows | yes, passes |
| extra: audit ignores the connector version (`false && got != id`) | same | same line, in `connector_answers_for_another_version`, `connector_answers_unqualified` | yes, passes |
| extra: audit ignores service-managed Elastic IPs (`false && e != nil && ...`) | same | same line, in `connector_with_service-managed_Elastic_IPs` | yes, passes |
| extra: unqualified connector accepted (`if !strings.HasPrefix(c.ConnectorID, "arn:") {` in place of `qualifiedConnector`) | `go test ./internal/isolatedjob/awsjob -run '^TestNew$' -count=1` | `runner_test.go:241: New = <nil>, want ErrInvalid` in `connector_unqualified`, `connector_version_not_a_number`, `connector_in_another_region`, `connector_of_another_service` | yes, passes |
| ASCII check removed (`if false && b >= 0x80 {`) | `go test ./internal/isolatedjob/awsjob -run '^TestRunRequestShape$' -count=1` | `runner_test.go:367: Launch = ("vm-1", <nil>), want ErrInvalid` in `bootstrap_with_invalid_UTF-8`, `bootstrap_with_valid_non-ASCII_UTF-8` | yes, passes |
| guard strips _test again (`basePackage` returns `strings.TrimSuffix(path, "_test")` for any path) | `go test ./internal/isolatedjob -run '^TestProviderGuardClassifies$' -count=1` | `providerguard_test.go:185: offenders = .../internal/hostedctl (via ...) .../awsjobx (via ...) want .../internal/isolatedjob/awsjob_test (via github.com/aws/aws-sdk-go-v2/aws) ...` | yes, passes |
| extra: guard skips every path ending _test (`strings.HasSuffix(plainPath(p.ImportPath), "_test") \|\| ...` on the test-main skip) | same | `providerguard_test.go:182: offenders = .../awsjobx (via ...) want .../awsjob_test (via github.com/aws/aws-sdk-go-v2/aws) .../internal/hostedctl (via ...)` | yes, passes |
| regression: scratch ordinary package `internal/isolatedjob/awsjob_test/doc.go` importing `github.com/aws/aws-sdk-go-v2/aws` (`go build` succeeded), then removed | `go test ./internal/isolatedjob -run '^TestProviderTypesStayInAdapter$' -count=1` | `providerguard_test.go:64: packages outside .../awsjob depend on the AWS SDK or the adapter: amadan.net/oficina/equipo/internal/isolatedjob/awsjob_test (via github.com/aws/aws-sdk-go-v2/aws)` | yes, directory removed, passes |

### Task 7 fix round 2

The guard now names each go list entry by its source directory relative to the module root, not by its import path and not by `ForTest`, and skips nothing. go list gives a generated test main `p.test` and the external test `p_test [p.test]` the directory of `p`, so a real package at `p.test` or `p_test` is judged as itself. `TestProviderGuardClassifies` now holds isolatedjob's generated main and a real `internal/isolatedjob.test` package with the same import path string.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| skip by path again (`if strings.HasSuffix(p.ImportPath, ".test") { continue }` before `basePackage`) | `go test ./internal/isolatedjob -run '^TestProviderGuardClassifies$' -count=1` | `providerguard_test.go:197: offenders = .../awsjob_test (via ...) .../internal/hostedctl (via ...) .../awsjobx (via ...) want ...` (the real `internal/isolatedjob.test` missing) | yes, passes |
| extra: judge by import path (`return plainPath(p.ImportPath)` first in `basePackage`) | same | `providerguard_test.go:195: offenders = ... .../isolatedjob/awsjob.test (via github.com/aws/aws-sdk-go-v2/aws) ... .../internal/hostedctl_test (via ...)` | yes, passes |
| regression: scratch real package `internal/isolatedjob.test/doc.go` importing `github.com/aws/aws-sdk-go-v2/aws` (`go build` succeeded), then removed | `go test ./internal/isolatedjob -run '^TestProviderTypesStayInAdapter$' -count=1` | `providerguard_test.go:65: packages outside .../awsjob depend on the AWS SDK or the adapter: amadan.net/oficina/equipo/internal/isolatedjob.test (via github.com/aws/aws-sdk-go-v2/aws)` | yes, directory removed, passes |

## Task 8

`internal/hostedwire`: ed25519-signed requests (headers `Equipo-Key-Id`, `Equipo-Timestamp`, `Equipo-Nonce`, `Equipo-Signature`, each exactly once, matched without regard to case) and responses (`Equipo-Signature`, bound to status, the request's nonce and the body hash), plus strict JSON wire types for every Task 15 route and `DecodeStrict`. Verify order: strict headers, key lookup (a public key shared by two IDs is refused, since the key ID is not in the signed message), skew (60 s either way, against `Verifier.Now`), body size, signature, then `Remember(r.Context(), id, nonce, now+10min)`; a held nonce is a replay and a store error denies. `DecodeStrict` reads at most `MaxBody`, needs exactly one object, and refuses unknown fields, keys not lower-case snake_case, and a key repeated in one object. RED was taken against stubs (signing real, verification and decoding naive): every test but `TestSignatureCoversEveryField`, `TestSignRequestRefusesBadInput`, `TestNewNonce` and `TestWireNames` failed by assertion; the first is shown red by the body-hash mutation below.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| drop the body hash (`sha256.Sum256(nil)` in `requestMessage`) | `go test ./internal/hostedwire -run 'TestSignatureCoversEveryField' -count=1` | `sign_test.go:227: Verify after changing the body = <nil>, want hostedwire: bad signature` | yes, passes |
| skip `Remember` (`fresh, err := true, error(nil)`) | `go test ./internal/hostedwire -run 'TestNonceReplayRefused' -count=1` | `sign_test.go:286: replayed Verify = ("inst-1", <nil>), want ErrReplay` | yes, passes |
| store error treated as fresh (`fresh, err = true, nil` in the error branch) | `go test ./internal/hostedwire -run 'TestNonceStoreErrorDenies' -count=1` | `sign_test.go:305: Verify with a failing nonce store = ("inst-1", <nil>), want ErrNonceStore wrapping the store error` | yes, passes |
| skew bound off (`if false && (...) {`) | `go test ./internal/hostedwire -run 'TestSkewRefused' -count=1` | `sign_test.go:257: Verify with the clock -1m1s off = <nil>, want hostedwire: timestamp outside the allowed skew` | yes, passes |
| response not bound to the request nonce (nonce dropped from `responseMessage`) | `go test ./internal/hostedwire -run 'TestResponseBoundToRequestNonce' -count=1` | `sign_test.go:364: VerifyResponse with a changed another request's nonce = <nil>, want hostedwire: bad signature` | yes, passes |
| strict decode: unknown fields allowed (`DisallowUnknownFields` commented out) | `go test ./internal/hostedwire -run 'TestDecodeStrict' -count=1` | `api_test.go:45: DecodeStrict(unknown field) = <nil>, want hostedwire: body is not one strict JSON object` | yes, passes |
| strict decode: trailing values allowed (`values < 1`) | same | `api_test.go:45: DecodeStrict(trailing value) = <nil>, want ...` | yes, passes |
| strict decode: repeated key allowed | same | `api_test.go:45: DecodeStrict(duplicate field) = <nil>, want ...` | yes, passes |
| strict decode: key case not checked | same | `api_test.go:45: DecodeStrict(field in another case) = <nil>, want ...` | yes, passes |
| strict decode: top-level object not required | same | `api_test.go:45: DecodeStrict(null) = <nil>, want ...` | yes, passes |
| shared public key allowed (`if false && other != id ...`) | `go test ./internal/hostedwire -run 'TestSharedPublicKeyRefused' -count=1` | `sign_test.go:461: Verify as op-alias with a shared public key = ("op-alias", <nil>), want ErrSharedKey` | yes, passes |
| repeated header allowed (`case 1, 2:` in `single`) | `go test ./internal/hostedwire -run 'TestRequestHeadersStrict' -count=1` | `sign_test.go:444: Verify with key id twice = <nil>, want hostedwire: signature header malformed or repeated` | yes, passes |
| oversize body allowed in Verify | `go test ./internal/hostedwire -run 'TestOversizeBodyRefused' -count=1` | `sign_test.go:389: Verify of 1048577 signed bytes = <nil>, want ErrTooLarge` | yes, passes |

Fix round 1 (review r1). `StopProof.ObservedAt` is controller time, a `time.Duration` since the controller's epoch, sent as integer nanoseconds in `observed_at_ns` (no wall time on the wire). `LaunchRequest.MaxLifetime()` now returns `(time.Duration, error)`: a negative `max_lifetime_ms` or one too large for a `time.Duration` is `ErrDuration`, checked before the multiplication (unchecked, 288230376155311744 and -288230376148111744 both wrapped to one hour). The signed target keeps the `?` of an empty query (`ForceQuery || RawQuery != ""`). RED: the new `TestLaunchLifetimeBounds` and the changed `TestWireNames` row did not build against the old API; the empty-query rows failed with `sign_test.go:256: Verify after the empty query added = <nil>, want ErrBadSignature` (and `removed`). Line numbers in the Task 8 rows above are as of `af8096ad`; the rows below are from this round.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| proof time sent as a string (`json:"observed_at_ns,string"`) | `go test ./internal/hostedwire -run 'TestWireNames' -count=1` | `api_test.go:119: json of hostedwire.StopProof = {...,"observed_at_ns":"4611686018427387905"}, want {...,"observed_at_ns":4611686018427387905}` | yes, passes |
| lifetime unchecked (`if false && ms < 0 \|\| false && ms > ...`) | `go test ./internal/hostedwire -run 'TestLaunchLifetimeBounds' -count=1` | `api_test.go:157: MaxLifetime(9223372036855 ms) = (-2562047h47m16.854551616s, <nil>), want (0, ErrDuration)` | yes, passes |
| negative lifetime allowed (`if ms > math...`) | same | `api_test.go:157: MaxLifetime(-288230376148111744 ms) = (1h0m0s, <nil>), want (0, ErrDuration)` | yes, passes |
| empty query unsigned (`if r.URL.RawQuery != "" {`) | `go test ./internal/hostedwire -run 'TestSignatureCoversEveryField' -count=1` | `sign_test.go:256: Verify after the empty query added = <nil>, want ErrBadSignature` and `... empty query removed = <nil>, want ErrBadSignature` | yes, passes |

## Task 9

`internal/hostedctl` foundation: the SQLite store (schema `schema/0001_jobs.sql`, `PRAGMA user_version`, WAL, busy timeout, foreign keys, one connection, `BEGIN IMMEDIATE` transactions), controller time and the controller skeleton. Controller time: `Now() = base + (Mono() - monoAtOpen)`. Every `Tx` commit and every `Checkpoint` writes `(Now(), Wall())`; on `Open` with a checkpoint, `base = cpT + max(0, wallNow - cpWall)`, `Restarted()` is true, a wall clock behind the checkpoint adds a `clock_rollback` audit row and a startup alert that `New` must deliver, and Open writes a fresh checkpoint. A fresh database starts at T = 0 with `Restarted()` false. RED was taken against stubs (API only, T from the wall clock, no schema, no checks): all ten tests failed by assertion (for example `clock_test.go:20: Now on a fresh database = 498708h0m0s, want 0`, `store_test.go:120: Open of a database at schema 99 = nil error, want ErrSchemaNewer`, `store_test.go:184: Tx = database is locked (5) (SQLITE_BUSY)` after a panicking Tx). GREEN: `go test ./internal/hostedctl -run 'TestStore|TestAudit|TestSpecImmutable|TestRollback|TestRestart' -count=1` ok; whole package 0.6 s.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| T from the wall clock (`elapsed := k.c.Wall().Sub(k.wallAtOpen)`) | `go test ./internal/hostedctl -run 'TestRollbackThenElapsedTime' -count=1` | `clock_test.go:31: Now advanced 0s after the wall clock went back 1h and Mono advanced 10m, want exactly 10m` | yes, passes |
| `Restarted()` false when the wall clock moved forward (`s.restarted = restarted && rollback > 0`) | `go test ./internal/hostedctl -run 'TestRestartMarksElapsedUntrusted' -count=1` | `clock_test.go:60: Restarted() after a restart with the wall clock ahead = false, want true` | yes, passes |
| drop the `jobs_spec_immutable` trigger | `go test ./internal/hostedctl -run 'TestSpecImmutable' -count=1` | `store_test.go:218: UPDATE jobs SET spec_json = '{"image":"b"}' ... = <nil>, want 'spec is immutable'` and `store_test.go:228: spec after refused updates = "{\"image\":\"b\"}" "bbbb", want the original` | yes, passes |
| extra: newer schema accepted (`if false && version > schemaVersion()`) | `go test ./internal/hostedctl -run 'TestStoreRefusesNewerSchema' -count=1` | `store_test.go:121: Open of a database at schema 99 = nil error, want ErrSchemaNewer` | yes, passes |
| extra: nonce replay accepted (`ON CONFLICT ... DO UPDATE SET until_unix_ns = ...`) | `go test ./internal/hostedctl -run 'TestStoreRemembersNonces' -count=1` | `store_test.go:247: Remember(inst-1, n1) = (true, <nil>), want (false, nil)` | yes, passes |
| extra: nil runner accepted (`case false && d.Runner == nil:`) | `go test ./internal/hostedctl -run 'TestNewRefusesNilDependency' -count=1` | `store_test.go:326: New without the runner = (&{...}, <nil>), want (nil, an error)` | yes, passes |
| extra: no rollback alert (`if false && rollback > 0 {`) | `go test ./internal/hostedctl -run 'TestRestartWithRollback' -count=1` | `clock_test.go:125: StartupAlerts = [], want one clock_rollback alert naming 1h0m0s at 20m` | yes, passes |
| extra: rollback alert sent again by a second `New` (`s.delivered = 0` after delivery) | same | `clock_test.go:146: alerts delivered after Open and two News = [{Kind:clock_rollback ...} {Kind:clock_rollback ...}], want exactly [...]` | yes, passes |
| extra: no checkpoint in `Tx` commits | `go test ./internal/hostedctl -run 'TestRestartKeepsCommittedTime' -count=1` | `clock_test.go:98: Now after a restart = 0s, below the 7m0s a committed row already holds` | yes, passes |
| extra: Open keeps the old checkpoint (`ON CONFLICT (id) DO NOTHING`) | `go test ./internal/hostedctl -run 'TestRestartMarksElapsedUntrusted' -count=1` | `clock_test.go:72: Now after a second restart with the wall clock 20m back = 15m0s, want 35m` | yes, passes |

Fix round 1 (review r1, rulings R10-R13). These are the changes:
- Jobs rows are never deleted: a `jobs_never_deleted` trigger, with `recursive_triggers` on so the implicit delete of `INSERT OR REPLACE` fires it. `resume_ops` no longer cascades.
- `Close` checkpoints. The `Tx` checkpoint is sampled after `fn`. The invariant is narrowed to T persisted or acted on (R10).
- One owner per database: `Open` takes a non-blocking `flock` on `path.lock` and fails at once with `ErrStoreInUse`.
- Startup alerts sit in a durable `alert_outbox`. Each detail starts with `alert <id>: `. `New` delivers each alert and marks it delivered, at least once.
- `nonce_pruned` keeps the latest pruned expiry. `Remember` denies with `ErrNoncePruned` when `until <= mark + 2 MaxSkew`. The margin covers a replay up to 2 MaxSkew later than the original, which still passes the skew check.
- Typed-nil Runner, Auditor, Alerter and Clock are refused, using reflect.

RED came after adding only the new names (`closed`, `release`, `ErrStoreInUse` stub). Every new or extended test failed except `TestRestartKeepsCommittedTime`, which R2b turns red. Examples:
- `store_test.go:260: replace on the attempt ID = <nil>, want "jobs are never deleted"`
- `store_test.go:290: second Open while the first is open = nil error, want ErrStoreInUse`
- `clock_test.go:207: New after a crash = <nil> with alerts [], want ...`
- `store_test.go:319: replay of a pruned nonce after the wall clock went back = (true, <nil>), want (false, an error)`

GREEN: `go test ./internal/hostedctl -count=1` ok, 0.8-1.2 s. Line numbers in the Task 9 rows above are as of `3e074674`. M7, M8 and M10 were re-run against this round's code and still fail (`clock_test.go:157`, `:109`, `:178`).

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| R1 `recursive_triggers(0)` | `go test ./internal/hostedctl -run '^TestJobsNeverReplaced$' -count=1` | `store_test.go:260: replace on the attempt ID = <nil>, want "jobs are never deleted"` and `store_test.go:274: after refused replaces: spec "{\"image\":\"b\"}" "bbbb", ...; want the original spec and its one done row` | yes, passes |
| R2a `Close` without a checkpoint | `go test ./internal/hostedctl -run '^TestRestartAfterClose$' -count=1` | `clock_test.go:130: Now after Close and a wall clock 1h back = 0s, below the 10m0s seen before Close` | yes, passes |
| R2b `Tx` checkpoint sampled before `fn` | `go test ./internal/hostedctl -run '^TestRestartKeepsCommittedTime$' -count=1` | `clock_test.go:109: Now after a crash and a wall clock 1h back = 0s, below the 7m0s a committed row already holds` | yes, passes |
| R3 no `flock` (`if err := error(nil); err != nil {`) | `go test ./internal/hostedctl -run '^TestStoreOneOwner$' -count=1` | `store_test.go:290: second Open while the first is open = nil error, want ErrStoreInUse` | yes, passes |
| R4a outbox reloaded only for this Open's rollback (`if rollback == 0 { pending = nil }`) | `go test ./internal/hostedctl -run '^TestRestartWithRollback$' -count=1` | `clock_test.go:207: New after a crash = <nil> with alerts [], want nil and exactly [{Kind:clock_rollback Detail:alert 2: ...}]` | yes, passes |
| R4b delivery not marked (`SET delivered = 0`) | same | `clock_test.go:186: StartupAlerts on the next restart = [{Kind:clock_rollback Detail:alert 1: ...}], want none` | yes, passes |
| R5a no pruned-through check (`if false && (...)`) | `go test ./internal/hostedctl -run '^TestStoreDeniesNonceAfterPruneAndRollback$' -count=1` | `store_test.go:319: replay of a pruned nonce after the wall clock went back = (true, <nil>), want (false, an error)` | yes, passes |
| R5b no skew margin (`untilNs <= through`) | same | `store_test.go:325: replay 90s after the original = (true, <nil>), want (false, ErrNoncePruned)` | yes, passes |
| R6 plain `== nil` for Runner, Auditor, Alerter | `go test ./internal/hostedctl -run '^TestNewRefusesNilDependency$' -count=1` | `store_test.go:438: New with typed nil runner = (&{...}, <nil>), want (nil, an error)` (and auditor, alerter) | yes, passes |
| R6b plain `c == nil` in `Open` | `go test ./internal/hostedctl -run '^TestStoreRefusesNilClock$' -count=1` | `store_test.go:457: Open with a typed nil clock panicked (runtime error: invalid memory address or nil pointer dereference), want an error` | yes, passes |

Fix round 2 (review r2, findings 3 and 5).

- **One owner per database file.** The `flock` on `path.lock` locked a name, so a symlink got a second lock. It is replaced by SQLite's own lock on the file: `locking_mode(EXCLUSIVE)` with `busy_timeout(0)`. The connection keeps the lock from Open's first write until Close, for every name of the file, symlinks and hard links included. A second Open gets SQLITE_BUSY at once, which maps to `ErrStoreInUse`.
  - This replaces option (a), a `flock` on the database file. On BSD/macOS, and on Linux NFS, `flock` and SQLite's `fcntl` locks share one lock table, so an exclusive `flock` on the file would block SQLite's own locks.
  - modernc runs `busy_timeout` first and the other pragmas in name order. So the connection enters WAL first and then switches to EXCLUSIVE, which SQLite allows.
- **Nonce checks before pruning.**
  - A held row for `(key_id, nonce)` is a replay whatever its expiry, checked before anything is pruned.
  - The bound is now the larger of the durable mark and the latest expiry this call is about to prune, plus 2 MaxSkew.
  - `TestStoreRemembersNonces` changed for this: an expired but still-held nonce is now a replay.

RED: `store_test.go:326: Open through current.db while controller.db is open = nil error, want ErrStoreInUse`; `store_test.go:354: replay with until 12:10 at 12:11 = (true, <nil>), want (false, nil)`. GREEN: `go test ./internal/hostedctl -count=1` ok, 1.2 s.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| R3c `_pragma=locking_mode(NORMAL)` in the DSN | `go test ./internal/hostedctl -run '^TestStoreOneOwner' -count=1` | `store_test.go:290: second Open while the first is open = nil error, want ErrStoreInUse`; `store_test.go:326: Open through current.db while controller.db is open = nil error, want ErrStoreInUse`; `store_test.go:330: Open through linked.db ... = hostedctl: migrate: disk I/O error (522), want ErrStoreInUse` | yes, passes |
| R7a round-1 order (no held-row check, bound from the old mark only) | `go test ./internal/hostedctl -run '^TestStoreNonceReplayAcrossWallJump$' -count=1` | `store_test.go:354: replay with until 12:10 at 12:11 = (true, <nil>), want (false, nil): a held row is a replay whatever its expiry` | yes, passes |
| R7b no held-row check | same | `store_test.go:354: replay with until 12:10 at 12:11 = (false, hostedctl: nonce window already pruned ...), want (false, nil)` | yes, passes |
| R7c bound ignores this call's prune | same | `store_test.go:360: new nonce with until 12:10 at 12:11, pruning until 12:10 = (true, <nil>), want (false, ErrNoncePruned)` | yes, passes |

Controller ruling R15 (review r3, finding 3: database/sql can discard the connection and open a fresh one, so the exclusive lock lapses while the Store lives on).
- `Open` pins one `*sql.Conn` (`db.Conn`), which takes the exclusive lock at Open's first write. Migrate, clock restore, `Tx` (and through it `Checkpoint`, `Remember`, alert marking and Close's checkpoint) all run on that Conn, one transaction at a time.
- When a `Tx` fails, the Store checks whether the Conn is gone: the error is `driver.ErrBadConn` or `sql.ErrConnDone`, or a ping on the Conn fails. If it is gone, the Store is marked lost for good: this and every later call returns `ErrStoreLost`, and nothing reconnects.
- `Close` of a lost Store skips the checkpoint and only releases. Recovery is `Close` and a fresh `Open`.
- `TestStoreLostConnectionFailsStore`:
  - It discards the pinned connection (`Conn.Raw` returning `driver.ErrBadConn`, as database/sql does with a bad connection).
  - A second Store then opens, which proves the lock lapsed, and closes, writing its checkpoint.
  - The original Store's `Tx`, `Checkpoint` and `Remember` all return `ErrStoreLost`, and the second Store's checkpoint is unchanged.
- RED: with the names only and `Tx` still on the pool, the run hung, because the pinned Conn holds the pool's one slot. That is a deadlock, not an assertion; the mutation below is the assertion evidence. GREEN: `go test ./internal/hostedctl -count=1` ok.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| R15 continue on a new connection (on a lost Conn: `s.conn, _ = s.db.Conn(ctx); return s.runTx(ctx, fn)`) | `go test ./internal/hostedctl -run '^TestStoreLostConnectionFailsStore$' -count=1` | `store_test.go:379: Tx on the Store whose connection was discarded = <nil>, want ErrStoreLost` | yes, passes |

## Task 10

Launch intents and replay: `internal/hostedctl/{launch.go,audit.go,states.go,launch_test.go}`, plus `Config.Egress` and the in-memory audit result on `Controller` (controller.go). No schema change.

- RED (stub with the names only): every new test failed on its assertion, for example `launch_test.go:201: Launch = not built`, `launch_test.go:495: Launch = (..., not built), want (zero view, hostedctl: hosted launches are disabled)`, `launch_test.go:637: Deadlines(0s, 8h0m0s) = (0s, 0s, 0s), want (8h0m0s, 7h15m0s, 7h50m0s)`.
- GREEN: `go test ./internal/hostedctl -run 'TestLaunch|TestConcurrentLaunch|TestCrashBetween|TestThrottle|TestDeadlines' -count=1` ok 1.2 s; whole package `go test ./internal/hostedctl -count=1` ok 3.3 s on a5050ff9; the new tests once under `-race`: ok.
- Mutations ran first with `-overlay` mapping Task 9's files to HEAD 94122cdc while its follow-up was mid-edit, then again with no overlay on a5050ff9 (the pinned connection): same outcomes and the same failure lines. Every command below is `go test ./internal/hostedctl -run '<test>' -count=1`; every row was restored and its test passed again.

| Mutation | Test | Observed failure | Restored |
| --- | --- | --- | --- |
| M1 save the intent after the provider call | `^TestLaunchSavesIntentBeforeProvider$` | `launch_test.go:211: the provider was called before the launch intent was saved` | yes, passes |
| M2 skip the image check in Launch (`if false && !c.cfg.Images[q.Image]`) | `^TestLaunchRefusals$` | `launch_test.go:498: Launch = ({... State:starting VMRef:vm-0001 ...}, <nil>), want (zero view, hostedctl: image is not in the allowlist)` | yes, passes |
| M3 skip the Replaces check (`if false && q.Replaces != ""`) | `^TestLaunchRefusals$` | `launch_test.go:498: Launch = ({... State:starting VMRef:vm-0002 ...}, <nil>), want (zero view, hostedctl: replaced attempt is not proven stopped)` (3 rows) | yes, passes |
| M4 replay without re-checking the gates (abandon check and `creatable` both skipped) | `^TestThrottleThenRefusal$` | `launch_test.go:590: provider launches = 2, want 1: a failed gate calls nothing` (every row) | yes, passes |
| L1 Launch: flag gate dropped | `^TestLaunchRefusals$` | `launch_test.go:498: Launch = ({... State:starting ...}, <nil>), want (zero view, hostedctl: hosted launches are disabled)` | yes, passes |
| L2 Launch: role gate dropped | `^TestLaunchRefusals$` | `launch_test.go:498: Launch = ({... State:starting ...}, <nil>), want (zero view, hostedctl: this key may not do that)` (operator role and no key ID) | yes, passes |
| L3 Launch: audit gate dropped at the call site | `^TestLaunchRefusals$` | `launch_test.go:498: ... want (zero view, hostedctl: no passing network audit in the last 5 minutes)` (no audit, stale, failing, call fails) | yes, passes |
| L4 stale audit accepted (`age > AuditMaxAge && false`, shared) | `^(TestLaunchRefusals\|TestThrottleThenRefusal)$` | `launch_test.go:498: ... want (zero view, hostedctl: no passing network audit ...)` and `launch_test.go:590: provider launches = 2, want 1` | yes, passes |
| L4b audit age boundary `>=` | `^TestLaunchRefusals$` | `launch_test.go:493: Launch = (..., hostedctl: no passing network audit in the last 5 minutes: the last pass is 5m0s old), want it started` | yes, passes |
| L5 failing audit accepted (`false && !s.passed`, shared) | `^(TestLaunchRefusals\|TestThrottleThenRefusal)$` | `launch_test.go:498: ... want (zero view, hostedctl: no passing network audit ...)` and `launch_test.go:590: provider launches = 2, want 1` | yes, passes |
| L5b `!s.ran` dropped | `^TestLaunchRefusals$` | survives: equivalent, an audit that never ran also has `passed` false, so the next check refuses; only the message changes | n/a |
| L6 Replaces: stop proof not required | `^TestLaunchRefusals$` | `launch_test.go:498: Launch = ({... VMRef:vm-0002 ...}, <nil>), want (zero view, hostedctl: replaced attempt is not proven stopped)` | yes, passes |
| L6b Replaces: owner not checked (`if !found {`) | `^TestLaunchRefusals$` | same line, row "replaced attempt of another key" | yes, passes |
| L7 instance code not checked | `^TestLaunchRefusals$` | `launch_test.go:498: Launch = ({... State:starting ...}, <nil>), want (zero view, isolatedjob: invalid request)` (empty and non-ASCII) | yes, passes |
| L8 lifetime margin not checked | `^TestLaunchRefusals$` | `launch_test.go:498: Launch = ({... DeadlineIn:10m0s DrainIn:0s StopIn:0s}, <nil>), want (zero view, isolatedjob: invalid request)` | yes, passes |
| R1 Replay: flag gate dropped | `^TestThrottleThenRefusal$` | `launch_test.go:590: provider launches = 2, want 1: a failed gate calls nothing` | yes, passes |
| R2 Replay: image gate dropped | `^TestThrottleThenRefusal$` | same line, row "image removed" | yes, passes |
| R3 Replay: audit gate dropped at the call site (`return nil`) | `^TestThrottleThenRefusal$` | same line, rows "stale audit" and "failing audit" | yes, passes |
| R4 Replay: stop request ignored | `^TestThrottleThenRefusal$` | same line, row "stop requested" | yes, passes |
| R5 Replay: stop time ignored | `^TestThrottleThenRefusal$` | same line, row "stop time passed" | yes, passes |
| R5b Replay: stop time boundary `>` | `^TestThrottleThenRefusal$` | same line, row "stop time passed" (exactly at `stop_t`) | yes, passes |
| R6 Replay lists abandoned intents too | `^TestThrottleThenRefusal$` | survives alone: `replayOne` re-reads the row and skips anything not waiting | n/a |
| R6c R6 plus the re-read skip dropped | `^TestThrottleThenRefusal$` | `launch_test.go:604: Replay after abandoning = hostedctl: abandon att-1: 0 rows (<nil>)` | yes, passes |
| X1 a repeat of a saved intent calls the provider | `^TestConcurrentLaunchSameAttempt$` | `launch_test.go:352: Launch 0 = hostedctl: launch att-1: isolatedjob: conflict: attempt att-1 was launched with a different spec` | yes, passes |
| X2 replay sends a changed spec (bootstrap plus one byte) | `^TestCrashBetweenLaunchAndSave$` | `launch_test.go:401: Replay = hostedctl: launch att-1: isolatedjob: conflict: attempt att-1 was launched with a different spec` | yes, passes |
| X3 a throttle returned as an error | `^TestThrottleWaitsThenReplays$` | `launch_test.go:522: throttled Launch = (zero view, hostedctl: launch att-1: isolatedjob: throttled: fake launch), want a waiting view with a launch ID and no error` | yes, passes |
| X4 request hash ignores the key | `^TestLaunchConflictOnChangedRequest$` | `launch_test.go:312: changed Launch = ({... State:starting ...}, <nil>), want (zero view, ErrConflict)` | yes, passes |

### Task 10 fix round 1

Review r1 findings 1, 2, 4 and 5 fixed; finding 3 settled by ruling R16 (limits kept, documented in `checkRequest` as controller policy).
- Provider errors are classified (`providerError`): the matching isolatedjob sentinel (or context error) is kept for `errors.Is`, otherwise `ErrProviderLaunch`; the provider's text is dropped from returned errors on both paths, the throttle branch included.
- One `dispatch` serves Launch and Replay: it re-reads the intent in its own transaction (stop asked for, `stop_t`), then checks flag, image and audit freshness immediately before the provider call. A transient failure after transaction 1 leaves the intent waiting; Launch returns the waiting view, nil, and a `launch_deferred` audit row.
- The launch ID, bootstrap and spec are built inside transaction 1, only for a new attempt; validation uses a placeholder ID of the real length.
- The probe in `TestLaunchSavesIntentBeforeProvider` reads the store from a helper goroutine, marks the call blocked after 2 s and returns so the caller unwinds, then joins the helper. `TestConcurrentLaunchSameAttempt` now holds the first provider call until the other 19 calls have returned.
- New tests: `TestLaunchRechecksGatesBeforeDispatch` (transaction admission held, the audit goes stale while the launch waits; zero provider calls, intent waiting), `TestLaunchProviderTextNeverReturned` (invalid, conflict, unclassified, throttle; Launch and Replay).
- GREEN: the brief's command ok 1.1 s; `go test ./internal/hostedctl -count=1` ok 3.5 s (with Task 11's work in progress in the tree) and 2.6 s over HEAD; the new tests under `-race` ok.
- Mutations ran with `-overlay` mapping Task 11's in-flight files to HEAD and hiding its new files, so they test this code alone. Every row below was restored and passed again. Round 0 rows were re-run on the new code: all fail as before except X2, which no longer applies because Launch now also sends the decoded saved spec, so a decode change alters both calls alike; X2b replaces it.

| Mutation | Test | Observed failure | Restored |
| --- | --- | --- | --- |
| F1 provider text kept in the returned error | `^TestLaunchProviderTextNeverReturned$` | `launch_test.go:658: Launch error "hostedctl: launch att-1: ValidationException: RunHookPayload {...\"instance_code\":\"code-SECRET-4f2a9c\"} rejected: isolatedjob: invalid request" carries the provider's text and the instance code` (also conflict, unclassified) | yes, passes |
| F2 no gate recheck before a Launch dispatch (`replay && gate != nil`) | `^TestLaunchRechecksGatesBeforeDispatch$` | `launch_test.go:576: provider launches = 1, want 0: the audit went stale before dispatch` | yes, passes |
| F4 provider call inside the intent transaction | `^TestLaunchSavesIntentBeforeProvider$` | `launch_test.go:264: provider call 0: a store read waited 2 s; a transaction is held across the provider call` | yes, passes |
| F4b provider call inside the dispatch transaction | `^TestLaunchSavesIntentBeforeProvider$` | same line | yes, passes |
| M1 provider called before the intent is saved | `^TestLaunchSavesIntentBeforeProvider$` | `launch_test.go:270: provider call 0: the provider was called before the launch intent was saved` | yes, passes |
| M4 replay without re-checking the gates (`!replay &&` on both checks) | `^TestThrottleThenRefusal$` | `launch_test.go:837: provider launches = 2, want 1: a failed gate calls nothing` | yes, passes |
| L4 audit age not checked | `^(TestLaunchRefusals\|TestThrottleThenRefusal\|TestLaunchRechecksGatesBeforeDispatch)$` | `launch_test.go:576: provider launches = 1, want 0` plus `:745` and `:837` | yes, passes |
| X1 a repeat of a saved intent dispatches | `^TestConcurrentLaunchSameAttempt$` | `launch_test.go:471: view 0, returned while the provider call was held = {... State:starting VMRef:vm-0001 ...}, want waiting with no ref` | yes, passes |
| X2b replay alone sends changed bytes | `^TestCrashBetweenLaunchAndSave$` | `launch_test.go:514: Replay = hostedctl: launch att-1: provider refused: isolatedjob: conflict` | yes, passes |
| M2, M3, L1-L3, L4b, L5-L8, R1-R5b, R6c, X3, X4 | as in round 0 | each fails as before (now `launch_test.go:745`, `:740`, `:837`, `:851`, `:769`, `:379`); M2, L1 and L3 now end with the intent deferred as `waiting` by the dispatch gates, L8 as `abandoned` | yes, passes |

## Task 11

Get, Stop with stop proof, unknown states and Refresh with restart reconciliation: `internal/hostedctl/{stop.go,refresh.go,stop_test.go}`. Shared files, additive only: `states.go` (JobRunning, JobSuspending, JobSuspended, JobStopping, JobStopped), `store.go` (`(*Store) OpenedAt() T`), `controller.go` (one field, `rebased rebasedSet`). No schema change.

- RED (stub with the names only): every new test failed on its assertion, for example `stop_test.go:158: Stop of a running VM = not built, want ErrStopPending (it is only stopping)`, `stop_test.go:436: Stop by another instance = not built, want ErrForbidden`, `stop_test.go:526: Refresh = not built`.
- GREEN: `go test ./internal/hostedctl -run 'TestStop|TestUnknownState|TestLostStop|TestRestart' -count=1` ok 1.5 s; whole package `go test ./internal/hostedctl -count=1` ok 3.4 s on f506a22a; the new tests once under `-race`: ok.
- Ruling R1: `TestRestartDowntimeExceedsWallDelta` asserts the job halves only; the orphan-grace clause lands with Task 13.
- Every command below is `go test ./internal/hostedctl -run '<test>' -count=1`; every row was restored and its test passed again.

| Mutation | Test | Observed failure | Restored |
| --- | --- | --- | --- |
| M1 accept `stopping` as proof (Stop) | `^TestStopProofNeedsTerminalState$` | `stop_test.go:186: Stop while the VM is stopping = <nil>, want ErrStopPending` | yes, passes |
| M2a accept `unknown` as proof (Stop) | `^TestUnknownStateIsNeverProof$` | `stop_test.go:238: Stop with the provider state unknown = <nil>, want ErrStateUnknown` | yes, passes |
| M2b accept `unknown` as proof (Refresh) | `^TestUnknownStateIsNeverProof$` | `stop_test.go:253: Refresh with an unknown state: state "stopped" (was "starting"), proof {... "state":"unknown" ...}; want it left alone` | yes, passes |
| M3 `max` instead of `min` when re-basing | `^TestRestartUsesProviderAge$` | `stop_test.go:531: after Refresh: launched 60000000000 deadline 7260000000000 ...; want -2340000000000 4860000000000 ...` (wall back) and `launched 16260000000000 ...; want 60000000000 ...` (wall ahead) | yes, passes |
| M4 `stop_t` not recomputed | `^TestRestartUsesProviderAge$` | `stop_test.go:531: after Refresh: launched -2340000000000 deadline 4860000000000 drain 2160000000000 stop 6660000000000; want ... stop 4260000000000` | yes, passes |
| M5 trust the wall delta for a job without age (mark settled, no stop) | `^TestRestartDowntimeExceedsWallDelta$` | `stop_test.go:592: att-1 with no age: requested {0 false} reason { false}; want stopped with elapsed_unknown` | yes, passes |
| M6 keep jobs whose elapsed time is unknown (`stopElapsedUnknown` returns at once) | `^TestRestartStopsWhenElapsedUnknown$` | `stop_test.go:619: att-1 after Refresh: requested {0 false} reason { false} state "starting"; want a stop for elapsed_unknown, stopping` | yes, passes |
| M7 creator check dropped (Stop) | `^TestStopRoles$` | `stop_test.go:437: Stop by another instance = hostedctl: stop asked for; ... VM vm-0001 is stopping, want ErrForbidden` | yes, passes |
| M7b creator check dropped (Get) | `^TestStopRoles$` | `stop_test.go:454: Get by another instance = <nil>, want ErrForbidden` | yes, passes |
| M8 role check dropped (Stop) | `^TestStopRoles$` | `stop_test.go:437: Stop by an operator key with the creator's id = ... VM vm-0001 is stopping, want ErrForbidden` | yes, passes |
| M9 Ref-less proof ignores unlinked live VMs | `^TestStopIntentWithoutRef$` | `stop_test.go:365: proof {"attempt_id":"att-1","vm_ref":"","state":"stopped",...} while an unlinked VM is live` | yes, passes |
| M10 Ref-less proof without the 2-minute wait | `^TestStopIntentWithoutRef$` | `stop_test.go:411: proof {... "observed_at_ns":119999999999} from a list started under 2 minutes after the request` | yes, passes |
| M10b 2-minute wait measured from the list's end | `^TestStopIntentWithoutRef$` | same line as M10 | yes, passes |
| M11 Ref-less proof from an incomplete list | `^TestStopIntentWithoutRef$` | `stop_test.go:381: proof {...} from an incomplete list` | yes, passes |
| M12 Ref-less check counts only live (not unknown) VMs | `^TestStopIntentWithoutRef$` | unreachable: the fake's List never reports `unknown` (FaultUnknownState is Get-only), so no test can tell the two checks apart; the code keeps the stricter non-terminal check | n/a |
| M13 re-base not once per process | `^TestRestartStopsWhenElapsedUnknown$` | `stop_test.go:633: provider stops = [vm-0001 vm-0001 vm-0002], want only vm-0001` | yes, passes |
| M14 pre-restart boundary `<` OpenedAt | `^TestRestartJobAtOpenTime$` | `stop_test.go:668: job launched at OpenedAt with no age: reason { false}, want elapsed_unknown` | yes, passes |
| M15 Refresh does not send the stop again | `^TestLostStopReplyRetries$` | `stop_test.go:306: provider stops after Refresh = [vm-0001], want a second one` | yes, passes |
| M16 gone VM is not proof | `^TestStopOfGoneVMSucceeds$` | `stop_test.go:331: Stop of a VM the provider no longer holds = (..., hostedctl: read VM vm-0001 of att-1 after stop: isolatedjob: not found: vm-0001), want {... State:stopped ...}` | yes, passes |
| M17 a VM that ended while down gets no reason `ended` | `^TestRestartFindsVMGone$` | `stop_test.go:496: att-a after Refresh: state "stopped" reason { false} requested {0 false}; want stopped, ended, no request` | yes, passes |
| M18 Stop does not abandon a waiting intent | `^TestStopIntentWithoutRef$` | `stop_test.go:354: after Stop: state "waiting" requested {60000000000 true} proof { false}; want abandoned at 60000000000, no proof` | yes, passes |
| M19 saving proof rewrites `stop_t` | `^TestStopProofNeedsTerminalState$` | `stop_test.go:211: after proof: state "stopped" reason {task done true} stop_t 0 ...; want ... times 6600000000000 7200000000000 unchanged` | yes, passes |

### Task 11, controller ruling R17: confirm a missing VM twice

GetMicrovm is eventually consistent, so one not-found is no longer proof. New nullable column `jobs.notfound_since_t` in `schema/0001_jobs.sql` (nothing released). `NotFoundConfirm = 60 * time.Second` (stop.go; equals Task 13's ReapInterval). Stop and Refresh share `notFound`: a not-found proves the VM gone only when `notfound_since_t` holds an earlier not-found that came after the stop request (if any) and is at least NotFoundConfirm before this Get began; otherwise the first not-found is recorded (audit `vm_not_found`) and the result is ErrStopPending. Any live Get clears it (`mirrorState`). A terminal state is still proof at once. The Ref-less path uses List, never a Get not-found, so it is unchanged. The M16 row above is superseded by N1 to N6; line numbers in the rows above are as of 9202c3d2.

- RED (constant only, old behaviour): `stop_test.go:332: Stop on the first not-found = <nil>, want ErrStopPending`, `stop_test.go:388: after one not-found: proof {...} notfound_since_t {0 false}; want no proof and a since time`, `stop_test.go:578: att-a after one not-found: proof {...}; want no proof yet`.
- GREEN: `go test ./internal/hostedctl -run 'TestStop|TestUnknownState|TestLostStop|TestRestart' -count=1` ok 3.0 s; whole package ok 3.7 s; the new tests once under `-race`: ok.

| Mutation | Test | Observed failure | Restored |
| --- | --- | --- | --- |
| N1 accept a single not-found | `^TestStopNotFoundThenRunning$` | `stop_test.go:388: after one not-found: proof {{"attempt_id":"att-1",...,"state":"stopped",...} true} notfound_since_t {0 false}; want no proof and a since time` | yes, passes |
| N1b same mutation | `^(TestStopOfGoneVMSucceeds\|TestRestartFindsVMGone)$` | `stop_test.go:332: Stop on the first not-found = <nil>, want ErrStopPending` and `stop_test.go:578: att-a after one not-found: proof {...}; want no proof yet` | yes, passes |
| N2 a live Get does not clear `notfound_since_t` | `^TestStopNotFoundThenRunning$` | `stop_test.go:393: after a running Get: state "running" proof { false} notfound_since_t {0 true}; want running, no proof, since cleared` | yes, passes |
| N3 a not-found from before the stop request counts | `^TestStopNotFoundThenRunning$` | `stop_test.go:414: Stop on a not-found with the earlier one before the request = <nil>, want ErrStopPending` | yes, passes |
| N4 boundary `>` NotFoundConfirm | `^TestStopOfGoneVMSucceeds$` | `stop_test.go:353: Stop on a not-found 1m0s after the first = (..., ... VM vm-0001 not found once; proof needs a second not-found 1m0s later), want {... State:stopped ObservedAt:120000000000}` | yes, passes |
| N5 gap measured to the second Get's end | `^TestStopOfGoneVMSucceeds$` | `stop_test.go:342: Stop on a second not-found under 1m0s later = <nil>, want ErrStopPending` | yes, passes |
| N6 every not-found restarts the wait | `^TestStopOfGoneVMSucceeds$` | `stop_test.go:345: notfound_since_t moved to 119999999999 on a second not-found, want 60000000000 kept` | yes, passes |

### Task 11 fix round 1 (review r1, rulings R18 to R20)

Changes: `attemptlock.go` (new: `func (c *Controller) lockAttempt(id string) func()`, reference-counted per-attempt mutexes; Controller field `attempts`). The lock is held by Launch's and Replay's `dispatch` (launch.go, one line), by Stop after its refusals, by Refresh's per-job reconcile and re-base, and by each Ref-less proof write; never taken inside a store transaction. Refresh saves a live state (clearing `notfound_since_t`) before any restart handling. New nullable `jobs.last_dispatch_t` (schema/0001_jobs.sql), written by `markDispatch` in its own transaction right before every provider Launch call (launch.go, three lines). Ref-less proof needs a complete List begun ReflessProofDelay after max(stop request, last dispatch, OpenedAt); a not-found pair counts only when the first is after OpenedAt (strictly) after a restart. R20: a pre-restart job whose Get fails is retried; on the RestartGetTries (3rd) failed pass in a row it is stopped as elapsed_unknown (stop request saved first), the Get error still returned. Finding 8 (stop reason limit) deferred, as ruled.

- Order note: in this round the code and the new tests were written together; each test's guard is shown by a mutation that removes the fix (rows below), not by a separate RED run.
- Task 12's uncommitted files (pause.go, pause_test.go, resume.go, resume_test.go) did not compile while this ran. Every run below used `go test -overlay` mapping them to an empty `package hostedctl` file.
- GREEN: `go test ./internal/hostedctl -run 'TestStop|TestUnknownState|TestLostStop|TestRestart' -count=1` ok; whole package ok 7.5 s (load average 7 to 10); the targeted tests under `-race`: ok.
- Corrected evidence for M10b, N5 and M12 (review finding 6): the earlier rows used different mutations (`at+1`) or no reaching test. The exact mutations now fail against tests whose wrappers move the clock during Get and List and list an unlinked VM in an unknown state (rows below); M12 is no longer unreachable.

| Mutation | Test | Observed failure | Restored |
| --- | --- | --- | --- |
| F1 Stop without the attempt lock | `^TestStopWaitsForDispatch$` | `refresh_test.go:167: Stop returned (... att-1 has no VM ref yet ...) while the launch call was in flight; it must wait for the answer` (both subtests) | yes, passes |
| F2 dispatch without the attempt lock | `^TestStopWaitsForDispatch$` | same line, both subtests | yes, passes |
| F3a Refresh reconcile without the attempt lock | `^TestRestartOverlappingRefresh$` | `refresh_test.go:426: after two overlapping passes: re-based true, stopped true; want exactly one` | yes, passes |
| F3b same mutation | `^TestStopNotFoundRacesLiveRead$` | `refresh_test.go:349: after a not-found and a live read: state "running" notfound_since_t {0 true}; want running and no not-found held` | yes, passes |
| F4 live state saved after the restart handling (the old order) | `^TestStopNotFoundClearedBeforeRestartStop$` | `refresh_test.go:387: notfound_since_t 2000000000 kept after a live read` | yes, passes |
| F5 a pre-open not-found counts | `^TestRestartWallJump$` | `refresh_test.go:500: Stop on a not-found after the wall jump = <nil>, want ErrStopPending: the first one is from before Open` and `refresh_test.go:529` | yes, passes |
| F5b pre-open boundary `>=` OpenedAt | `^TestRestartWallJump$` | `refresh_test.go:529: Stop on a not-found paired with one saved at OpenedAt = <nil>, want ErrStopPending` | yes, passes |
| F6 Ref-less wait ignores OpenedAt | `^TestRestartWallJump$` | `refresh_test.go:544: proof {"attempt_id":"att-1","vm_ref":"","state":"stopped","observed_at_ns":601000000000} 1 s after a restart` | yes, passes |
| F7 Ref-less wait ignores the last dispatch | `^TestStopIntentWithoutRefFences$` | `refresh_test.go:254: proof {...} from a list begun 1m30s after the last dispatch` | yes, passes |
| F8 no dispatch mark | `^(TestStopWaitsForDispatch\|TestStopIntentWithoutRefFences)$` | `refresh_test.go:154: last_dispatch_t during the provider call = {0 false}, want 0` | yes, passes |
| F9 stop after the first failed Get | `^TestRestartRetriesFailedGet$` | `refresh_test.go:465: pass 1: stopped after 1 failed reads, want 3 first` | yes, passes |
| F10 never stop on failed Gets | `^TestRestartRetriesFailedGet$` | `refresh_test.go:469: pass 3: requested {0 false} reason { false}; want a stop for elapsed_unknown` | yes, passes |
| M10b exact: `at` for `start` in the Ref-less wait | `^TestStopIntentWithoutRefFences$` | `refresh_test.go:271: proof {... "observed_at_ns":130000000000} from a list begun 1m40s after the request` | yes, passes |
| N5 exact: `at` for `before` in the not-found gap | `^TestStopNotFoundSlowGet$` | `refresh_test.go:319: Stop on a not-found Get begun 55s after the first ended = <nil>, want ErrStopPending` | yes, passes |
| M12 exact: Ref-less check counts only `Live()` VMs | `^TestStopIntentWithoutRefFences$` | `refresh_test.go:289: proof {...} while the list shows an unlinked VM in an unknown state` | yes, passes |
| TX1 Stop's provider stop inside a transaction | `^TestStopRecordsRequestBeforeProvider$` | `stop_test.go:220: provider stop (call 0): a store read waited 2 s; a transaction is held across the provider call` | yes, passes |
| TX2 Stop's provider get inside a transaction | `^TestStopRecordsRequestBeforeProvider$` | `stop_test.go:220: provider get (call 1): a store read waited 2 s; ...` | yes, passes |
| TX3 Refresh's get inside a transaction | `^TestStopRecordsRequestBeforeProvider$` | `stop_test.go:252: provider get (call 2): a store read waited 2 s; ...` | yes, passes |
| TX4 Refresh's list inside a transaction | `^TestStopRecordsRequestBeforeProvider$` | `stop_test.go:252: provider list (call 3): a store read waited 2 s; ...` | yes, passes |
| N1, M1, M5 rechecked | `^TestStopNotFoundThenRunning$`, `^TestStopProofNeedsTerminalState$`, `^TestRestartDowntimeExceedsWallDelta$` | `stop_test.go:473: after one not-found: proof {...}; want no proof and a since time`; `stop_test.go:272: Stop while the VM is stopping = <nil>, want ErrStopPending`; `stop_test.go:778: att-1 with no age: requested {0 false} ...` | yes, passes |

### Task 11 fix round 2 (review r2 finding 4, ruling R21, test budget)

Changes: Refresh sends a pending stop again on every pass, whatever the restart state: on a failed Get when `stop_requested_t` is set (unless the third failed pass runs the elapsed_unknown stop itself), and on any read that is not `stopping` (live or unknown); shared helper `resendStop`. `ProviderLaunchTimeout = 60 * time.Second` (refresh.go): `dispatch` (launch.go) calls the provider Launch with `context.WithTimeout(ctx, ProviderLaunchTimeout)`, so the caller's own shorter deadline still holds. Tests: the sleeps in the concurrency tests are replaced by explicit synchronisation. `gatedGet` holds call 1 until released, and `attemptLocks.waiting` (a hook, nil in production) reports when a caller has to wait for an attempt lock. Timeouts remain only as 5 s watchdogs a healthy run never reaches. Every Task 11 test now calls `t.Parallel()`.

- GREEN: `go test ./internal/hostedctl -run 'TestStop|TestUnknownState|TestLostStop|TestRestart|TestProviderLaunchTimeout' -count=1` ok; the same under `-race` ok.
- Budget: the Task 11 tests alone take 1.4 to 1.6 s of wall time (5.35 s summed before, run one after another). The whole package took 7.4 to 15 s with the host's load average between 10 and 23. The other tests alone (Tasks 9, 10 and 12, 42 tests, not parallel) took 11.9 to 13.1 s in the same window; the slowest were TestSuspendNeedsCurrentAck 0.94 s, TestResumePastDeadlineRefused 0.65 s, TestSuspendAndResumeRoles 0.57 s, TestResumeRetrySameOperation 0.49 s and TestConcurrentLaunchSameAttempt 0.49 s.

| Mutation | Test | Observed failure | Restored |
| --- | --- | --- | --- |
| P1 a failed Get does not resend a pending stop | `^TestRestartRetriesPendingStop$` | `refresh_test.go:633: provider stops = [vm-0001], want the stop sent again` | yes, passes |
| D1 provider launch without a deadline (`WithCancel`) | `^TestProviderLaunchTimeout$` | `refresh_test.go:699: provider launch 0: deadline set true, 59m59.96706408s left; want one at most 1m0s away` | yes, passes |
| D2 timeout longer than the fence (3 min) | `^TestProviderLaunchTimeout$` | `refresh_test.go:668: ProviderLaunchTimeout = 3m0s, want 60s and under ReflessProofDelay 2m0s` | yes, passes |
| D3 deadline not derived from the caller (`context.Background()`) | `^TestProviderLaunchTimeout$` | `refresh_test.go:699: provider launch 2: deadline set true, 59.999997836s left; want one at most 5s away` | yes, passes |
| F1, F2 (recheck against the hook-based test) | `^TestStopWaitsForDispatch$` | `refresh_test.go:200: Stop returned (... att-1 has no VM ref yet ...) while the launch call was in flight; it must wait for the answer` (both subtests, each) | yes, passes |
| F3a, F3b (recheck against `overlap`) | `^TestRestartOverlappingRefresh$`, `^TestStopNotFoundRacesLiveRead$` | `refresh_test.go:468: after two overlapping passes: re-based true, stopped true; want exactly one`; `refresh_test.go:389: after a not-found and a live read: state "running" notfound_since_t {0 true}; ...` | yes, passes |
| F10 (recheck) | `^TestRestartRetriesFailedGet$` | `refresh_test.go:512: pass 3: requested {0 false} reason { false}; want a stop for elapsed_unknown` | yes, passes |

## Task 12

Pause generations (Drain, Quiescent, Suspend, Reopen) and prepared resume epochs (Resume) in
`internal/hostedctl/pause.go` and `resume.go`; tests in `pause_test.go` and `resume_test.go`. All five
methods take the verified key, as Stop does, for the instance-role check, and run under the attempt
lock (R18). Refresh's one change: refreshOne calls `mirrorLive` in place of `mirrorState`, which
leaves `draining`, `suspending` and `resuming` to the controller, settles only the expected moves,
and still clears `notfound_since_t` on every live sighting. States `JobDraining` and `JobResuming`
added to states.go. No schema change.

- RED (compile-only stubs returning an error): all 13 tests fail on their first assertion, e.g.
  `pause_test.go:91: Drain = (0, stub), want a new generation`.
- GREEN: `go test ./internal/hostedctl -run 'TestSuspend|TestLateAck|TestResume' -count=1` ok 3.5 s;
  whole package ok 13.3 s at load average 5 to 7 (10.1 s with the Task 12 tests skipped); vet,
  gofmt, staticcheck v0.7.0 clean; `make budget` (size) within budget.

| Mutation | Test | Observed failure | Restored |
| --- | --- | --- | --- |
| M1 generations compared with `>=` | `^TestSuspendNeedsCurrentAck$` | `pause_test.go:118: Suspend(2) with current generation 1 = hostedctl: record suspend of att-1: 0 rows (<nil>), want hostedctl: pause generation is cancelled or not the current one` | yes, passes |
| M2 provider called before preparing | `^TestResumePreparesEpochBeforeProvider$` | `resume_test.go:161: store at the provider call: {state:suspended epoch:0 status:{String: Valid:false} prep:{Int64:0 Valid:false} err:<nil>}; want resuming at epoch 0 with op-1 pending at epoch 1` | yes, passes |
| M3 epoch raised on each call (a done operation re-prepared and committed again) | `^TestResumeRetrySameOperation$` | `resume_test.go:255: Resume(op-1) = (2, <nil>), want (1, nil)` | yes, passes |
| M4 commit without Get showing running | `^TestResumeLostReply$` | `resume_test.go:229: retry while the VM is suspended = (1, <nil>), want (0, ErrResumePending)` | yes, passes |
| M5 only the latest operation looked up | `^TestResumeOperationsRemembered$` | `resume_test.go:282: Resume(op-a) = (0, isolatedjob: conflict: only a suspended job can resume; att-1 is running), want (1, nil)` | yes, passes |
| M6 creator check dropped | `^TestSuspendAndResumeRoles$` | `pause_test.go:252: reopen_refused by another instance = <nil>, want ErrForbidden` | yes, passes |
| M7 no lazy cancellation | `^TestLateAckIgnored$` | `pause_test.go:150: Quiescent at 2m1s = <nil>, want ErrGenerationCancelled` | yes, passes |
| M8 no ErrPastDeadline check | `^TestResumePastDeadlineRefused$` | `resume_test.go:317: Resume at the stop time = hostedctl: a resume is pending; ...: VM vm-0001 is suspended, want ErrPastDeadline` | yes, passes |
| M9 Refresh hook bypassed (plain mirrorState) | `^TestSuspendRefreshSettles$` | `pause_test.go:276: Refresh of a draining job with a running VM left "running", not-found since {0 false}; want draining, cleared` | yes, passes |
| M10 hook leaves `notfound_since_t` for pause states | `^TestSuspendRefreshSettles$` | `pause_test.go:276: Refresh of a draining job with a running VM left "draining", not-found since {1 true}; want draining, cleared` | yes, passes |
| M11 a failed resume re-send fails Refresh | `^TestSuspendRefreshSettles$` | `pause_test.go:310: Refresh = isolatedjob: throttled: fake resume` | yes, passes |

### Task 12 fix round 1 (review r1)

1. Every live VM read by Resume clears `notfound_since_t` (finishResume, commitResume), the
   controller state untouched, so a stale not-found never pairs with a later one into stop proof.
2. Resume recovery respects the stop time. Resume's prepare fails a pending operation once the stop
   time has come; driveResume checks the time again before the provider call and finishResume
   before the commit; the Refresh hook fails a pending operation past the stop time (the job takes
   the VM's state, no provider call, no commit) and skips a suspend re-send. Reopen past the stop
   time is ErrPastDeadline. A pre-restart job whose times Refresh has not yet re-based
   (`ageUnsettled`, refreshOne's untrusted test) gets no recovery from the hook on that pass, and
   Resume answers ErrResumePending for it. Done operations still return their epoch.
3. `writeProof` (stop.go) fails a pending resume in the transaction that saves the proof (one call
   to `failPendingResume`), so Refresh's terminal and confirmed not-found proof, Stop's proof and
   Ref-less proof all settle it. refresh.go is unchanged from HEAD in this round.
4. Every Task 12 test runs with `t.Parallel()`.

- GREEN: `go test ./internal/hostedctl -run 'TestSuspend|TestLateAck|TestResume' -count=1` ok 3.7 s;
  whole package `-v` ok 3.9 s at load average 5 to 8 (slowest Task 12 test
  TestResumePastDeadlineRefused 0.54 s); vet, gofmt, staticcheck v0.7.0 clean; `make budget` within.
- All of M1 to M11 rechecked against the new code: each still fails on its assertion (M8 now trips
  at `resume_test.go:337`, where the dispatch-time recheck fails the operation instead) and passes
  restored.

| Mutation | Test | Observed failure | Restored |
| --- | --- | --- | --- |
| F1 Resume's live read keeps the not-found | `^TestResumeLiveReadClearsNotFound$` | `resume_test.go:457: after a live read: not-found since {0 true}, state "resuming"; want cleared, resuming` | yes, passes |
| F2a Refresh hook ignores the stop time | `^TestResumeRefreshPastDeadline$` | `resume_test.go:386: job "resuming" at epoch 0, ops [{op-1 pending ...}], 1 provider resumes; want "suspended" at 0, [{op-1 failed ...}], 1` | yes, passes |
| F2b Refresh recovers before the restart re-base | `^TestResumeRestartRebasesFirst$` | `resume_test.go:412: job "running" at epoch 1, ops [{op-1 done ... 1}], 1 provider resumes; want "resuming" at 0, [{op-1 pending ...}], 1` | yes, passes |
| F2c commit without the stop-time recheck | `^TestResumeDeadlineDuringProviderCall$` | `resume_test.go:431: Resume whose provider call crossed the stop time = (1, <nil>), want (0, ErrPastDeadline)` | yes, passes |
| F2d Resume does not wait for the re-base | `^TestResumeCrashAfterProvider$` | `resume_test.go:213: Resume before the first refresh after a restart = <nil>, want ErrResumePending` | yes, passes |
| F2e Reopen past the stop time | `^TestResumePastDeadlineRefused$` | `resume_test.go:368: Reopen at the stop time = <nil>, want ErrPastDeadline` | yes, passes |
| F2f a pending operation past the stop time left pending | `^TestResumePastDeadlineRefused$` | `resume_test.go:356: job "resuming" at epoch 0, ops [{op-1 pending ...}] ...; want ... [{op-1 failed ...}], 1` | yes, passes |
| F3 proof leaves a pending resume (writeProof's call removed) | `^TestResumeFailedByProof$` | all three subtests (ends on its own, gone confirmed, instance stops it): `resume_test.go:517: job "stopped" at epoch 0, ops [{op-1 pending ...}] ...; want "stopped" at 0, [{op-1 failed ...}], 1` | yes, passes |

## Task 13

The reaper pass and loop in `internal/hostedctl/reaper.go`, tests in `reaper_test.go`. `Reap(ctx)
(ReapReport, error)`, `Loop(ctx, every) error`, `LastReap() (ReapResult, bool)`, `ReapInterval`,
`OrphanGrace`, `UnknownAlertPasses = 3`, alert kinds `orphan_stopped`, `unknown_state`,
`audit_failed`. A pass, one at a time: checkpoint; Replay; Refresh; recorded jobs by saved Ref
(drain mark, deadline stop with reason `deadline`, unknown count and alert); orphans on a complete
List only (`unmatched_vms`, 10 min grace in controller time, expired at once for sightings before a
restart, then a recheck: audit if none fresh, Replay, List, re-read saved Refs, stop with reason
`orphan`, no proof); the network audit (one alert per failing run). Alerts are queued and delivered
at the end of the pass; one the Alerter refuses stays queued and its error joins the pass error.

Shared-file edits: `schema/0001_jobs.sql` adds nullable `jobs.drain_marked_t` (rulings);
`controller.go` adds the `reap reapState` field; `refresh.go` adds one line in `refreshOne` after
the Get (`c.reap.observeGet`) so the reaper counts unknown reads without a second Get;
`stop_test.go` extends `TestRestartDowntimeExceedsWallDelta` with the orphan clause (R1): an orphan
seen just before the exit is stopped on the first pass after it. Its wall move is now 5 min (was 10
min) so the controller time since the sighting stays under the grace.

- RED (compile-only stubs): all 14 tests fail, e.g. `reaper_test.go:165: Reap = (..., stub)`,
  `reaper_test.go:546: pass 0: audit_failed alerts [], want one`, `stop_test.go:765: Reap = (..., stub)`.
- GREEN: `go test ./internal/hostedctl -run 'TestReap|TestOrphanGrace|TestUnknownStateRetried|TestFailingAudit' -count=1`
  ok 0.47 s (that pattern misses `TestIncompleteListSkipsOrphansOnly` and
  `TestDeadlineEnforcedDuringIncompleteLists`; with them and `TestRestartDowntimeExceedsWallDelta`
  ok 0.74 s, and ok under `-race`); whole package `-v` ok 3.25 s, 83 tests, load average 3 to 6;
  vet, gofmt, staticcheck v0.7.0 clean; `make budget` within; dead-reference scan 0 failures.
- Mutations ran with `go test -overlay` over mutated copies under `$TMPDIR`; the tree was never
  edited, so "restored" is the unmutated run passing.

| Mutation | Test | Observed failure | Restored |
| --- | --- | --- | --- |
| M1 orphans processed from an incomplete List | `^TestIncompleteListSkipsOrphansOnly$` | `reaper_test.go:304: pass with an incomplete list: report {Skipped:false ... OrphansSeen:1 OrphansStopped:1 ...}, want orphans skipped` | yes, passes |
| M2 deadline stops skipped on an incomplete List | `^TestDeadlineEnforcedDuringIncompleteLists$` | `reaper_test.go:348: at the stop time: report {Skipped:true ... Stopped:0 ...} requested {0 false} reason { false}; want a deadline stop` | yes, passes |
| M3 recheck dropped (stop without the fresh List and table read) | `^TestReapRechecksOwnership$` | `reaper_test.go:237: pass at 10 min: report {... Replayed:1 ... OrphansSeen:2 OrphansStopped:2 ...}, want one orphan stopped and one replayed` | yes, passes |
| M3b whole recheck dropped (no replay, List or table read) | `^TestReapRechecksOwnership$` | `reaper_test.go:237: pass at 10 min: report {... Replayed:0 ... OrphansStopped:2 ...}, want one orphan stopped and one replayed` | yes, passes |
| M4 wall time for the grace | `^TestReaperUnderRollback$` | `reaper_test.go:434: at 10 min of elapsed time, wall clock 2 h back: report {... OrphansSeen:1 OrphansStopped:0 ...}, want the orphan stopped` | yes, passes |
| M5 no restart clause in the grace | `^(TestOrphanGraceExpiresAfterRestart\|TestRestartDowntimeExceedsWallDelta)$` | `reaper_test.go:469: first pass after the restart: report {... OrphansSeen:2 OrphansStopped:0 ...}, want one orphan stopped and one replayed`; `stop_test.go:805: first reaper pass after the restart: report {... OrphansStopped:0 ...}, want the orphan stopped` | yes, passes |
| M6 abandoned intents' VMs not reaped (no expiry while a Ref-less job is unproven) | `^TestReapStopsAbandonedIntentVM$` | `reaper_test.go:269: at 10 min: report {... OrphansSeen:1 OrphansStopped:0 ...}, want the abandoned intent's VM stopped` | yes, passes |
| M7 audit_failed alerted every pass | `^TestFailingAuditBlocksLaunchAndAlertsOnce$` | `reaper_test.go:546: pass 1: audit_failed alerts [{Kind:audit_failed ...} {Kind:audit_failed ...}], want one` | yes, passes |
| M8 no stop re-sent on an unknown read (refreshOne) | `^TestUnknownStateRetriedAndAlerted$` | `reaper_test.go:521: pass 1: provider stops [vm-0001], want 2, all to vm-0001` | yes, passes |
| M9 unknown_state alerted every pass | `^TestUnknownStateRetriedAndAlerted$` | `reaper_test.go:524: pass 4: unknown_state alerts [... 4 alerts ...], want 2` | yes, passes |
| M10 orphans before the replay | `^TestReapReplaysIntentFirst$` | `reaper_test.go:152: report {... Replayed:1 ... OrphansSeen:1 ...}, want one replayed and no orphans` | yes, passes |
| M11 recheck without running a missing audit | `^TestOrphanGraceExpiresAfterRestart$` | `reaper_test.go:469: first pass after the restart: report {... Replayed:0 ... OrphansStopped:2 ...}, want one orphan stopped and one replayed` | yes, passes |

### Task 13 fix round 1 (review r1, rulings R22, R23)

1. R22: the orphan final check counts waiting (not abandoned) Ref-less intents with
   `last_dispatch_t` set; while any exist, every expired candidate is deferred, not stopped
   (`ReapReport.OrphansDeferred`, audit `orphan_deferred` once per candidate per run of
   deferrals). Abandoned intents never defer.
2. R23: `ownershipLock` (an RWMutex in reaper.go, field `Controller.ownership`). `dispatch`
   (launch.go, two lines) holds it for reading from just before `markDispatch` to the settled
   answer; `finalOrphanCheck` holds it for writing from its fresh List through the last provider
   Stop. Order: attempt lock, then ownership; the orphan path takes no attempt lock; never inside a
   Tx. A test-only `waiting` hook reports a dispatch that has to wait.
3. Every reaper audit (the recheck's and step 6) goes through `reaperAudit`: one run of failures
   across both, the recheck's error joins the pass error.
4. New guards: a stale live List entry for a proven job; the final check's own List; an incomplete
   final-check List; the R22 deferral; the ownership lock; audit runs across both audit points.

- New tests: `TestReapDefersOrphansWhileIntentWaits` (8 subtests: throttled, launches off, image
  removed, audit failing; each ended by a stop request and by the stop time),
  `TestReapOwnershipLockHoldsClaims`, `TestReapAuditEpisodesAcrossBothAudits`,
  `TestReapProvenJobIsNeverOrphan`, `TestReapRecheckListsAgain`,
  `TestReapIncompleteRecheckListStopsNothing`. RED: each fails under the mutation that restores
  the round 0 behaviour it guards (R1 to R6 below).
- GREEN: the brief's command ok 0.47 s; whole package `-v` ok 4.33 s, 89 tests, load average 6 to
  7; the new tests under `-race -count=10` ok; vet, gofmt, staticcheck v0.7.0, `make budget`,
  dead-reference scan clean. M1 to M11 re-run against this code (M3, M3b, M6 and M11 rewritten
  for it): all fail as below and pass unmutated.

| Mutation | Test | Observed failure | Restored |
| --- | --- | --- | --- |
| M3 final check ignores the fresh List and table | `^TestReapRechecksOwnership$` | `reaper_test.go:238: pass at 10 min: report {... Replayed:1 ... OrphansStopped:2 ...}, want one orphan stopped and one replayed` | yes, passes |
| M6 abandoned intents defer too (count without the state filter) | `^(TestReapStopsAbandonedIntentVM\|TestReapDefersOrphansWhileIntentWaits)$` | `reaper_test.go:270: at 10 min: report {... OrphansStopped:0 OrphansDeferred:1 ...}, want the abandoned intent's VM stopped`; `reaper_test.go:727: pass after the intent was abandoned: ... OrphansDeferred:2 ..., want both orphans stopped` | yes, passes |
| M11 recheck without running a missing audit | `^TestOrphanGraceExpiresAfterRestart$` | `reaper_test.go:470: first pass after the restart: report {... Replayed:0 ... OrphansStopped:0 OrphansDeferred:2 ...}, want one orphan stopped and one replayed` | yes, passes |
| R1 R22 deferral dropped | `^TestReapDefersOrphansWhileIntentWaits$` | all 8 subtests: `reaper_test.go:711: pass 0 after the grace: report {... OrphansStopped:2 OrphansDeferred:0 ...}, want both orphans deferred` | yes, passes |
| R2 R23 write lock dropped | `^TestReapOwnershipLockHoldsClaims$` | `reaper_test.go:828: VM vm-0002 was stopped as an orphan while a job held it` (5 of 5 runs) | yes, passes (10 of 10 under `-race`) |
| R3 recheck audit result ignored (round 0) | `^TestReapAuditEpisodesAcrossBothAudits$` | `reaper_test.go:890: pass 1: audit_failed alerts 1, want 2` | yes, passes |
| R4 matched query excludes proven jobs | `^TestReapProvenJobIsNeverOrphan$` | `reaper_test.go:922: report {... OrphansSeen:1 ...}, want no orphan` | yes, passes |
| R5 final check reuses the first List | `^TestReapRecheckListsAgain$` | `reaper_test.go:975: report {... OrphansStopped:1 ...}, want no stop of a VM the fresh list does not show` | yes, passes |
| R6 incomplete final-check List used | `^TestReapIncompleteRecheckListStopsNothing$` | `reaper_test.go:993: pass with an incomplete recheck list: report {Skipped:false ... OrphansStopped:1 ...}, want skipped, no stop` | yes, passes |

### Task 13 fix round 2 (review r2)

`dispatch` (launch.go) now takes the ownership read lock right after the attempt lock, before the
readiness transaction (stop request, stop time) and the transient gates (`creatable`), and holds it
to the settled answer. A dispatch that waits behind the orphan final check therefore checks every
gate after the wait. New test `TestReapWaitingDispatchChecksGatesAfter`: the test holds the
ownership write lock, a Replay's dispatch waits (`waiting` hook), then (a) controller time passes
`stop_t`, (b) the audit goes stale, (c) a failing audit is recorded; on release each gives no
provider Launch, with the intent abandoned (a, `replay_abandoned` row) or waiting (b, c); a control
subtest with no change launches once.

- GREEN: the brief's command ok 0.61 s; whole package `-v` ok 4.77 s, 90 tests, at load average
  50 to 90; the dispatch and lock tests under `-race -count=5` ok; vet, gofmt, staticcheck v0.7.0,
  `make budget`, dead-reference scan clean. R2 re-run against the new placement: still fails as
  before.

| Mutation | Test | Observed failure | Restored |
| --- | --- | --- | --- |
| G1 ownership lock taken after the checks again (before `markDispatch`) | `^TestReapWaitingDispatchChecksGatesAfter$` | subtests stop time passes, audit goes stale, audit fails: `reaper_test.go:1070: provider launches after the wait = 1, want 0` | yes, passes |
| R2 (re-run) R23 write lock dropped | `^TestReapOwnershipLockHoldsClaims$` | `reaper_test.go:828: VM vm-0002 was stopped as an orphan while a job held it` | yes, passes |

## Task 14

`internal/hostedctl/sim_test.go` (the driver: seeds, steps, time) and `sim_model_test.go` (the
provider wrapper, the snapshot and the invariants). `TestLifecycleSimulation` drives the real
controller over the real store and `isolatedjob.Fake` (backstop off) on `isolatedjobtest.FakeClock`,
through public methods and `Reap`. 200 seeds by default on up to 8 workers, 40 steps a seed;
`EQUIPO_SIM_SEEDS=n` runs seeds 1 to n and `EQUIPO_SIM_SEED=s` replays one. A failure prints the
seed, the step, the violations and the last 400 lines of the step log. I1 to I7 are checked after
every step and every reaper pass; I3, I5, I6 (replacement launch) and I7 (prepared before the call)
also at the provider call itself. No production change.

Two test-only speed measures, without which 200 seeds took 23 s: each seed copies one store migrated
once per run (its clock row removed, so Open still starts fresh), and the test turns off SQLite disk
syncs on the store's pinned connection after each Open (`PRAGMA synchronous = OFF`; a crash here is
Close and Open, never a power cut).

- RED: each mutation below, applied alone, fails within the default 200 seeds with the invariant
  named; the unmutated run passes. Mutations were edits to the tree, each restored with
  `git checkout -- <file>`; `git diff -- '*.go' ':!internal/hostedctl/sim*_test.go'` is empty.
- GREEN: `go test ./internal/hostedctl -run TestLifecycleSimulation -count=1` ok 2.49 to 3.05 s over
  six runs at load average 4 to 8; `EQUIPO_SIM_SEEDS=5000` ok 69.6 s; whole package ok 6.1 to
  7.3 s; 40 seeds under `-race` ok; vet, gofmt, staticcheck v0.7.0, `make budget`, dead-reference
  scan 0 failures. Test lines in the directory 6,756 of 8,000.
- I5's `>=` alone (only `currentGen`) is held by a second guard: Suspend's and Quiescent's UPDATEs
  still filter on the named generation, so the call errors with 0 rows and no provider Suspend is
  sent (0 of 200 seeds fail, as no invariant breaks). The I5 row applies `>=` with the UPDATEs keyed
  on the stored generation. Under I1, 3 of 154 failing seeds first report I2 (the replayed VM's
  reply was lost too, so it is neither saved nor any intent's); 151 report I1.

Command for every row: `go test ./internal/hostedctl -run TestLifecycleSimulation -count=1`. Seeds
failing of 200 in brackets.

| Mutation | Observed failure (first seed) | Restored |
| --- | --- | --- |
| I1 Replay with a fresh client token (`spec.AttemptID += "-r"` on replay) | `sim_test.go:82: seed 1 failed at step 15: I1: attempt a2 has 2 live VMs: [vm-0003 vm-0004]` (151) | yes, passes |
| I2 save the intent after the provider call (Launch calls the provider before `saveIntent`) | `seed 1 failed at step 38: I2: VM vm-0006 (attempt a4, starting) is no saved Ref, matches no stored intent and was not planted` (171) | yes, passes |
| I3a stop orphans on first sight (`graceOver` true) | `seed 1 failed at step 2: I3: orphan stop of vm-0001 at 9s, first seen at 9s: grace not over` (106) | yes, passes |
| I3b drop the recheck (stop every expired orphan, no replay, List or R22 check) | `seed 77 failed at step 26: I3: orphan stop of vm-0001, the VM of waiting intent a1` (7) | yes, passes |
| I4a reap at `deadline_t` | `seed 1 failed at step 18: I4: VM vm-0003 of a2 is running at 8m19s, its stop time 6m47s (allowed until 7m47s)` (139) | yes, passes |
| I4b wall time in `reapJob` (base plus wall time since Open) | `seed 1 failed at step 18: I4: VM vm-0003 of a2 is running at 8m19s, its stop time 6m47s (allowed until 7m47s)` (25; the wall was net 10 min back) | yes, passes |
| I4c skip deadline stops on an incomplete List | `seed 3 failed at step 14: I4: VM vm-0003 of a3 is running at 5m34s, its stop time 3m34s (allowed until 4m34s)` (22) | yes, passes |
| I5 accept `>=` generations (`currentGen`, UPDATEs on the stored generation) | `seed 17 failed at step 7: I5: provider suspend of vm-0001 (a1) for generation 2; the model's pause is &{gen:1 ... acked:true}` (11) | yes, passes |
| I6 treat `unknown` as terminal (refreshOne) | `seed 4 failed at step 5: I6: a1 holds proof from state "unknown"` (85) | yes, passes |
| I7a raise the epoch before preparing (prepare UPDATE sets `epoch = epoch + 1`) | `seed 5 failed at step 21: I7: provider resume of vm-0001 for operation op-1 prepared at epoch 1 while the job's epoch is 1` (13) | yes, passes |
| I7b commit on a lost reply (driveResume commits on `ErrLostReply`) | `seed 25 failed at step 21: I7: a2 operation op-1 committed with no running read of vm-0002 after its last resume call` (6) | yes, passes |

### Task 14 fix round 1 (review r1, ruling R24)

1. I4 per R24: every live fake VM (stopping included) tied to a recorded attempt by saved Ref or
   spec attempt ID, bound max(stop_t, OpenedAt) + ReapInterval with R24's extensions (a) stopping
   after a Stop issued within the bound then in force, (b) the current run of throttled-Stop passes
   only, (c) OrphanGrace + ReapInterval for a VM with no saved Ref, exempt while R22 deferral
   applies (and one interval after). Three more extensions were needed for correct controller
   behaviour, each found by an unmutated failure and flagged for a ruling: (d) a VM with no saved
   Ref gets an interval per pass since it appeared in which a List failed (seeds 36, 43, 121: orphans
   first seen late behind incomplete Lists); (e) after a restart a pre-restart job gets an interval
   per pass since the open in which its Get failed, at most RestartGetTries (seed 969: R20 delays the
   re-base); (f) a VM claimed late is bounded no earlier than one interval after the Launch reply
   that first carried its Ref (seeds 1688, 4498: claimed by the orphan recheck's replay, after the
   deadline step).
2. I7: running evidence is tied to the pending operation the latest provider Resume was for and is
   dropped by any other observed phase (a Get reading another state, a Suspend or Stop). A new
   mutation I7c (commit while preparing, no provider call) checks the reviewer's case.
3. I5: at every provider Suspend the stored state, generation, `pause_quiescent`,
   `pause_cancelled` and `pause_started_t` are checked, a named generation must equal the stored
   one, and the simulation's drain and acknowledgement history must agree; that history is also
   checked against the store after every step and pass.
4. Skip-ahead skips only with no failing-audit window, incomplete-List window or queued List fault
   left, so no omitted pass would have played a fault (no pass is counted twice any more).
5. Six directed scenarios run first under the same invariants: lost launch, stop and resume
   replies, each confirming the provider effect and the unresolved store state, then Close, Open
   and New before any reconciliation; a resume throttled while the VM stays suspended (after a
   running read before the suspend); a waiting intent's VM past its orphan grace while audits fail;
   next-generation acknowledgement and suspend refused. A model bug found on the way: a repeated
   Resume of a done operation closed the model's newer pause (seed 250); fixed.

- GREEN: `go test ./internal/hostedctl -run TestLifecycleSimulation -count=1` ok 2.74 to 2.84 s
  over five runs at load average 8; `EQUIPO_SIM_SEEDS=5000` ok 73.8 s; whole package (with Task
  15) ok 6.66 to 7.29 s; 40 seeds under `-race` ok; vet, gofmt, staticcheck v0.7.0, `make budget`,
  dead-reference scan 0 failures. Test lines in the directory 7,703 of 8,000.
- Mutations ran in a scratch copy (`git archive HEAD` plus the sim files), never in the worktree;
  the copy was removed. Command for every row as above. "Scenarios" names the directed scenarios
  that fail, which they do on every run.

| Mutation | Observed failure | Seeds (of 200) | Scenarios | Restored |
| --- | --- | --- | --- | --- |
| I1 | `seed 1 failed at step 15: I1: attempt a2 has 2 live VMs: [vm-0003 vm-0004]` | 154 | lost launch; orphan recheck (I1) | yes, passes |
| I2 | `seed 1 failed at step 38: I2: VM vm-0006 (attempt a4, starting) is no saved Ref, ...` | 169 | lost launch; orphan recheck (I2) | yes, passes |
| I3a | `seed 1 failed at step 2: I3: orphan stop of vm-0001 at 9s, first seen at 9s: grace not over` | 102 | none | yes, passes |
| I3b | `scenario a waiting intent's VM outlives its orphan grace failed at step 3: I3: orphan stop of vm-0001, the VM of waiting intent a1` | 6 | orphan recheck | yes, passes |
| I4a | `seed 1 failed at step 18: I4: VM vm-0003 of a2 is running at 8m19s, its stop time 6m47s (bound 7m47s, ...)` | 138 | lost launch | yes, passes |
| I4b | same line as I4a at seed 1 step 18 (wall net 10 min back) | 25 | none | yes, passes |
| I4c | `seed 3 failed at step 14: I4: VM vm-0003 of a3 is running at 5m34s, its stop time 3m34s (bound 4m34s, ...)` | 24 | none | yes, passes |
| I5 | `scenario future generations are refused failed at step 4: I5: a1 generation 1 is stored acknowledged; no acknowledgement of it came in time` | 28 | future generations | yes, passes |
| I5 plain `>=` only | `scenario future generations are refused failed at step 4: scenario: acknowledge the next generation: unexpected result hostedctl: record quiescent for a1: 0 rows` (earlier guard; no invariant) | 0 | future generations | yes, passes |
| I6 | `seed 4 failed at step 5: I6: a1 holds proof from state "unknown"` | 87 | none | yes, passes |
| I7a | `scenario lost resume reply, crash, reconcile failed at step 7: I7: provider resume of vm-0001 for operation op-1 prepared at epoch 1 while the job's epoch is 1` | 13 | lost resume; throttled resume | yes, passes |
| I7b | `scenario lost resume reply, crash, reconcile failed at step 7: I7: a1 operation op-1 committed with no running read of vm-0001 after a provider resume for it` | 6 | lost resume | yes, passes |
| I7c commit while preparing (Resume calls `finishResume` as running, no provider call) | `scenario throttled resume while the VM stays suspended failed at step 7: I7: a1 operation op-1 committed with no running read of vm-0001 after a provider resume for it` | 13 | lost resume; throttled resume | yes, passes |

### Task 14 fix round 2 (review r2, ruling R24a)

1. R24 (b) exact: only throttled Stops inside a reaper pass count, and the run is current only
   through consecutive passes that each throttle a Stop for the VM (`creditLocked`); a pass with
   none ends the run and its credit. A stop that takes effect records the credit current then.
2. R24a (c) exact: `simDeferral` records the first check at which R22 deferral no longer applies;
   the bound runs from one ReapInterval after that, plus one per later pass whose List failed (d).
3. New `TestSimDeadlineCredits` checks both on the review's examples: throttled at 10m, no Stop at
   11m, stopped at 12m is rejected (and accepted with throttles at 10m and 11m); deferred at 30m,
   ended at 31m with an incomplete List, stopped at 32m is accepted, still live at 33m with complete
   Lists is rejected.

- GREEN: `go test ./internal/hostedctl -run 'TestLifecycleSimulation|TestSimDeadlineCredits' -count=1`
  ok 2.63 to 2.68 s over four runs at load average 6; `EQUIPO_SIM_SEEDS=5000` ok 68.5 s; whole
  package ok 6.12, 6.26 s; vet, gofmt, staticcheck v0.7.0, `make budget`, dead-reference scan clean.
- Mutations in scratch copies (removed): I4a 138 seeds and the lost-launch scenario, first
  `seed 1 failed at step 18: I4: VM vm-0003 of a2 is running at 8m19s, its stop time 6m47s (bound 7m47s, ...)`;
  I4b 25 seeds, same first line; I4c 24 seeds, first
  `seed 3 failed at step 14: I4: VM vm-0003 of a3 is running at 5m34s, its stop time 3m34s (bound 4m34s, ...)`.
  Checker mutations: credit kept across a broken run gives
  `sim_model_test.go:893: throttled at 10m, no Stop at 11m, stopped at 12m: stop at 12m0s with credit 1 accepted true, want false`;
  the round-1 deferral rule gives
  `sim_model_test.go:908: incomplete List at 31m, stopped by the 32m pass: live at 32m0s within bound 31m0s is false, want true`;
  no List credit after the end gives
  `sim_model_test.go:908: incomplete Lists at 31m and 32m, live at 33m: live at 33m0s within bound 32m0s is false, want true`.
  All restored; the restored runs pass.

## Task 15

Controller HTTP API (`internal/hostedctl/http.go`), metrics (`metrics.go`) and the
`equipo-hosted-controller` command (config, main wiring of awsjob, SNS alerter). No edit to an
existing hostedctl file.

- RED: `go test ./internal/hostedctl -run 'TestRoutes|...|TestMetrics' -count=1` failed to build
  (`undefined: Metrics`, `undefined: HandlerConfig`, `e.c.Handler undefined`, `undefined: apiErrors`,
  `undefined: lookupError`). The command's tests were written with its code, not before; each guard
  there is shown by the mutations below. First green run: `TestMetricsCountJobsByState` failed on
  its own matcher (a HELP line matched the sample name), fixed in the test.
- GREEN: `go test ./internal/hostedctl ./cmd/equipo-hosted-controller -run 'TestRoutes|TestInstanceKey|TestUnknownFields|TestResponsesSigned|TestConfig|TestDisabled|TestMetrics' -count=1`
  ok; new hostedctl tests 0.2 to 0.46 s each, in parallel; whole hostedctl package 8.0 s at load
  average 17 to 19, the same 8.0 s with the new tests skipped; command package 0.01 s.
  `make build vet` ok; `go test ./internal/isolatedjob -run TestProviderTypesStayInAdapter` ok;
  `scripts/ci-test.py check` ok; `make budget` ok; staticcheck v0.7.0 clean on both packages;
  dead-reference scan 0 failures.

Each mutation was applied alone with a script, the named test run, and the file restored from a
saved copy; the test passes again after each.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Drop the creator check (Get: `j.actor != string(by)` removed) | `go test ./internal/hostedctl -run '^TestInstanceKeySeesOnlyItsJobs$' -count=1` | `http_test.go:287: instance B GET /v1/jobs/a1 = 200 {"attempt_id":"a1",...}, want 403` | yes, passes |
| Drop the handler's role check (`case key.Role != rt.role` to `case false`) | `go test ./internal/hostedctl -run '^TestRoutesEnforceRoles$' -count=1` | `http_test.go:239: operator GET /v1/jobs/a1 audit row = {Actor:op-1 ... Action:get_refused ...}, want api_refused by op-1` | yes, passes |
| Accept a wildcard listen (`IsUnspecified` check off) | `go test ./cmd/equipo-hosted-controller -run '^TestConfigRefusesWildcardListen$' -count=1` | `config_test.go:150: listen "0.0.0.0:8443" loaded, want a refusal` | yes, passes |
| Unsigned responses (`SignResponse` call removed) | `go test ./internal/hostedctl -run '^TestResponsesSigned$' -count=1` | `http_test.go:345: launch = 200 {...}, signed false; want a signed 200` | yes, passes |
| Lax decode (`json.Unmarshal` for `DecodeStrict`) | `go test ./internal/hostedctl -run '^TestUnknownFieldsRefused$' -count=1` | `http_test.go:311: launch with unknown field = 200 {...}, want 400 {"code":"bad_json",...}` | yes, passes |
| Error text in responses (message from `err.Error()`) | `go test ./internal/hostedctl -run '^TestRoutesEnforceRoles$' -count=1` | `http_test.go:232: operator GET /v1/jobs/a1 = 403 {"code":"forbidden","message":"hostedctl: this key may not do that: route get needs the instance role"}, want 403 {"code":"forbidden","message":"This key may not do that."}` | yes, passes |
| Enabled from any non-empty env value (`!= ""` for `== "1"`) | `go test ./cmd/equipo-hosted-controller -run '^TestConfigEnabledOnlyFromEnv$' -count=1` | `config_test.go:181: EQUIPO_HOSTED_ENABLED="true": Enabled true, want false` | yes, passes |

### Task 15 fix round 1

Review r1 findings 1 to 4 and ruling R25. Tests were written first: RED was
`TestResponsesSignedForHead` (`HEAD /v1/jobs/a1 = 405 "", signed false`), `TestResponsesSigned`
(`no API error with code "replay"`), and the command's build failure (`undefined: newAPIServer`,
`undefined: newMetricsServer`, `too many arguments in call to serve`).

- R25: a replay (new code `replay`) and a nonce-store failure come after the signature verified,
  so their refusals are signed bound to the request's nonce; missing or malformed headers, unknown
  key, skew and bad signature stay unsigned. hostedwire unchanged.
- HEAD: the signature covers the empty body actually sent; the status is kept.
- `OPTIONS *`: `DisableGeneralOptionsHandler` on both servers; the API handler verifies it.
- Shutdown: the reaper has its own lifetime; on a signal the servers drain (30 s), then remaining
  request contexts are cancelled, serve waits for every handler, then stops and joins the reaper;
  the store closes after serve returns.
- GREEN: `go test ./internal/hostedctl ./cmd/equipo-hosted-controller -run 'TestRoutes|TestInstanceKey|TestUnknownFields|TestResponsesSigned|TestConfig|TestDisabled|TestMetrics|TestOptionsStar|TestShutdown' -count=1`
  ok (0.46 s, 0.52 s); `make build vet` ok; Task 7 guard ok; `make budget` ok; staticcheck clean;
  command package ok under `-race`.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| `DisableGeneralOptionsHandler` off on the API server | `go test ./cmd/equipo-hosted-controller -run '^TestOptionsStarVerified$' -count=1` | `main_test.go:160: unsigned OPTIONS * = 200 "" (signature ""), want an unsigned 401` | yes, passes |
| HEAD signs the body it never sends (`body = nil` for HEAD removed) | `go test ./internal/hostedctl -run '^TestResponsesSignedForHead$' -count=1` | `http_test.go:430: HEAD /v1/jobs/a1 = 405 "", signed false; want a signed 405 with no body` | yes, passes |
| serve does not wait for running handlers (`active.closeAndWait()` removed) | `go test ./cmd/equipo-hosted-controller -run '^TestShutdownDrainsRequests$' -count=1` | `main_test.go:238: serve returned while a request handler was still running` | yes, passes |
| Verified refusals unsigned (`signedNonce` always "") | `go test ./internal/hostedctl -run '^TestResponsesSigned$' -count=1` | `http_test.go:395: replay = 401 {"code":"replay",...}, signed false; want a signed 401 {"code":"replay",...}` | yes, passes |

## Task 16

Instance-side client `internal/hostedclient` (`client.go`, `client_test.go`). New refuses unless
`EQUIPO_HOSTED_RUNNERS=1`, refuses a non-https or non-bare BaseURL, an empty key ID, keys of the wrong
length and a nil HTTP client (no default client: the deployment supplies TLS and timeout). One method
per instance route. Each response is verified against its own request nonce and the controller key
before its status or body is read; unsigned answers (including the controller's unsigned 401s) are
`ErrUnverified`. Signed refusals map by code and status to exported kinds (`ErrStopPending`,
`ErrConflict`, ..., plus `ErrReplay` for ruling R25's signed `replay` code); redirects are not
followed. No edit to hostedctl; the test builds the handler from hostedctl's public API.

- RED: `go test ./internal/hostedclient -count=1` failed to build (`undefined: Client`, `undefined:
  FlagEnv`, `undefined: New`, `undefined: Config`, `undefined: ErrGenerationCancelled`, ...). First
  green run: `TestClientAgainstController` expected a relaunch of a1 to conflict; the controller
  treats an identical relaunch as a repeat, so the test now relaunches with a different task.
- GREEN: `go test ./internal/hostedclient -count=1` ok, 0.42 to 0.68 s (go list -deps step 0.05 to
  0.08 s, warm cache). gofmt, go vet, staticcheck v0.7.0 clean; `scripts/ci-test.py check` ok;
  dead-reference scan 0 failures. Also passes against the in-progress R25 handler change.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Skip response verification (`VerifyResponse` call replaced by nil) | `go test ./internal/hostedclient -run '^TestClientRefusesUnsignedResponse$' -count=1` | `client_test.go:273: unsigned: Get = {AttemptID:a1 ... VMRef:vm-1 ...}, <nil>; want nothing and ErrUnverified` | yes, passes |
| Nonce binding: verify against the response's own `Equipo-Nonce` header | same | `client_test.go:273: signed for another nonce: Get = {AttemptID:a1 ... VMRef:vm-1 ...}, <nil>; want nothing and ErrUnverified` | yes, passes |
| Flag from any non-empty value (`!= "1"` to `== ""`) | `go test ./internal/hostedclient -run '^TestClientRefusesWithoutFlag$' -count=1` | `client_test.go:370: New with EQUIPO_HOSTED_RUNNERS="0" = (client true, <nil>); want ErrRunnersOff` | yes, passes |
| https-only off (scheme check removed) | `go test ./internal/hostedclient -run '^TestNewRefusesBadConfig$' -count=1` | `client_test.go:410: New with plain http = (client true, <nil>); want a refusal` | yes, passes |
| Follow redirects (`CheckRedirect` line removed) | `go test ./internal/hostedclient -run '^TestClientRefusesUnsignedResponse$' -count=1` | `client_test.go:309: launch answered by a redirect = ... with 1 hits elsewhere, want ErrUnverified and none` | yes, passes |
| Map by code alone (status check dropped) | `go test ./internal/hostedclient -run '^TestSignedAnswersMapToKinds$' -count=1` | `client_test.go:345: code and status disagree: ... controller answered 409 "disabled"; want ... unexpected answer` | yes, passes |
| Stop proof check off | same | `client_test.go:359: Stop answered with proof {AttemptID:a9 ...} = {AttemptID:a9 ...}, <nil>; want nothing and ErrBadResponse` | yes, passes |
| cmd/equipo imports hostedclient (temporary `cmd/equipo/zz_mut.go`) | `go test ./internal/hostedclient -run '^TestInstanceDoesNotCallHostedClient$' -count=1` | `client_test.go:444: amadan.net/oficina/equipo/cmd/equipo depends on internal/hostedclient; ...` | yes, file deleted, passes |

### Task 16 fix round 1 (review r1)

- Redirects: the client no longer calls `http.Client.Do`. It sends with one `RoundTrip` on
  `HTTP.Transport` (`http.DefaultTransport` when nil), with `HTTP.Timeout` applied as a context
  deadline over the whole call, body read included. A 3xx is never parsed or followed before it is
  verified. The unverified-answer error no longer names the status.
- Contract: `hostedctl.ErrorCodes()` (new, read-only: every status and code pair of `apiErrors` and
  `errInternal`). `TestClientMatchesHandlerErrorCodes` requires every handler pair to map to a typed
  kind and the client to know no code the handler does not send.
- Guards: `TestSignedSuccessMustFit` has one signed 200 case per success guard.
- Dependency guard: `testci.GoCommand` declares cmd/equipo's source as test inputs; the `go list` runs
  under `exec.CommandContext` (8 s) and prints its stderr on failure.
- Cache check, normal command `go test ./internal/hostedclient` (no -count): `ok 0.815s`, then
  `ok (cached)`; add `cmd/equipo/zz_mut.go` importing hostedclient: `client_test.go:575:
  amadan.net/oficina/equipo/cmd/equipo depends on internal/hostedclient; ...` FAIL; file deleted,
  `ok 0.740s`. Control with the `testci.GoCommand` line disabled: after the same import, `ok (cached)`.
- `go test ./internal/hostedclient -count=1` ok 0.72 s (10 tests); `go test ./internal/hostedctl
  -run 'TestRoutes|TestResponsesSigned' -count=1` ok; gofmt, vet, staticcheck v0.7.0 clean on both
  packages; `ci-test.py check` ok; dead-reference scan 0 failures.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Back to `http.Client.Do` with `CheckRedirect` | `go test ./internal/hostedclient -run '^TestClientRefusesUnsignedResponse$' -count=1` | `client_test.go:333: redirect to %, signed false: Launch = hostedclient: launch: Post "https://127.0.0.1:44573/v1/jobs": failed to parse Location header "%": ... want hostedclient: the response could not be verified after 1` | yes, passes |
| HTTP timeout not applied | `... -run '^TestClientHonoursTimeoutAndCancel$' ...` | `client_test.go:359: Get past the HTTP timeout = hostedclient: the response could not be verified: ... after 3.0025s, want context.DeadlineExceeded within 2 s` | yes, passes |
| Status back in the unverified error | `... -run '^TestClientRefusesUnsignedResponse$' ...` | `client_test.go:337: unsigned redirect error "hostedclient: the response could not be verified: launch (unverified status 307): ..." holds text from the answer` | yes, passes |
| Handler code renamed (`network_audit` to `audit_stale`, http.go) | `... -run '^TestClientMatchesHandlerErrorCodes$' ...` | `client_test.go:417: handler refusal 503 "audit_stale" maps to ... unexpected answer ..., want a typed kind` and `client_test.go:425: client maps 503 "network_audit", which the handler does not send` | yes, passes |
| Handler status changed (`past_deadline` 410 to 409, http.go) | same | `client_test.go:417: handler refusal 409 "past_deadline" maps to ... unexpected answer ...` and `client_test.go:425: client maps 410 "past_deadline", which the handler does not send` | yes, passes |
| Client entry `network_audit` removed | same | `client_test.go:417: handler refusal 503 "network_audit" maps to ... unexpected answer ..., want a typed kind` | yes, passes |
| Launch attempt check off | `... -run '^TestSignedSuccessMustFit$' ...` | `client_test.go:466: launch view for another attempt: = {AttemptID:a9 ...}, <nil>; want ErrBadResponse` | yes, passes |
| Get attempt check off | same | `client_test.go:466: get view for another attempt: = {AttemptID:a9 ...}, <nil>; want ErrBadResponse` | yes, passes |
| `DecodeStrict` to `json.Unmarshal` for successes | same | `client_test.go:466: get view with an unknown field: = {AttemptID:a1 ...}, <nil>; want ErrBadResponse` | yes, passes |
| Stop proof: attempt half removed | same | `client_test.go:466: stop proof for another attempt: = {AttemptID:a9 ... State:stopped ...}, <nil>; want ErrBadResponse` | yes, passes |
| Stop proof: terminal half removed | same | `client_test.go:466: stop proof not terminal: = {AttemptID:a1 ... State:running ...}, <nil>; want ErrBadResponse` | yes, passes |
| Drain generation >= 1 off | same | `client_test.go:466: drain generation 0: = 0, <nil>; want ErrBadResponse` | yes, passes |
| Generation echo off (`generationCall`) | same | `client_test.go:466: quiescent for another generation: = <nil>, <nil>; want ErrBadResponse` (and suspend, reopen) | yes, passes |
| Resume epoch >= 1 off | same | `client_test.go:466: resume epoch 0: = 0, <nil>; want ErrBadResponse` | yes, passes |
| Skip response verification (rerun) | `... -run '^TestClientRefusesUnsignedResponse$' ...` | `client_test.go:274: unsigned: Get = {AttemptID:a1 ... VMRef:vm-1 ...}, <nil>; want nothing and ErrUnverified` | yes, passes |

The round 0 rows above give line numbers from before this round.

### Task 16 fix round 2 (review r2)

- Transport and body-read errors go through `transportError`: `ErrTransport` plus the route and
  step ("sending" or "reading the body"). `context.Canceled` and `context.DeadlineExceeded` stay
  matchable with errors.Is, and a `net.Error` timeout keeps the fixed words "network timeout". The
  original error's text, which can quote server bytes, is dropped. `Config.HTTP` now documents that
  the transport must honour request contexts (Request.Cancel or CancelRequest-only transports are
  not supported).
- `TestTransportErrorsHoldNoServerBytes`: a TLS server hijacks the connection and sends a malformed
  status line, a header with no colon, or a chunked body with a malformed trailer. Each gives
  ErrTransport, not ErrUnverified, and none of the sent bytes.
- `go test ./internal/hostedclient -count=1` ok 0.95 s (11 tests); gofmt, vet, staticcheck v0.7.0
  clean; dead-reference scan 0 failures.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Wrap the raw error again (`%w` of err in `transportError`) | `go test ./internal/hostedclient -run '^TestTransportErrorsHoldNoServerBytes$' -count=1` | `client_test.go:365: malformed status: error "... get: sending: net/http: HTTP/1.x transport connection broken: malformed HTTP status code \"EVIL\"" holds bytes the server sent`, the same for the header (`missing colon: \"EVIL-HEADER-NO-COLON\"`) and the trailer (`reading the body: malformed MIME header: missing colon: \"EVIL-TRAILER\"`) | yes, passes |
| Deadline classification dropped | `go test ./internal/hostedclient -run '^TestClientHonoursTimeoutAndCancel$' -count=1` | `client_test.go:387: Get past the HTTP timeout = hostedclient: the exchange with the controller failed: get: sending: network timeout after 100.7ms, want context.DeadlineExceeded within 2 s` | yes, passes |

## Final fix wave

Findings from the final whole-branch review (final-A, B1, B2, C), fixed under rulings R26 to R31.

### A1 + A2: provider namespace binding and launch fingerprint (R28, R29)

- `provider_binding` (one row, never updated) holds the namespace; `New` needs
  `Config.ProviderNamespace` and `Config.ProviderFingerprint`, binds a fresh database, and returns
  `ErrProviderMismatch` for another namespace before anything reads the provider. Main resolves
  `aws:ACCOUNT:REGION` with a bounded STS GetCallerIdentity.
- Each intent saves `provider_fingerprint` (immutable with the spec). `dispatch` abandons an intent
  whose fingerprint differs from the current one (reason `config_changed`, an AlertConfigChanged
  alert, no provider call); the lost reply's VM is then an orphan. `awsjob.Config.Fingerprint` is
  region, connector, image ARN and the size's version.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Accept a mismatched binding (`bound != ns && false`) | `go test ./internal/hostedctl -run 'TestProviderNamespaceBound$' -count=1` | `store_test.go:605: New for another namespace = (&{...test:account-2:region-1...}, <nil>), want ErrProviderMismatch` | yes, passes |
| Skip the fingerprint check in `dispatch` | `go test ./internal/hostedctl -run 'TestReplayRefusesChangedProviderConfig$' -count=1` | `launch_test.go:555: provider launches = 2, want only the lost one` | yes, passes |
| Leave the version out of `awsjob.Config.Fingerprint` | `go test ./internal/isolatedjob/awsjob -run 'TestFingerprint$' -count=1` | `runner_test.go:252: small and large share a fingerprint, though their versions differ` | yes, passes |

### B1: gates rechecked after the dispatch marker commits

- After `markDispatch` commits, `dispatch` reads controller time once more, in memory: at or past
  the intent's stop time it abandons the intent (`abandonDue`); a failed `creatable` (launches off,
  image dropped, audit failed or stale) leaves it waiting; only then the provider call.
- `TestDispatchRechecksGatesAfterMarker`: a test hook (`beforeMark`) holds the store so the marker's
  transaction queues; the test invalidates one gate (stop time passes, audit fails, audit goes
  stale), then releases the store. No provider launch in any case; the marker is recorded.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Drop both post-marker checks | `go test ./internal/hostedctl -run 'TestDispatchRechecksGatesAfterMarker$' -count=1` | `launch_test.go:672: provider launches = 1, want 0` in all three subtests | yes, passes |
| Drop only the stop-time check | same | `launch_test.go:675: att-1 = {state:waiting ... lastDispatch:{Int64:7200000000000 Valid:true} ... stop:6600000000000}, want abandoned with its dispatch marker` | yes, passes |

### B2-1, B2-3, B2-4: deadline stops before replay, Reopen after reconciliation, pauses across a restart

- B2-1 (R26): `reapOverdue` runs right after the pass's checkpoint and sends the deadline stop
  (`reapJob`) for every Ref'd, unproven, unrequested job at or past its stop time, before Replay.
  Step 4 repeats and finds the stop already asked for.
- B2-3: `Reopen` refuses with `isolatedjob.ErrConflict` while `ageUnsettled`, then judges the
  re-based stop time.
- B2-4: `expire` (now a method) also cancels an unacknowledged generation whose Drain is at or
  before `OpenedAt` after a restart. The simulation's model now counts an acknowledgement of a
  generation drained before the last restart as never in time, so I5 would catch a controller that
  accepted one.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Drop `reapOverdue` from the pass | `go test ./internal/hostedctl -run 'TestDeadlineStopBeforeSlowReplay$' -count=1` | `reaper_test.go:393: provider stops while the replay's launch call hung = [], want att-1's vm-0001` | yes, passes |
| Drop the `ageUnsettled` refusal in `Reopen` | `go test ./internal/hostedctl -run 'TestReopenWaitsForRestartReconciliation$' -count=1` | `pause_test.go:236: Reopen before the first refresh = <nil>, want ErrConflict` | yes, passes |
| Drop the restart case in `expire` | `go test ./internal/hostedctl -run 'TestPauseAckAcrossRestartCancelled$' -count=1` | `pause_test.go:209: refresh first false: Quiescent(1) after the restart = <nil>, want ErrGenerationCancelled` | yes, passes |
| Same mutation, simulation | `EQUIPO_SIM_SEEDS=500 go test ./internal/hostedctl -run 'TestLifecycleSimulation' -count=1` | `sim_test.go:94: seed 12 failed at step 38: I5: a3 generation 1 is stored acknowledged; no acknowledgement of it came in time` (also seeds 50, 106) | yes, 500 seeds pass |

### C1: slice 1a runs with no egress (R30)

- `awsjob.Config` accepts an empty egress set (a group with no outbound rules); the command refuses
  a non-empty `egress` in slice 1a, so `ctl.Egress` is empty and the audit expects `EgressOnly`
  empty. `TestAuditNetwork/no_egress_against_a_group_with_no_rules` audits a no-rule group: no
  egress, `OK(nil)` passes, and `OK` against a non-empty set still fails.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Refuse empty egress in `awsjob.Config.check` again | `go test ./internal/isolatedjob/awsjob -run 'TestNew$\|TestAuditNetwork$' -count=1` | `runner_test.go:208: New(no egress) = isolatedjob: invalid request: awsjob config: no egress destinations, want nil` and `network_test.go:267: New(no egress) = ...` | yes, passes |
| Accept a non-empty egress in the command | `go test ./cmd/equipo-hosted-controller -run 'TestConfigRefusesMissingListenOrKeys$' -count=1` | `config_test.go:114: egress in slice 1a: config loaded, want a refusal` | yes, passes |

### C2 + B2-2: bounded provider calls, cancellable recovery calls, shutdown order (R27)

- `New` wraps the runner and auditor (`bounded.go`): Launch gets `ProviderLaunchTimeout` (60 s,
  moved out of `dispatch`), every other call and the network audit `ProviderCallTimeout` (30 s),
  each derived from the caller's context.
- `refreshOne` passes its own context to `mirrorLive`, which uses it for the Suspend and Resume it
  sends again and a detached copy only for store writes and audit rows.
- `serve` cancels the requests and the reaper together after the drain period, then joins both;
  the caller closes the store after.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Old shutdown order (join handlers before cancelling the reaper) | `go test ./cmd/equipo-hosted-controller -run 'TestShutdownCancelsReaperWithRequests$' -count=1` | `main_test.go:281: serve did not return within 10 s of the signal` | yes, passes |
| No deadline on Get in `boundedRunner` | `go test ./internal/hostedctl -run 'TestProviderCallsBounded$' -count=1` | `refresh_test.go:783: unbounded provider calls: [get: deadline set false, ... get: ...]` | yes, passes |
| No deadline on the network audit | same | `refresh_test.go:783: unbounded provider calls: [audit: deadline set false, ... audit: ...]` | yes, passes |
| `refreshOne` hands `mirrorLive` the detached context | `go test ./internal/hostedctl -run 'TestRefreshRecoveryCallsCancel$' -count=1` | `refresh_test.go:855: Refresh still in its suspend call 5 s after its context was cancelled` | yes, passes |
| Only the resume re-send gets the detached context | same | `refresh_test.go:855: Refresh still in its resume call 5 s after its context was cancelled` | yes, passes |

### Budgets (R31) and the final runs

- `make budget` after the fixes: `internal/hostedctl: 5153 source lines, ceiling 5000` and `8251
  test lines, ceiling 8000`. One size record added to `.rastrillo/budgets.txt` with R31's reason;
  `make budget` then reports 96 directories within budget.
- `go test ./internal/hostedctl ./internal/hostedclient ./internal/hostedwire ./internal/isolatedjob/...
  ./cmd/equipo-hosted-controller -count=1`: all ok (hostedctl 6.9 s, hostedclient 1.0 s, hostedwire
  0.03 s, isolatedjob 0.36 s, awsjob 0.006 s, command 0.53 s).
- `EQUIPO_SIM_SEEDS=2000 go test ./internal/hostedctl -run TestLifecycleSimulation -count=1`: PASS in
  30.5 s; no invariant loosened (I5's model was tightened for B2-4).
- `make build vet`, `TestProviderTypesStayInAdapter`, `python3 scripts/ci-test.py check`: clean.

### Residual B2-1 (re-review): pending stops retried before replay

- `reapOverdue` now selects every Ref'd, unproven job at or past its stop time. A job with a stop
  request, whatever its reason, gets the provider stop again (`resendPendingStop`, under the attempt
  lock, through `resendStop` with the recorded reason; `stop_requested_t` and `stop_reason` are not
  written); one without gets `reapJob` as before.
- `TestDeadlineStopBeforeSlowReplay` gains a case: a user stop ("done") whose provider call was
  throttled, then a pass with the replay's launch held; the retry has been sent when the launch is
  entered, with the reason and request time unchanged.
- Budget record updated to the new measure, 5180/8266 source/test lines.
- Runs: the test, `go test ./internal/hostedctl -count=1` (ok 7.1 s), `EQUIPO_SIM_SEEDS=1000` (PASS,
  14.1 s), `make budget` (all within budget).

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Early step skips pending stops again (`pending = false && ...`) | `go test ./internal/hostedctl -run 'TestDeadlineStopBeforeSlowReplay$' -count=1` | `reaper_test.go:405: pending true: provider stops while the replay's launch call hung = [vm-0001], want [vm-0001 vm-0001]` | yes, passes |

## Task 17 pre-flight

Offline preparation for the live check; no AWS call was made. The live pieces compile under
`hostedlive` and were not run.

### A3: the contract waits for a new VM to appear

- `isolatedjobtest.Harness` gains `Visibility` (how long Get may answer `ErrNotFound` for a VM Launch
  just returned; zero for the fake, 60 s live) and `CallTimeout` (each Runner call's bound, 30 s by
  default). The contract's `launch` waits for the VM to appear before any check reads it; this wait
  is separate from Settle's state waits. Every Runner call the contract makes, `listUntil`'s Lists
  included, now carries a deadline (closes the deferred Task 6 minor).
- The live `settle` helper bounds each Get and reads `ErrNotFound` again during the first 60 s,
  unless it waits for a terminal state (gone is then an answer).
- `TestFakeContractLateVisibility`: the contract over a runner whose Get misses every new VM once,
  and which counts Get and List calls without a deadline.
- Runs: `go test ./internal/isolatedjob/... -count=1` ok; `go vet -tags hostedlive
  ./internal/isolatedjob/...`; `make build vet`; the Task 7 guard passes.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Remove the visibility wait (`appear` not called in the contract's `launch`) | `go test ./internal/isolatedjob -run 'TestFakeContract' -count=1` | `contract.go:151: Get(vm-0001) = isolatedjob: not found: vm-0001 is not visible yet` | yes, passes |
| Drop the per-call deadline (`call` returns `context.WithCancel`) | same | `fake_test.go:136: contract made 19 Get or List calls without a deadline (0 with one), want none without` | yes, passes |

### The hostedclient live driver

- `internal/hostedclient/live_test.go` (`hostedlive` only): `TestLiveControllerSequence` drives one
  Small VM through a running controller (launch, running, drain, quiescent, suspend, suspended,
  resume with its epoch, running, stop with proof) and logs every timing and the epoch;
  `TestLiveCrashRecovery` is the two-step crash check (`launch` against a controller that exits
  after the provider call, `recover` after a restart: one VM for the attempt in `GET /v1/vms`, then
  stop with proof). Both skip without `EQUIPO_HOSTED_LIVE_URL` and stop their VM on failure.
- Checks: `go vet -tags hostedlive ./internal/hostedclient`, `go vet ./internal/hostedclient`,
  `go test ./internal/hostedclient -count=1` ok. Not run (live). No guard to mutate.

### The crash point after launch, and the key files

- `cmd/equipo-hosted-controller/crashpoint.go` (`hostedlive` only) sets `runnerHook`, which `main`
  applies to the runner it hands the controller. With `EQUIPO_HOSTED_CRASH_AFTER_LAUNCH=1` the
  wrapped Launch exits with 137 once the provider has returned a VM, before transaction 2 saves the
  Ref; otherwise the hook returns the runner itself. A normal build has `runnerHook` nil.
- `TestNoCrashPointWithoutTag` (untagged builds only): `runnerHook` is nil.
- `TestCrashAfterLaunch` (`hostedlive`, fake runner, injectable exit): the exit comes with 137, the
  fake holds one VM for the attempt, the job is still `waiting` with no Ref; a controller reopened
  on the same database without the variable replays the intent and holds that one VM, `starting`.
- `TestLiveKeygen` (`hostedlive`, skips without `EQUIPO_HOSTED_KEYGEN_DIR`): writes the controller,
  instance and operator keys, `verify_keys.json`, and a self-signed TLS pair for 127.0.0.1, refusing
  to replace a file, and checks them with the config loader's own readers.
- Runs: `go test ./cmd/equipo-hosted-controller -count=1` ok; `go test -tags hostedlive
  ./cmd/equipo-hosted-controller -run 'TestCrashAfterLaunch$|TestLiveKeygen$' -count=1` ok (both
  offline: the fake runner, and a keygen run into a scratch directory, since removed); `go vet` with
  and without the tag; `make build vet`; `make budget`; the Task 7 guard.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Drop the `hostedlive` build line from `crashpoint.go` | `go test ./cmd/equipo-hosted-controller -run 'TestNoCrashPointWithoutTag' -count=1` | `crashpoint_off_test.go:13: runnerHook is set in a build without the hostedlive tag; the Task 17 crash point must not ship` | yes, passes |
| Exit before the provider call (`crashExit(137)` first in `crashRunner.Launch`) | `go test -tags hostedlive ./cmd/equipo-hosted-controller -run 'TestCrashAfterLaunch$' -count=1` | `crashpoint_test.go:78: provider VMs for crash-1 at the crash = 0, want 1: the exit must come after the provider call` | yes, passes |

### R32: List sees only the configured images

- The dev account is shared, and the reaper stops any listed VM no job owns after 10 minutes. So
  `awsjob.Runner.List` now makes one `ListMicrovms` walk per configured image ARN (deduplicated,
  sorted), with the SDK's `ImageIdentifier` filter, and reads every page of each. It also drops any
  item whose `imageArn` is not the ARN asked for, so another image's VM is never returned even if
  the filter were ignored. Any page error, repeated token or item with no ID still gives
  `ErrIncomplete` and no jobs. The rule is documented in the `Config.Images` comment and in
  doc.go's List facts.
- `TestListOnlyConfiguredImages`: two configured images and one other image, two pages each. With
  the filter honoured, and again with a provider that ignores it, only the configured VMs come back,
  through exactly the expected (image, token) calls. A page error on the second image gives
  `ErrIncomplete` with no jobs. `TestListAllPages` and the age rows now expect the filter and carry
  `ImageArn`.
- Runs: RED first (`TestListAllPages` saw no filter; the new test listed `vm-x1 vm-x2`), then
  `go test ./internal/isolatedjob/awsjob -count=1` ok; `go vet -tags hostedlive`; the Task 7 guard;
  `make build vet`.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Unfiltered List again (no `ImageIdentifier`, no `imageArn` check) | `go test ./internal/isolatedjob/awsjob -run 'TestListOnlyConfiguredImages' -count=1` | `runner_test.go:1074: List refs = [vm-a1 vm-a1 ... vm-x1 vm-x1 vm-x2 vm-x2], want [vm-a1 vm-a2 vm-b1 vm-b2]: only VMs from the configured images` (and `:1078` calls without the image) | yes, passes |
| Filter sent, `imageArn` check dropped | same | `runner_test.go:1074: List refs = [... vm-x1 vm-x1 vm-x2 vm-x2], want [vm-a1 vm-a2 vm-b1 vm-b2]` (the provider-ignores-the-filter row) | yes, passes |

### Code review round 1 (t17-code-review.md)

- The driver logic moved from `live_test.go` to an untagged `liveDriver`
  (`internal/hostedclient/driver_test.go`). Its steps return errors and register their cleanups
  through a hook. `live_test.go` now only reads the environment and calls it, and
  `driver_offline_test.go` runs every path against the test controller, with a goroutine standing
  in for the reaper's refresh.
- Finding 1: `crashLaunch` and `crashRecover` register the VM guard first (before the Launch, and
  before the operator key is read). Only the intended crash handover (Launch failing in transport)
  releases it, and so does stop proof. Every other ending stops the VM.
- Finding 2: `stopUntilProof`, and so the cleanup, sends Stop again on transport failure, on an
  unverified answer and on any signed 503, as well as on pending and throttled answers. It reports
  the last error once its bound passes.
- Minor 3: the sequence fails unless Resume's epoch is the running job's epoch plus one.
- Evidence (a): the contract logs `visibility: Get showed new VM <ref> <d> after Launch returned
  (<n> reads)` and `list lag: List showed running VM <ref> <d> after Get did (<n> lists)` through
  `Harness.Logf` (nil means t.Logf).
- Evidence (b): `hostedctl.Deps.Log` (slog; nil discards; `main` sends it to stderr at info) gets
  fixed-message records:
  - orphan stopped: `vm_ref`, `first_seen_ns`, `unclaimed_for`, `grace`, `seen_before_restart`;
  - orphan stop call failed;
  - orphan deferred: also `dispatched_intents`;
  - network audit failed: fixed `kinds` such as `resolver_enabled`, `provider_read_failed`, with no
    error text;
  - restart re-base: `attempt`, `provider_age`, and how far the launch and stop times moved back;
  - restart elapsed_unknown stop.
- Budget: `internal/hostedctl` record moved to 5288/8388.
- Tests:
  - `TestDriverSequenceOffline`, `TestDriverCrashLaunchAnsweredStopsVM`,
    `TestDriverCrashLaunchTransportHandsOver`, `TestDriverRecoverBadOperatorKeyStopsVM`,
    `TestDriverStopRetriesTransport` and `TestRetryableStop`, all `-count=10` clean;
  - `TestControllerLogs` (five scenarios, and no provider text or instance code in the log);
  - `TestFakeContractLateVisibility` now also wants both delay lines.
- Runs: `go test` for hostedclient, hostedctl (6.7 s), isolatedjob/... and the controller command
  all ok; `go vet -tags hostedlive` on the four; `make build vet`; `make budget`; the Task 7 guard;
  `scripts/ci-test.py check`.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| `crashLaunch` registers its guard only after the answered-launch check | `go test ./internal/hostedclient -run 'TestDriverCrashLaunch' -count=1` | `driver_offline_test.go:113: Get(crash-1) = starting, <nil>; want stopped` | yes, passes |
| `crashRecover` registers its guard after reading the operator key | `go test ./internal/hostedclient -run 'TestDriverRecover' -count=1` | `driver_offline_test.go:149: Get(rec-1) = starting, <nil>; want stopped` | yes, passes |
| `retryableStop` no longer retries `ErrTransport` | `go test ./internal/hostedclient -run 'TestDriverStopRetriesTransport' -count=1` | `driver_offline_test.go:166: cleanup made 1 calls, want the two failures and a retry` | yes, passes |
| Epoch check expects no rise (`running.Epoch+0`) | `go test ./internal/hostedclient -run 'TestDriverSequenceOffline' -count=1` | `driver_offline_test.go:95: sequence = Resume gave epoch 1, want 1: one resume raises the epoch by one` (the message prints the unmutated expectation) | yes, passes |

### Code review round 2 (t17-code-r2-review.md): R36 and seen_before_restart

- `isolatedjob.Ref.Valid`: 1 to 128 letters, digits and '-'. Neither the API reference nor the SDK
  documents a syntax for `microvmId`, so ruling R36's fallback applies.
- awsjob rejects an ID that fails the check:
  - RunMicrovm: a fixed error;
  - GetMicrovm: a fixed error;
  - any ListMicrovms item: `ErrIncomplete` with no jobs;
  - a malformed ref passed to Get, Suspend, Resume or Stop: `ErrInvalid` before any provider call.
  No error quotes the ID. doc.go records it.
- hostedctl's `boundedRunner`, the one way runner answers reach the controller, checks every Ref
  again. A Launch with a bad Ref becomes a provider failure, so the intent stays waiting with no
  Ref. A bad Get becomes an error, and a List holding one becomes `ErrIncomplete`. So no stored or
  logged Ref can carry other text.
- `seen_before_restart` is now `Restarted() && firstSeen < OpenedAt()`, the reaper's own rule.
- Tests:
  - `TestMalformedIDsRefused` (awsjob): a sentinel ID, a 129-character one, `vm/1` and a trailing
    newline, each on Run, Get and List, and malformed refs passed in;
  - `TestMalformedRefsNeverStoredOrLogged` (hostedctl): Launch, Get and List with a sentinel ref;
    no job ref, unmatched VM, audit row, log line or error holds it;
  - `TestControllerLogs` gains an orphan first seen before a restart and stopped more than the grace
    later (`seen_before_restart=true`), and the plain case says `false`.
- Budget: hostedctl record moved to 5313/8489.
- Runs:
  - hostedctl 7.3 s and 6.7 s (budget 10 s);
  - awsjob, isolatedjob, hostedclient and the controller command ok;
  - tagged vets, `make build vet`, `make budget`, the Task 7 guard.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| awsjob checks only for an empty ID again (no validation) | `go test ./internal/isolatedjob/awsjob -run TestMalformedIDsRefused -count=1` | `ids_test.go:36: Launch with id "vm-1 SENTINEL-secret=hunter2" = ("vm-1 SENTINEL-secret=hunter2", <nil>), want an error and no ref` (and the Get and List rows) | yes, passes |
| hostedctl boundary checks only for an empty Ref | `go test ./internal/hostedctl -run TestMalformedRefsNeverStoredOrLogged -count=1` | `logs_test.go:94: Launch answered with a malformed ref = nil error, want a provider failure` | yes, passes |
| `seen_before_restart` back to `now-firstSeen < OrphanGrace` | `go test ./internal/hostedctl -run TestControllerLogs -count=1` | `logs_test.go:160: no log line holds [... "seen_before_restart=true"]` | yes, passes |

### R38 (code review round 3): a Get without a MicroVM ID is an error

- `awsjob.Runner.Get` used to substitute the asked-for ref when the reply's `microvmId` was empty or
  absent. It now always validates the reply's ID; missing or malformed is a fixed error. Run and
  List already required a valid ID; no other reply ID is optional.
- `TestMalformedIDsRefused` adds Get replies with an empty and a nil ID (state TERMINATED).
  `TestGetWithoutRefNeverProof` (hostedctl): a Get that answers stopped but names no VM yields no
  proof through Stop, Refresh or a reaper pass.
- Budget: hostedctl test lines record moved to 8516.
- Runs: awsjob and isolatedjob ok; hostedctl ok (6.8 s); tagged vets; `make build vet`;
  `make budget`; the Task 7 guard.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Get substitutes the asked-for ref for an empty ID again | `go test ./internal/isolatedjob/awsjob -run TestMalformedIDsRefused -count=1` | `ids_test.go:73: Get answered with a nil id = ({Ref:vm-1 State:stopped ...}, <nil>), want an error and no job` (and the empty row) | yes, passes |
| hostedctl boundary skips the Get check | `go test ./internal/hostedctl -run TestGetWithoutRefNeverProof -count=1` | `logs_test.go:147: Stop with a Get naming no VM = proof {AttemptID:att-1 VMRef:vm-0001 State:stopped ObservedAt:0}, want none` | yes, passes |

## Task 17 live run

Plan revision 3 (`30d21b0a`), code `a7f505a0`, account `640012953448` (profile `kass`), `eu-west-1`.
Attempt 1 (revision 2, run `1123-eef187`) stopped at 0.4 with nothing created; its journal is kept
outside the repo. This is attempt 2, run `1124-5415de`, started 2026-11-24 13:01Z.

### Section 0

- 0.1: code pin ok (`a7f505a0`); aws-cli 2.36.10; go1.26.10.
- 0.1a: attempt 1 scratch removed; its journal kept.
- 0.3: `640012953448`, `arn:aws:iam::640012953448:user/remote-agent`.
- 0.4: 0 live MicroVMs in the account and region; nothing tagged `purpose=equipo-hosted-dev`;
  collision checks clean.
- Estimate (11.2): 0 VMs, $0.21 (fixed items only).

### Section 1

- VPC `vpc-0a9ff3150edc03416` (10.177.0.0/16), DNS support and hostnames off; defaults tagged
  (`sg-0393fe63d3c4fa54a`, `rtb-09519508746c93ec6`, `acl-0e7cd3a6c5a00fc51`, two default rules).
- Subnet `subnet-0ed61e4aa0ff739ab` (10.177.1.0/24, eu-west-1a, no public IPs).
- Route table `rtb-083c469ecf048d3c5`: local route only, associated.
- Security group `sg-06a1e195e5f7a13dd`: no rules.
- Estimate (11.2): $0.21.

### Section 2: stopped at 2.2 (safe stop run)

- 2.1: operator role `arn:aws:iam::640012953448:role/equipo-hosted-dev-t17-1124-5415de-conn-op`
  with the inline policy `t17-connector-eni` (scoped to the subnet and group), created 13:03:33Z.
- 2.2, 13:03:54Z: `create-network-connector` refused:
  `InvalidParameterValueException ... CreateNetworkConnector operation: Encountered unauthorized
  operation while calling EC2 due to invalid ConnectorOperatorRole permissions`. This is stop
  point U2 (the scoped operator policy); the policy was not widened.
- Safe stop: S.1 no controller; S.2 `NOTCREATED connector`, nothing unresolved; S.3 skipped (no
  image). Estimate (11.2): 0 VMs, $0.21 (fixed items; actual spend about $0).
- Left in place for Paul (S.4, no listed charge): the VPC and its defaults, the subnet, the route
  table and its association, the security group, the operator role. Teardown waits for Paul's word.

### Teardown of attempt 2 (Paul's ruling 2026-11-25, discussion 46)

Run `1124-5415de` only, in `kass` / `640012953448` / `eu-west-1` (IAM global), using the plan's
section 10 blocks at `30d21b0a` and the run's ledger. A block runs only for resources with a
`CONFIRMED` record; anything never created is skipped.

- 10.1 (image, versions, VMs), 10.2 (connector, interfaces), 10.5 (S3), 10.6 (log group) and
  10.7 (SNS): skipped, never created (the connector is `NOTCREATED` in S.2; no VM, interface,
  image, bucket, object, log group or topic records).
- 10.3 ran as written: deleted `sg-06a1e195e5f7a13dd`, `rtbassoc-01d2371400574d7b2`,
  `rtb-083c469ecf048d3c5`, `subnet-0ed61e4aa0ff739ab` and `vpc-0a9ff3150edc03416` (with it the
  default group `sg-0393fe63d3c4fa54a` and its two rules, the main route table
  `rtb-09519508746c93ec6` and the default ACL `acl-0e7cd3a6c5a00fc51`). Each was confirmed by a
  filtered describe listing 0.
- 10.4: only its operator-role lines ran (the same calls, behind the same guard), because the
  build role was never created and its `delete-role` would fail. Deleted the inline policy
  `t17-connector-eni`, then the role `equipo-hosted-dev-t17-1124-5415de-conn-op`. `get-role`
  answers `NoSuchEntity`.
- Verification by type (2026-11-25 19:26Z, direct reads): VPC, subnet, both route tables, the
  association, both groups, both default rules and the ACL each list 0, and no interfaces are
  left in the VPC. IAM `get-role` answers `NoSuchEntity` for both role names.
- 10.8 ran without `IMAGE_ARN` in its `need` line (no image was ever recorded):
  - 0 VMs recorded.
  - The only "creations without a deletion" are two key mismatches in the plan's classification.
    The role's `DELETED` line names the role, while its `CONFIRMED` line holds the ARN. The
    default rules had no `DELETED` line, and one was added after the direct read.
- Tag index, by `run=1124-5415de` and by `purpose=equipo-hosted-dev` (19:26Z, and again at
  19:27Z): only the deleted default group `sg-0393fe63d3c4fa54a` and its rules
  `sgr-0eabb0a8499ad2b8d` and `sgr-07d4a701a0947630f` are still listed. That is index lag: the
  direct reads show them gone. Nothing else is listed.
- Left in AWS: nothing. Spend for attempt 2: about $0 (no VM, image, bucket, logs or topic).

Journal (attempt 2, intents and controller lines omitted, as in 10.9):

```
RUN 1124-5415de start pin=a7f505a0d69a2459062c83cb46baf7882e261c5f
COLLISION-CHECKS clean
CONFIRMED VPC vpc-0a9ff3150edc03416
CONFIRMED DEF_SG sg-0393fe63d3c4fa54a
CONFIRMED MAIN_RTB rtb-09519508746c93ec6
CONFIRMED DEF_ACL acl-0e7cd3a6c5a00fc51
CONFIRMED DEF_SG_RULES sgr-0eabb0a8499ad2b8d sgr-07d4a701a0947630f
CONFIRMED SUBNET subnet-0ed61e4aa0ff739ab
CONFIRMED RTB rtb-083c469ecf048d3c5
CONFIRMED RTB_ASSOC rtbassoc-01d2371400574d7b2
CONFIRMED SG sg-06a1e195e5f7a13dd
CONFIRMED OPERATOR_ROLE_ARN arn:aws:iam::640012953448:role/equipo-hosted-dev-t17-1124-5415de-conn-op
ABORT call failed (rc 254, InvalidParameterValueException):  | aws: [ERROR]: An error occurred (InvalidParameterValueException) when calling the CreateNetworkConnector operation: Encountered unauthorized operation while calling EC2 due to invalid ConnectorOperatorRole permissions
NOTCREATED connector equipo-hosted-dev-t17-1124-5415de-egress
DELETED security-group sg-06a1e195e5f7a13dd
DELETED route-table-association rtbassoc-01d2371400574d7b2
DELETED route-table rtb-083c469ecf048d3c5
DELETED subnet subnet-0ed61e4aa0ff739ab
DELETED vpc vpc-0a9ff3150edc03416
DELETED vpc-default-security-group sg-0393fe63d3c4fa54a
DELETED vpc-main-route-table rtb-09519508746c93ec6
DELETED vpc-default-network-acl acl-0e7cd3a6c5a00fc51
DELETED iam-role equipo-hosted-dev-t17-1124-5415de-conn-op
VERIFY direct reads: every recorded resource gone
DELETED vpc-default-security-group-rule sgr-0eabb0a8499ad2b8d gone with sg-0393fe63d3c4fa54a; describe-security-group-rules filter lists 0 (2026-11-25 19:26Z)
DELETED vpc-default-security-group-rule sgr-07d4a701a0947630f gone with sg-0393fe63d3c4fa54a; describe-security-group-rules filter lists 0 (2026-11-25 19:26Z)
TEARDOWN attempt 2 done: 10.3 as written; 10.4 operator-role lines only (build role never created); 10.1 10.2 10.5 10.6 10.7 skipped (never created)
```

VM ledger (`vms.tsv`): empty, no VM was launched.

### Attempt 3 (plan revision 4 at `c5f9bc36`, code `a7f505a0`, run `1126-c01121`)

Started 2026-11-26 11:18Z. Every block was extracted verbatim from `c5f9bc36` and run with the
agent sandbox off.

#### Attempt 3, section 0

- 0.1: code pin ok; aws-cli 2.36.10; go1.26.10. 0.1a: no earlier scratch, nothing to remove.
- 0.3: `640012953448`, `user/remote-agent`. 0.4: 0 live MicroVMs; nothing tagged
  `purpose=equipo-hosted-dev`; collision checks clean. Estimate: $0.21 (fixed items).

#### Attempt 3, section 1

- VPC `vpc-0fca2d577ca433d82`, DNS off; defaults `sg-04486f43343aa2423`, `rtb-0c96c86355176c103`,
  `acl-0de2037b6cfee48c7`, rules `sgr-0b198bb6a3fc81262` and `sgr-0262fe4480ff4ef56`, all tagged.
- Subnet `subnet-0404401a8cd7d255d`; route table `rtb-06096f98e685c2bc1` (local route only,
  associated); security group `sg-0df60ecf755a35e99` (no rules). Estimate: $0.21.

#### Attempt 3, section 2: stopped at 2.4 (safe stop run)

- 2.1: role `arn:aws:iam::640012953448:role/equipo-hosted-dev-t17-1126-c01121-conn-op`, narrow
  inline policy, 60 s wait (11:20:07Z to 11:21:13Z).
- 2.2, the connector:
  - Attempt 1 (11:21:21Z, 74 s after the role was created) was refused with the same error as
    attempt 2: `InvalidParameterValueException`, "invalid ConnectorOperatorRole permissions".
  - Attempt 2 (11:23:39Z, after a further 120 s) was refused the same way. Both were confirmed
    `NOTCREATED`. Propagation is therefore ruled out: the narrow policy lacks something the
    connector needs.
  - Fallback: the role got `AWSLambdaNetworkConnectorOperatorPolicy` plus an inline
    `t17-connector-eni-delete`.
  - Attempt 3 (11:26:58Z) was accepted: connector `nc-9027ec0e-413c-45c2-8233-70242dda0764`,
    `PENDING`. `CONN_OPERATOR_POLICY` = managed policy plus inline delete.
- 2.3: `ACTIVE` at 11:31:23Z, about 4.4 min after create (16 polls).
- 2.4 aborted: `connector version is [None]`. The installed CLI (aws-cli 2.36.10) has no `Version`
  field in `get-network-connector`, and none in the create reply either (its keys are Arn,
  Configuration, Id, Name, OperatorRole and State). This is U3, the old CLI model.
- Safe stop: S.1 no controller; S.2 nothing unresolved; S.3 skipped (no image). Estimate: 0 VMs,
  $0.21 (fixed items; real spend about $0).
- Left in place for Paul (S.4, no listed charge):
  - the VPC with its defaults, the subnet, the route table and its association, and the group;
  - the operator role, with the managed policy attached and the inline delete policy;
  - the ACTIVE connector and its Lambda-managed interfaces in the subnet. These were not recorded,
    because 2.4 stopped before its interface read.

#### Attempt 3, discovery against the live connector (Paul, 2026-11-28, discussion 46)

These were read-only calls on connector `nc-9027ec0e-413c-45c2-8233-70242dda0764`, behind the
account guard, at 14:59Z.

- The literal `--network-connector-identifier` flag fails CLI parameter validation (rc 252, no
  request sent). The CLI's flag is `--identifier`.
- `get-network-connector --identifier <arn>:1` succeeds: `Version` 1, `State` ACTIVE,
  `StateReason` "Initial creation", `LastModified` 2026-11-26T11:31:09Z. The CLI shows no
  `VersionArn`.
- The unqualified read's raw response body (from `--debug`) holds `LatestVersion: 1` and
  `LatestVersionArn: <arn>:1`. It has no `Version`, `VersionArn`, `StateReasonCode` or
  `LastUpdateStatus`. The CLI output drops `LatestVersion*`, so `--query Version` gives `None`
  (the cause of 2.4's abort). The response carries a `Date` header.
- Network interfaces: 0 in the run's VPC and 0 in its subnet while the connector is ACTIVE, so
  there were no `SERVICE-ENI` lines to journal.

#### Attempt 3, teardown (revision 4's section 10, as written)

- 10.1: no controller; `SKIP IMAGE_ARN`.
- 10.2: `delete-network-connector` at 15:00:00Z; DELETING at 15:00:03Z; not found by 15:00:19Z
  (about 19 s); interfaces in the VPC 0. No DELETE_FAILED.
- 10.3: deleted the group `sg-0df60ecf755a35e99`, association `rtbassoc-07254c8e1b8d2f5e6`,
  route table `rtb-06096f98e685c2bc1`, subnet `subnet-0404401a8cd7d255d` and VPC
  `vpc-0fca2d577ca433d82`. The defaults `sg-04486f43343aa2423` (with rules
  `sgr-0b198bb6a3fc81262` and `sgr-0262fe4480ff4ef56`), `rtb-0c96c86355176c103` and
  `acl-0de2037b6cfee48c7` were each confirmed gone by a filtered describe listing 0.
- 10.4: the operator role, its inline `t17-connector-eni-delete` and the
  `AWSLambdaNetworkConnectorOperatorPolicy` attachment removed; `get-role` gives `NoSuchEntity`.
  `SKIP BUILD_ROLE_ARN`.
- 10.5, 10.6 and 10.7: `SKIP` (bucket, log group and topic never created).
- 10.8:
  - 0 VMs.
  - Unmatched values: only `CONN_ID` (the deleted connector's ID) and the `CONN_OPERATOR_POLICY`
    label. Neither is a separate resource.
  - Tag index, by `run=1126-c01121` and by `purpose=equipo-hosted-dev`: only the deleted default
    group and its two rules, and the deleted connector. That is index lag; the direct reads show
    them gone.
- Left in AWS: nothing. Spend for attempt 3: about $0 (0 VMs; no image, bucket, logs or topic).

Journal (attempt 3, intents and controller lines omitted, as in 10.9):

```
RUN 1126-c01121 start pin=a7f505a0d69a2459062c83cb46baf7882e261c5f
COLLISION-CHECKS clean
CONFIRMED VPC vpc-0fca2d577ca433d82
CONFIRMED DEF_SG sg-04486f43343aa2423
CONFIRMED MAIN_RTB rtb-0c96c86355176c103
CONFIRMED DEF_ACL acl-0de2037b6cfee48c7
CONFIRMED DEF_SG_RULES sgr-0b198bb6a3fc81262 sgr-0262fe4480ff4ef56
CONFIRMED SUBNET subnet-0404401a8cd7d255d
CONFIRMED RTB rtb-06096f98e685c2bc1
CONFIRMED RTB_ASSOC rtbassoc-07254c8e1b8d2f5e6
CONFIRMED SG sg-0df60ecf755a35e99
CONFIRMED OPERATOR_ROLE_ARN arn:aws:iam::640012953448:role/equipo-hosted-dev-t17-1126-c01121-conn-op
REFUSED connector attempt 1:  | aws: [ERROR]: An error occurred (InvalidParameterValueException) when calling the CreateNetworkConnector operation: Encountered unauthorized operation while calling EC2 due to invalid ConnectorOperatorRole permissions
NOTCREATED connector attempt 1
REFUSED connector attempt 2:  | aws: [ERROR]: An error occurred (InvalidParameterValueException) when calling the CreateNetworkConnector operation: Encountered unauthorized operation while calling EC2 due to invalid ConnectorOperatorRole permissions
NOTCREATED connector attempt 2
FALLBACK operator role: AWSLambdaNetworkConnectorOperatorPolicy plus inline delete (Paul, 2026-11-25)
CONFIRMED OPERATOR_MANAGED_POLICY arn:aws:iam::aws:policy/AWSLambdaNetworkConnectorOperatorPolicy
CONFIRMED OPERATOR_INLINE_POLICY t17-connector-eni-delete
CONFIRMED CONN_OPERATOR_POLICY managed AWSLambdaNetworkConnectorOperatorPolicy plus inline delete
CONFIRMED CONN_ARN arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-9027ec0e-413c-45c2-8233-70242dda0764
CONFIRMED CONN_ID nc-9027ec0e-413c-45c2-8233-70242dda0764
TIMING connector-active
ABORT connector version is [None]
SKIP IMAGE_ARN none
DISCOVERY start (Paul 2026-11-28, disc 46): read-only, connector arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-9027ec0e-413c-45c2-8233-70242dda0764
FACT discovery a0: --network-connector-identifier rc=252 (CLI flag is --identifier)
FACT discovery a: :1 read ok, keys ["Arn","Configuration","Id","LastModified","Name","OperatorRole","State","StateReason","Version"], Version=1, State=ACTIVE
FACT discovery b: unqualified read rc=0, CLI keys ["Arn","Configuration","Id","LastModified","Name","OperatorRole","State","StateReason"], Date header present
FACT discovery c: 0 interfaces in the VPC, 0 in the subnet
SKIP IMAGE_ARN none
DELETED connector arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-9027ec0e-413c-45c2-8233-70242dda0764
DELETED security-group sg-0df60ecf755a35e99
DELETED route-table-association rtbassoc-07254c8e1b8d2f5e6
DELETED route-table rtb-06096f98e685c2bc1
DELETED subnet subnet-0404401a8cd7d255d
DELETED vpc vpc-0fca2d577ca433d82
DELETED vpc-default-security-group-rules sgr-0b198bb6a3fc81262 sgr-0262fe4480ff4ef56
DELETED vpc-default-security-group sg-04486f43343aa2423
DELETED vpc-main-route-table rtb-0c96c86355176c103
DELETED vpc-default-network-acl acl-0de2037b6cfee48c7
DELETED iam-role arn:aws:iam::640012953448:role/equipo-hosted-dev-t17-1126-c01121-conn-op
DELETED iam-inline-policy t17-connector-eni-delete
DELETED iam-managed-attachment arn:aws:iam::aws:policy/AWSLambdaNetworkConnectorOperatorPolicy
SKIP BUILD_ROLE_ARN none
SKIP BUCKET_CREATED none
SKIP LOG_GROUP_CREATED none
SKIP TOPIC_ARN none
```

VM ledger (`vms.tsv`): empty, no VM was launched.

### Revision 5 pre-flight: `livectl` (ruling R40)

- `internal/isolatedjob/awsjob/livectl` (package main, `hostedlive` on every file) makes each Lambda
  MicroVMs and Lambda core call of the live run through the pinned SDK. It has one subcommand per
  operation:
  - `connector` create, get, list-versions, wait-active, delete and wait-gone;
  - `image` base-versions, create, update, get, get-version, list, wait-version and delete;
  - `vm` run, get, list, suspend, resume, terminate and wait-state;
  - `caller`.
- Each subcommand prints the SDK's whole output struct as JSON (every field, null when absent).
  `ResultMetadata` shows the response's `ServerTime` and `RequestID`.
- Failures are one JSON line on stderr. Exit codes: 2 API, 3 usage, 4 guard, 5 wait timeout,
  6 failed state, 1 other.
- Guards:
  - account `640012953448` and region `eu-west-1` are build constants, checked through STS before
    any other call;
  - creates need a name (VM runs: the image's name and the client token) inside
    `equipo-hosted-dev-t17-RUN`;
  - deletes, updates and VM state changes read their target first.
- It sits inside the adapter subtree, so the provider guard needs no change.
- Runs:
  - `go test -tags hostedlive ./internal/isolatedjob/awsjob/livectl -count=1` ok;
  - `go vet -tags hostedlive ./internal/isolatedjob/...`, `make build vet` and `make budget`;
  - the Task 7 guard passes unchanged.
- No AWS call was made.

| Mutation | Command | Observed failure | Restored |
| --- | --- | --- | --- |
| Account and region guard skipped (`checkCaller` returns nil at once) | `go test -tags hostedlive ./internal/isolatedjob/awsjob/livectl -run TestAccountRegionGuard -count=1` | `main_test.go:469: livectl ["connector" "get" "-id" "nc-1"] = exit 0, want 4` | yes, passes |
| Run-prefix guard skipped (`inRun` returns nil at once) | `go test -tags hostedlive ./internal/isolatedjob/awsjob/livectl -run TestRunPrefixGuard -count=1` | `main_test.go:500: livectl ["connector" "create" "-name" "equipo-hosted-dev-t17-1128-abc123-conn" ...] = exit 0, want 4` | yes, passes |

#### livectl review round 1 (livectl-r1.md)

- **Endpoints (Critical).** `newClients` builds all three clients (STS, Lambda MicroVMs, Lambda core)
  with:
  - the configured endpoint dropped (`BaseEndpoint` nil), which covers `AWS_ENDPOINT_URL`,
    `AWS_ENDPOINT_URL_<SERVICE>` and a profile's `endpoint_url` or `services` section;
  - FIPS and dual-stack off, the region pinned to eu-west-1, and the SDK's default resolver.

  `TestClientsIgnoreEndpointOverrides` sets every override in the environment and a profile, then
  records each request's host offline. The hosts must equal the clean ones,
  `sts.eu-west-1.amazonaws.com` and `lambda.eu-west-1.amazonaws.com`.
- **Retries.** Every client uses `aws.NopRetryer` and `RetryMaxAttempts` 1, whatever
  `AWS_MAX_ATTEMPTS` and the profile's `max_attempts` and `retry_mode` say.
  `TestClientsOneAttempt` sends one request per call on a 500 and on a 429.
- **Deadlines.**
  - Every operation gets `callTimeout` (60 s) on its context through a stack middleware, the STS
    check included (`TestClientsBoundEachCall`).
  - Waits check their deadline before each read and again after it, so a late success is a
    timeout (`TestWaitNeverSucceedsLate`). They also put the deadline on the reads' context
    (`TestWaitEndsStalledRead`, a stalled read ending at a 1 s wait).
  - A 1m wait every 15 s now reads 4 times, not 5.
- **Evidence.**
  - The account and region guards each have their own test.
  - `TestRunPrefixGuard` has one subtest per guard, including the VM client token alone (an image
    in the run with a token outside it).
  - `TestServerTimePrinted` shows a populated `ResultMetadata.ServerTime` from a real client's
    response.
- Runs: the package's offline tests ok (1.6 s); tagged vets; `make build vet`; `make budget`; the
  Task 7 guard.

| Mutation (each alone) | Command (`go test -tags hostedlive ./internal/isolatedjob/awsjob/livectl -count=1 -run ...`) | Observed failure | Restored |
| --- | --- | --- | --- |
| Account check off | `TestAccountGuard$` | `main_test.go:469: livectl ["connector" "get" "-id" "nc-1"] = exit 0, want 4` | yes, passes |
| Region check off | `TestRegionGuard$` | `main_test.go:482: livectl ["-run" "1128-abc123" "vm" "terminate" "-id" "vm-1"] = exit 0, want 4` | yes, passes |
| connector create's prefix check off | `TestRunPrefixGuard/connector_create,_another_run` | `main_test.go:568: livectl [... "connector" "create" "-name" "equipo-hosted-dev-t17-other-conn" ...] = exit 0, want 4` | yes, passes |
| image create's prefix check off | `TestRunPrefixGuard/image_create` | `main_test.go:568: livectl [... "image" "create" "-name" "someone-else" ...] = exit 0, want 4` | yes, passes |
| vm run's image-name check off | `TestRunPrefixGuard/vm_run,_image_outside` | `main_test.go:568: livectl [... "vm" "run" "-image" "...:microvm-image:runner" ...] = exit 0, want 4` | yes, passes |
| vm run's client-token check off | `TestRunPrefixGuard/vm_run,_token_outside` | `main_test.go:568: livectl [... "vm" "run" "-image" "...:microvm-image:equipo-hosted-dev-t17-1128-abc123-image" ...] = exit 0, want 4` | yes, passes |
| connector delete's read-and-check off | `TestRunPrefixGuard/connector_delete` | `main_test.go:568: livectl ["-run" "1128-abc123" "connector" "delete" "-id" "nc-prod"] = exit 0, want 4` | yes, passes |
| image delete's read-and-check off | `TestRunPrefixGuard/image_delete` | `main_test.go:568: livectl ["-run" "1128-abc123" "image" "delete" "-id" "arn:runner"] = exit 0, want 4` | yes, passes |
| image update's read-and-check off | `TestRunPrefixGuard/image_update` | `main_test.go:568: livectl [... "image" "update" "-id" "arn:runner" ...] = exit 0, want 4` | yes, passes |
| VM change read-and-check off (terminate, suspend, resume) | `TestRunPrefixGuard/vm_terminate` | `main_test.go:568: livectl ["-run" "1128-abc123" "vm" "terminate" "-id" "vm-x"] = exit 0, want 4` | yes, passes |
| Wait: expiry check before each read off | `TestBoundedWaits$` | `main_test.go:601: reads in a 1m wait every 15s = 5, want 4` | yes, passes |
| Wait: expiry check after each read off | `TestWaitNeverSucceedsLate$` | `main_test.go:647: livectl ["connector" "wait-active" "-id" "nc-1" "-timeout" "1m"] = exit 0, want 5` | yes, passes |
| Wait: deadline not put on the reads' context | `TestWaitEndsStalledRead$` | `main_test.go:666: a 1s wait on a stalled read took 5.001910063s` | yes, passes |
| STS endpoint override kept | `TestClientsIgnoreEndpointOverrides$` | `clients_test.go:158: hosts under overrides = [evil-sts.invalid lambda.eu-west-1.amazonaws.com ...], want the standard [sts.eu-west-1.amazonaws.com ...]` | yes, passes |
| Lambda core retries kept | `TestClientsOneAttempt$` | `clients_test.go:186: status 500: 6 requests for two calls, want one each (no retries)` | yes, passes |
| STS per-call deadline dropped | `TestClientsBoundEachCall$` | `clients_test.go:210: stalled call 0 = ... request send failed, the request had no deadline, want the per-call deadline` | yes, passes |

#### livectl review round 2 (livectl-r2.md): static credentials only (R41)

- `resolveCredentials` (creds.go) runs once, in `main`, before the account check. It reads only the
  environment and the selected profile of the shared config and credentials files, and takes
  static keys: the environment's first, else the profile's.
- Refused with exit 4 and a fixed message naming the kind: web identity (profile or environment),
  SSO (session or legacy), `credential_process`, `credential_source` (container or instance
  metadata), assume role, login session, container credentials from the environment, and no static
  keys at all (named instance metadata, the SDK's last fallback).
- None of those providers is built. `main` no longer calls `LoadDefaultConfig`: the only config is
  the region plus a fixed provider that never expires (`fixedCredentials`). So no credential
  service client exists, nothing refreshes, and the per-call deadlines cover every request.
- Tests:
  - `TestCredentialKindsRefused`: eleven cases from config files in `t.TempDir` and the
    environment. Every credential service endpoint points at a counting 127.0.0.1 server, which
    sees 0 requests, and the `credential_process` marker is never written.
  - `TestStaticCredentialsAccepted`: profile keys, and environment keys winning over a role
    profile.
  - `TestCredentialsNeverRefresh`: two requests are signed with the first keys after the
    environment changes.
  - `TestClientsIgnoreEndpointOverrides` also runs the production path, resolved keys plus
    `staticConfig`.
- Runs: the package's offline tests ok; tagged vets; `make build vet`; `make budget`; the Task 7
  guard; `go mod tidy -diff` clean.

| Mutation (each alone) | Command (`go test -tags hostedlive ./internal/isolatedjob/awsjob/livectl -count=1 -run ...`) | Observed failure | Restored |
| --- | --- | --- | --- |
| `credential_process` allowed | `TestCredentialKindsRefused/credential_process` | `creds_test.go:99: resolveCredentials = <nil>, want a guard refusal naming "credential_process"` | yes, passes |
| Assume role allowed | `TestCredentialKindsRefused/assume_role` | `creds_test.go:99: resolveCredentials = guard: credentials from instance metadata are refused ..., want a guard refusal naming "assume role"` | yes, passes |
| Web identity from the environment allowed | `TestCredentialKindsRefused/web_identity_in_the_environment` | `creds_test.go:99: ... credentials from instance metadata are refused ..., want a guard refusal naming "web identity"` | yes, passes |
| Refresh re-enabled (keys re-read on every Retrieve) | `TestCredentialsNeverRefresh$` | `creds_test.go:168: requests signed with [AKIDFIRST AKIDSECOND], want the first keys twice` | yes, passes |

### Attempt 4 (plan revision 5 at `52a771ad`, code `bdf85fb7`, run `1128-4ba61b`)

Started 2026-11-28 17:54Z. Every block was written verbatim to `$T17/blocks/<block>.sh` and run
with `bash`, sandbox off; Lambda calls go through livectl.

#### Attempt 4, section 0

- 0.1: code pin ok (`bdf85fb7`); livectl offline tests ok. 0.1a: nothing to remove.
- 0.2: livectl built.
- 0.3: CLI and livectl both see `640012953448` in `eu-west-1`, so the exported static keys work
  (U23).
- 0.4: nothing tagged; collision checks clean. Estimate $0.21.

#### Attempt 4, section 1

- VPC `vpc-0048e6026eda29270`, DNS off; defaults `sg-0fcee04c7a190c689`, `rtb-0f0e150517b1ef66e`,
  `acl-08cc47b20377a1a05` and rules `sgr-0114f9753b21dd97f` and `sgr-054d5184b83c894d5`, all
  tagged.
- Subnet `subnet-0e4cc358228df4994`; route table `rtb-0c24bb2e599df089d`; group
  `sg-0cb56fe86467e152b`. Every readback ok, no FINDING. Estimate $0.21.

#### Attempt 4, section 2

- 2.1: operator role `equipo-hosted-dev-t17-1128-4ba61b-conn-op` with the managed connector policy
  plus the inline subnet-scoped delete; 120 s wait.
- 2.2: connector `nc-2e892a59-0945-4534-89e9-c636b111fede`, accepted on the first call
  (17:59:08Z). The SDK create reply carries `Version` 1 and `VersionArn <arn>:1`.
- 2.3: ACTIVE at 18:03:27Z (about 4.3 min).
- 2.4:
  - The `:1` read is this run's ACTIVE connector, with no Elastic IP configuration.
  - The unqualified read shows `LatestVersion` 1 and `LatestVersionArn <arn>:1` (Version null).
  - One version listed (1, ACTIVE). There are 0 interfaces while the connector is ACTIVE.
- Estimate $0.21.

#### Attempt 4, sections 3 and 4

- Bucket `equipo-hosted-dev-t17-1128-4ba61b-640012953448`, log group
  `/aws/lambda-microvms/equipo-hosted-dev-t17-1128-4ba61b` (1 day), build role
  `...-build` (60 s wait).
- Artifact `t17/app.zip`, digest
  `sha256:ca59e2a1a77f2e44e2b43429073fce30f663ed867d6e444d58fdb29ebaa938c4`; S3 checksum and tag
  ok.
- 3.6: base `al2023-1` versions 4 and 3 are AVAILABLE with ARM_64 and X86_64; 2, 1 and 0 are ARM_64
  only. 4 was chosen, with 3 as the step down.
- 3.7: image `arn:aws:lambda:eu-west-1:640012953448:microvm-image:equipo-hosted-dev-t17-1128-4ba61b`
  created at once (18:05:20Z), Small version `1.0`.
- 3.8: Small `1.0` SUCCESSFUL ACTIVE at 18:07:11Z (about 1.8 min). The adapter's fields match. The
  version carries the image tags (U19).
- 3.9: Large version `2.0` built by 18:09:10Z (about 1.8 min); Small still SUCCESSFUL ACTIVE.
- 4: topic `arn:aws:sns:eu-west-1:640012953448:equipo-hosted-dev-t17-1128-4ba61b-alerts`, tagged,
  no subscriptions.
- 0 FINDING. Estimate $0.21.

#### Attempt 4, section 5

- 5.1 to 5.5: keys (`task17-instance` instance, `task17-operator` operator); ports free; configs
  written with `connector_arn` `<arn>:1` and `egress: []`; both controller builds; driver env.
- 5.6, the audit-only controller:
  - Ready at once: `network_audit_passing 1`, `reap_last_error 0`, `store_readable 1`. It listened
    on 127.0.0.1:18443 and :18444, reported "launches enabled: false", and stopped with exit 0.
  - The database holds `provider_bound` (`aws:640012953448:eu-west-1`) and no audit failures.
  - FINDING: "no network audit passed". The database has no `network_audit_passed` row, because
    the controller writes that row only when an audit passes again after failing
    (`internal/hostedctl/reaper.go:747`, "network audit passes again"). A first pass writes no row.
    The plan's check expects one, so `AUDIT_OK=no` and, by the plan's own branch, sections 7 and 8
    are skipped (FINDINGs). Sections 6 and 9 still run.

#### Attempt 4, facts 9.A to 9.F (R7)

- U21: A1 launched with the qualified egress ARN (`<conn>:1`), so RunMicrovm accepts it.
- First real MicroVM ID: `microvm-a8f71284-6226-3160-835a-8f2ba037b9f0`, 44 characters, inside
  R36's form. The format is `microvm-<uuid>`, not `mvm-` (U17): the plan's log harvest pattern
  `mvm-...` does not match it. Image-scoped scans are the inventory.
- A2 (same token, same body): `same-vm`.
- A3 (same token, new payload): refused `ValidationException`, "The provided clientToken was used
  with different request parameters."
- startedAt:
  - The PENDING reply carries `StartedAt` 18:10:24.835Z, inside the call window 18:10:23.815Z to
    18:10:24.878Z.
  - The first read at 18:10:39.8Z was already RUNNING, with the same `StartedAt`.
- Echoes:
  - ingress `[...:aws-network-connector:NO_INGRESS]`, the exact literal;
  - egress `[<conn>:1]`;
  - max 600;
  - ExecutionRoleArn null, IdlePolicy null.
- Date header on GetMicrovm: present (`ServerTime` 18:10:40Z). List: not measured.
- 0 interfaces in the VPC while VM_A ran.
- 9.C:
  - resume on RUNNING `accepted` (not ConflictException);
  - suspend 18:10:47.1Z, SUSPENDED by 18:10:49 (about 2 s);
  - suspend on SUSPENDED `accepted`;
  - resume 18:10:50.1Z, then a second resume `accepted:after-first-resume`;
  - RUNNING at 18:10:54 (about 4 s).
- 9.D, payload (ASCII): 4096 accepted; 4097 refused `ValidationException`, "Value at
  'runHookPayload' failed to satisfy constraint: Member must have length less than or equal to
  4096".
- 9.E:
  - VM_A ended at 18:11:40Z; a second terminate was accepted.
  - E1 (the original token after the VM ended) returned `same-ended-vm`, with no new VM.
- 9.F: at 18:12:48Z, 68 s after the end, Get still answers TERMINATED and the image list still
  shows VM_A.
- Estimate: 2 VMs, 0.02 VM-hours, $0.22.

#### Attempt 4, section 6 (contract)

- 6.1, 18:13:05Z to 18:14:01Z:
  - `TestLiveContract` took 35 s. 8 subtests passed: LaunchIdempotentOnAttempt, StopTwice,
    StopUnknownRef, GetAfterStop, SuspendResumeRoundTrip, ResumeRunningIsNoop,
    OversizeBootstrapRefusedBeforeProvider and LimitsAreSane.
  - One failed, recorded as a FINDING: `ChangedSpecConflicts` [known]. RunMicrovm answered 400
    `ValidationException` "The provided clientToken was used with different request parameters",
    which the adapter does not map to `ErrConflict`.
  - 7 contract VMs, all settled (9 VMs recorded in the run). 0 interfaces in the VPC.
- Delays: Get showed each new VM 46 to 76 ms after Launch returned, on the first read. List showed
  a running VM 49 ms after Get did, on the first list. The pre-flight's 60 s and 30 s were guesses.
- Estimate: 9 VMs, 0.10 VM-hours, $0.23.

#### Attempt 4, sections 7 and 8, and 9.G

- 7.1 and 8.1: FINDINGs "section 7 skipped" and "section 8 skipped". The 5.6 check found no
  `network_audit_passed` row (see section 5). 7.2, 7.3, 7.4 and 8.2 ran their skip branches (7.4
  settled: 9 VMs, none live). The controller sequence, the crash and replay check, and orphan
  reaping were **not measured**.
- 9.G: G1 (the original token, 7 min after first use) returned `same-ended-vm`, so the token window
  is at least 7 min. The planned 3 to 4 h point was not reached, because 7 and 8 were skipped.
- 9.F again at 18:18:09Z, 6.5 min after VM_A ended: Get still answers TERMINATED, and the image
  list (9 VMs) still shows VM_A.
- Estimate: 9 VMs, 0.10 VM-hours, $0.23.

#### Attempt 4, teardown (section 10) and verification

- 10.1:
  - No controller was running; settled (9 VMs, none live).
  - `image delete` at about 18:19:22Z; DELETING until 18:20:31Z, gone from the list at 18:20:48Z.
  - Versions `1.0` and `2.0` were confirmed deleted.
- 10.2:
  - 0 interfaces before the delete. The connector delete started 18:20:59Z; `wait-gone` ok; 0
    interfaces at 18:21:12Z (about 13 s).
  - No DELETE_FAILED, so the fallback was not needed. Interface cleanup was still not exercised:
    no interface ever appeared in the subnet, even with VMs running (U2 delete half still
    untested).
- 10.3: deleted group `sg-0cb56fe86467e152b`, association `rtbassoc-092fc8d3d9525599f`, route
  table `rtb-0c24bb2e599df089d`, subnet `subnet-0e4cc358228df4994` and VPC `vpc-0048e6026eda29270`.
  Its defaults (`sg-0fcee04c7a190c689` with its two rules, `rtb-0f0e150517b1ef66e`,
  `acl-08cc47b20377a1a05`) were each confirmed gone by a filtered describe listing 0.
- 10.4: the operator role (managed attachment and inline delete policy removed) and the build role
  were deleted; `get-role` gives `NoSuchEntity` for both.
- 10.5: object and bucket deleted (bucket gone from the list at 18:22:28Z).
- 10.6: log group deleted. 10.7: topic deleted (gone from the list at 18:22:43Z).
- 10.8:
  - Unmatched values are settings, tokens, times and results only. Every resource ID has a
    `DELETED` line.
  - 9 VMs recorded, each confirmed ended.
  - Every intent has its confirmation (A3 and P4097 were confirmed refusals).
  - Tag index, by `run=1128-4ba61b` and by `purpose=equipo-hosted-dev`: only the deleted default
    group and its two rules, and the deleted connector. That is index lag; the direct reads show
    them gone.
- Left in AWS: nothing.

#### Attempt 4, spend (11.2) and VM lifetimes

The provider's startedAt runs to the confirmed end (VMGONE), which is an upper bound.

| VM | Source | Start | Confirmed end | Life |
| --- | --- | --- | --- | --- |
| microvm-a8f71284-6226-3160-835a-8f2ba037b9f0 | A1 (also A2, E1, G1) | 18:10:24 | 18:11:40 | 75 s |
| microvm-c1202e70-5391-3804-be8c-bca46b857d8c | P4096 | 18:11:07 | 18:11:20 | 13 s |
| microvm-f0bb78f1-ce19-3bfb-84d3-30d771b46c5f | contract | 18:13:08 | 18:13:59 | 51 s |
| microvm-fd98b38b-21f3-3291-bb56-9da85641cca7 | contract | 18:13:09 | 18:14:01 | 52 s |
| microvm-352f0d76-82c3-3873-985e-774c9ac396d2 | contract | 18:13:09 | 18:13:52 | 43 s |
| microvm-a9fcaa7f-74a1-3d91-8c81-58a587387199 | contract | 18:13:10 | 18:13:55 | 45 s |
| microvm-084a6ecb-1fbd-304f-91b1-292c3595df7f | contract | 18:13:16 | 18:13:47 | 31 s |
| microvm-bf348b8e-9b92-3296-8a16-05f39bbe7347 | contract | 18:13:32 | 18:13:57 | 25 s |
| microvm-14ef54d4-957e-3570-bf6b-1f5395b284d7 | contract | 18:13:37 | 18:13:50 | 13 s |

Total 348 s (0.10 VM-hours). 11.2 estimate: $0.23. That is about $0.02 of compute; the rest is
fixed items (image storage minimum, builds, small items, pause cycles). Paul reads the bill.

#### Attempt 4, FINDINGs (4)

1. 18:09:57Z, 5.6 "no network audit passed". This is a plan defect: the controller writes
   `network_audit_passed` only on a fail-to-pass transition (`reaper.go:747`). The metric showed
   `network_audit_passing 1`.
2. 18:15:04Z, contract `ChangedSpecConflicts` [known]: the `ValidationException` "The provided
   clientToken was used with different request parameters" is not mapped to `ErrConflict`.
3. 18:15:29Z, section 7 skipped (follows from 1).
4. 18:16:45Z, section 8 skipped (follows from 1).

Journal (attempt 4, intents and controller lines omitted, as in 10.9):

```
RUN 1128-4ba61b start pin=bdf85fb70f26094b99241de3f1285de92a76a759
COLLISION-CHECKS clean
CONFIRMED VPC vpc-0048e6026eda29270
CONFIRMED DEF_SG sg-0fcee04c7a190c689
CONFIRMED MAIN_RTB rtb-0f0e150517b1ef66e
CONFIRMED DEF_ACL acl-08cc47b20377a1a05
CONFIRMED DEF_SG_RULES sgr-0114f9753b21dd97f sgr-054d5184b83c894d5
CONFIRMED SUBNET subnet-0e4cc358228df4994
CONFIRMED RTB rtb-0c24bb2e599df089d
CONFIRMED RTB_ASSOC rtbassoc-092fc8d3d9525599f
CONFIRMED SG sg-0cb56fe86467e152b
CONFIRMED OPERATOR_ROLE_ARN arn:aws:iam::640012953448:role/equipo-hosted-dev-t17-1128-4ba61b-conn-op
CONFIRMED OPERATOR_MANAGED_POLICY arn:aws:iam::aws:policy/AWSLambdaNetworkConnectorOperatorPolicy
CONFIRMED OPERATOR_INLINE_POLICY t17-connector-eni-delete
CONFIRMED CONN_ARN arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-2e892a59-0945-4534-89e9-c636b111fede
CONFIRMED CONN_ID nc-2e892a59-0945-4534-89e9-c636b111fede
CONFIRMED CONN_OPERATOR_POLICY managed AWSLambdaNetworkConnectorOperatorPolicy plus inline delete
FACT connector create reply: {"State":"PENDING","Version":1,"VersionArn":"arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-2e892a59-0945-4534-89e9-c636b111fede:1","LatestVersion":null,"LatestVersionArn":null}
TIMING connector-active
CONFIRMED CONN_VERSION 1
CONFIRMED CONN_QARN arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-2e892a59-0945-4534-89e9-c636b111fede:1
FACT unqualified read: {"Version":null,"VersionArn":null,"LatestVersion":1,"LatestVersionArn":"arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-2e892a59-0945-4534-89e9-c636b111fede:1","ServerTime":"2026-11-28T18:03:38Z"}
FACT connector versions: [{"Version":1,"VersionArn":"arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-2e892a59-0945-4534-89e9-c636b111fede:1","State":"ACTIVE"}]
FACT interfaces in the VPC (2.4, connector ACTIVE): 0
CONFIRMED BUCKET_CREATED equipo-hosted-dev-t17-1128-4ba61b-640012953448
CONFIRMED LOG_GROUP_CREATED /aws/lambda-microvms/equipo-hosted-dev-t17-1128-4ba61b
CONFIRMED BUILD_ROLE_ARN arn:aws:iam::640012953448:role/equipo-hosted-dev-t17-1128-4ba61b-build
CONFIRMED DIGEST sha256:ca59e2a1a77f2e44e2b43429073fce30f663ed867d6e444d58fdb29ebaa938c4
CONFIRMED ARTIFACT_B64 ylnioad/LkTitDQpBz/OMPZj7YZ9bkRNWP2ynrqpOMQ=
CONFIRMED ARTIFACT s3://equipo-hosted-dev-t17-1128-4ba61b-640012953448/t17/app.zip
CONFIRMED BASE_ARN arn:aws:lambda:eu-west-1:aws:microvm-image:al2023-1
CONFIRMED BASE_VER 4
CONFIRMED BASE_VER_DOWN 3
CONFIRMED IMAGE_ARN arn:aws:lambda:eu-west-1:640012953448:microvm-image:equipo-hosted-dev-t17-1128-4ba61b
CONFIRMED VER_SMALL 1.0
CONFIRMED BASE_VER_USED 4
FACT Small version: {"ImageVersion":"1.0","State":"SUCCESSFUL","Status":"ACTIVE","Tags":{"purpose":"equipo-hosted-dev","run":"1128-4ba61b"}}
TIMING image-small-built
CONFIRMED VER_LARGE 2.0
CONFIRMED TOPIC_ARN arn:aws:sns:eu-west-1:640012953448:equipo-hosted-dev-t17-1128-4ba61b-alerts
FINDING no network audit passed
CONFIRMED AUDIT_OK no
CONFIRMED TOKEN_A equipo-hosted-dev-t17-1128-4ba61b-token-a
CONFIRMED A1_BEFORE 2026-11-28T18:10:23.815Z
VM microvm-a8f71284-6226-3160-835a-8f2ba037b9f0 A1 2026-11-28T18:10:24.835Z
CONFIRMED A1_AFTER 2026-11-28T18:10:24.878Z
CONFIRMED VM_A microvm-a8f71284-6226-3160-835a-8f2ba037b9f0
FIRST-VM-ID microvm-a8f71284-6226-3160-835a-8f2ba037b9f0 (length 44)
VM microvm-a8f71284-6226-3160-835a-8f2ba037b9f0 A2 2026-11-28T18:10:24.835Z
CONFIRMED A2_RESULT same-vm
CONFIRMED A3_RESULT refused:ValidationException
FACT A3 message: The provided clientToken was used with different request parameters.
FACT interfaces in the VPC (9.B, VM_A running): 0
FACT VM_A echoes: {"IngressNetworkConnectors":["arn:aws:lambda:eu-west-1:aws:network-connector:aws-network-connector:NO_INGRESS"],"EgressNetworkConnectors":["arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-2e892a59-0945-4534-89e9-c636b111fede:1"],"MaximumDurationInSeconds":600,"ExecutionRoleArn":null,"IdlePolicy":null,"StartedAt":"2026-11-28T18:10:24.835Z"}
CONFIRMED DATE_HEADER_get present
FACT GetMicrovm Date header: 2026-11-28T18:10:40Z
CONFIRMED DATE_HEADER_list not measured: livectl prints no metadata for lists
CONFIRMED RESUME_ON_RUNNING accepted
CONFIRMED SUSPEND_AT 2026-11-28T18:10:47.133Z
CONFIRMED SUSPEND_ON_SUSPENDED accepted
CONFIRMED RESUME_AT 2026-11-28T18:10:50.082Z
CONFIRMED SECOND_RESUME accepted:after-first-resume
VM microvm-c1202e70-5391-3804-be8c-bca46b857d8c P4096 2026-11-28T18:11:07.181Z
VMGONE microvm-c1202e70-5391-3804-be8c-bca46b857d8c TERMINATED
CONFIRMED PAYLOAD_4096 accepted
CONFIRMED PAYLOAD_4097 refused:ValidationException
FACT payload 4097 message: 1 validation error detected: Value at 'runHookPayload' failed to satisfy constraint: Member must have length less than or equal to 4096
VMGONE microvm-a8f71284-6226-3160-835a-8f2ba037b9f0 TERMINATED
CONFIRMED VM_A_ENDED 2026-11-28T18:11:40Z
CONFIRMED TERMINATE_AGAIN ok
VM microvm-a8f71284-6226-3160-835a-8f2ba037b9f0 E1 2026-11-28T18:10:24.835Z
CONFIRMED E1_RESULT same-ended-vm
VM microvm-c1202e70-5391-3804-be8c-bca46b857d8c scan 2026-11-28T18:11:07.181Z
VM microvm-a8f71284-6226-3160-835a-8f2ba037b9f0 scan 2026-11-28T18:10:24.835Z
SETTLED 2 recorded
VISIBILITY VM_A TERMINATED since 2026-11-28T18:11:40Z
PHASE 6-contract.json start 2026-11-28T18:13:07.063Z
PHASE 6-contract.json end rc=1
FACT interfaces in the VPC (6.1, after the contract): 0
VM microvm-bf348b8e-9b92-3296-8a16-05f39bbe7347 scan 2026-11-28T18:13:32.148Z
VM microvm-a9fcaa7f-74a1-3d91-8c81-58a587387199 scan 2026-11-28T18:13:10.542Z
VM microvm-fd98b38b-21f3-3291-bb56-9da85641cca7 scan 2026-11-28T18:13:09.091Z
VM microvm-f0bb78f1-ce19-3bfb-84d3-30d771b46c5f scan 2026-11-28T18:13:08.282Z
VM microvm-084a6ecb-1fbd-304f-91b1-292c3595df7f scan 2026-11-28T18:13:16.431Z
VM microvm-352f0d76-82c3-3873-985e-774c9ac396d2 scan 2026-11-28T18:13:09.752Z
VM microvm-14ef54d4-957e-3570-bf6b-1f5395b284d7 scan 2026-11-28T18:13:37.597Z
VMGONE microvm-084a6ecb-1fbd-304f-91b1-292c3595df7f TERMINATED
VMGONE microvm-14ef54d4-957e-3570-bf6b-1f5395b284d7 TERMINATED
VMGONE microvm-352f0d76-82c3-3873-985e-774c9ac396d2 TERMINATED
VMGONE microvm-a9fcaa7f-74a1-3d91-8c81-58a587387199 TERMINATED
VMGONE microvm-bf348b8e-9b92-3296-8a16-05f39bbe7347 TERMINATED
VMGONE microvm-f0bb78f1-ce19-3bfb-84d3-30d771b46c5f TERMINATED
VMGONE microvm-fd98b38b-21f3-3291-bb56-9da85641cca7 TERMINATED
SETTLED 9 recorded
FINDING contract TestLiveContract/ChangedSpecConflicts failed [known: refusal not mapped to ErrConflict]:     contract.go:179: Launch with the same attempt and a new bootstrap = ("", awsjob: run: isolatedjob: invalid request: operation error Lambda Microvms: RunMicrovm, https response error StatusCode: 400, RequestID: 3120a8c3-bb78-4127-9a41-a268f4c66734, ValidationException: The provided clientToken was used with different request parameters.), want ErrConflict 
FINDING section 7 skipped: the 5.6 audit did not pass
CONFIRMED SKIP_7 yes
SETTLED 9 recorded
FINDING section 8 skipped: the 5.6 audit did not pass
CONFIRMED SKIP_8 yes
VM microvm-a8f71284-6226-3160-835a-8f2ba037b9f0 G1 2026-11-28T18:10:24.835Z
CONFIRMED G1_RESULT same-ended-vm
SETTLED 9 recorded
VISIBILITY VM_A TERMINATED since 2026-11-28T18:11:40Z
SETTLED 9 recorded
DELETED microvm-image arn:aws:lambda:eu-west-1:640012953448:microvm-image:equipo-hosted-dev-t17-1128-4ba61b
DELETED microvm-image-version arn:aws:lambda:eu-west-1:640012953448:microvm-image:equipo-hosted-dev-t17-1128-4ba61b:1.0
DELETED microvm-image-version arn:aws:lambda:eu-west-1:640012953448:microvm-image:equipo-hosted-dev-t17-1128-4ba61b:2.0
FACT interfaces in the VPC (10.2, before the connector delete): 0
DELETED connector arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-2e892a59-0945-4534-89e9-c636b111fede
DELETED security-group sg-0cb56fe86467e152b
DELETED route-table-association rtbassoc-092fc8d3d9525599f
DELETED route-table rtb-0c24bb2e599df089d
DELETED subnet subnet-0e4cc358228df4994
DELETED vpc vpc-0048e6026eda29270
DELETED vpc-default-security-group-rules sgr-0114f9753b21dd97f sgr-054d5184b83c894d5
DELETED vpc-default-security-group sg-0fcee04c7a190c689
DELETED vpc-main-route-table rtb-0f0e150517b1ef66e
DELETED vpc-default-network-acl acl-08cc47b20377a1a05
DELETED iam-role arn:aws:iam::640012953448:role/equipo-hosted-dev-t17-1128-4ba61b-conn-op
DELETED iam-inline-policy t17-connector-eni-delete
DELETED iam-managed-attachment arn:aws:iam::aws:policy/AWSLambdaNetworkConnectorOperatorPolicy
DELETED iam-role arn:aws:iam::640012953448:role/equipo-hosted-dev-t17-1128-4ba61b-build
DELETED s3-object s3://equipo-hosted-dev-t17-1128-4ba61b-640012953448/t17/app.zip
DELETED s3-bucket equipo-hosted-dev-t17-1128-4ba61b-640012953448
DELETED log-group /aws/lambda-microvms/equipo-hosted-dev-t17-1128-4ba61b
DELETED sns-topic arn:aws:sns:eu-west-1:640012953448:equipo-hosted-dev-t17-1128-4ba61b-alerts
```

VM ledger (`vms.tsv`):

```
microvm-a8f71284-6226-3160-835a-8f2ba037b9f0	A1	2026-11-28T18:10:24.835Z	2026-11-28T18:10:24.876Z
microvm-a8f71284-6226-3160-835a-8f2ba037b9f0	A2	2026-11-28T18:10:24.835Z	2026-11-28T18:10:25.906Z
microvm-c1202e70-5391-3804-be8c-bca46b857d8c	P4096	2026-11-28T18:11:07.181Z	2026-11-28T18:11:07.287Z
microvm-a8f71284-6226-3160-835a-8f2ba037b9f0	E1	2026-11-28T18:10:24.835Z	2026-11-28T18:11:42.363Z
microvm-c1202e70-5391-3804-be8c-bca46b857d8c	scan	2026-11-28T18:11:07.181Z	2026-11-28T18:11:43.399Z
microvm-a8f71284-6226-3160-835a-8f2ba037b9f0	scan	2026-11-28T18:10:24.835Z	2026-11-28T18:11:43.402Z
microvm-bf348b8e-9b92-3296-8a16-05f39bbe7347	scan	2026-11-28T18:13:32.148Z	2026-11-28T18:13:45.292Z
microvm-a9fcaa7f-74a1-3d91-8c81-58a587387199	scan	2026-11-28T18:13:10.542Z	2026-11-28T18:13:45.295Z
microvm-fd98b38b-21f3-3291-bb56-9da85641cca7	scan	2026-11-28T18:13:09.091Z	2026-11-28T18:13:45.298Z
microvm-f0bb78f1-ce19-3bfb-84d3-30d771b46c5f	scan	2026-11-28T18:13:08.282Z	2026-11-28T18:13:45.301Z
microvm-084a6ecb-1fbd-304f-91b1-292c3595df7f	scan	2026-11-28T18:13:16.431Z	2026-11-28T18:13:45.304Z
microvm-352f0d76-82c3-3873-985e-774c9ac396d2	scan	2026-11-28T18:13:09.752Z	2026-11-28T18:13:45.308Z
microvm-14ef54d4-957e-3570-bf6b-1f5395b284d7	scan	2026-11-28T18:13:37.597Z	2026-11-28T18:13:45.313Z
microvm-a8f71284-6226-3160-835a-8f2ba037b9f0	G1	2026-11-28T18:10:24.835Z	2026-11-28T18:17:00.602Z
```

## Client token conflict mapping (2026-11-30, after attempt 4)

Paul approved the fix on 2026-11-30. RunMicrovm's ValidationException "The
provided clientToken was used with different request parameters." now maps
to ErrConflict (op "run" only, message substring match); every other
ValidationException keeps ErrInvalid. hostedctl treats ErrConflict and
ErrInvalid from Launch alike (providerError, settle; both leave the intent
waiting for Replay), so the outward change is the HTTP answer for that
refusal: 409 "conflict" with its fixed message instead of 400 "invalid".

- Red: TestClientTokenReuseConflicts/launch_token_reuse failed with
  "invalid request ... want isolatedjob: conflict" before the change.
- Green: `go test -count=1 -run 'TestClientTokenReuseConflicts|TestErrorMapping' ./internal/isolatedjob/awsjob/` ok;
  `-run TestFakeContract ./internal/isolatedjob/`: ChangedSpecConflicts PASS (fake and late-visibility fake).
- M1 drop the run-only condition: get_same_text fails.
- M2 every ValidationException conflicts: TestErrorMapping/launch_ValidationException,
  payload_limit, other_validation, empty_message fail.
- M3 remove the case: launch_token_reuse fails.
- Astra round 1: APPROVED; its Minor (wrapped error, nil Message) folded in
  as two more rows. M4 replace errors.As with a direct type assertion:
  launch_token_reuse_wrapped fails.

## Task 17b live run (attempt 5)

Plan `docs/superpowers/plans/2026-11-30-hosted-1a-task17b-live-plan.md` revision 1 (`78620c94`),
code `bf29344a`, account `640012953448` (profile `kass`), `eu-west-1`. Paul's GO on discussion 46,
2026-11-30. Run `1130-b8103a4`, 2026-11-30 12:11:24Z (0.1) to 12:56:57Z (last 11.2). Every block
ran as a script with the agent sandbox off; the long blocks and every controller start ran as
`t17b-1130-b8103a4-*` systemd user units (R44, R45). No hard stop, no safe stop, no FINDING.

### Results by section

- 0: code pin ok, livectl and awsjob offline tests ok; probe unit passed (only allowlisted names,
  `signal:TERM`); `640012953448` `user/remote-agent`; nothing tagged `purpose=equipo-hosted-dev`;
  collision checks clean. Estimate $0.04.
- 1: VPC `vpc-044330dab8f4229a7` (DNS off, defaults tagged), subnet `subnet-0cff01091869c19d6`,
  route table `rtb-0096777df771ccfe1` (local only), group `sg-02a1457da3166e23b` (no rules). $0.04.
- 2: operator role with the managed policy plus the scoped inline delete; connector
  `nc-bed72ef5-97cd-4de7-9f24-9ed16f559115` accepted on the first call, ACTIVE after about 4.4 min;
  version-1 read ACTIVE, no Elastic IP configuration, 0 interfaces. $0.04.
- 3: bucket, log group (1-day retention), build role; base `al2023-1` version 4 (step-down 3
  recorded, not used); image created first attempt; Small version `1.0` SUCCESSFUL ACTIVE in about
  1.8 min, adapter fields match. $0.12.
- 4: SNS topic `equipo-hosted-dev-t17-1130-b8103a4-alerts`, 0 subscriptions. $0.12.
- 5: keys, configs (`small` only), both binaries; 5.6 audit-only start: `network_audit_passing 1`,
  `reap_last_error 0`, one `provider_bound` row for `aws:640012953448:eu-west-1`, no failure rows,
  0 `network_audit_passed` rows, exit 0. `AUDIT_OK=yes`. $0.12.
- 6: `ChangedSpecConflicts` PASS live; Get showed the new VM 74 ms after Launch; 1 VM settled. $0.13.
- 7: sequence, crash and Replay all as expected (record lines below). $0.14.
- 8: orphan stopped by the reaper at P+12:00, alert sent to SNS (record lines below). $0.18.
- 10: image gone in about 1.5 min; connector deleted on the first try (no fallback), 0 interfaces
  before and after; network, roles, S3, log group and topic deleted, each proven by a direct read.
  10.8: 4 VMs recorded, all confirmed ended; every resource has a `DELETED` line; the tag index
  still listed the default group, its two rules and the connector (all confirmed deleted: index
  lag). 10.9: no FINDING lines.

### Task 17b record (11.3)

- ChangedSpecConflicts: `CONTRACT_CSC=pass` (the `5f6e3e65` mapping works live).
- Sequence `task17-seq-7807b95d`: `timings: launch_call=267.257682ms to_running=50.255454856s drain_call=19.320561ms quiescent_call=19.669692ms suspend_call=106.056101ms to_suspended=1m0.468246276s resume=5.292139829s resume_calls=2 epoch=1 to_running_after_resume=37.169217ms stop_to_proof=5.30378646s stop_calls=2`;
  epoch 0 -> 1; job `stopped` with proof; audit rows launch_intent, launch_started, drain,
  quiescent, suspend_requested, suspend_settled, resume_prepared, resume_continued,
  resume_committed, stop_requested, stop_repeated, stop_proven.
- Crash `task17-crash-11514c54`: the launch call saw the controller go away 278 ms in; exit status
  137; crash VM `microvm-7571e222-fc51-3a46-8bbc-62f2c42c9c32` RUNNING; job `waiting` with no ref;
  `launch_intent` row.
- Recover: the restarted unit's `env -i` argv had no crash switch; TestLiveCrashRecovery PASS; the
  job held the crash VM 55 s after the first read (Replay on the second reaper pass, 60 s after the
  first pass sighted the VM as `orphan_seen`); `replay_started`, `restart_rebased` (age 1m26s),
  `stop_requested`, `stop_proven`; job `stopped` holding the crash VM; 1 VM of the image started
  since the crash launch; no elapsed-unknown stop.
- Orphan `microvm-06c9748f-8610-37fd-bad7-6987cfca3818`: planted 12:38:20Z (P); RUNNING to P+11:38,
  TERMINATED at P+12:00; controller stop at 12:50:15Z, `unclaimed_for=11m0.09s grace=10m0s`;
  `equipo_hosted_alerts_total{kind="orphan_stopped",result="sent"} 1` (first live SNS publish);
  no deferral; one `orphan_seen` and one `orphan_stopped` row for it.
- Interfaces in the VPC: 0 at 2.4, 6.1, 7.2, 8.1 and 10.2.
- 11.2 at the end: 4 VMs, 0.28 VM-hours, 1 image version, estimate $0.18.
- FINDINGs: none.

Journal (`journal-for-progress.txt`, INTENT and CONTROLLER lines left out):

```text
UNIT t17b-1130-b8103a4-probe.service
RUN 1130-b8103a4 start pin=bf29344a8b6832dff425aafc1337d4883f6a894f
COLLISION-CHECKS clean
CONFIRMED VPC vpc-044330dab8f4229a7
CONFIRMED DEF_SG sg-08e68aed5b8fff97c
CONFIRMED MAIN_RTB rtb-0ddb9cb6cfcc3180d
CONFIRMED DEF_ACL acl-0f6e3d54e365b155f
CONFIRMED DEF_SG_RULES sgr-04267690ea065a725 sgr-0bf721ab0d646bfc1
CONFIRMED SUBNET subnet-0cff01091869c19d6
CONFIRMED RTB rtb-0096777df771ccfe1
CONFIRMED RTB_ASSOC rtbassoc-086bc50cdecc1b95f
CONFIRMED SG sg-02a1457da3166e23b
UNIT t17b-1130-b8103a4-2.1.service
CONFIRMED OPERATOR_ROLE_ARN arn:aws:iam::640012953448:role/equipo-hosted-dev-t17-1130-b8103a4-conn-op
CONFIRMED OPERATOR_MANAGED_POLICY arn:aws:iam::aws:policy/AWSLambdaNetworkConnectorOperatorPolicy
CONFIRMED OPERATOR_INLINE_POLICY t17-connector-eni-delete
CONFIRMED CONN_ARN arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-bed72ef5-97cd-4de7-9f24-9ed16f559115
CONFIRMED CONN_ID nc-bed72ef5-97cd-4de7-9f24-9ed16f559115
CONFIRMED CONN_OPERATOR_POLICY managed AWSLambdaNetworkConnectorOperatorPolicy plus inline delete
FACT connector create reply: {"State":"PENDING","Version":1,"VersionArn":"arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-bed72ef5-97cd-4de7-9f24-9ed16f559115:1","LatestVersion":null,"LatestVersionArn":null}
UNIT t17b-1130-b8103a4-2.3.service
TIMING connector-active
CONFIRMED CONN_VERSION 1
CONFIRMED CONN_QARN arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-bed72ef5-97cd-4de7-9f24-9ed16f559115:1
FACT unqualified read: {"Version":null,"VersionArn":null,"LatestVersion":1,"LatestVersionArn":"arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-bed72ef5-97cd-4de7-9f24-9ed16f559115:1","ServerTime":"2026-11-30T12:22:52Z"}
FACT connector versions: [{"Version":1,"VersionArn":"arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-bed72ef5-97cd-4de7-9f24-9ed16f559115:1","State":"ACTIVE"}]
FACT interfaces in the VPC (2.4, connector ACTIVE): 0
CONFIRMED BUCKET_CREATED equipo-hosted-dev-t17-1130-b8103a4-640012953448
CONFIRMED LOG_GROUP_CREATED /aws/lambda-microvms/equipo-hosted-dev-t17-1130-b8103a4
CONFIRMED BUILD_ROLE_ARN arn:aws:iam::640012953448:role/equipo-hosted-dev-t17-1130-b8103a4-build
CONFIRMED DIGEST sha256:41f356359491246b3c6f87e3b799a9679f42066ff7a7de5267a813d4153066a7
CONFIRMED ARTIFACT_B64 QfNWNZSRJGs8b4fjt5mpZ59CBm/3p95SZ6gT1BUwZqc=
CONFIRMED ARTIFACT s3://equipo-hosted-dev-t17-1130-b8103a4-640012953448/t17/app.zip
CONFIRMED BASE_ARN arn:aws:lambda:eu-west-1:aws:microvm-image:al2023-1
CONFIRMED BASE_VER 4
CONFIRMED BASE_VER_DOWN 3
CONFIRMED IMAGE_ARN arn:aws:lambda:eu-west-1:640012953448:microvm-image:equipo-hosted-dev-t17-1130-b8103a4
CONFIRMED VER_SMALL 1.0
CONFIRMED BASE_VER_USED 4
UNIT t17b-1130-b8103a4-3.8.service
FACT Small version: {"ImageVersion":"1.0","State":"SUCCESSFUL","Status":"ACTIVE","Tags":{"purpose":"equipo-hosted-dev","run":"1130-b8103a4"}}
TIMING image-small-built
CONFIRMED TOPIC_ARN arn:aws:sns:eu-west-1:640012953448:equipo-hosted-dev-t17-1130-b8103a4-alerts
UNIT t17b-1130-b8103a4-ctl-audit-only.service
FACT 5.6 metrics: equipo_hosted_store_readable 1 equipo_hosted_network_audit_passing 1 equipo_hosted_reap_last_error 0 equipo_hosted_reap_last_age_seconds 4.202161474 
FACT network_audit_passed rows after a clean start: 0 (0 expected)
CONFIRMED AUDIT_OK yes
AUDIT passed before any launch
UNIT t17b-1130-b8103a4-6.1.service
PHASE 6-contract.json start 2026-11-30T12:29:05.161Z
PHASE 6-contract.json end rc=0
VM microvm-abba1378-96f1-3024-acc8-3632a15120b8 6-contract.json phase:2026-11-30T12:29:05.161Z
FACT interfaces in the VPC (6.1, after the contract subtest): 0
VM microvm-abba1378-96f1-3024-acc8-3632a15120b8 scan 2026-11-30T12:29:06.636Z
VMGONE microvm-abba1378-96f1-3024-acc8-3632a15120b8 TERMINATED
SETTLED 1 recorded
CONFIRMED CONTRACT_CSC pass
CONTRACT ChangedSpecConflicts pass
UNIT t17b-1130-b8103a4-ctl-sequence.service
UNIT t17b-1130-b8103a4-7.2.service
CONFIRMED SEQ_ATTEMPT task17-seq-7807b95d
PHASE 7.2-sequence.log start 2026-11-30T12:30:44.239Z
PHASE 7.2-sequence.log end rc=0
VM microvm-6fc6be7c-70f5-3121-9b24-2379411f9d2a 7.2-sequence.log phase:2026-11-30T12:30:44.239Z
FACT interfaces in the VPC (7.2, after the sequence): 0
VM microvm-6fc6be7c-70f5-3121-9b24-2379411f9d2a scan 2026-11-30T12:30:45.597Z
VMGONE microvm-6fc6be7c-70f5-3121-9b24-2379411f9d2a TERMINATED
SETTLED 2 recorded
FACT sequence timings: launch_call=267.257682ms to_running=50.255454856s drain_call=19.320561ms quiescent_call=19.669692ms suspend_call=106.056101ms to_suspended=1m0.468246276s resume=5.292139829s resume_calls=2 epoch=1 to_running_after_resume=37.169217ms stop_to_proof=5.30378646s stop_calls=2
FACT sequence epoch 0 -> 1
UNIT t17b-1130-b8103a4-7.3.service
CONFIRMED CRASH_ATTEMPT task17-crash-11514c54
CONFIRMED CRASH_START 2026-11-30T12:35:03
UNIT t17b-1130-b8103a4-ctl-crash.service
PHASE 7.3-launch.log start 2026-11-30T12:35:15.489Z
PHASE 7.3-launch.log end rc=0
VM microvm-7571e222-fc51-3a46-8bbc-62f2c42c9c32 controller phase:2026-11-30T12:35:03.850Z
CONFIRMED CRASH_VM microvm-7571e222-fc51-3a46-8bbc-62f2c42c9c32
CRASH controller exited after launching microvm-7571e222-fc51-3a46-8bbc-62f2c42c9c32
UNIT t17b-1130-b8103a4-7.4.service
UNIT t17b-1130-b8103a4-ctl-recover.service
PHASE 7.4-recover.log start 2026-11-30T12:35:48.449Z
PHASE 7.4-recover.log end rc=0
VM microvm-6fc6be7c-70f5-3121-9b24-2379411f9d2a 7.4-recover.log phase:2026-11-30T12:35:48.449Z
VM microvm-7571e222-fc51-3a46-8bbc-62f2c42c9c32 7.4-recover.log phase:2026-11-30T12:35:48.449Z
VM microvm-abba1378-96f1-3024-acc8-3632a15120b8 7.4-recover.log phase:2026-11-30T12:35:48.449Z
VM microvm-7571e222-fc51-3a46-8bbc-62f2c42c9c32 scan 2026-11-30T12:35:16.745Z
VMGONE microvm-7571e222-fc51-3a46-8bbc-62f2c42c9c32 TERMINATED
SETTLED 3 recorded
UNIT t17b-1130-b8103a4-ctl-orphan.service
CONFIRMED ORPHAN_TOKEN equipo-hosted-dev-t17-1130-b8103a4-orphan
CONFIRMED ORPHAN_PLANTED 2026-11-30T12:38:20Z
VM microvm-06c9748f-8610-37fd-bad7-6987cfca3818 orphan 2026-11-30T12:38:27.592Z
CONFIRMED ORPHAN_VM microvm-06c9748f-8610-37fd-bad7-6987cfca3818
FACT interfaces in the VPC (8.1, orphan planted): 0
UNIT t17b-1130-b8103a4-8.2.service
ORPHAN stopped by the reaper at P+720s
VM microvm-06c9748f-8610-37fd-bad7-6987cfca3818 controller phase:2026-11-30T12:38:14.087Z
VMGONE microvm-06c9748f-8610-37fd-bad7-6987cfca3818 TERMINATED
VM microvm-06c9748f-8610-37fd-bad7-6987cfca3818 scan 2026-11-30T12:38:27.592Z
SETTLED 4 recorded
UNIT t17b-1130-b8103a4-10.1.service
SETTLED 4 recorded
DELETED microvm-image arn:aws:lambda:eu-west-1:640012953448:microvm-image:equipo-hosted-dev-t17-1130-b8103a4
DELETED microvm-image-version arn:aws:lambda:eu-west-1:640012953448:microvm-image:equipo-hosted-dev-t17-1130-b8103a4:1.0
UNIT t17b-1130-b8103a4-10.2.service
FACT interfaces in the VPC (10.2, before the connector delete): 0
DELETED connector arn:aws:lambda:eu-west-1:640012953448:network-connector:nc-bed72ef5-97cd-4de7-9f24-9ed16f559115
DELETED security-group sg-02a1457da3166e23b
DELETED route-table-association rtbassoc-086bc50cdecc1b95f
DELETED route-table rtb-0096777df771ccfe1
DELETED subnet subnet-0cff01091869c19d6
DELETED vpc vpc-044330dab8f4229a7
DELETED vpc-default-security-group-rules sgr-04267690ea065a725 sgr-0bf721ab0d646bfc1
DELETED vpc-default-security-group sg-08e68aed5b8fff97c
DELETED vpc-main-route-table rtb-0ddb9cb6cfcc3180d
DELETED vpc-default-network-acl acl-0f6e3d54e365b155f
DELETED iam-role arn:aws:iam::640012953448:role/equipo-hosted-dev-t17-1130-b8103a4-conn-op
DELETED iam-inline-policy t17-connector-eni-delete
DELETED iam-managed-attachment arn:aws:iam::aws:policy/AWSLambdaNetworkConnectorOperatorPolicy
DELETED iam-role arn:aws:iam::640012953448:role/equipo-hosted-dev-t17-1130-b8103a4-build
DELETED s3-object s3://equipo-hosted-dev-t17-1130-b8103a4-640012953448/t17/app.zip
DELETED s3-bucket equipo-hosted-dev-t17-1130-b8103a4-640012953448
DELETED log-group /aws/lambda-microvms/equipo-hosted-dev-t17-1130-b8103a4
DELETED sns-topic arn:aws:sns:eu-west-1:640012953448:equipo-hosted-dev-t17-1130-b8103a4-alerts
```

VM ledger (`vms.tsv`: ID, source, start, recorded at):

```text
microvm-abba1378-96f1-3024-acc8-3632a15120b8	6-contract.json	phase:2026-11-30T12:29:05.161Z	2026-11-30T12:29:07.449Z
microvm-abba1378-96f1-3024-acc8-3632a15120b8	scan	2026-11-30T12:29:06.636Z	2026-11-30T12:29:09.661Z
microvm-6fc6be7c-70f5-3121-9b24-2379411f9d2a	7.2-sequence.log	phase:2026-11-30T12:30:44.239Z	2026-11-30T12:32:47.407Z
microvm-6fc6be7c-70f5-3121-9b24-2379411f9d2a	scan	2026-11-30T12:30:45.597Z	2026-11-30T12:33:19.130Z
microvm-7571e222-fc51-3a46-8bbc-62f2c42c9c32	controller	phase:2026-11-30T12:35:03.850Z	2026-11-30T12:35:17.086Z
microvm-6fc6be7c-70f5-3121-9b24-2379411f9d2a	7.4-recover.log	phase:2026-11-30T12:35:48.449Z	2026-11-30T12:36:50.675Z
microvm-7571e222-fc51-3a46-8bbc-62f2c42c9c32	7.4-recover.log	phase:2026-11-30T12:35:48.449Z	2026-11-30T12:36:50.677Z
microvm-abba1378-96f1-3024-acc8-3632a15120b8	7.4-recover.log	phase:2026-11-30T12:35:48.449Z	2026-11-30T12:36:50.680Z
microvm-7571e222-fc51-3a46-8bbc-62f2c42c9c32	scan	2026-11-30T12:35:16.745Z	2026-11-30T12:36:52.060Z
microvm-06c9748f-8610-37fd-bad7-6987cfca3818	orphan	2026-11-30T12:38:27.592Z	2026-11-30T12:38:27.705Z
microvm-06c9748f-8610-37fd-bad7-6987cfca3818	controller	phase:2026-11-30T12:38:14.087Z	2026-11-30T12:50:23.606Z
microvm-06c9748f-8610-37fd-bad7-6987cfca3818	scan	2026-11-30T12:38:27.592Z	2026-11-30T12:50:31.805Z
```
