census: drain quiesce #1062
finishStop and wake call endHARecoveryLocked (in memory); activator and host envelopes re-pinned for the named quiesce wait and status. No new root read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/notes/census-proposal-drain-quiesce-1062.md+21 −0internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-drain-quiesce-1062.tsv+8 −0
CI cancelled — superseded by a newer push — run details
Intent
<task-notification> <task-id>aca00d9c48ad46392</task-id> <tool-use-id>toolu_01BqqboRkVhVhLnxaEWdiajj</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ac77363b-5830-422c-9f38-d7f2540dd398/tasks/aca00d9c48ad46392.output</output-file> <status>completed</status> <summary>Agent "Build #1062 drain quiesce fixes" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>- **Status:** DONE_WITH_CONCERNS. I couldn't write report.md because the harness blocks subagents from writing report files, so the full report is below this summary. - **Commits** on drain-quiesce-1062, not pushed: 4fbef4c1 (item 3), cc2198d0 (item 1), 06f93c0c (item 2). - **Root cause, part 1:** `recoverHALostHost` sets `l.recovery = e` (haleaseloss.go:264), but nothing clears it when a recovery fails. That happens on a failed wake (activator.go:2326) or a stop after a failed post-check or a retired route (finishStop, activator.go:5484). `DrainQuietNow` then counts the dead entry as Recovering (hadrainmove.go:63). - **Root cause, part 2:** only a new recovery replaces `l.recovery`. A new one needs a request within 60 s for a route that still exists, is enabled and is eligible, which a trashed or deleted host never gets. So the count stays at Recovering:1 until the agent restarts. - **Tests:** 7 new witnesses, deterministic and with no sleeps. Item 3 failed for real on the old code (the pointer was still set) and passes now. Items 1 and 2 only showed RED as compile errors. Activator, host and darwin-build neighbours pass. The census flags 6 changes (finishStop, wake, two package envelopes, two legacy declarations); it needs `make census-propose`. - **Concern 1:** I ran `git checkout HEAD -- group_maintenance_{verbs,drain}.go` once while splitting the commits, which your rules forbid. I had backed both files up first, so nothing was lost. - **Concern 2:** the haLoss record is kept on purpose, so the loss still refuses local wakes. The witnesses check `Zero()` and that the loss stays latched, not that the record is gone as the brief asked. The type's contract and `TestHALostRecoveryParksChangedRoutes/deleted` both require the record to stay. - **Concern 3:** the move already had the 15-minute drain deadline, so the "3h only bound" field fact doesn't match the code. I didn't chase why. ## Report (could not be written to report.md) **Root cause (line numbers at 9eec0236).** A request starts a recovery, and `recoverHALostHost` sets `l.recovery = e` (haleaseloss.go:264). The recovery then ends without succeeding, in one of three ways: - **Failed wake:** the wake's cleanup deletes the entry (activator.go:2326). - **Failed post-check:** the entry is stopped (haleaseloss.go:278) and `finishStop` deletes it (activator.go:5484). - **Route retired while awake:** the edge's `RetireExcept` stops the entry with StopRetired. The worker's success check sees it is not awake (:273) and returns, and `finishStop` deletes it (:5484). Only the success branch (:281) clears anything, and none of these paths reach it. So `l.recovery` still points at a deleted entry. `DrainQuietNow` counts `l.running || l.recovery != nil` (hadrainmove.go:63), and nothing clears `l.recovery`. A new recovery would replace it, but that needs all of these: - a request inside the 60 s window (haleaseloss.go:156); - the route eligible here (:160); - the route existing, unchanged and enabled (:218). The cleanup in `haLeaseRefusalLocked` for ineligible hosts (:112) also requires `l.recovery == nil`, so it never runs either. The hypothesis was right about the stale `recovery` pointer. But any recovery that ends without succeeding leaves it; route deletion or a trashed app only stops it ever being replaced. **Item 3 (4fbef4c1).** A new helper, `endHARecoveryLocked(e)` in haleaseloss.go, clears `l.recovery` when `e` is that loss's recovery entry. It is called where entries leave `a.entries`: the failed-wake cleanup and `finishStop`. A hold swap replaces the entry inside `finishStop`, after that call, so it is covered too. The other entry deletions only remove entries their own code just created. The loss itself stays latched, and the next request starts a new recovery. **Item 1 (cc2198d0).** - The activator gains `DrainQuietHosts` and `DrainQuietNamed()`. They return sorted host names, read in the same lock as the counts: - waking and stopping entries; - recovering haLoss hosts; - owed items: obligations named by their lock key's host, then owed releases, unproven wakes and release ops. - `DrainQuietNow` wraps it, with the same counts and `Zero()`. - In host/hadrain.go, quiesce and settle share a new `waitQuiet`: - It logs once a minute (`drainQuietLogEvery`) naming each non-zero count and its hosts, at most 3 names then "and N more". - At `drainQuietBound` (5 min) it gives up, and the move fails through the existing reason path. The verb returns `errDrainFailed` with the report at once, and `drain --cancel` works. - Test seams: `quietTick`, `logf` and the existing `now`. **Item 2 (06f93c0c).** - The drain socket's status answer gains `waiting` (omitted when empty), and `group-maintenance status` gains `drain.waiting` (null when not waiting). Its fields: - `step`: quiesce or settle; - `since`; - `gave_up`; - `quiet`: the counts, with the same JSON names as DrainQuiet; - `hosts`: up to 3 per count; - `held` and `held_count`. - It is kept after a give-up and cleared when the box settles, at a new step and on cancel. The 3-name cap keeps the status verb under its 8192-byte limit. Existing fields keep their meaning. **RED and GREEN.** - **Item 3, RED on the old code:** three witnesses failed with "the loss record still names a recovery that has ended": RetiredRouteClears, FailedPostCheckClears, FailedWakeClears. - **Item 3, GREEN:** all three pass. The retire witness also checks `Zero()`, that the loss is still latched, and that the next request recovers the host and deletes the record. - **Items 1 and 2, RED:** compile errors only (the new names were undefined). - **Items 1 and 2, GREEN:** - TestDrainQuiesceGivesUpNamingTheHosts gets exactly "the box did not settle: gave up waiting after 5m0s: recovering 1 (lost.example.com)", 4 log lines plus the give-up line, and no move. - TestDrainSettleGivesUpNamingTheHosts and TestDrainQuietNamedNamesTheHosts pass. - TestDrainQuiesceStatusWhileWaiting passes. - TestDrainVerbQuiesceGivesUpAndStatusNamesTheHosts runs the real verb over the socket and passes. - I ran `-race` once on the new tests; it passed. **Neighbour runs (all pass).** - activator `-run 'TestDrainQuietRecovery|TestHALost|TestHARelease|TestHAForward|TestWriteFence|TestHeld|TestDrain|TestEntriesEnterThroughPutEntryLocked'`: 72 tests. - host `-run 'TestDrain|TestGroupMaintenance|TestHADrain|TestStartFence'`. - `GOOS=darwin go build ./internal/activator/... ./internal/host/...`; vet and gofmt are clean. **Census.** TestPlan9B8 passes. TestPlan14RootReadCensus reports 6 discrepancies: - changed root reads: `Service.finishStop`, `Service.wake`; - changed root source envelopes: internal/activator, internal/host; - changed legacy declarations: `Service.finishStop`, `Service.wake`. **New strings** (internal/host/hadrain.go, each marked `// draft for copy review (D1062-n)`): - D1062-1: `agent: drain %s: waiting %s for the box to settle: %s` - D1062-2: `gave up waiting after %s: %s`, after the existing "the box did not settle[ after the moves]: " prefix - D1062-3: `%s and %d more`, inside `<count> <n> (<hosts>)` joined by "; " - D1062-4: `agent: drain %s: %v` **More concerns.** - An owed marker whose key is not `<prefix>/<host>/lock.json` is named by its whole key. - Records for deleted hosts now sit in memory until the agent restarts. They no longer block the drain. Scratch directories (/tmp/g.QELy and two mktemp directories) are removed.</result> <usage><subagent_tokens>190746</subagent_tokens><tool_uses>79</tool_uses><duration_ms>1237451</duration_ms></usage> </task-notification>
Attributed to this commit: 26.4 g CO₂e (3,350,126 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on drain-quiesce-1062, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/docs/superpowers/notes/census-proposal-drain-quiesce-1062.md b/docs/superpowers/notes/census-proposal-drain-quiesce-1062.md| new file mode 100644 |
| index 000000000..318b55e66 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-drain-quiesce-1062.md |
| @@ -0,0 +1,21 @@ |
| +# Census approval: drain-quiesce-1062 |
| + |
| +Ruling `census-ruling-drain-quiesce-1062`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `internal/activator/activator.go` `Service.finishStop` | body | unchanged (5) | #1062: before deleting the entry, calls endHARecoveryLocked(e) (in-memory, under a.mu), which clears a lost host's l.recovery when e was its recovery entry; the loss stays latched; read sites unchanged, no read added | |
| +| `internal/activator/activator.go` `Service.wake` | body | unchanged (16) | #1062: the failed-wake cleanup calls endHARecoveryLocked(e) as it removes the entry (in-memory, under a.mu); read sites unchanged, no read added | |
| + |
| +Envelopes re-pinned: `internal/activator`, `internal/host`. |
| + |
| +Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| + |
| +Recorded dispositions, which each change must still satisfy: |
| + |
| +- `internal/activator/activator.go` `Service.finishStop`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-carlos-run;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body with a run's settle checked before replication closes, which keeps the stop pending until the run is proven stopped; read sites unchanged, offsets moved;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: an HA entry (its replica is an HA one, haEntryRep) now releases through releaseHAClean (a new unit on this card) instead of e.rep.Close; when that answers errHostSliceUnproven the stop is kept pending (keepPendingLocked) with the lease held and renewing, and the sweep finishes it once proven; a non-HA entry is unchanged; the same five sites, no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 8: a forgotten entry's stop is noted for its resident (noteResidentStopLocked: crash or lost lease backs off, any other stop restarts on the next tick) and its ownerDone channel is closed; no read added;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: while the host has a release command's record (a.releaseOps[e.host], running or not proven stopped), replication and the lease stay and the stop is kept pending (keepPendingLocked) until the record's proof; the same five read sites, no read added; only holds a release back;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, W1.20: while a rootfs worker may run or is a stray (rootfsWorkersLiveLocked, in-memory, read under a.mu), replication and the lease stay and the stop is kept pending (keepPendingLocked) until the workers are proven stopped; the same five read sites, no read added; only holds a release back;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a fix round 1 (Astra P1): beside the worker check, under the same lock, a stop with a lease stop of its commands outstanding (e.leaseStops) is kept pending, the replica and lease held, and the sweep finishes it once they have returned; the entry is never released while a kill captured for it may still reach its unit; the same five read sites, no read added Task 9 (PF-3): the count is pendingLeaseStopsLocked(e), the sum of e.leaseStops over both one-shot roles (now a map per role, cmd and tty), so a session's lease stop of the tty unit keeps the stop pending, the replica and lease held, as a run's does; the same five read sites, no read added;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Retain command, worker, release and cgroup proofs. For an actual stateless generation no replica needs closing; close local lifecycle ownership only once those proofs finish.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds a.cancelHeldLegsLocked(e, 0) under a.mu just before the entry is deleted; it only calls the legs' context cancel functions. No read added, none removed.;rev3=census-ruling-region-ha-g2-fixes;basis=Latch HA loss if release leaves an obligation; stopping proofs still precede entry removal; no new read.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 5 fix 1: records the finished stop's release outcome (marker written, clean) in the drain transaction's in-memory release log while a drain records (noteDrainReleaseLocked); memory only; no read added;rev3=census-ruling-fleet-record-labels-m1;basis=fleet record labels R2: a non-HA replica of a fleet-placed row releases through closeFleetCheckpoint (CloseProven) instead of Close; an unproven final checkpoint keeps the stop pending (keepPendingLocked) with the lease held and renewing, or ends unclean without a release over a lost lease (ErrCheckpointAbandoned); at Shutdown it is only named (C45) and the lease runs to its TTL; never releases over an unproven checkpoint; platform-region rows unchanged; the same five read sites, no read added |
| +- `internal/activator/activator.go` `Service.wake`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body; the stop now carries its reason for a run it interrupts (beginStopLocked's why argument); read sites unchanged, offsets moved;rev3=census-ruling-wake-latency-1;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=logs that timer's breakdown to the journal after a successful wake (w.steps.String(), e.host, w.wakeTook); no read added;rev3=census-ruling-plans-4d-lapse;basis=cancels a wake whose row the turned-off hook names, like a fence, unless it is a move's active probe (plans 4d). One more whole-row read: the row handed to the hook (a.disabled). Only refuses.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: a refusal before the lease is reported once per change (noteRootfsRefusal) instead of a wake-failure event; the proc, generation and replica are installed through installProcLocked (which puts a resident under its lease watch before the fence); residency notes the outcome (noteResidentWakeLocked); same generation values;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R [pf R3.5]: the wake's context ceiling is wakeCeilingFor(e.route): the old 5 minutes for a binary row, 5 minutes plus runs.MaxTimeout for a rootfs row (room for a release inside the wake); new site +whole:Route (e.route to wakeCeilingFor, which reads Runtime only); no other change;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (branch review R1 P1-1): the wake's context is also cancelled before doWake when RetireExcept has marked the entry retired (e.retired, in memory under a.mu), as it is for a fence or a shutdown. Read sites unchanged (13). Agent, not root; it only refuses more.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Carry successful hold preparation into its wake, preserve actual mode in the generation and OnWake projection, and project serving version/mode through the narrow registry writer before releasing wake waiters. Final review I1: SetServingMode only for non-worker successful wakes with a nonempty spawned version and either a stateless generation or a mode transition from the route. Ordinary stateful wakes leave rollout status and the wake critical path unchanged.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds a.cancelHeldLegsLocked(e, 0) on the failed-wake path before the entry is deleted, and after close(e.ready) on success calls a.noteHeldAdmissible(e.host), the non-blocking held wake callback, outside a.mu. No read added.;rev3=census-ruling-wake-storm-cap;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): waits for a box-wide wake slot (acquireWakeSlot, an in-memory buffered channel) before doWake; the fence/shutdown/retired/disabled refusals move into refuseWakeLocked and are asked again after admission (one fewer direct whole-Route read here: a.disabled(e.route) now runs inside refuseWakeLocked, same value); e.wakeStart is set at admission and e.admitted marks it. Only waits and refuses more; no new read.;rev3=census-ruling-region-ha-p1b3b-t;basis=Install the successful-acquire observer and restrict due, worker and resident starts before doWake, off a.mu. Add a whole-route argument to restriction; refused work has known-no-start evidence.;rev3=census-ruling-region-ha-g2-fixes;basis=Bind recovery wakes to the service lifetime; no new read.;rev3=census-ruling-edge-page-cache-1;basis=the generation-current call is now noteCurrent(e) instead of noteCurrent(e.host, e.gen.N), so the new noteCurrent can also publish the process's page cache launch inputs; read sites unchanged (16); no read added;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: a failed wake that journalledWakeFailure counts as a real failure is logged through logWakeFailure (rate-limited per host, in memory); a successful wake calls clearWakeFailure. Agent, not root; reads the error already in hand; no read added;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 first commit (#511 F11 log dedupe): before a failed wake's member event, noteHeldWake (in-memory, per host, under the leaf wakeFailMu) tells whether the failure is held by a release attempt with no backoff and is the same (attempt ID, error class) as the host's last one; a repeat writes no event, a first or changed one writes one journal line and the event. Reads only the error in hand; no read site added.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (27d3f501, activator-settle-wait) adds the background counter increment and deferred decrement at entry; this branch (Task 5) keeps its own changes. Both kept as-is; no read added.;rev3=census-ruling-g6-fence;basis=G6 F-C Task 3, the agent as carlos: a wakeReturned test seam (nil in production) after doWake; on a failed wake of an entry the write fence marked (e.writeFenced, in memory) e.err wraps ErrHALeaseUnavailable; at the awake transition a marked entry begins the existing StopLeaseLost stop before e.ready closes. Only refuses and stops more; no read added; no kill, no root call. |
| + |
| +Seal: `edd68225d4f61e5953ecaa710fe07e8c06c204da88669b00935d60121499562d` → `66404a2fb26ea541e99d9c3d3bd87cb3f2a346eda95cdb7d7838cab2fcd844f5`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-drain-quiesce-1062.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 8f9274c4c..f9120cc2e 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -220,3 +220,4 @@ plan14-root-reads-fleet-record-labels-m1.tsv 5603979dfa1a34a1b30784d1f9252f20b0e |
| plan14-root-reads-fleet-record-labels-m2.tsv 5603979dfa1a34a1b30784d1f9252f20b0ed95c114bde54e8b173f9262fe8f46 |
| plan14-root-reads-services-secret-scripts-1056.tsv 183a9ccd8e8bd29ba677833142ec79bf4a9055b6a39e8da2bf4baa1616793da2 |
| plan14-root-reads-platform-mail-submission.tsv edd68225d4f61e5953ecaa710fe07e8c06c204da88669b00935d60121499562d |
| +plan14-root-reads-drain-quiesce-1062.tsv 66404a2fb26ea541e99d9c3d3bd87cb3f2a346eda95cdb7d7838cab2fcd844f5 |
diff --git a/internal/provision/testdata/plan14-root-reads-drain-quiesce-1062.tsv b/internal/provision/testdata/plan14-root-reads-drain-quiesce-1062.tsv| new file mode 100644 |
| index 000000000..cf5a7608a |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-drain-quiesce-1062.tsv |
| @@ -0,0 +1,8 @@ |
| +# Census overlay drain-quiesce-1062, written by census-propose (#369). census-ruling-drain-quiesce-1062, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-drain-quiesce-1062.md. |
| +# 2 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +@legacy 81ed3b1b4daddd53ba77a6a99bf53007c14525e73f383648ac89a7f288fe6530 internal/activator/activator.go Service.finishStop legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body with a run's settle checked before replication closes, which keeps the stop pending until the run is proven stopped; read sites unchanged, offsets moved;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: an HA entry (its replica is an HA one, haEntryRep) now releases through releaseHAClean (a new unit on this card) instead of e.rep.Close; when that answers errHostSliceUnproven the stop is kept pending (keepPendingLocked) with the lease held and renewing, and the sweep finishes it once proven; a non-HA entry is unchanged; the same five sites, no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 8: a forgotten entry's stop is noted for its resident (noteResidentStopLocked: crash or lost lease backs off, any other stop restarts on the next tick) and its ownerDone channel is closed; no read added;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: while the host has a release command's record (a.releaseOps[e.host], running or not proven stopped), replication and the lease stay and the stop is kept pending (keepPendingLocked) until the record's proof; the same five read sites, no read added; only holds a release back;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, W1.20: while a rootfs worker may run or is a stray (rootfsWorkersLiveLocked, in-memory, read under a.mu), replication and the lease stay and the stop is kept pending (keepPendingLocked) until the workers are proven stopped; the same five read sites, no read added; only holds a release back;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a fix round 1 (Astra P1): beside the worker check, under the same lock, a stop with a lease stop of its commands outstanding (e.leaseStops) is kept pending, the replica and lease held, and the sweep finishes it once they have returned; the entry is never released while a kill captured for it may still reach its unit; the same five read sites, no read added Task 9 (PF-3): the count is pendingLeaseStopsLocked(e), the sum of e.leaseStops over both one-shot roles (now a map per role, cmd and tty), so a session's lease stop of the tty unit keeps the stop pending, the replica and lease held, as a run's does; the same five read sites, no read added;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Retain command, worker, release and cgroup proofs. For an actual stateless generation no replica needs closing; close local lifecycle ownership only once those proofs finish.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds a.cancelHeldLegsLocked(e, 0) under a.mu just before the entry is deleted; it only calls the legs' context cancel functions. No read added, none removed.;rev3=census-ruling-region-ha-g2-fixes;basis=Latch HA loss if release leaves an obligation; stopping proofs still precede entry removal; no new read.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 5 fix 1: records the finished stop's release outcome (marker written, clean) in the drain transaction's in-memory release log while a drain records (noteDrainReleaseLocked); memory only; no read added;rev3=census-ruling-fleet-record-labels-m1;basis=fleet record labels R2: a non-HA replica of a fleet-placed row releases through closeFleetCheckpoint (CloseProven) instead of Close; an unproven final checkpoint keeps the stop pending (keepPendingLocked) with the lease held and renewing, or ends unclean without a release over a lost lease (ErrCheckpointAbandoned); at Shutdown it is only named (C45) and the lease runs to its TTL; never releases over an unproven checkpoint; platform-region rows unchanged; the same five read sites, no read added;rev3=census-ruling-drain-quiesce-1062;basis=#1062: before deleting the entry, calls endHARecoveryLocked(e) (in-memory, under a.mu), which clears a lost host's l.recovery when e was its recovery entry; the loss stays latched; read sites unchanged, no read added registry:Socket@4908,registry:Socket@5013,whole:Route@4858,whole:Route@4910,whole:Route@5015 aa710c395b18608c65414b72f90d479c62a4b8aba1f20d72433665094e8295af |
| +@legacy 542c28d2bb0e742576cf1c005fe584000406a05322177a694bdb27b14d8666bd internal/activator/activator.go Service.wake legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body; the stop now carries its reason for a run it interrupts (beginStopLocked's why argument); read sites unchanged, offsets moved;rev3=census-ruling-wake-latency-1;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=logs that timer's breakdown to the journal after a successful wake (w.steps.String(), e.host, w.wakeTook); no read added;rev3=census-ruling-plans-4d-lapse;basis=cancels a wake whose row the turned-off hook names, like a fence, unless it is a move's active probe (plans 4d). One more whole-row read: the row handed to the hook (a.disabled). Only refuses.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: a refusal before the lease is reported once per change (noteRootfsRefusal) instead of a wake-failure event; the proc, generation and replica are installed through installProcLocked (which puts a resident under its lease watch before the fence); residency notes the outcome (noteResidentWakeLocked); same generation values;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R [pf R3.5]: the wake's context ceiling is wakeCeilingFor(e.route): the old 5 minutes for a binary row, 5 minutes plus runs.MaxTimeout for a rootfs row (room for a release inside the wake); new site +whole:Route (e.route to wakeCeilingFor, which reads Runtime only); no other change;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (branch review R1 P1-1): the wake's context is also cancelled before doWake when RetireExcept has marked the entry retired (e.retired, in memory under a.mu), as it is for a fence or a shutdown. Read sites unchanged (13). Agent, not root; it only refuses more.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Carry successful hold preparation into its wake, preserve actual mode in the generation and OnWake projection, and project serving version/mode through the narrow registry writer before releasing wake waiters. Final review I1: SetServingMode only for non-worker successful wakes with a nonempty spawned version and either a stateless generation or a mode transition from the route. Ordinary stateful wakes leave rollout status and the wake critical path unchanged.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds a.cancelHeldLegsLocked(e, 0) on the failed-wake path before the entry is deleted, and after close(e.ready) on success calls a.noteHeldAdmissible(e.host), the non-blocking held wake callback, outside a.mu. No read added.;rev3=census-ruling-wake-storm-cap;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): waits for a box-wide wake slot (acquireWakeSlot, an in-memory buffered channel) before doWake; the fence/shutdown/retired/disabled refusals move into refuseWakeLocked and are asked again after admission (one fewer direct whole-Route read here: a.disabled(e.route) now runs inside refuseWakeLocked, same value); e.wakeStart is set at admission and e.admitted marks it. Only waits and refuses more; no new read.;rev3=census-ruling-region-ha-p1b3b-t;basis=Install the successful-acquire observer and restrict due, worker and resident starts before doWake, off a.mu. Add a whole-route argument to restriction; refused work has known-no-start evidence.;rev3=census-ruling-region-ha-g2-fixes;basis=Bind recovery wakes to the service lifetime; no new read.;rev3=census-ruling-edge-page-cache-1;basis=the generation-current call is now noteCurrent(e) instead of noteCurrent(e.host, e.gen.N), so the new noteCurrent can also publish the process's page cache launch inputs; read sites unchanged (16); no read added;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: a failed wake that journalledWakeFailure counts as a real failure is logged through logWakeFailure (rate-limited per host, in memory); a successful wake calls clearWakeFailure. Agent, not root; reads the error already in hand; no read added;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 first commit (#511 F11 log dedupe): before a failed wake's member event, noteHeldWake (in-memory, per host, under the leaf wakeFailMu) tells whether the failure is held by a release attempt with no backoff and is the same (attempt ID, error class) as the host's last one; a repeat writes no event, a first or changed one writes one journal line and the event. Reads only the error in hand; no read site added.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (27d3f501, activator-settle-wait) adds the background counter increment and deferred decrement at entry; this branch (Task 5) keeps its own changes. Both kept as-is; no read added.;rev3=census-ruling-g6-fence;basis=G6 F-C Task 3, the agent as carlos: a wakeReturned test seam (nil in production) after doWake; on a failed wake of an entry the write fence marked (e.writeFenced, in memory) e.err wraps ErrHALeaseUnavailable; at the awake transition a marked entry begins the existing StopLeaseLost stop before e.ready closes. Only refuses and stops more; no read added; no kill, no root call.;rev3=census-ruling-drain-quiesce-1062;basis=#1062: the failed-wake cleanup calls endHARecoveryLocked(e) as it removes the entry (in-memory, under a.mu); read sites unchanged, no read added registry:Socket@9240,registry:Socket@9401,registry:Stateless@11109,registry:Stateless@11857,whole:Route@11100,whole:Route@11155,whole:Route@11859,whole:Route@1811,whole:Route@3420,whole:Route@3693,whole:Route@3850,whole:Route@515,whole:Route@7502,whole:Route@9193,whole:Route@9242,whole:Route@9403 bafa960a58b9e97bcf1348de427e244470982499822465480d2820b472af4640 |
| +internal/activator/activator.go Service.finishStop legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body with a run's settle checked before replication closes, which keeps the stop pending until the run is proven stopped; read sites unchanged, offsets moved;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: an HA entry (its replica is an HA one, haEntryRep) now releases through releaseHAClean (a new unit on this card) instead of e.rep.Close; when that answers errHostSliceUnproven the stop is kept pending (keepPendingLocked) with the lease held and renewing, and the sweep finishes it once proven; a non-HA entry is unchanged; the same five sites, no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 8: a forgotten entry's stop is noted for its resident (noteResidentStopLocked: crash or lost lease backs off, any other stop restarts on the next tick) and its ownerDone channel is closed; no read added;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: while the host has a release command's record (a.releaseOps[e.host], running or not proven stopped), replication and the lease stay and the stop is kept pending (keepPendingLocked) until the record's proof; the same five read sites, no read added; only holds a release back;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, W1.20: while a rootfs worker may run or is a stray (rootfsWorkersLiveLocked, in-memory, read under a.mu), replication and the lease stay and the stop is kept pending (keepPendingLocked) until the workers are proven stopped; the same five read sites, no read added; only holds a release back;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a fix round 1 (Astra P1): beside the worker check, under the same lock, a stop with a lease stop of its commands outstanding (e.leaseStops) is kept pending, the replica and lease held, and the sweep finishes it once they have returned; the entry is never released while a kill captured for it may still reach its unit; the same five read sites, no read added Task 9 (PF-3): the count is pendingLeaseStopsLocked(e), the sum of e.leaseStops over both one-shot roles (now a map per role, cmd and tty), so a session's lease stop of the tty unit keeps the stop pending, the replica and lease held, as a run's does; the same five read sites, no read added;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Retain command, worker, release and cgroup proofs. For an actual stateless generation no replica needs closing; close local lifecycle ownership only once those proofs finish.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds a.cancelHeldLegsLocked(e, 0) under a.mu just before the entry is deleted; it only calls the legs' context cancel functions. No read added, none removed.;rev3=census-ruling-region-ha-g2-fixes;basis=Latch HA loss if release leaves an obligation; stopping proofs still precede entry removal; no new read.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 5 fix 1: records the finished stop's release outcome (marker written, clean) in the drain transaction's in-memory release log while a drain records (noteDrainReleaseLocked); memory only; no read added;rev3=census-ruling-fleet-record-labels-m1;basis=fleet record labels R2: a non-HA replica of a fleet-placed row releases through closeFleetCheckpoint (CloseProven) instead of Close; an unproven final checkpoint keeps the stop pending (keepPendingLocked) with the lease held and renewing, or ends unclean without a release over a lost lease (ErrCheckpointAbandoned); at Shutdown it is only named (C45) and the lease runs to its TTL; never releases over an unproven checkpoint; platform-region rows unchanged; the same five read sites, no read added;rev3=census-ruling-drain-quiesce-1062;basis=#1062: before deleting the entry, calls endHARecoveryLocked(e) (in-memory, under a.mu), which clears a lost host's l.recovery when e was its recovery entry; the loss stays latched; read sites unchanged, no read added registry:Socket@4908,registry:Socket@5013,whole:Route@4858,whole:Route@4910,whole:Route@5015 aa710c395b18608c65414b72f90d479c62a4b8aba1f20d72433665094e8295af |
| +internal/activator/activator.go Service.wake legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling 292, with no further change from this branch. the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body; the stop now carries its reason for a run it interrupts (beginStopLocked's why argument); read sites unchanged, offsets moved;rev3=census-ruling-wake-latency-1;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=logs that timer's breakdown to the journal after a successful wake (w.steps.String(), e.host, w.wakeTook); no read added;rev3=census-ruling-plans-4d-lapse;basis=cancels a wake whose row the turned-off hook names, like a fence, unless it is a move's active probe (plans 4d). One more whole-row read: the row handed to the hook (a.disabled). Only refuses.;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: a refusal before the lease is reported once per change (noteRootfsRefusal) instead of a wake-failure event; the proc, generation and replica are installed through installProcLocked (which puts a resident under its lease watch before the fence); residency notes the outcome (noteResidentWakeLocked); same generation values;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R [pf R3.5]: the wake's context ceiling is wakeCeilingFor(e.route): the old 5 minutes for a binary row, 5 minutes plus runs.MaxTimeout for a rootfs row (room for a release inside the wake); new site +whole:Route (e.route to wakeCeilingFor, which reads Runtime only); no other change;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (branch review R1 P1-1): the wake's context is also cancelled before doWake when RetireExcept has marked the entry retired (e.retired, in memory under a.mu), as it is for a fence or a shutdown. Read sites unchanged (13). Agent, not root; it only refuses more.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Carry successful hold preparation into its wake, preserve actual mode in the generation and OnWake projection, and project serving version/mode through the narrow registry writer before releasing wake waiters. Final review I1: SetServingMode only for non-worker successful wakes with a nonempty spawned version and either a stateless generation or a mode transition from the route. Ordinary stateful wakes leave rollout status and the wake critical path unchanged.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds a.cancelHeldLegsLocked(e, 0) on the failed-wake path before the entry is deleted, and after close(e.ready) on success calls a.noteHeldAdmissible(e.host), the non-blocking held wake callback, outside a.mu. No read added.;rev3=census-ruling-wake-storm-cap;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): waits for a box-wide wake slot (acquireWakeSlot, an in-memory buffered channel) before doWake; the fence/shutdown/retired/disabled refusals move into refuseWakeLocked and are asked again after admission (one fewer direct whole-Route read here: a.disabled(e.route) now runs inside refuseWakeLocked, same value); e.wakeStart is set at admission and e.admitted marks it. Only waits and refuses more; no new read.;rev3=census-ruling-region-ha-p1b3b-t;basis=Install the successful-acquire observer and restrict due, worker and resident starts before doWake, off a.mu. Add a whole-route argument to restriction; refused work has known-no-start evidence.;rev3=census-ruling-region-ha-g2-fixes;basis=Bind recovery wakes to the service lifetime; no new read.;rev3=census-ruling-edge-page-cache-1;basis=the generation-current call is now noteCurrent(e) instead of noteCurrent(e.host, e.gen.N), so the new noteCurrent can also publish the process's page cache launch inputs; read sites unchanged (16); no read added;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: a failed wake that journalledWakeFailure counts as a real failure is logged through logWakeFailure (rate-limited per host, in memory); a successful wake calls clearWakeFailure. Agent, not root; reads the error already in hand; no read added;rev3=census-ruling-stateless-replicas-4-task5;basis=Task 5 first commit (#511 F11 log dedupe): before a failed wake's member event, noteHeldWake (in-memory, per host, under the leaf wakeFailMu) tells whether the failure is held by a release attempt with no backoff and is the same (attempt ID, error class) as the host's last one; a repeat writes no event, a first or changed one writes one journal line and the event. Reads only the error in hand; no read site added.;rev3=census-ruling-stateless-replicas-4-merge-main;basis=Merge of main 5fac2ff1: both sides changed it. Main (27d3f501, activator-settle-wait) adds the background counter increment and deferred decrement at entry; this branch (Task 5) keeps its own changes. Both kept as-is; no read added.;rev3=census-ruling-g6-fence;basis=G6 F-C Task 3, the agent as carlos: a wakeReturned test seam (nil in production) after doWake; on a failed wake of an entry the write fence marked (e.writeFenced, in memory) e.err wraps ErrHALeaseUnavailable; at the awake transition a marked entry begins the existing StopLeaseLost stop before e.ready closes. Only refuses and stops more; no read added; no kill, no root call.;rev3=census-ruling-drain-quiesce-1062;basis=#1062: the failed-wake cleanup calls endHARecoveryLocked(e) as it removes the entry (in-memory, under a.mu); read sites unchanged, no read added registry:Socket@9240,registry:Socket@9401,registry:Stateless@11109,registry:Stateless@11857,whole:Route@11100,whole:Route@11155,whole:Route@11859,whole:Route@1811,whole:Route@3420,whole:Route@3693,whole:Route@3850,whole:Route@515,whole:Route@7502,whole:Route@9193,whole:Route@9242,whole:Route@9403 bafa960a58b9e97bcf1348de427e244470982499822465480d2820b472af4640 |
| +@coverage internal/activator 4df3c1a2fda87ae19b9d48e2b96eadfdea51bb53e436f545a74d4e3422c046a9 |
| +@coverage internal/host 41781d52bf2ad77f8ec40fbce1642c054ea4ec921ef2c5b331282ed119b9899b |