host: hold the first serial seed until request baselines read
Whole-branch review P1: tick 1 could seed lastSerial while the restart and sidecar wake baselines were still reading, so a request landing in between was taken as history by the baseline yet its serial bump came back as a move: the request was lost. fastBoot now starts the request baselines before the view walks, and fastTick skips its serial read while fastDeps.serialAfter is open, so the seed never precedes the baselines. A full pass run while held is run once more after the seed. restartSeed is called directly again (J4 authority coverage needs its production caller visible); tests hold the baselines with a nil hook. Also: AST pin for ready() before fastTick, a log line when the seed wait passes slowLegAfter, a guard on the runs witness, stale comments reworded (startup measurement labelled as the pre-change baseline, armRestartLegs and restartSeed docs). Census overlay -4 re-proposed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/notes/census-proposal-fleet-first-reconcile-speed-4.md+5 −3internal/host/agent.go+47 −2internal/host/fastboot.go+91 −47internal/host/fastboot_test.go+149 −14internal/host/restart.go+10 −10internal/host/startupmeasure_e2e_test.go+9 −5internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-fleet-first-reconcile-speed-4.tsv+9 −7
Intent
<task-notification> <task-id>acfdf5f043a273cf9</task-id> <tool-use-id>toolu_01KmPBczafyVM1hY2MqJvwTR</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/68be7e6f-7841-4936-9fa0-2041da778685/tasks/acfdf5f043a273cf9.output</output-file> <status>completed</status> <summary>Agent "Implement Task 4: first pass on arming" 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. Astra's Minor is fixed. The runs test now queues a real run, and it fails without the catch-up pass at ready. Commits: `894b72d7` (Task 4), `eb870914` (this test fix; only `internal/host/fastboot_test.go` changed). Test summary: the boot pass is held on a channel after it has listed the records, and the first tick then queues and notes a real run. The first tick launches nothing; ready launches exactly one run, and the record shows that run picked by box-1. Without the catch-up pass it fails ("0 runs launched after ready, want 1"); with it, it passes, race-clean over 3 runs. The runs and lifetime tests and the census tests pass. Steps moved vs kept: unchanged from the Task 4 commit. The five seeds run beside the first tick and the tick sleep is gone; the moves hold view and offline view still run before the first pass. Concerns: - My first try held the boot pass on its first listing and passed even without the fix, because the boot pass lists twice. I now hold it after the whole listing. - Census: only a test file changed, so census-propose did not need a rerun. - Task 4's earlier concerns stand. Report (fix appended): /home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-first-reconcile-speed/.superpowers/sdd/2026-11-15-fleet-first-reconcile/task-4-report.md</result> <usage><subagent_tokens>258735</subagent_tokens><tool_uses>11</tool_uses><duration_ms>424248</duration_ms></usage> </task-notification>
<task-notification> <task-id>b4kx5w673</task-id> <tool-use-id>toolu_01BM4cbK8UgG2WRr4jDpBwsL</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/68be7e6f-7841-4936-9fa0-2041da778685/tasks/b4kx5w673.output</output-file> <status>failed</status> <summary>Background command "W=/home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-first-reconcile-speed/.superpowers/sdd/2026-11-15-fleet-first-reconcile; $W/astra-review.sh $W/final-review-prompt.md $W/final-review-astra.md & a=$!; $W/fable-review.sh $W/final-review-prompt.md $W/final-review-fable.md & f=$!; $W/astra-review.sh $W/census4-review-prompt.md $W/census4-review-astra.md & c=$!; wait $a $f $c; tail -2 $W/final-review-astra.md $W/final-review-fable.md $W/census4-review-astra.md" failed with exit code 1</summary> </task-notification>
<task-notification> <task-id>badf0nyy3</task-id> <tool-use-id>toolu_012xCpTh5JWhGq3KsYksHAjk</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/68be7e6f-7841-4936-9fa0-2041da778685/tasks/badf0nyy3.output</output-file> <status>completed</status> <summary>Background command "until s=$(amadan ci status carlos/platform -branch fleet-first-reconcile-fix 2>&1 | head -1); ! echo "$s" | grep -q "queued\|running"; do sleep 30; done; echo "$s"" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 5.68 g CO₂e (672,626 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on fleet-first-reconcile-fix, 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-fleet-first-reconcile-speed-4.md b/docs/superpowers/notes/census-proposal-fleet-first-reconcile-speed-4.md| index 51cb37208..9cbac367b 100644 |
| --- a/docs/superpowers/notes/census-proposal-fleet-first-reconcile-speed-4.md |
| +++ b/docs/superpowers/notes/census-proposal-fleet-first-reconcile-speed-4.md |
| @@ -5,7 +5,8 @@ Ruling `census-ruling-fleet-first-reconcile-speed-4`. The independent reviewer a |
| | unit | change | read sites | what changed | |
| |---|---|---|---| |
| | `internal/host/agent.go` `fastConvergeLoop` | body | unchanged (1) | Arming order only (fleet first reconcile Task 4). The moves hold view, the offline view, the restart seed, the sidecar wake seed, the runs boot pass, the arming schedule converge and the arming systemLeg.observe are no longer called here: fastBoot.start runs them (views on this goroutine, then the first tick at once with the seeds beside it). The restart legs, the sidecar wake leg closure (same reg.List + sidecarWakeLeg) and newSystemLeg are built here as before and handed to fastBoot, which gives them to fastDeps once the seeds return, before the second tick. The first tick no longer waits for a tick's sleep. Same calls with the same arguments and keys; no read added; read sites unchanged (1). Agent, not root. | |
| -| `internal/host/restart.go` `restartSeed` | body | unchanged (1) | List-error log line moved into logRestartListError (same text); body otherwise unchanged (reg.List then restartBaseline). Doc comment notes fastBoot runs restartBaseline over the arming route list. No read added; agent, not root. | |
| +| `internal/host/agent.go` `fastTick` | body | unchanged (1) | Startup serial hold (whole-branch review P1). While fastDeps.serialAfter is open (fastBoot closes it when the restart and sidecar wake baselines have read) the tick skips its one ReadSerial of control/serial, so it neither seeds nor acts on a move; the rest of the tick (backstop full pass, index, sweep) is unchanged. A full pass run while held sets fullBeforeSeed, and the seed then sets fullDue once so the backstop branch runs one more full pass under the clamp. Same read, read sites unchanged (1); no read added. Agent, not root. | |
| +| `internal/host/restart.go` `restartSeed` | body | unchanged (1) | List-error log line moved into logRestartListError (same text); body otherwise unchanged (reg.List then restartBaseline). Doc comment notes fastBoot calls it on the seeds' goroutine, ahead of the serial seed. No read added; agent, not root. | |
| | `internal/host/sidecarwake.go` `sidecarWakeSeed` | body | unchanged (1) | Body split: reg.List, then sidecarWakeBaseline (the former rest of the body, unchanged); list-error log line moved into logSidecarWakeListError (same text). No read added; agent, not root. | |
| Envelopes re-pinned: `internal/host`. |
| @@ -15,15 +16,16 @@ Review: a model from the other family than the author reads the branch's diff ag |
| Recorded dispositions, which each change must still satisfy: |
| - `internal/host/agent.go` `fastConvergeLoop`: authority, task B3. Basis: rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): every pass context carries the box's lifetime judge (provision.WithLifetimes) and the reconcile config is boxProvisionConfig's; read sites unchanged, offsets moved; B3 authority retained;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 12: its pass config is now BoxProvisionConfig(reg, os.Getenv, judge, configure) (BoxProvisionConfig replaces boxProvisionConfig: the hub predicate hubArmed and, on the hub, ReconcileConfig.FleetOwners from hubFleetOwners); a call, no read site; read sites unchanged (2); B3 authority retained.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: wire the coordinator's nonblocking SignalTick to the existing fast tick. No new timer, polling read or authority.;rev3=census-ruling-region-ha-p3b;basis=Bind systemLeg to the existing cached reader fold and handle a nil leg on groups; names-2 rollback gate runs before artifact/request/marker work. Agent-memory evidence only, no new direct or cloud read and no autonomous group update.;rev3=census-ruling-restart-new-box-gap;basis=restart leg closure moved into armRestartLegs (same reg.List + restartRequestLeg); also wires restartGain; read moved, not added;rev3=census-ruling-agent-start-demo-3;basis=Attach the moved reader to the existing shared change watch and advertise that reader as armed. Census read-site delta: unchanged (2).;rev3=census-ruling-fleet-first-reconcile-speed;basis=Startup timing log lines only (fleet first reconcile Task 1). Logs its entry offset and one line per arming step, then times the first tick. restartSeed, sidecarWakeSeed, refreshMovesHolds, refreshOfflineView and the one arming systemLeg.observe now read through countStore(store), a pass-through wrapper that counts and times each call and forwards it unchanged with the same key; for that observe, systemLeg.store is swapped to the wrapper and restored. For the first tick only, d.store is a fresh countStore(store) wrapper and d.startup a step logger; both are reset to the plain store and nil after the tick. passLegs gets startup. Same calls in the same order, no read added; read sites unchanged (1). Agent, not root. |
| +- `internal/host/agent.go` `fastTick`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=PROPOSED-s3-change-index;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=observes the change index before any pass (observeIndex), runs the backstop's requested full pass and a scoped pass for moved app scopes (indexTick), and arms the canary pointer gate on the sweep (canaryPointerGate) only on a tick whose own index observation succeeded; read site unchanged, offset moved;rev3=census-ruling-stateless-replicas-1;basis=Call coordinator Tick on the existing tick before convergence; client renews held terms only at the pinned interval. Existing registry read unchanged. Final review I3: signal the owned renewal worker instead of waiting for its sequential console HTTP calls. Existing convergence and record read unchanged.;rev3=census-ruling-region-ha-p3a;basis=Run the optional desired-role reader on the existing tick after observing the armed change index; no new root path or timer, nil reader is unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: signals the owned replica worker on the existing tick; coalesced asynchronous execution, no timer or bucket scan added. merge of origin/main 7920cccf: Retain main box-role reader pass on the existing tick alongside the replica worker signal; merge-only body change, unchanged read sites.;rev3=census-ruling-restart-new-box-gap;basis=calls the optional restartGain hook (restartGainSeed) once per existing tick before the serial read; no new root path, timer or read kind; nil hook is unchanged;rev3=census-ruling-agent-start-demo-3;basis=Refresh moved notices through the shared watch before normal convergence; no new per-box poll. Census read-site delta: unchanged (1).;rev3=census-ruling-stateless-replicas-4-task1;basis=Signals the owned replica swap worker (armedReplicaDeploy.tick) beside the placement worker on the existing tick; coalesced background pass, no timer, no bucket read. Its transitions go through the console's authenticated /deploy.;rev3=census-ruling-platform-mail-submission;basis=Task 4: on a serial move, after the schedule leg, starts the armed mail switch cache's Refresh on its own goroutine (each read bounded at 2 s, overlapping refreshes skipped). It re-reads the app sender records already cached, through the agent's deploy store. Agent, not root; the tick waits on nothing new. Fable final P2-1: on a serial move, before the pass set and the restart leg, calls the armed cache's MarkStale (a counter bump under the cache's mutex; no I/O), so a spawn the move causes reads the switch again, bounded, instead of using an answer from before the move. No read added.;rev3=census-ruling-fleet-first-reconcile-speed;basis=Startup timing log lines only: d.startup.done(<part>) calls between the existing parts and a deferred one after the sweep. d.startup is nil on every tick but the first after agent start, and its methods are then no-ops. No read added, no order change; read site unchanged (1). Agent, not root. |
| - `internal/host/restart.go` `restartSeed`: authority, task E1,E3,J1,J4. Basis: fix1-merge-review;basis=Baselines both request logs without applying historical ordinary restarts; signed retry grants remain independently verified.;rev3=census-ruling-restart-new-box-gap;basis=body split: list routes then restartBaseline (the former body, unchanged); the route reads move with it |
| - `internal/host/sidecarwake.go` `sidecarWakeSeed`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route |
| New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff: |
| -- new `internal/host/fastboot.go:fastBoot.seed`: reads +whole:Route ×2; written legacy, accepted-legacy, frozen |
| +- new `internal/host/fastboot.go:fastBoot.seed`: reads +whole:Route; written legacy, accepted-legacy, frozen |
| - new `internal/host/fastboot.go:fastBoot.start`: reads +whole:Route; written legacy, accepted-legacy, frozen |
| - new `internal/host/sidecarwake.go:sidecarWakeBaseline`: reads +whole:Route; written legacy, accepted-legacy, frozen |
| -Seal: `9206205b2a3bf27b8b85310f4a44f94ef0c5886d85d6e55dbf2f22e073a8af11` → `e82eba6df923f7baa2d14517be12b71a67e641d136f1b7acc1bb50df9107814e`. |
| +Seal: `9206205b2a3bf27b8b85310f4a44f94ef0c5886d85d6e55dbf2f22e073a8af11` → `4eda67fee53800e2cfa4177b954c7f0fce6bdfcfbfe1aa2547ddcec3027b668b`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-fleet-first-reconcile-speed-4.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/host/agent.go b/internal/host/agent.go| index 70934a071..838c77eab 100644 |
| --- a/internal/host/agent.go |
| +++ b/internal/host/agent.go |
| @@ -2925,6 +2925,31 @@ type fastDeps struct { |
| // (startuptiming.go); nil on every other tick, where its calls do |
| // nothing. |
| startup *startupSteps |
| + |
| + // serialAfter holds the serial unread, and so unseeded, until it is |
| + // closed: fastBoot closes it when the request baselines have read, so a |
| + // request they take as history has its serial bump taken as history too |
| + // (fastBoot's comment). nil: no hold. |
| + serialAfter <-chan struct{} |
| + // fullBeforeSeed is set when a full pass ran on a tick whose serial was |
| + // held: the seed asks for one more full pass, for whatever the bumps it |
| + // absorbed carried while that pass was running. |
| + fullBeforeSeed bool |
| +} |
| + |
| +// serialHeld reports whether this tick must leave the serial unread |
| +// (serialAfter still open), and drops the hold once it has opened. |
| +func (d *fastDeps) serialHeld() bool { |
| + if d.serialAfter == nil { |
| + return false |
| + } |
| + select { |
| + case <-d.serialAfter: |
| + d.serialAfter = nil |
| + return false |
| + default: |
| + return true |
| + } |
| } |
| // canaryRead is one canary group's last good pointer read: the head it |
| @@ -3346,6 +3371,10 @@ func logSlow(what string, start time.Time, detail string) { |
| // is deferred by NOT recording the acted serial, so the next tick past |
| // the window re-fires. Read errors are tolerated silently (one log |
| // line per state change, never per tick). |
| +// At startup the read waits for fastBoot's request baselines |
| +// (serialAfter): until they have read, a tick reads no serial, so it |
| +// neither seeds nor moves, and a full pass it runs meanwhile is run once |
| +// more after the seed. |
| // The restart leg (issue #113) rides that same move, AFTER the pass set: |
| // a bump can carry a promote and a restart request at once, and cycling |
| // processes before their new version and config land would cycle them onto |
| @@ -3397,9 +3426,17 @@ func fastTick(ctx context.Context, d *fastDeps, now time.Time) { |
| } |
| d.startup.done("restart gain") |
| fullRan := false |
| - doc, _, err := release.ReadSerial(ctx, d.store) |
| - d.startup.done("serial read") |
| + held := d.serialHeld() |
| + var doc release.SerialDoc |
| + var err error |
| + if !held { |
| + doc, _, err = release.ReadSerial(ctx, d.store) |
| + d.startup.done("serial read") |
| + } |
| switch { |
| + case held: |
| + // fastBoot's request baselines have not read yet: no seed, no move. |
| + d.startup.done("serial held for the request baselines") |
| case err != nil: |
| if !d.serialBroken { |
| log.Printf("agent: fast converge serial read: %v", err) |
| @@ -3416,6 +3453,13 @@ func fastTick(ctx context.Context, d *fastDeps, now time.Time) { |
| // must not act on (adoptLoop's 1-minute first pass covers boot). |
| d.lastSerial, d.seeded = doc.Serial, true |
| d.serialBroken = false |
| + // A full pass that ran while the serial was held may have missed |
| + // what the bumps behind this seed carried: one more, under the |
| + // clamp, as the backstop's request runs. |
| + if d.fullBeforeSeed && d.fullDue != nil { |
| + d.fullDue.Store(true) |
| + } |
| + d.fullBeforeSeed = false |
| default: |
| d.serialBroken = false |
| if doc.Serial != d.lastSerial && now.Sub(d.lastFull) >= fastFullClamp { |
| @@ -3491,6 +3535,7 @@ func fastTick(ctx context.Context, d *fastDeps, now time.Time) { |
| d.runFull(ctx) |
| fullRan = true |
| d.lastFull = now |
| + d.fullBeforeSeed = d.fullBeforeSeed || held |
| d.startup.done("full pass") |
| } |
| // An index-only change runs the scoped pass (spec §4.5). |
diff --git a/internal/host/fastboot.go b/internal/host/fastboot.go| index f3ccc61ef..ec4ccffe8 100644 |
| --- a/internal/host/fastboot.go |
| +++ b/internal/host/fastboot.go |
| @@ -16,40 +16,57 @@ import ( |
| // the routes a stopped box missed, so it runs as soon as what it reads is |
| // built: |
| // |
| -// 1. The views, on the loop's goroutine: the moves hold view, then the |
| +// 1. The request baselines (restart, then sidecar wake) start first, on a |
| +// goroutine of their own, over the routes the box serves at arming. They |
| +// read neither view, so they start before the view walks, where they |
| +// always ran. |
| +// 2. The views, on the loop's goroutine: the moves hold view, then the |
| // offline keep view. An unbuilt hold view freezes every host (moves spec |
| // §9.4), and keep answers false only once the offline view has read a |
| // listing (movesoffline.go), so no pass starts before both have returned. |
| -// 2. The first tick, at once rather than after a tick's sleep, on the loop's |
| -// goroutine like every tick. Beside it, on a goroutine of their own, the |
| -// seeds, in their old order: restart, sidecar wake, the runs boot pass, |
| -// the schedule converge, the system pointer. The first tick reads none |
| -// of what they write. |
| -// 3. ready, which the loop calls before its second tick, on the loop's |
| +// The rest of the seeds (the runs boot pass, the schedule converge, the |
| +// system pointer) follow on the seeds' goroutine once the views are |
| +// built: the converger reads the hold view (Converger.Frozen). |
| +// 3. The first tick, at once rather than after a tick's sleep, on the loop's |
| +// goroutine like every tick. It reads the serial only if the request |
| +// baselines have finished (fastDeps.serialAfter); otherwise it leaves |
| +// the serial unseeded and still runs the boot full pass, which needs no |
| +// serial. |
| +// 4. ready, which the loop calls before its second tick, on the loop's |
| // goroutine: it waits for the seeds, runs one runs pass for what the |
| // first tick noted, and only then hands the loop the legs that read the |
| // seeds' memories. |
| // |
| // Why each seed's promise still holds: |
| // |
| -// - The restart, sidecar wake and schedule legs act only on a serial MOVE. |
| -// The first tick cannot act on one: its first good serial read only seeds |
| -// lastSerial (fastTick). ready runs before the second tick, so every |
| -// baseline exists before the first move is acted on. The two legs that |
| -// run on every tick and read seeded memory, restartGain and the system |
| -// leg's tick, are left off the first tick for the same reason. |
| -// - Both baselines are taken over the route list read here, before the |
| +// - The serial is never seeded before the request baselines have read. |
| +// A request that lands before a baseline reads it is history, and so is |
| +// its serial bump, which the seed then absorbs: the old order's rule, |
| +// where both baselines finished before the first tick. Were the serial |
| +// seeded first, that bump would come back as a move the legs answer |
| +// from a baseline that already holds the request, and the request would |
| +// be lost (whole-branch review, Astra P1). |
| +// - The restart, sidecar wake and schedule legs act only on a serial MOVE, |
| +// and no tick before ready can see one: the first good serial read only |
| +// seeds lastSerial (fastTick). ready runs before the second tick, so |
| +// every baseline exists before the first move is acted on. The two legs |
| +// that run on every tick and read seeded memory, restartGain and the |
| +// system leg's tick, are left off the first tick for the same reason. |
| +// - The sidecar baseline is taken over the route list read before the |
| // first pass, never over what that pass leaves. A sidecar the pass mints |
| // with a wake already standing at it is the create-then-wake flow, and is |
| // woken on the next move (sidecarWakeChanges), not recorded as history. |
| -// An app the pass mints is gained on the second tick (restartGainSeed), |
| -// as an app minted after arming always was: its baseline, not a request. |
| +// The restart seed lists the routes itself; an app the first pass mints |
| +// is a baseline whichever of the seed or the second tick's restartGain |
| +// (restartGainSeed) reads it first, never a request. |
| +// - A boot full pass that ran while the serial was unseeded is requested |
| +// once more when the serial is seeded (fastTick), so a change whose bump |
| +// the seed absorbed while that pass was running is still converged. |
| // - The schedule converger and the runs worker already take calls from |
| // more than one goroutine and order them themselves: Converger.Pass holds |
| // its mutex for the whole pass, and a runs pass that starts before the |
| // runs boot pass has finished acts on nothing and keeps reconcile's notes |
| -// (runsWorker.booted), which ready then takes. Both still start after the |
| -// views, as before: the converger reads the hold view (Converger.Frozen). |
| +// (runsWorker.booted), which ready then takes. |
| type fastBoot struct { |
| reg *registry.Registry |
| viewStore release.Store // the views' reads |
| @@ -71,40 +88,45 @@ type fastBoot struct { |
| } |
| // The boot steps, production by default. Tests replace them to hold one |
| -// step on a barrier or to record the order the steps ran in. |
| +// step on a barrier or to record the order the steps ran in. The request |
| +// baselines are called directly (restartSeed is a census authority unit |
| +// whose production caller must stay visible); bootBeforeBaseline is the |
| +// tests' hold in front of each, nil in production. |
| var ( |
| - bootMovesHolds = refreshMovesHolds |
| - bootOfflineView = func(ctx context.Context, s release.Store) { refreshOfflineView(ctx, s, armedOfflineView()) } |
| - bootRestartSeed = restartBaseline |
| - bootWakeSeed = sidecarWakeBaseline |
| - bootRunsPass = runRunsBootPass |
| - bootRunsNotes = runRunsPass |
| - bootSchedule = func(ctx context.Context, sd *scheduleDeps) error { return sd.converge(ctx) } |
| - bootSystem = func(ctx context.Context, l *systemLeg) { l.observe(ctx) } |
| + bootBeforeBaseline func(step string) |
| + bootMovesHolds = refreshMovesHolds |
| + bootOfflineView = func(ctx context.Context, s release.Store) { refreshOfflineView(ctx, s, armedOfflineView()) } |
| + bootRunsPass = runRunsBootPass |
| + bootRunsNotes = runRunsPass |
| + bootSchedule = func(ctx context.Context, sd *scheduleDeps) error { return sd.converge(ctx) } |
| + bootSystem = func(ctx context.Context, l *systemLeg) { l.observe(ctx) } |
| ) |
| -// start builds the views, then runs first (the loop's first tick) with the |
| -// seeds beside it, and returns ready. The loop calls ready before its second |
| -// tick, and before any other tick: it is what hands the loop the seeded legs. |
| +// start runs fastBoot's order: the request baselines started, the views |
| +// built, then first (the loop's first tick), and returns ready. The loop |
| +// calls ready before its second tick, and before any other tick: it is what |
| +// hands the loop the seeded legs. |
| func (b *fastBoot) start(ctx context.Context, d *fastDeps, first func()) (ready func()) { |
| - bootMovesHolds(ctx, b.viewStore) |
| - b.arming.done("moves holds") |
| - bootOfflineView(ctx, b.viewStore) |
| - b.arming.done("offline view") |
| // The routes the box serves now, before the first pass mints anything: |
| - // the baselines are taken over this list (fastBoot's comment). |
| + // the sidecar baseline is taken over this list (fastBoot's comment). |
| routes, listErr := b.reg.List() |
| - done := make(chan struct{}) |
| + baselined, viewsBuilt, done := make(chan struct{}), make(chan struct{}), make(chan struct{}) |
| go func() { |
| defer close(done) |
| - b.seed(ctx, routes, listErr) |
| + b.seed(ctx, routes, listErr, baselined, viewsBuilt) |
| }() |
| + bootMovesHolds(ctx, b.viewStore) |
| + b.arming.done("moves holds") |
| + bootOfflineView(ctx, b.viewStore) |
| + b.arming.done("offline view") |
| + close(viewsBuilt) |
| + d.serialAfter = baselined |
| first() |
| var once sync.Once |
| return func() { |
| once.Do(func() { |
| wait := b.log.steps("seeds: ", nil) |
| - <-done |
| + waitSeeds(done) |
| wait.done("second tick wait") |
| // The first tick's runs pass may have run before the runs boot |
| // pass had finished, and then acted on nothing: a run queued after |
| @@ -112,30 +134,52 @@ func (b *fastBoot) start(ctx context.Context, d *fastDeps, first func()) (ready |
| // acts on them now, rather than at the next full pass. |
| bootRunsNotes(ctx) |
| wait.done("runs notes") |
| + d.serialAfter = nil |
| d.restartGain, d.restartLeg, d.wakeLeg, d.systemLeg = b.restartGain, b.restartLeg, b.wakeLeg, b.system |
| }) |
| } |
| } |
| -// seed runs the seeds, in order, over routes (the list read at arming; nil |
| -// with listErr when it could not be read). Its own goroutine: it touches |
| -// nothing the loop reads until ready has waited for it. |
| -func (b *fastBoot) seed(ctx context.Context, routes []registry.Route, listErr error) { |
| +// waitSeeds waits for done, saying once in the journal when that has taken |
| +// longer than slowLegAfter: the loop stands still meanwhile, after "armed". |
| +func waitSeeds(done <-chan struct{}) { |
| + slow := time.NewTimer(slowLegAfter) |
| + defer slow.Stop() |
| + select { |
| + case <-done: |
| + return |
| + case <-slow.C: |
| + log.Printf("agent: fast converge: the second tick is still waiting for the startup seeds after %s", slowLegAfter) |
| + } |
| + <-done |
| +} |
| + |
| +// seed runs the seeds, in order: the request baselines, then (closing |
| +// baselined) the rest once viewsBuilt is closed. routes is the list read at |
| +// arming, nil with listErr when it could not be read. Its own goroutine: it |
| +// touches nothing the loop reads until the loop has seen baselined (the |
| +// serial) or ready has waited for it (everything else). |
| +func (b *fastBoot) seed(ctx context.Context, routes []registry.Route, listErr error, baselined chan<- struct{}, viewsBuilt <-chan struct{}) { |
| steps := b.log.steps("seeds: ", b.seedOps) |
| - if listErr != nil { |
| - logRestartListError(listErr) |
| - } else { |
| - bootRestartSeed(ctx, routes, b.seedStore, b.dd, b.restartMem) |
| + if bootBeforeBaseline != nil { |
| + bootBeforeBaseline("restart seed") |
| } |
| + restartSeed(ctx, b.reg, b.seedStore, b.dd, b.restartMem) |
| steps.done("restart seed") |
| + if bootBeforeBaseline != nil { |
| + bootBeforeBaseline("sidecar wake seed") |
| + } |
| // An unread list leaves the wake memory unseeded on purpose |
| // (sidecarWakeSeed): the first leg pass is then the baseline. |
| if listErr != nil { |
| logSidecarWakeListError(listErr) |
| } else { |
| - bootWakeSeed(ctx, routes, b.seedStore, b.wakeMem) |
| + sidecarWakeBaseline(ctx, routes, b.seedStore, b.wakeMem) |
| } |
| steps.done("sidecar wake seed") |
| + close(baselined) |
| + <-viewsBuilt |
| + steps.done("views wait") |
| // carlos run's boot pass (run spec §5.2, index item 2): it must not wait |
| // for a reconcile pass on a box whose first one is a minute away, since |
| // the CLI expires a run at 60 s. A runs pass that starts before it has |
diff --git a/internal/host/fastboot_test.go b/internal/host/fastboot_test.go| index 80e60f8df..fdd21da43 100644 |
| --- a/internal/host/fastboot_test.go |
| +++ b/internal/host/fastboot_test.go |
| @@ -20,18 +20,18 @@ import ( |
| // never paces a passing run. |
| const bootFailAfter = 10 * time.Second |
| -// swapBootSteps replaces every boot step with a no-op for the test's life, |
| -// so a test arms only the steps it names. |
| +// swapBootSteps replaces every boot step that has a seam with a no-op for |
| +// the test's life, so a test arms only the steps it names. The request |
| +// baselines always run (production calls them directly); bootBeforeBaseline |
| +// is how a test holds one. |
| func swapBootSteps(t *testing.T) { |
| t.Helper() |
| - holds, offline, restart, wake, runs, notes, sched, system := bootMovesHolds, bootOfflineView, bootRestartSeed, bootWakeSeed, bootRunsPass, bootRunsNotes, bootSchedule, bootSystem |
| + holds, offline, before, runs, notes, sched, system := bootMovesHolds, bootOfflineView, bootBeforeBaseline, bootRunsPass, bootRunsNotes, bootSchedule, bootSystem |
| t.Cleanup(func() { |
| - bootMovesHolds, bootOfflineView, bootRestartSeed, bootWakeSeed, bootRunsPass, bootRunsNotes, bootSchedule, bootSystem = holds, offline, restart, wake, runs, notes, sched, system |
| + bootMovesHolds, bootOfflineView, bootBeforeBaseline, bootRunsPass, bootRunsNotes, bootSchedule, bootSystem = holds, offline, before, runs, notes, sched, system |
| }) |
| bootMovesHolds = func(context.Context, release.Store) {} |
| bootOfflineView = func(context.Context, release.Store) {} |
| - bootRestartSeed = func(context.Context, []registry.Route, release.Store, string, *restartMemory) {} |
| - bootWakeSeed = func(context.Context, []registry.Route, release.Store, *sidecarWakeMemory) {} |
| bootRunsPass = func(context.Context) {} |
| bootRunsNotes = func(context.Context) {} |
| bootSchedule = func(context.Context, *scheduleDeps) error { return nil } |
| @@ -69,10 +69,12 @@ func TestFastBootFirstPassDoesNotWaitForTheSeeds(t *testing.T) { |
| unblock := func() { once.Do(func() { close(barrier) }) } |
| hold := func() { <-barrier } |
| switch seed { |
| - case "restart seed": |
| - bootRestartSeed = func(context.Context, []registry.Route, release.Store, string, *restartMemory) { hold() } |
| - case "sidecar wake seed": |
| - bootWakeSeed = func(context.Context, []registry.Route, release.Store, *sidecarWakeMemory) { hold() } |
| + case "restart seed", "sidecar wake seed": |
| + bootBeforeBaseline = func(step string) { |
| + if step == seed { |
| + hold() |
| + } |
| + } |
| case "runs boot pass": |
| bootRunsPass = func(context.Context) { hold() } |
| case "schedule converge": |
| @@ -164,7 +166,6 @@ func TestFastBootFirstPassWaitsForTheViews(t *testing.T) { |
| // acted on at the next serial move. The boot pass runs once, at arming. |
| func TestFastBootRestartBaselineNeitherReplaysNorSwallows(t *testing.T) { |
| swapBootSteps(t) |
| - bootRestartSeed = restartBaseline |
| ctx := context.Background() |
| f := newFastFixture(t) |
| @@ -232,6 +233,108 @@ func TestFastBootRestartBaselineNeitherReplaysNorSwallows(t *testing.T) { |
| } |
| } |
| +// TestFastBootRequestDuringTheSeedsIsNeverHalfTaken is the overlap the |
| +// whole-branch review found (Astra P1). The request baselines are held |
| +// before they read anything; the first tick finishes; a restart request |
| +// and a sidecar wake land, with their serial bump; then the baselines read. |
| +// Those reads take both requests as history, so their serial bump must be |
| +// history too: the first tick may not seed the serial while the baselines |
| +// are unread. Otherwise the second tick processes the bump as a move and the |
| +// legs, comparing against a baseline that already holds the request, drop |
| +// it. A request written once the baselines have read is acted on at the next |
| +// move. A boot full pass that ran before the serial was seeded is run once |
| +// more after it is, for whatever the bump behind the seed carried. |
| +func TestFastBootRequestDuringTheSeedsIsNeverHalfTaken(t *testing.T) { |
| + swapBootSteps(t) |
| + barrier := make(chan struct{}) |
| + bootBeforeBaseline = func(step string) { |
| + if step == "restart seed" { // before either baseline reads |
| + <-barrier |
| + } |
| + } |
| + |
| + ctx := context.Background() |
| + f := newFastFixture(t) |
| + served := execRoute("one.example.com", "bab", "shop") |
| + sidecar := wakeSidecarRoute("old.shop.sidecar.internal", "bab", "shop", "old") |
| + for _, rt := range []registry.Route{served, sidecar} { |
| + if err := f.reg.Upsert(rt); err != nil { |
| + t.Fatalf("upsert: %v", err) |
| + } |
| + } |
| + now := time.Unix(1762382167, 0) |
| + if err := release.BumpSerial(ctx, f.store, now.Add(-time.Minute)); err != nil { |
| + t.Fatalf("bump serial: %v", err) |
| + } |
| + |
| + passes := 0 |
| + d, b := bootFixture(t, f, func() { passes++ }) |
| + var bounced []string |
| + restartLegs := 0 |
| + gain, leg := armRestartLegs(f.reg, f.store, f.dataDir, b.restartMem, |
| + func(h string) bool { bounced = append(bounced, h); return true }, nil) |
| + b.restartGain = gain |
| + b.restartLeg = func(ctx context.Context) { restartLegs++; leg(ctx) } |
| + var woken []registry.Route |
| + wakeLegs := 0 |
| + b.wakeLeg = func(ctx context.Context) { |
| + wakeLegs++ |
| + routes, err := f.reg.List() |
| + if err != nil { |
| + t.Errorf("list: %v", err) |
| + return |
| + } |
| + m, _ := sidecarWakeLeg(ctx, routes, f.store, b.wakeMem, nil) |
| + woken = append(woken, m...) |
| + } |
| + |
| + ready := b.start(ctx, d, func() { fastTick(ctx, d, now) }) |
| + if passes != 1 { |
| + t.Fatalf("the first tick ran %d full passes, want the boot pass", passes) |
| + } |
| + if d.seeded { |
| + t.Fatal("the first tick seeded the serial while the request baselines were unread") |
| + } |
| + // Both requests land with their bump, then the baselines read. |
| + if err := release.TouchRestartGen(ctx, f.store, "bab", "shop"); err != nil { |
| + t.Fatalf("touch restart gen: %v", err) |
| + } |
| + touchSidecarWake(t, ctx, f.store, "bab", "shop", "old") |
| + if err := release.BumpSerial(ctx, f.store, now.Add(time.Second)); err != nil { |
| + t.Fatalf("bump serial: %v", err) |
| + } |
| + close(barrier) |
| + ready() |
| + fastTick(ctx, d, now.Add(2*time.Second)) // the second tick |
| + fastTick(ctx, d, now.Add(6*time.Second)) // past the clamp |
| + if restartLegs > 0 && len(bounced) == 0 { |
| + t.Fatal("the restart request's serial move was processed, but its baseline had already taken it as history: lost") |
| + } |
| + if wakeLegs > 0 && len(woken) == 0 { |
| + t.Fatal("the wake's serial move was processed, but its baseline had already taken it as history: lost") |
| + } |
| + if passes != 2 { |
| + t.Fatalf("%d full passes by the clamp, want 2: the boot pass ran before the serial was seeded and is not run again", passes) |
| + } |
| + |
| + // After the baselines: acted on at the next move. |
| + bounced, woken = nil, nil |
| + if err := release.TouchRestartGen(ctx, f.store, "bab", "shop"); err != nil { |
| + t.Fatalf("touch restart gen: %v", err) |
| + } |
| + touchSidecarWake(t, ctx, f.store, "bab", "shop", "old") |
| + if err := release.BumpSerial(ctx, f.store, now.Add(time.Hour)); err != nil { |
| + t.Fatalf("bump serial: %v", err) |
| + } |
| + fastTick(ctx, d, now.Add(time.Hour)) |
| + if !slices.Equal(bounced, []string{served.Host}) { |
| + t.Fatalf("bounced %v at the next move, want [%s]", bounced, served.Host) |
| + } |
| + if len(woken) != 1 || woken[0].Host != sidecar.Host { |
| + t.Fatalf("woke %v at the next move, want [%s]", woken, sidecar.Host) |
| + } |
| +} |
| + |
| // TestFastBootWakesASidecarTheFirstPassMints: the sidecar wake baseline is |
| // taken over the routes the box served when it armed. A sidecar the first |
| // pass mints with a wake already standing at it is the create-then-wake flow |
| @@ -239,7 +342,6 @@ func TestFastBootRestartBaselineNeitherReplaysNorSwallows(t *testing.T) { |
| // as history. |
| func TestFastBootWakesASidecarTheFirstPassMints(t *testing.T) { |
| swapBootSteps(t) |
| - bootWakeSeed = sidecarWakeBaseline |
| ctx := context.Background() |
| f := newFastFixture(t) |
| @@ -273,6 +375,7 @@ func TestFastBootWakesASidecarTheFirstPassMints(t *testing.T) { |
| ready := b.start(ctx, d, func() { fastTick(ctx, d, now) }) |
| ready() |
| + fastTick(ctx, d, now.Add(2*time.Second)) // the second tick: the serial is seeded by now |
| if err := release.BumpSerial(ctx, f.store, now.Add(time.Hour)); err != nil { |
| t.Fatalf("bump serial: %v", err) |
| } |
| @@ -327,7 +430,12 @@ func TestFastBootActsOnTheRunsTheFirstTickNoted(t *testing.T) { |
| var id string |
| d, b := bootFixture(t, f, func() { |
| - <-listed // the boot pass has read the records, and is held |
| + select { // the boot pass has read the records, and is held |
| + case <-listed: |
| + case <-time.After(bootFailAfter): |
| + t.Error("the runs boot pass never reached its owned-route check beside the first tick") |
| + return |
| + } |
| var rec provision.Record |
| rec, id = queueRun(t, f.store, time.Now().Add(time.Minute)) |
| w.note(rec) // reconcile's note |
| @@ -360,13 +468,37 @@ func TestFastConvergeLoopArmsThroughFastBoot(t *testing.T) { |
| "refreshMovesHolds": true, "refreshOfflineView": true, "restartSeed": true, "restartBaseline": true, |
| "sidecarWakeSeed": true, "sidecarWakeBaseline": true, "runRunsBootPass": true, |
| } |
| - found, starts := false, 0 |
| + found, starts, loops := false, 0, 0 |
| for _, decl := range file.Decls { |
| fn, ok := decl.(*ast.FuncDecl) |
| if !ok || fn.Name.Name != "fastConvergeLoop" { |
| continue |
| } |
| found = true |
| + for _, stmt := range fn.Body.List { |
| + loop, ok := stmt.(*ast.ForStmt) |
| + if !ok { |
| + continue |
| + } |
| + readyAt, tickAt := token.NoPos, token.NoPos |
| + ast.Inspect(loop.Body, func(n ast.Node) bool { |
| + if call, ok := n.(*ast.CallExpr); ok { |
| + if id, ok := call.Fun.(*ast.Ident); ok { |
| + switch { |
| + case id.Name == "ready" && readyAt == token.NoPos: |
| + readyAt = call.Pos() |
| + case id.Name == "fastTick" && tickAt == token.NoPos: |
| + tickAt = call.Pos() |
| + } |
| + } |
| + } |
| + return true |
| + }) |
| + if readyAt == token.NoPos || tickAt == token.NoPos || readyAt > tickAt { |
| + t.Error("fastConvergeLoop's tick loop does not call ready() before fastTick: the seeded legs never reach the loop, or reach it after a tick that can act on a move") |
| + } |
| + loops++ |
| + } |
| ast.Inspect(fn.Body, func(n ast.Node) bool { |
| call, ok := n.(*ast.CallExpr) |
| if !ok { |
| @@ -391,6 +523,9 @@ func TestFastConvergeLoopArmsThroughFastBoot(t *testing.T) { |
| if !found { |
| t.Fatal("no fastConvergeLoop in agent.go") |
| } |
| + if loops != 1 { |
| + t.Fatalf("fastConvergeLoop has %d for loops at its top level, want the tick loop alone", loops) |
| + } |
| if starts != 1 { |
| t.Fatalf("fastConvergeLoop calls .start %d times, want once (fastBoot.start)", starts) |
| } |
diff --git a/internal/host/restart.go b/internal/host/restart.go| index 7cb44aa8b..c1be4967d 100644 |
| --- a/internal/host/restart.go |
| +++ b/internal/host/restart.go |
| @@ -935,11 +935,11 @@ func restartRequestLeg(ctx context.Context, routes []registry.Route, store relea |
| // before this agent started is not lost to the baseline. One spent or made |
| // stale since clears nothing. |
| // |
| -// fastConvergeLoop runs the same sweep (restartBaseline) over the route list |
| -// it takes at arming, on the seeds' goroutine beside its first tick |
| -// (fastBoot), and hands the loop the restart legs only once it has |
| -// returned: the baseline still exists before the first serial move is acted |
| -// on. |
| +// fastConvergeLoop runs it through fastBoot, first on the seeds' goroutine, |
| +// beside the view walks and the first tick. The loop reads no serial until |
| +// it has returned, and gets the restart legs only once it has: the baseline |
| +// exists before the serial is seeded, as it did when the seed ran before |
| +// arming. |
| func restartSeed(ctx context.Context, reg *registry.Registry, store release.Store, dd string, mem *restartMemory) { |
| routes, err := reg.List() |
| if err != nil { |
| @@ -1126,11 +1126,11 @@ func restartGainSeed(ctx context.Context, routes []registry.Route, store release |
| // armRestartLegs builds the agent's two restart hooks over ONE memory: gain, |
| // which fastTick runs on every tick (restartGainSeed), and leg, which it runs |
| -// on a serial move (restartRequestLeg). The memory is passed in already |
| -// seeded (restartSeed), because fastConvergeLoop arms more than this file |
| -// knows about on it first. fastConvergeLoop takes both hooks from here, and |
| -// so do the tests, so the wiring a test exercises is the wiring production |
| -// runs. |
| +// on a serial move (restartRequestLeg). Building them reads nothing; the |
| +// memory is seeded by restartSeed, which fastConvergeLoop runs through |
| +// fastBoot, and fastBoot hands both hooks to the loop only once that seed has |
| +// returned. fastConvergeLoop takes both hooks from here, and so do the |
| +// tests, so the wiring a test exercises is the wiring production runs. |
| func armRestartLegs(reg *registry.Registry, store release.Store, dd string, mem *restartMemory, |
| bounce func(host string) bool, wake func(rt registry.Route) error) (gain func(ctx context.Context, now time.Time), leg func(ctx context.Context)) { |
| gain = func(ctx context.Context, now time.Time) { |
diff --git a/internal/host/startupmeasure_e2e_test.go b/internal/host/startupmeasure_e2e_test.go| index f64ab8d3e..d9d0d8765 100644 |
| --- a/internal/host/startupmeasure_e2e_test.go |
| +++ b/internal/host/startupmeasure_e2e_test.go |
| @@ -43,9 +43,12 @@ import ( |
| // instances on pi-1, 2(n-1) are created through the console's door (they |
| // alternate boxes), pi-1 runs one reconcile (its previous life), then one |
| // more is created while it is "stopped" (it lands on pi-1, the witness |
| -// method). The box then starts: the seeds fastConvergeLoop runs before it |
| -// arms, then the first tick's reads and the first full pass, in production |
| -// order, through the production helpers, every store op over the door. |
| +// method). The box then starts: the seeds, then the first tick's reads and |
| +// the first full pass, one after another, through the production helpers, |
| +// every store op over the door. That is the order before Task 4 (the |
| +// pre-change sequential baseline): fastConvergeLoop now arms through |
| +// fastBoot, which runs the seeds beside the first tick. Read these numbers |
| +// as the cost of each step, not as the new startup path. |
| // |
| // Not measured here: the activator startup (systemd sweep and Recover), |
| // the runDuties steps, the runs boot pass and the schedule converge (each |
| @@ -247,8 +250,9 @@ func measureStartup(t *testing.T, n int, lat time.Duration) string { |
| } |
| optDir := t.TempDir() |
| - // fastConvergeLoop's seeds, in its order (the runs boot pass and the |
| - // schedule converge open their own stores: left out). |
| + // The seeds in the pre-change sequential order (before Task 4's |
| + // fastBoot; the runs boot pass and the schedule converge open their own |
| + // stores: left out). |
| arming := slog.steps("arming: ", counter) |
| mem := newRestartMemory() |
| mem.pub = pub |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 00f61cab3..87db5b8cf 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -230,4 +230,4 @@ plan14-root-reads-fleet-unrouted-503.tsv 0f148cc5106065040691da81c9705da76b3663f |
| plan14-root-reads-fleet-unrouted-503-fix1.tsv e8043922abe9911a69ed6f5a9f8ec1d8f1db1aaf0c250f369cadff8ed394b079 |
| plan14-root-reads-omr-run.tsv f82b5e513d7434e1440c13aa4aa8bc06348745749a21593cf453f761ded0781b |
| plan14-root-reads-fleet-first-reconcile-speed.tsv 9206205b2a3bf27b8b85310f4a44f94ef0c5886d85d6e55dbf2f22e073a8af11 |
| -plan14-root-reads-fleet-first-reconcile-speed-4.tsv e82eba6df923f7baa2d14517be12b71a67e641d136f1b7acc1bb50df9107814e |
| +plan14-root-reads-fleet-first-reconcile-speed-4.tsv 4eda67fee53800e2cfa4177b954c7f0fce6bdfcfbfe1aa2547ddcec3027b668b |
diff --git a/internal/provision/testdata/plan14-root-reads-fleet-first-reconcile-speed-4.tsv b/internal/provision/testdata/plan14-root-reads-fleet-first-reconcile-speed-4.tsv| index 9d254424c..c9523d968 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-fleet-first-reconcile-speed-4.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-fleet-first-reconcile-speed-4.tsv |
| @@ -1,14 +1,16 @@ |
| # Census overlay fleet-first-reconcile-speed-4, written by census-propose (#369). census-ruling-fleet-first-reconcile-speed-4, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-fleet-first-reconcile-speed-4.md. |
| -# 3 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +# 4 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| # 3 new dispositions: 0 reads re-frozen at their disposition with the claim, 3 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other. |
| +@legacy 56c59582ac0dfa8b8ef952f9b0422e7f36711764abb4225536123575f5099871 internal/host/agent.go fastTick legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=PROPOSED-s3-change-index;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=observes the change index before any pass (observeIndex), runs the backstop's requested full pass and a scoped pass for moved app scopes (indexTick), and arms the canary pointer gate on the sweep (canaryPointerGate) only on a tick whose own index observation succeeded; read site unchanged, offset moved;rev3=census-ruling-stateless-replicas-1;basis=Call coordinator Tick on the existing tick before convergence; client renews held terms only at the pinned interval. Existing registry read unchanged. Final review I3: signal the owned renewal worker instead of waiting for its sequential console HTTP calls. Existing convergence and record read unchanged.;rev3=census-ruling-region-ha-p3a;basis=Run the optional desired-role reader on the existing tick after observing the armed change index; no new root path or timer, nil reader is unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: signals the owned replica worker on the existing tick; coalesced asynchronous execution, no timer or bucket scan added. merge of origin/main 7920cccf: Retain main box-role reader pass on the existing tick alongside the replica worker signal; merge-only body change, unchanged read sites.;rev3=census-ruling-restart-new-box-gap;basis=calls the optional restartGain hook (restartGainSeed) once per existing tick before the serial read; no new root path, timer or read kind; nil hook is unchanged;rev3=census-ruling-agent-start-demo-3;basis=Refresh moved notices through the shared watch before normal convergence; no new per-box poll. Census read-site delta: unchanged (1).;rev3=census-ruling-stateless-replicas-4-task1;basis=Signals the owned replica swap worker (armedReplicaDeploy.tick) beside the placement worker on the existing tick; coalesced background pass, no timer, no bucket read. Its transitions go through the console's authenticated /deploy.;rev3=census-ruling-platform-mail-submission;basis=Task 4: on a serial move, after the schedule leg, starts the armed mail switch cache's Refresh on its own goroutine (each read bounded at 2 s, overlapping refreshes skipped). It re-reads the app sender records already cached, through the agent's deploy store. Agent, not root; the tick waits on nothing new. Fable final P2-1: on a serial move, before the pass set and the restart leg, calls the armed cache's MarkStale (a counter bump under the cache's mutex; no I/O), so a spawn the move causes reads the switch again, bounded, instead of using an answer from before the move. No read added.;rev3=census-ruling-fleet-first-reconcile-speed;basis=Startup timing log lines only: d.startup.done(<part>) calls between the existing parts and a deferred one after the sweep. d.startup is nil on every tick but the first after agent start, and its methods are then no-ops. No read added, no order change; read site unchanged (1). Agent, not root.;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=Startup serial hold (whole-branch review P1). While fastDeps.serialAfter is open (fastBoot closes it when the restart and sidecar wake baselines have read) the tick skips its one ReadSerial of control/serial, so it neither seeds nor acts on a move; the rest of the tick (backstop full pass, index, sweep) is unchanged. A full pass run while held sets fullBeforeSeed, and the seed then sets fullDue once so the backstop branch runs one more full pass under the clamp. Same read, read sites unchanged (1); no read added. Agent, not root. registry:Host@7321 5e7b593089330e12933dac81b1ffab26a34edc0d65e355b530faed17c28f2e47 |
| @legacy b0d342fd85526d360ba5d6b2b31d603800c7b1b6192985679b3e1e64f3cdfd5e internal/host/sidecarwake.go sidecarWakeSeed legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=Body split: reg.List, then sidecarWakeBaseline (the former rest of the body, unchanged); list-error log line moved into logSidecarWakeListError (same text). No read added; agent, not root. whole:Route@226 2ab3e681cf37e2020c89971b0a9ce4da882053b37931308710dfcf2bee81cebc |
| -@legacy 16afd173acebffd6bf8c97e66f0cd397d13a744f144cff15aabb8ad1019fce91 internal/host/fastboot.go fastBoot.seed legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=New: the seeds moved out of fastConvergeLoop, same order: restartBaseline and sidecarWakeBaseline over the arming route snapshot (or the two existing list-error lines), runRunsBootPass, sd.converge, and systemLeg.observe with systemLeg.store swapped to the counting wrapper and restored, all through package func vars defaulting to those functions. Same calls and keys as before; no read added. Agent, not root. whole:Route@216,whole:Route@500 22b0ee458e68a571ed694180c9e980aa2298b743473a2bac8b07e9f37d3a9346 |
| -@legacy 16b9e5cb942d9d670a9bbad7817b24c9f68ab1b3a4f54fb0b0f5db792cbcebd9 internal/host/fastboot.go fastBoot.start legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=New: the arming order moved out of fastConvergeLoop. Calls refreshMovesHolds and refreshOfflineView (through package func vars defaulting to them), one reg.List of this box's registry (the route snapshot the seeds use), starts the seeds goroutine, runs the first tick, returns ready which waits for the seeds, runs runRunsPass once (through bootRunsNotes; the same runs pass every full pass runs, here for notes the first tick kept while the runs boot pass was unfinished) and assigns the seeded legs to fastDeps. No read beyond those the moved calls and that existing runs pass already make. Agent, not root. whole:Route@467 762ff6187a65d46f44cfcc312b376f58818d78cffb911bf08426ff730f295fe1 |
| +@legacy 5de5403ccc8acfdec62ec3ac54188491766596cafc180a8a8f03b440d4184b77 internal/host/fastboot.go fastBoot.seed legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=New (Task 4): the seeds moved out of fastConvergeLoop, same order. restartSeed is called directly (its own reg.List, then restartBaseline, as fastConvergeLoop called it before), sidecarWakeBaseline over the arming route snapshot (or the existing list-error line), then it closes the serial hold, waits for the views, and runs runRunsBootPass, sd.converge and systemLeg.observe (systemLeg.store swapped to the counting wrapper and restored), the last three through package func vars defaulting to them. A nil test hook (bootBeforeBaseline) precedes each baseline. Same calls and keys as before; no read added. Agent, not root. whole:Route@640 3ff89b37f97698583a97e56b72b7a2f36b6bc837991525dddd41f3eb7c8ee9eb |
| +@legacy 77c697a23c8948b9b466ab3fdb41f043e1ff5980c402274cb59e231ef8c24c83 internal/host/fastboot.go fastBoot.start legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=New (Task 4): the arming order moved out of fastConvergeLoop. One reg.List of this box's registry (the route snapshot for the sidecar baseline), starts the seeds goroutine first, then refreshMovesHolds and refreshOfflineView (through package func vars defaulting to them), sets fastDeps.serialAfter, runs the first tick, and returns ready, which waits for the seeds (one log line if over slowLegAfter), runs runRunsPass once (through bootRunsNotes; the same runs pass every full pass runs, for notes the first tick kept while the runs boot pass was unfinished), clears the serial hold and assigns the seeded legs to fastDeps. No read beyond those the moved calls and that existing runs pass already make. Agent, not root. whole:Route@408 37ce68db08a2099bf75e3082ac811a286d7ab3fed78f67baedf7819919a63d95 |
| @legacy e7e1964bcc5167146f6b0438f36132659cacd1cdd6b23923e6061e172135b9f6 internal/host/sidecarwake.go sidecarWakeBaseline legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=New: the former second half of sidecarWakeSeed over a given route list (sidecarWakeChanges on the box's own routes, read errors logged). The route values come from the caller's reg.List of this box's registry; no new read site. Agent, not root. whole:Route@158 44f8d730300282571787e2d2e7d59c8f8bb0f768045c44864a7860233370636e |
| internal/host/agent.go fastConvergeLoop authority B3 rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): every pass context carries the box's lifetime judge (provision.WithLifetimes) and the reconcile config is boxProvisionConfig's; read sites unchanged, offsets moved; B3 authority retained;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 12: its pass config is now BoxProvisionConfig(reg, os.Getenv, judge, configure) (BoxProvisionConfig replaces boxProvisionConfig: the hub predicate hubArmed and, on the hub, ReconcileConfig.FleetOwners from hubFleetOwners); a call, no read site; read sites unchanged (2); B3 authority retained.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: wire the coordinator's nonblocking SignalTick to the existing fast tick. No new timer, polling read or authority.;rev3=census-ruling-region-ha-p3b;basis=Bind systemLeg to the existing cached reader fold and handle a nil leg on groups; names-2 rollback gate runs before artifact/request/marker work. Agent-memory evidence only, no new direct or cloud read and no autonomous group update.;rev3=census-ruling-restart-new-box-gap;basis=restart leg closure moved into armRestartLegs (same reg.List + restartRequestLeg); also wires restartGain; read moved, not added;rev3=census-ruling-agent-start-demo-3;basis=Attach the moved reader to the existing shared change watch and advertise that reader as armed. Census read-site delta: unchanged (2).;rev3=census-ruling-fleet-first-reconcile-speed;basis=Startup timing log lines only (fleet first reconcile Task 1). Logs its entry offset and one line per arming step, then times the first tick. restartSeed, sidecarWakeSeed, refreshMovesHolds, refreshOfflineView and the one arming systemLeg.observe now read through countStore(store), a pass-through wrapper that counts and times each call and forwards it unchanged with the same key; for that observe, systemLeg.store is swapped to the wrapper and restored. For the first tick only, d.store is a fresh countStore(store) wrapper and d.startup a step logger; both are reset to the plain store and nil after the tick. passLegs gets startup. Same calls in the same order, no read added; read sites unchanged (1). Agent, not root.;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=Arming order only (fleet first reconcile Task 4). The moves hold view, the offline view, the restart seed, the sidecar wake seed, the runs boot pass, the arming schedule converge and the arming systemLeg.observe are no longer called here: fastBoot.start runs them (views on this goroutine, then the first tick at once with the seeds beside it). The restart legs, the sidecar wake leg closure (same reg.List + sidecarWakeLeg) and newSystemLeg are built here as before and handed to fastBoot, which gives them to fastDeps once the seeds return, before the second tick. The first tick no longer waits for a tick's sleep. Same calls with the same arguments and keys; no read added; read sites unchanged (1). Agent, not root. whole:Route@7828 305f82326c431fb0fcb7dc4d66a94dee5bb46107ec935dafbc456407fcd53627 |
| -internal/host/restart.go restartSeed authority E1,E3,J1,J4 fix1-merge-review;basis=Baselines both request logs without applying historical ordinary restarts; signed retry grants remain independently verified.;rev3=census-ruling-restart-new-box-gap;basis=body split: list routes then restartBaseline (the former body, unchanged); the route reads move with it;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=List-error log line moved into logRestartListError (same text); body otherwise unchanged (reg.List then restartBaseline). Doc comment notes fastBoot runs restartBaseline over the arming route list. No read added; agent, not root. whole:Route@221 5ee75ad73f3e2ed1d0ef3f3cd4c87c5b055cd9488e0e5a891f865079ebc97a40 |
| +internal/host/agent.go fastTick legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=PROPOSED-s3-change-index;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=observes the change index before any pass (observeIndex), runs the backstop's requested full pass and a scoped pass for moved app scopes (indexTick), and arms the canary pointer gate on the sweep (canaryPointerGate) only on a tick whose own index observation succeeded; read site unchanged, offset moved;rev3=census-ruling-stateless-replicas-1;basis=Call coordinator Tick on the existing tick before convergence; client renews held terms only at the pinned interval. Existing registry read unchanged. Final review I3: signal the owned renewal worker instead of waiting for its sequential console HTTP calls. Existing convergence and record read unchanged.;rev3=census-ruling-region-ha-p3a;basis=Run the optional desired-role reader on the existing tick after observing the armed change index; no new root path or timer, nil reader is unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: signals the owned replica worker on the existing tick; coalesced asynchronous execution, no timer or bucket scan added. merge of origin/main 7920cccf: Retain main box-role reader pass on the existing tick alongside the replica worker signal; merge-only body change, unchanged read sites.;rev3=census-ruling-restart-new-box-gap;basis=calls the optional restartGain hook (restartGainSeed) once per existing tick before the serial read; no new root path, timer or read kind; nil hook is unchanged;rev3=census-ruling-agent-start-demo-3;basis=Refresh moved notices through the shared watch before normal convergence; no new per-box poll. Census read-site delta: unchanged (1).;rev3=census-ruling-stateless-replicas-4-task1;basis=Signals the owned replica swap worker (armedReplicaDeploy.tick) beside the placement worker on the existing tick; coalesced background pass, no timer, no bucket read. Its transitions go through the console's authenticated /deploy.;rev3=census-ruling-platform-mail-submission;basis=Task 4: on a serial move, after the schedule leg, starts the armed mail switch cache's Refresh on its own goroutine (each read bounded at 2 s, overlapping refreshes skipped). It re-reads the app sender records already cached, through the agent's deploy store. Agent, not root; the tick waits on nothing new. Fable final P2-1: on a serial move, before the pass set and the restart leg, calls the armed cache's MarkStale (a counter bump under the cache's mutex; no I/O), so a spawn the move causes reads the switch again, bounded, instead of using an answer from before the move. No read added.;rev3=census-ruling-fleet-first-reconcile-speed;basis=Startup timing log lines only: d.startup.done(<part>) calls between the existing parts and a deferred one after the sweep. d.startup is nil on every tick but the first after agent start, and its methods are then no-ops. No read added, no order change; read site unchanged (1). Agent, not root.;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=Startup serial hold (whole-branch review P1). While fastDeps.serialAfter is open (fastBoot closes it when the restart and sidecar wake baselines have read) the tick skips its one ReadSerial of control/serial, so it neither seeds nor acts on a move; the rest of the tick (backstop full pass, index, sweep) is unchanged. A full pass run while held sets fullBeforeSeed, and the seed then sets fullDue once so the backstop branch runs one more full pass under the clamp. Same read, read sites unchanged (1); no read added. Agent, not root. registry:Host@7321 5e7b593089330e12933dac81b1ffab26a34edc0d65e355b530faed17c28f2e47 |
| +internal/host/restart.go restartSeed authority E1,E3,J1,J4 fix1-merge-review;basis=Baselines both request logs without applying historical ordinary restarts; signed retry grants remain independently verified.;rev3=census-ruling-restart-new-box-gap;basis=body split: list routes then restartBaseline (the former body, unchanged); the route reads move with it;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=List-error log line moved into logRestartListError (same text); body otherwise unchanged (reg.List then restartBaseline). Doc comment notes fastBoot calls it on the seeds' goroutine, ahead of the serial seed. No read added; agent, not root. whole:Route@221 5ee75ad73f3e2ed1d0ef3f3cd4c87c5b055cd9488e0e5a891f865079ebc97a40 |
| internal/host/sidecarwake.go sidecarWakeSeed legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=Body split: reg.List, then sidecarWakeBaseline (the former rest of the body, unchanged); list-error log line moved into logSidecarWakeListError (same text). No read added; agent, not root. whole:Route@226 2ab3e681cf37e2020c89971b0a9ce4da882053b37931308710dfcf2bee81cebc |
| -internal/host/fastboot.go fastBoot.seed legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=New: the seeds moved out of fastConvergeLoop, same order: restartBaseline and sidecarWakeBaseline over the arming route snapshot (or the two existing list-error lines), runRunsBootPass, sd.converge, and systemLeg.observe with systemLeg.store swapped to the counting wrapper and restored, all through package func vars defaulting to those functions. Same calls and keys as before; no read added. Agent, not root. whole:Route@216,whole:Route@500 22b0ee458e68a571ed694180c9e980aa2298b743473a2bac8b07e9f37d3a9346 |
| -internal/host/fastboot.go fastBoot.start legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=New: the arming order moved out of fastConvergeLoop. Calls refreshMovesHolds and refreshOfflineView (through package func vars defaulting to them), one reg.List of this box's registry (the route snapshot the seeds use), starts the seeds goroutine, runs the first tick, returns ready which waits for the seeds, runs runRunsPass once (through bootRunsNotes; the same runs pass every full pass runs, here for notes the first tick kept while the runs boot pass was unfinished) and assigns the seeded legs to fastDeps. No read beyond those the moved calls and that existing runs pass already make. Agent, not root. whole:Route@467 762ff6187a65d46f44cfcc312b376f58818d78cffb911bf08426ff730f295fe1 |
| +internal/host/fastboot.go fastBoot.seed legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=New (Task 4): the seeds moved out of fastConvergeLoop, same order. restartSeed is called directly (its own reg.List, then restartBaseline, as fastConvergeLoop called it before), sidecarWakeBaseline over the arming route snapshot (or the existing list-error line), then it closes the serial hold, waits for the views, and runs runRunsBootPass, sd.converge and systemLeg.observe (systemLeg.store swapped to the counting wrapper and restored), the last three through package func vars defaulting to them. A nil test hook (bootBeforeBaseline) precedes each baseline. Same calls and keys as before; no read added. Agent, not root. whole:Route@640 3ff89b37f97698583a97e56b72b7a2f36b6bc837991525dddd41f3eb7c8ee9eb |
| +internal/host/fastboot.go fastBoot.start legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=New (Task 4): the arming order moved out of fastConvergeLoop. One reg.List of this box's registry (the route snapshot for the sidecar baseline), starts the seeds goroutine first, then refreshMovesHolds and refreshOfflineView (through package func vars defaulting to them), sets fastDeps.serialAfter, runs the first tick, and returns ready, which waits for the seeds (one log line if over slowLegAfter), runs runRunsPass once (through bootRunsNotes; the same runs pass every full pass runs, for notes the first tick kept while the runs boot pass was unfinished), clears the serial hold and assigns the seeded legs to fastDeps. No read beyond those the moved calls and that existing runs pass already make. Agent, not root. whole:Route@408 37ce68db08a2099bf75e3082ac811a286d7ab3fed78f67baedf7819919a63d95 |
| internal/host/sidecarwake.go sidecarWakeBaseline legacy accepted-legacy accepted-legacy;rev3=census-ruling-fleet-first-reconcile-speed-4;basis=New: the former second half of sidecarWakeSeed over a given route list (sidecarWakeChanges on the box's own routes, read errors logged). The route values come from the caller's reg.List of this box's registry; no new read site. Agent, not root. whole:Route@158 44f8d730300282571787e2d2e7d59c8f8bb0f768045c44864a7860233370636e |
| -@coverage internal/host 4df5538380d525506ce4a81aea909a5d2434e2342102726f55c0875e73f0944d |
| +@coverage internal/host acb11853f3c614e9ac9d4758a1621d1d6c8a852803b8ada2a1c6e565ec34ed7e |