Merge remote-tracking branch 'origin/main' into lease-checkpoint-no-compaction
# Conflicts: # internal/provision/testdata/plan14-root-reads-chain.tsv
12 files changed,
+127
−14
docs/superpowers/notes/census-proposal-activator-settle-wait.md+25 −0docs/superpowers/notes/census-proposal-lease-checkpoint-no-compaction.md+1 −1internal/activator/activator.go+10 −0internal/activator/background_test.go+28 −0internal/activator/cmd.go+23 −6internal/activator/opset.go+7 −1internal/activator/rootfs_wake_release_test.go+1 −0internal/activator/rootfsrelease.go+1 −0internal/activator/rootfsrelease_test.go+1 −0internal/host/buildstate_test.go+18 −5internal/provision/testdata/plan14-root-reads-activator-settle-wait.tsv+10 −0internal/provision/testdata/plan14-root-reads-chain.tsv+2 −1
CI passed — run details
diff --git a/docs/superpowers/notes/census-proposal-activator-settle-wait.md b/docs/superpowers/notes/census-proposal-activator-settle-wait.md| new file mode 100644 |
| index 000000000..d4ac836e5 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-activator-settle-wait.md |
| @@ -0,0 +1,25 @@ |
| +# Census approval: activator-settle-wait |
| + |
| +Ruling `census-ruling-activator-settle-wait`. 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.wake` | body | unchanged (16) | Counts the wake in Service.background (a.background.Add(1), deferred Add(-1)) as its first statements; an in-memory atomic counter nothing in the agent waits on. No read added; read sites unchanged (16). | |
| +| `internal/activator/activator.go` `type Service` | body | unchanged (0) | One field, background (atomic.Int64): in-memory count of wakes, failed-wake reapers and command settle attempts in flight, for tests to wait on (#897). Declaration only; no read. | |
| +| `internal/activator/cmd.go` `Service.RunCmd` | body | unchanged (17) | Points the new hold at the Service background counter (h.settles = &a.background) after newCmdHold; bookkeeping only, no read added, read sites unchanged (17). | |
| +| `internal/activator/rootfsrelease.go` `Service.runReleaseAdmitted` | body | unchanged (12) | Points the release hold at the Service background counter (op.hold.settles = &a.background) after newCmdHold; bookkeeping only, no read added, read sites unchanged (12). | |
| + |
| +Envelopes re-pinned: `internal/activator`. |
| + |
| +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.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 |
| +- `internal/activator/activator.go` `type Service`: authority, task B,C,D,F,J4. Basis: rev3=PROPOSED-seed; existing activator lifecycle and due-wake state plus owned seed exclusion and incarnation-keyed diagnostics; normal refusal and preparation ordering remain authoritative; PROPOSED-plans-2-box-limits adds the idleFor hook field, which only narrows idle windows;rev3=census-ruling-plans-4c-box-throttle;basis=gains the maxRunFor hook field beside idleFor (plans 4c). No read added.;rev3=census-ruling-plans-4d-lapse;basis=gains the disabledFor hook field beside maxRunFor (plans 4d). No read added.;rev3=census-ruling-remote-instance-metrics;basis=gains tenancySeq, hostTenants and hostMixed, in-memory fields for Tenancies; no read added;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more field, markers (markerRetry: an atomic running flag and the last log time) for retryOwedMarkers; no read added; merge of origin/main d7ae1d76: main's fields are kept as main has them (census-ruling-remote-instance-metrics: tenancySeq, hostTenants, hostMixed); this branch's change is the same as above;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: new fields for rootfs admission (rootfsArmed, rootfsSwept), the per-host gate ask and refusal memo, and residency state (lister, backoff, start ceiling, cursor, test seam); no read;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: one new field, releaseOps (host to the in-memory release record, under a.mu); no read;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: one new field, leaseNow (a clock seam for a worker start's headroom against the lease deadline, nil is the real clock); no read;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2: gains the holder cache and its single-flight state; no read;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): one field, Fleet (activator.FleetWake: the box's fleet state, not on a fleet by default, on a fleet with a known label and a record reader, or on a fleet with an invalid identity), set by the agent before Start and read only by routeCurrentUnderLease. No read in the declaration. Agent, not root.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a fix round 1: one field, drainBudget (time.Duration), which New copies from residentDrainBudget and a rootfs entry's lease watch reads in its place, so a test's change of the package var never races a watch goroutine; declaration only, reads nothing; merge of origin/main 6f1f6ca6: main's one field, Fleet (activator.FleetWake), is kept as main has it (census-ruling-managed-fleets-1b); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b3a;basis=Add bounded placement peer and diagnostic state and the over-capacity callback; no read in this declaration and no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Add coordinator, existing-record observation callback and per-host preparation locks; no read in the declaration. Task 3a: Add optional canonical storage-selection and durable deploy-ID callbacks; declaration only, no read or authority in these fields.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds the heldLegs map to actEntry (legs by id, under a.mu) and heldWakeHook (atomic pointer to a callback) and heldLegSeq (atomic counter) to Service. State only, in memory; no read of tenant, app or box-agent-writable input.;rev3=census-ruling-wake-storm-cap;basis=the agent as carlos: one field, wakeSlots (chan struct{}, the wake semaphore made by New from Config.WakeSlots, default 4); declaration only, no read.;rev3=census-ruling-region-ha-p1b3b-t;basis=Add the B2 DutyStore interface field and process-local duty view, suppression and invalidation state. No read added. B2 adds the verified-successor identity callback; no read in the declaration. B3b adds a nonblocking departure-suspicion callback, invoked only after an accepted holder-forward failure and after cache locks release; it cannot authorize a take.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: immutable callbacks installed before Start for tenant admission, local start permission, fixed route exemptions and shutdown closure; nil callbacks preserve switch-off behavior; no new reads. Fix R1: add an immutable startup-phase callback for response copy, set before service startup. No new read or execution authority.;rev3=census-ruling-region-ha-g2-fixes;basis=Add in-memory HA loss state and pool withdrawal jobs; no new read.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 1: one new field, drain (drainSources: two atomic func pointers for this box's and peers' drain state); no read added. region HA held-requests Task 2: one new field, moves (moveTable: per-host move state, hold counts and admission tickets in memory, under mu); no read added;rev3=census-ruling-held-move-speed;basis=the agent as carlos: one new field, moveStreams (per-host in-memory set of edge.StreamEnd for requests in flight, own mutex), for the move's early stream cut; actEntry gains drainRelease (bool, under a.mu), set by DrainStop; declarations only, no read added;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: two fields, wakeFailMu and wakeFailLogged (per-host in-memory note of the last journalled wake failure); declaration only, no read;rev3=census-ruling-w6-ingress-drain;basis=new field TenantStartsClosed func() bool; when it answers true tenantStartRefusal refuses every start, exempt routes included. Wired only by fixedAdmission.bind to the ingress drain's closed flag. Struct field only; no read added. |
| +- `internal/activator/cmd.go` `Service.RunCmd`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-carlos-run;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): admits one run against an awake entry under the agent's own lease, fence and swap checks; it starts nothing itself and root validates what it later names;rev3=census-ruling-edge-request-records;basis=passes nil for begin's new req parameter; no read added;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: a carlos run is refused with ErrCmdBusy while a release record of the host is open (a.releaseOps[rt.Host], in-memory), as a run already in flight refuses it; new site +registry:Host (that map lookup); adds a refusal only;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a: AfterSettled honoured on every path (called before return on each path that starts no unit, else by the settle that proves the unit gone); a rootfs run is refused as a lost lease (CmdStoppedError StopLeaseLost) when its entry is not under the lease watch (residentWatchedLocked), and, off a.mu, when the replica's in-memory SafeUntil leaves less than oneShotStartLead (oneShotHeadroom); new sites are e.route.Rootfs() and a log line; adds refusals only Task 9 (PF-17): a session (spec.TTY) takes the entry's tty slot and a run its cmd slot (holdSlot), the hold carrying its role (newCmdHold); each is refused only for its own role (holdBusyLocked: ErrCmdBusy or ErrTTYBusy), so a run and a session coexist; a release command (a.releaseOps) refuses a run only, since the session's tty unit is its own; no read added, read sites unchanged Task 12 fix round 1 (Astra P1, incarnation binding): a session (spec.TTY) is refused with ErrCmdIncarnation, under a.mu, at admission (before the hold is attached, so nothing of it runs) and again at the last check before the start, unless the awake entry's row lifetime (e.route.Incarnation) equals spec.Incarnation, the lifetime the box's grant authorized; Task 12 fix round 2 (revised ruling): only a mismatch refuses, and 0 matches 0 (a record and row with no lifetime fields); a run is not checked; refuses more, starts nothing new, no read added beyond the in-memory e.route field (sessionIncarnationLocked);rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Take command/TTY mode from the actual serving generation alongside the existing captured environment; no authority comes from a route flag.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: add/recheck the local start prohibition on generation, worker, sidecar, command or root-control launch, including retained leases; preserve existing lease/ownership checks and fixed-unit exemptions. Whole Route passes to the in-memory predicate; no new filesystem/store read.;rev3=census-ruling-stateless-replicas-2;basis=Only a set command chains the existing exec gate to the current record membership recheck immediately before exec; preserves caller gate and legacy path. merge of origin/main 7920cccf: Retain main tenantStartRefusal before command admission alongside the replica exec-gate wrapper; whole existing Route passed to admission, no new read source.;rev3=census-ruling-region-ha-g2-fixes;basis=Reject an existing entry with the wrong command lifetime before begin; new read of Host indexes the in-memory entry map. |
| +- `internal/activator/rootfsrelease.go` `Service.runReleaseAdmitted`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Extract existing runner unchanged except optional pre-exec durable release transition after local admission and before any command; same staged process reads, stop/proof and exec gates, no new filesystem path. |
| + |
| +Seal: `587f6e92c5e594b9bb6436a2d0066849454407202e311f43483bed3be4591940` → `b3d35a0bd7c0500c74efbe5e8f566adb623696d31bd9860164907e08a2e79369`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-activator-settle-wait.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/notes/census-proposal-lease-checkpoint-no-compaction.md b/docs/superpowers/notes/census-proposal-lease-checkpoint-no-compaction.md| index 33b211ed6..2bc81e8bd 100644 |
| --- a/docs/superpowers/notes/census-proposal-lease-checkpoint-no-compaction.md |
| +++ b/docs/superpowers/notes/census-proposal-lease-checkpoint-no-compaction.md |
| @@ -6,6 +6,6 @@ Envelopes re-pinned: `internal/lease`. |
| 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. |
| -Seal: `587f6e92c5e594b9bb6436a2d0066849454407202e311f43483bed3be4591940` → `587f6e92c5e594b9bb6436a2d0066849454407202e311f43483bed3be4591940`. |
| +Seal: `b3d35a0bd7c0500c74efbe5e8f566adb623696d31bd9860164907e08a2e79369` → `b3d35a0bd7c0500c74efbe5e8f566adb623696d31bd9860164907e08a2e79369`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-lease-checkpoint-no-compaction.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/activator/activator.go b/internal/activator/activator.go| index d332d4f96..b179097e4 100644 |
| --- a/internal/activator/activator.go |
| +++ b/internal/activator/activator.go |
| @@ -1617,6 +1617,14 @@ type Service struct { |
| // OnWake. |
| GenerationsFile string |
| + // background counts work that can still write the box's files after |
| + // its caller has its answer: wake goroutines (a wake closes e.ready and |
| + // then records the outcome and the generations file), command settle |
| + // attempts with their proof's callbacks (cmdHold.settle), and failed |
| + // wakes' reapers (reapUnprovenWake). Nothing in the agent waits on it; |
| + // tests do, before their files go (#897). |
| + background atomic.Int64 |
| + |
| // schedMu guards schedFences, each host's schedule write fence |
| // (schedfence.go). It is never held with a.mu or a fence's own lock. |
| schedMu sync.Mutex |
| @@ -2083,6 +2091,8 @@ func (a *Service) refuseWakeLocked(e *actEntry, cancel context.CancelFunc) { |
| // requests still need the wake to finish even if the requester who started it |
| // hangs up. |
| func (a *Service) wake(e *actEntry) { |
| + a.background.Add(1) |
| + defer a.background.Add(-1) |
| if a.wakeEnded != nil { |
| defer a.wakeEnded(e.host) |
| } |
diff --git a/internal/activator/background_test.go b/internal/activator/background_test.go| new file mode 100644 |
| index 000000000..04d42c456 |
| --- /dev/null |
| +++ b/internal/activator/background_test.go |
| @@ -0,0 +1,28 @@ |
| +package activator |
| + |
| +import ( |
| + "testing" |
| + "time" |
| +) |
| + |
| +// waitBackground waits until a has no background work in flight |
| +// (Service.background): no wake goroutine, failed-wake reaper or command |
| +// settle attempt. Each can write the generations file after its caller |
| +// has its answer: a wake records its outcome after it closes e.ready, a |
| +// failed wake's reaper writes after Shutdown saw its obligation gone, and |
| +// a release whose stop was not proven settles later, its proof writing |
| +// the file (releaseProven) after the stop returned. A rig calls this from |
| +// a cleanup registered after its t.TempDir calls, so it runs before they |
| +// are removed; without it RemoveAll raced the write (#897: "TempDir |
| +// RemoveAll cleanup: directory not empty"). |
| +func waitBackground(t *testing.T, a *Service) { |
| + t.Helper() |
| + deadline := time.Now().Add(10 * time.Second) |
| + for a.background.Load() > 0 { |
| + if time.Now().After(deadline) { |
| + t.Errorf("%d background tasks still in flight after 10s", a.background.Load()) |
| + return |
| + } |
| + time.Sleep(time.Millisecond) |
| + } |
| +} |
diff --git a/internal/activator/cmd.go b/internal/activator/cmd.go| index da1a3dd75..7a93634ec 100644 |
| --- a/internal/activator/cmd.go |
| +++ b/internal/activator/cmd.go |
| @@ -6,6 +6,7 @@ import ( |
| "fmt" |
| "log" |
| "sync" |
| + "sync/atomic" |
| "time" |
| "github.com/carlosframework/platform/internal/instancectl" |
| @@ -130,12 +131,15 @@ type cmdHold struct { |
| // it, under a.mu, so a stop interrupts a download. |
| cancelPrepare context.CancelFunc |
| started chan struct{} // closed once StartCmd returned, either way |
| - unit CmdUnit // written before started is closed; nil when no unit can be running |
| - now func() time.Time |
| - mu sync.Mutex |
| - asked bool // a stop has been asked for; under mu |
| - reason string |
| - askedAt time.Time // when the first stop was asked for; under mu |
| + // settles is its Service's background count (Service.background): each |
| + // settle attempt counts until its proof's callbacks have run. |
| + settles *atomic.Int64 |
| + unit CmdUnit // written before started is closed; nil when no unit can be running |
| + now func() time.Time |
| + mu sync.Mutex |
| + asked bool // a stop has been asked for; under mu |
| + reason string |
| + askedAt time.Time // when the first stop was asked for; under mu |
| // settling is the settle attempt in flight, nil when none is. A stop |
| // joins it rather than starting a second one. Under mu. |
| settling *cmdSettle |
| @@ -177,6 +181,13 @@ func (h *cmdHold) settled() { |
| } |
| } |
| +// settleStarted counts a settle attempt about to start (see settles). |
| +func (h *cmdHold) settleStarted() { |
| + if h.settles != nil { |
| + h.settles.Add(1) |
| + } |
| +} |
| + |
| // cmdSettle is one settle attempt: done closes when it has ended, and err |
| // is its result, written before done closes. |
| type cmdSettle struct { |
| @@ -227,6 +238,7 @@ func (h *cmdHold) stop(ctx context.Context, reason string) error { |
| if at == nil { |
| at = &cmdSettle{done: make(chan struct{})} |
| h.settling = at |
| + h.settleStarted() |
| go h.settle(at) |
| } |
| h.mu.Unlock() |
| @@ -245,6 +257,9 @@ func (h *cmdHold) stop(ctx context.Context, reason string) error { |
| // goroutine, and no stop waits for them (fix round 2: proof and the |
| // callback's completion are different states, CmdSpec.AfterSettled). |
| func (h *cmdHold) settle(at *cmdSettle) { |
| + if h.settles != nil { |
| + defer h.settles.Add(-1) |
| + } |
| err := h.unit.StopAndSettle(context.Background()) |
| h.mu.Lock() |
| at.err = err |
| @@ -286,6 +301,7 @@ func (h *cmdHold) retrySettle(released bool, every time.Duration) { |
| } |
| at := &cmdSettle{done: make(chan struct{})} |
| h.settling = at |
| + h.settleStarted() |
| go h.settle(at) |
| } |
| @@ -768,6 +784,7 @@ func (a *Service) RunCmd(ctx context.Context, rt registry.Route, spec CmdSpec) ( |
| pctx, pcancel := context.WithCancel(ctx) |
| defer pcancel() |
| h := newCmdHold(spec.RunID, role, pcancel, a.now) |
| + h.settles = &a.background |
| h.afterSettled = spec.AfterSettled |
| a.mu.Lock() |
| e := a.entries[rt.Host] |
diff --git a/internal/activator/opset.go b/internal/activator/opset.go| index d9628e1b3..e2c7e91fa 100644 |
| --- a/internal/activator/opset.go |
| +++ b/internal/activator/opset.go |
| @@ -869,7 +869,13 @@ func (a *Service) reapUnprovenWakesLocked() { |
| continue |
| } |
| u.busy = true |
| - go a.reapUnprovenWake(host, u) |
| + // Counted from before launch through its last write (Service.background): |
| + // it forgets the obligation, then writes the generations file. |
| + a.background.Add(1) |
| + go func(host string, u *unprovenWake) { |
| + defer a.background.Add(-1) |
| + a.reapUnprovenWake(host, u) |
| + }(host, u) |
| } |
| } |
diff --git a/internal/activator/rootfs_wake_release_test.go b/internal/activator/rootfs_wake_release_test.go| index ef5968c3c..cb4a20a93 100644 |
| --- a/internal/activator/rootfs_wake_release_test.go |
| +++ b/internal/activator/rootfs_wake_release_test.go |
| @@ -296,6 +296,7 @@ func (r *wakeRelRig) service(t *testing.T) *Service { |
| r.b.setStuck(false) |
| r.clk.advance(actStopTimeout + time.Second) |
| a.Shutdown(context.Background()) |
| + waitBackground(t, a) |
| }) |
| return a |
| } |
diff --git a/internal/activator/rootfsrelease.go b/internal/activator/rootfsrelease.go| index 737b80520..ae8280aeb 100644 |
| --- a/internal/activator/rootfsrelease.go |
| +++ b/internal/activator/rootfsrelease.go |
| @@ -425,6 +425,7 @@ func (a *Service) runReleaseAdmitted(ctx context.Context, e *actEntry, rt regist |
| defer cancel(nil) |
| op := &releaseOp{host: host, build: id, cancel: cancel, owner: e, state: releaseRunning, done: make(chan struct{})} |
| op.hold = newCmdHold("release", instancectl.RoleCmd, func() { cancel(context.Canceled) }, a.now) |
| + op.hold.settles = &a.background |
| op.hold.starting = true |
| op.hold.onProven = func() { a.releaseProven(op) } |
| startedClosed := false |
diff --git a/internal/activator/rootfsrelease_test.go b/internal/activator/rootfsrelease_test.go| index 2a39a13cb..bdac13487 100644 |
| --- a/internal/activator/rootfsrelease_test.go |
| +++ b/internal/activator/rootfsrelease_test.go |
| @@ -626,6 +626,7 @@ func newReleaseRig(t *testing.T) *releaseRig { |
| a.entries[rt.Host] = e |
| a.mu.Unlock() |
| id := release.StagedIdentity{Version: "v2", StagedPath: filepath.Join(t.TempDir(), "v2", "rootfs.squashfs"), Digest: "bb22"} |
| + t.Cleanup(func() { waitBackground(t, a) }) |
| return &releaseRig{a: a, b: b, clk: clk, e: e, rt: rt, id: id, sink: sink, held: newOwnedLease(time.Now().Add(time.Hour), false)} |
| } |
diff --git a/internal/host/buildstate_test.go b/internal/host/buildstate_test.go| index 0be283fcf..acc2da7ed 100644 |
| --- a/internal/host/buildstate_test.go |
| +++ b/internal/host/buildstate_test.go |
| @@ -1113,20 +1113,27 @@ func TestAHeldWakeReadsTheCopyAsRootsTargetDoes(t *testing.T) { |
| } |
| } |
| -// budgetEater records which host's build state each read asks for and |
| -// holds the read until the caller's context ends: the host it is reading |
| -// spends the whole refresh budget. |
| +// budgetEater records which host's build state each read asks for, ends |
| +// the pass (spend) and holds the read until the caller's context ends: the |
| +// host it is reading spends the whole refresh budget. Ending the pass from |
| +// the read, not from a short wall-clock budget, keeps a slow registry list |
| +// on a loaded runner from spending the budget before any host is reached. |
| type budgetEater struct { |
| release.Store |
| mu sync.Mutex |
| hosts []string |
| + spend context.CancelFunc |
| } |
| func (e *budgetEater) Get(ctx context.Context, key string) ([]byte, string, error) { |
| if host, ok := strings.CutSuffix(strings.TrimPrefix(key, "inst/"), "/build-state.json"); ok { |
| e.mu.Lock() |
| e.hosts = append(e.hosts, host) |
| + spend := e.spend |
| e.mu.Unlock() |
| + if spend != nil { |
| + spend() |
| + } |
| <-ctx.Done() |
| return nil, "", ctx.Err() |
| } |
| @@ -1146,9 +1153,15 @@ func TestRefreshAllRotatesPastWhereTheLastOneStopped(t *testing.T) { |
| } |
| eater := &budgetEater{Store: s} |
| b.storeFor = storesOf(map[string]release.Store{"hib": eater}) |
| - b.budget = 200 * time.Millisecond |
| + b.budget = time.Minute |
| for i := 0; i < 4; i++ { |
| - if skipped := b.refreshAll(context.Background()); skipped != 2 { |
| + ctx, spend := context.WithCancel(context.Background()) |
| + eater.mu.Lock() |
| + eater.spend = spend |
| + eater.mu.Unlock() |
| + skipped := b.refreshAll(ctx) |
| + spend() |
| + if skipped != 2 { |
| t.Fatalf("pass %d skipped %d, want 2 (one host eats the budget)", i, skipped) |
| } |
| } |
diff --git a/internal/provision/testdata/plan14-root-reads-activator-settle-wait.tsv b/internal/provision/testdata/plan14-root-reads-activator-settle-wait.tsv| new file mode 100644 |
| index 000000000..a5df9b4ab |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-activator-settle-wait.tsv |
| @@ -0,0 +1,10 @@ |
| +# Census overlay activator-settle-wait, written by census-propose (#369). census-ruling-activator-settle-wait, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-activator-settle-wait.md. |
| +# 4 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +@legacy 91b448bb82c9409ece5267a9e9186bb6bf39e6e66f87b9f547a5c7a54f6d5a27 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-activator-settle-wait;basis=Counts the wake in Service.background (a.background.Add(1), deferred Add(-1)) as its first statements; an in-memory atomic counter nothing in the agent waits on. No read added; read sites unchanged (16). registry:Socket@8698,registry:Socket@8859,registry:Stateless@10193,registry:Stateless@10941,whole:Route@10184,whole:Route@10239,whole:Route@10943,whole:Route@1811,whole:Route@3326,whole:Route@3453,whole:Route@3610,whole:Route@515,whole:Route@6960,whole:Route@8651,whole:Route@8700,whole:Route@8861 46ff8624586a65fbf6c8a70c1faa083c2354154ab7970a0f955488fe99bcca3b |
| +@legacy d8736b373d45ed5bdacdbc091d8d780bb4773a47f201096179a729c31be2a6d1 internal/activator/cmd.go Service.RunCmd legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): admits one run against an awake entry under the agent's own lease, fence and swap checks; it starts nothing itself and root validates what it later names;rev3=census-ruling-edge-request-records;basis=passes nil for begin's new req parameter; no read added;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: a carlos run is refused with ErrCmdBusy while a release record of the host is open (a.releaseOps[rt.Host], in-memory), as a run already in flight refuses it; new site +registry:Host (that map lookup); adds a refusal only;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a: AfterSettled honoured on every path (called before return on each path that starts no unit, else by the settle that proves the unit gone); a rootfs run is refused as a lost lease (CmdStoppedError StopLeaseLost) when its entry is not under the lease watch (residentWatchedLocked), and, off a.mu, when the replica's in-memory SafeUntil leaves less than oneShotStartLead (oneShotHeadroom); new sites are e.route.Rootfs() and a log line; adds refusals only Task 9 (PF-17): a session (spec.TTY) takes the entry's tty slot and a run its cmd slot (holdSlot), the hold carrying its role (newCmdHold); each is refused only for its own role (holdBusyLocked: ErrCmdBusy or ErrTTYBusy), so a run and a session coexist; a release command (a.releaseOps) refuses a run only, since the session's tty unit is its own; no read added, read sites unchanged Task 12 fix round 1 (Astra P1, incarnation binding): a session (spec.TTY) is refused with ErrCmdIncarnation, under a.mu, at admission (before the hold is attached, so nothing of it runs) and again at the last check before the start, unless the awake entry's row lifetime (e.route.Incarnation) equals spec.Incarnation, the lifetime the box's grant authorized; Task 12 fix round 2 (revised ruling): only a mismatch refuses, and 0 matches 0 (a record and row with no lifetime fields); a run is not checked; refuses more, starts nothing new, no read added beyond the in-memory e.route field (sessionIncarnationLocked);rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Take command/TTY mode from the actual serving generation alongside the existing captured environment; no authority comes from a route flag.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: add/recheck the local start prohibition on generation, worker, sidecar, command or root-control launch, including retained leases; preserve existing lease/ownership checks and fixed-unit exemptions. Whole Route passes to the in-memory predicate; no new filesystem/store read.;rev3=census-ruling-stateless-replicas-2;basis=Only a set command chains the existing exec gate to the current record membership recheck immediately before exec; preserves caller gate and legacy path. merge of origin/main 7920cccf: Retain main tenantStartRefusal before command admission alongside the replica exec-gate wrapper; whole existing Route passed to admission, no new read source.;rev3=census-ruling-region-ha-g2-fixes;basis=Reject an existing entry with the wrong command lifetime before begin; new read of Host indexes the in-memory entry map.;rev3=census-ruling-activator-settle-wait;basis=Points the new hold at the Service background counter (h.settles = &a.background) after newCmdHold; bookkeeping only, no read added, read sites unchanged (17). file:Prepare@2971,file:Prepare@3005,registry:FleetBoxes@9591,registry:Host@1785,registry:Host@2381,registry:Host@8215,registry:Host@9451,registry:Host@948,registry:Kind@511,registry:Stateless@5415,whole:Route@1125,whole:Route@402,whole:Route@757,whole:Route@8619,whole:Route@9083,whole:Route@9780,whole:Route@9821 b1e0656cf402645c2ec9d7e25a6415ea5afbe5fed2a9e1f9796dc1df18e67b4f |
| +@legacy ff7c47fe30461a794e5a9a78f8460aa5a2634510500133f416b803d2366c4d6e internal/activator/rootfsrelease.go Service.runReleaseAdmitted legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Extract existing runner unchanged except optional pre-exec durable release transition after local admission and before any command; same staged process reads, stop/proof and exec gates, no new filesystem path.;rev3=census-ruling-activator-settle-wait;basis=Points the release hold at the Service background counter (op.hold.settles = &a.background) after newCmdHold; bookkeeping only, no read added, read sites unchanged (12). registry:Host@216,whole:Route@3118,whole:Route@3347,whole:Route@3835,whole:Route@3864,whole:Route@5912,whole:Route@621,whole:Route@6380,whole:Route@6657,whole:Route@7087,whole:Route@849,whole:Route@934 6c5ea557379d0198adea4ae4ccee117128ba178cd5e71c64475b6e310f502bdd |
| +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-activator-settle-wait;basis=Counts the wake in Service.background (a.background.Add(1), deferred Add(-1)) as its first statements; an in-memory atomic counter nothing in the agent waits on. No read added; read sites unchanged (16). registry:Socket@8698,registry:Socket@8859,registry:Stateless@10193,registry:Stateless@10941,whole:Route@10184,whole:Route@10239,whole:Route@10943,whole:Route@1811,whole:Route@3326,whole:Route@3453,whole:Route@3610,whole:Route@515,whole:Route@6960,whole:Route@8651,whole:Route@8700,whole:Route@8861 46ff8624586a65fbf6c8a70c1faa083c2354154ab7970a0f955488fe99bcca3b |
| +internal/activator/activator.go type Service authority B,C,D,F,J4 rev3=PROPOSED-seed; existing activator lifecycle and due-wake state plus owned seed exclusion and incarnation-keyed diagnostics; normal refusal and preparation ordering remain authoritative; PROPOSED-plans-2-box-limits adds the idleFor hook field, which only narrows idle windows;rev3=census-ruling-plans-4c-box-throttle;basis=gains the maxRunFor hook field beside idleFor (plans 4c). No read added.;rev3=census-ruling-plans-4d-lapse;basis=gains the disabledFor hook field beside maxRunFor (plans 4d). No read added.;rev3=census-ruling-remote-instance-metrics;basis=gains tenancySeq, hostTenants and hostMixed, in-memory fields for Tenancies; no read added;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more field, markers (markerRetry: an atomic running flag and the last log time) for retryOwedMarkers; no read added; merge of origin/main d7ae1d76: main's fields are kept as main has them (census-ruling-remote-instance-metrics: tenancySeq, hostTenants, hostMixed); this branch's change is the same as above;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: new fields for rootfs admission (rootfsArmed, rootfsSwept), the per-host gate ask and refusal memo, and residency state (lister, backoff, start ceiling, cursor, test seam); no read;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: one new field, releaseOps (host to the in-memory release record, under a.mu); no read;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: one new field, leaseNow (a clock seam for a worker start's headroom against the lease deadline, nil is the real clock); no read;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2: gains the holder cache and its single-flight state; no read;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): one field, Fleet (activator.FleetWake: the box's fleet state, not on a fleet by default, on a fleet with a known label and a record reader, or on a fleet with an invalid identity), set by the agent before Start and read only by routeCurrentUnderLease. No read in the declaration. Agent, not root.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a fix round 1: one field, drainBudget (time.Duration), which New copies from residentDrainBudget and a rootfs entry's lease watch reads in its place, so a test's change of the package var never races a watch goroutine; declaration only, reads nothing; merge of origin/main 6f1f6ca6: main's one field, Fleet (activator.FleetWake), is kept as main has it (census-ruling-managed-fleets-1b); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b3a;basis=Add bounded placement peer and diagnostic state and the over-capacity callback; no read in this declaration and no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Add coordinator, existing-record observation callback and per-host preparation locks; no read in the declaration. Task 3a: Add optional canonical storage-selection and durable deploy-ID callbacks; declaration only, no read or authority in these fields.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): adds the heldLegs map to actEntry (legs by id, under a.mu) and heldWakeHook (atomic pointer to a callback) and heldLegSeq (atomic counter) to Service. State only, in memory; no read of tenant, app or box-agent-writable input.;rev3=census-ruling-wake-storm-cap;basis=the agent as carlos: one field, wakeSlots (chan struct{}, the wake semaphore made by New from Config.WakeSlots, default 4); declaration only, no read.;rev3=census-ruling-region-ha-p1b3b-t;basis=Add the B2 DutyStore interface field and process-local duty view, suppression and invalidation state. No read added. B2 adds the verified-successor identity callback; no read in the declaration. B3b adds a nonblocking departure-suspicion callback, invoked only after an accepted holder-forward failure and after cache locks release; it cannot authorize a take.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: immutable callbacks installed before Start for tenant admission, local start permission, fixed route exemptions and shutdown closure; nil callbacks preserve switch-off behavior; no new reads. Fix R1: add an immutable startup-phase callback for response copy, set before service startup. No new read or execution authority.;rev3=census-ruling-region-ha-g2-fixes;basis=Add in-memory HA loss state and pool withdrawal jobs; no new read.;rev3=census-ruling-region-ha-held-build;basis=region HA held-requests Task 1: one new field, drain (drainSources: two atomic func pointers for this box's and peers' drain state); no read added. region HA held-requests Task 2: one new field, moves (moveTable: per-host move state, hold counts and admission tickets in memory, under mu); no read added;rev3=census-ruling-held-move-speed;basis=the agent as carlos: one new field, moveStreams (per-host in-memory set of edge.StreamEnd for requests in flight, own mutex), for the move's early stream cut; actEntry gains drainRelease (bool, under a.mu), set by DrainStop; declarations only, no read added;rev3=census-ruling-fix-silent-start-kill-861;basis=#861: two fields, wakeFailMu and wakeFailLogged (per-host in-memory note of the last journalled wake failure); declaration only, no read;rev3=census-ruling-w6-ingress-drain;basis=new field TenantStartsClosed func() bool; when it answers true tenantStartRefusal refuses every start, exempt routes included. Wired only by fixedAdmission.bind to the ingress drain's closed flag. Struct field only; no read added.;rev3=census-ruling-activator-settle-wait;basis=One field, background (atomic.Int64): in-memory count of wakes, failed-wake reapers and command settle attempts in flight, for tests to wait on (#897). Declaration only; no read. 9d8ff4cc7f6e152f8e365db6d26fcbbc4b0e0f81a81da073443c2ef70c4f6b97 |
| +internal/activator/cmd.go Service.RunCmd legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): admits one run against an awake entry under the agent's own lease, fence and swap checks; it starts nothing itself and root validates what it later names;rev3=census-ruling-edge-request-records;basis=passes nil for begin's new req parameter; no read added;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: a carlos run is refused with ErrCmdBusy while a release record of the host is open (a.releaseOps[rt.Host], in-memory), as a run already in flight refuses it; new site +registry:Host (that map lookup); adds a refusal only;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a: AfterSettled honoured on every path (called before return on each path that starts no unit, else by the settle that proves the unit gone); a rootfs run is refused as a lost lease (CmdStoppedError StopLeaseLost) when its entry is not under the lease watch (residentWatchedLocked), and, off a.mu, when the replica's in-memory SafeUntil leaves less than oneShotStartLead (oneShotHeadroom); new sites are e.route.Rootfs() and a log line; adds refusals only Task 9 (PF-17): a session (spec.TTY) takes the entry's tty slot and a run its cmd slot (holdSlot), the hold carrying its role (newCmdHold); each is refused only for its own role (holdBusyLocked: ErrCmdBusy or ErrTTYBusy), so a run and a session coexist; a release command (a.releaseOps) refuses a run only, since the session's tty unit is its own; no read added, read sites unchanged Task 12 fix round 1 (Astra P1, incarnation binding): a session (spec.TTY) is refused with ErrCmdIncarnation, under a.mu, at admission (before the hold is attached, so nothing of it runs) and again at the last check before the start, unless the awake entry's row lifetime (e.route.Incarnation) equals spec.Incarnation, the lifetime the box's grant authorized; Task 12 fix round 2 (revised ruling): only a mismatch refuses, and 0 matches 0 (a record and row with no lifetime fields); a run is not checked; refuses more, starts nothing new, no read added beyond the in-memory e.route field (sessionIncarnationLocked);rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Take command/TTY mode from the actual serving generation alongside the existing captured environment; no authority comes from a route flag.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: add/recheck the local start prohibition on generation, worker, sidecar, command or root-control launch, including retained leases; preserve existing lease/ownership checks and fixed-unit exemptions. Whole Route passes to the in-memory predicate; no new filesystem/store read.;rev3=census-ruling-stateless-replicas-2;basis=Only a set command chains the existing exec gate to the current record membership recheck immediately before exec; preserves caller gate and legacy path. merge of origin/main 7920cccf: Retain main tenantStartRefusal before command admission alongside the replica exec-gate wrapper; whole existing Route passed to admission, no new read source.;rev3=census-ruling-region-ha-g2-fixes;basis=Reject an existing entry with the wrong command lifetime before begin; new read of Host indexes the in-memory entry map.;rev3=census-ruling-activator-settle-wait;basis=Points the new hold at the Service background counter (h.settles = &a.background) after newCmdHold; bookkeeping only, no read added, read sites unchanged (17). file:Prepare@2971,file:Prepare@3005,registry:FleetBoxes@9591,registry:Host@1785,registry:Host@2381,registry:Host@8215,registry:Host@9451,registry:Host@948,registry:Kind@511,registry:Stateless@5415,whole:Route@1125,whole:Route@402,whole:Route@757,whole:Route@8619,whole:Route@9083,whole:Route@9780,whole:Route@9821 b1e0656cf402645c2ec9d7e25a6415ea5afbe5fed2a9e1f9796dc1df18e67b4f |
| +internal/activator/rootfsrelease.go Service.runReleaseAdmitted legacy accepted-legacy accepted-legacy;rev3=census-ruling-stateless-replicas-1;basis=Extract existing runner unchanged except optional pre-exec durable release transition after local admission and before any command; same staged process reads, stop/proof and exec gates, no new filesystem path.;rev3=census-ruling-activator-settle-wait;basis=Points the release hold at the Service background counter (op.hold.settles = &a.background) after newCmdHold; bookkeeping only, no read added, read sites unchanged (12). registry:Host@216,whole:Route@3118,whole:Route@3347,whole:Route@3835,whole:Route@3864,whole:Route@5912,whole:Route@621,whole:Route@6380,whole:Route@6657,whole:Route@7087,whole:Route@849,whole:Route@934 6c5ea557379d0198adea4ae4ccee117128ba178cd5e71c64475b6e310f502bdd |
| +@coverage internal/activator add1a82da8b594cbf18160e14ac630ac0beb8c8fd8bfc29866fb1f6ec6082375 |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 9898932b8..13b555735 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -171,4 +171,5 @@ plan14-root-reads-group-read-transport-retry.tsv 9c74b9876a13a3a3802860fe4440689 |
| plan14-root-reads-linked-deployments-slice1.tsv 40c8459580c3e62a53637e9989f1616e5735ce78796ec6ea1b22655a5eb4ad63 |
| plan14-root-reads-stats-prune-400.tsv 75b32391a24d2c9269fc579aae68ac80b7b1d4ccf0be55f0373490e43a2a652a |
| plan14-root-reads-group-observation-carry.tsv 587f6e92c5e594b9bb6436a2d0066849454407202e311f43483bed3be4591940 |
| -plan14-root-reads-lease-checkpoint-no-compaction.tsv 587f6e92c5e594b9bb6436a2d0066849454407202e311f43483bed3be4591940 |
| +plan14-root-reads-activator-settle-wait.tsv b3d35a0bd7c0500c74efbe5e8f566adb623696d31bd9860164907e08a2e79369 |
| +plan14-root-reads-lease-checkpoint-no-compaction.tsv b3d35a0bd7c0500c74efbe5e8f566adb623696d31bd9860164907e08a2e79369 |