carlos / platform Public

host: an unindexed box runs its boot full pass on the first fast tick

A restarted box with no record view (every fleet box, and any box with
the change index off) had no backstop rebuild to request the boot full
pass, and the fast loop's first tick only seeds a present serial, so
its first reconcile was instancesLoop's, a minute after start (#1008
T9, P3). RunAgent now requests that pass right after arming the index
when no view is armed. The serial seed rule is unchanged: it is a
convergence pass, not a replay of the restart, wake or schedule legs.
Armed boxes are unchanged; the backstop owns their request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 93bf24bd4ecd79cfbf27d30d36e636e487b2e050 parent ea0dff8
3 files changed, +52 −0
  • internal/host/agent.go +3 −0
  • internal/host/agent_test.go +35 −0
  • internal/host/changeindex.go +14 −0

Intent

Human

<task-notification> <task-id>acf2048be8e4f44a0</task-id> <tool-use-id>toolu_01H6h9LsL413hWtEcGvK5HpH</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/24f2e8d0-8e47-4773-a96b-f7e9260c860f/tasks/acf2048be8e4f44a0.output</output-file> <status>completed</status> <summary>Agent "Implement Task 2: detached box relabel" 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. Records on a detached box now move to the only box left, both from the worker and straight from either detach door. Commit: `ea0dff8f` console: move a detached box's records to the sole survivor Tests: RED then GREEN on the 6 new tests. The step-5 regression set passes. gofmt and vet are clean, and census-card says nothing to approve. Concerns: 1. I changed one existing test, `TestReplicaLegacyRelabelSurvivesEarlyReturn/incomplete`. It built a view that is Active but not Complete, which the loader never makes, and so it depended on the old `!v.Active` gate. Now the incomplete view goes only to replica placement, and the relabel gets the whole view. The reviewer should confirm that keeps the test's intent. 2. The brief's witness could never pass as written: `wantLabel` fails whenever `FleetBoxMoved` is set. I used a new `wantMovedTo` instead. Also, `listsOf` already existed, so I made it variadic rather than adding a second one. 3. Rootfs records can't be relabelled with `labelOn` (`ErrRuntimeProtected`), so the new world helper labels records when it creates them. 4. A one-box fleet that is read whole and whose only box is lost now logs "no box to move to" on each pass. It writes nothing. Report: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/fleet-drain-followups/.superpowers/sdd/2026-11-15-fleet-drain-followups/task-2-report.md</result> <usage><subagent_tokens>113664</subagent_tokens><tool_uses>29</tool_uses><duration_ms>852675</duration_ms></usage> </task-notification>

diff --git a/internal/host/agent.go b/internal/host/agent.go
index 183c52aa9..7d4920c78 100644
--- a/internal/host/agent.go
+++ b/internal/host/agent.go
@@ -1074,6 +1074,9 @@ func runAgent(args []string, buildClaims ClaimFactory) {
// loops that read through it, with its backstop running from here.
// Without an index the backstop loop handles early full-pass requests.
v := armChangeIndex(agentCtx, os.Getenv, openDeployStore)
+ // Requested here, not in the backstop loop: that loop starts only
+ // once the HA ingress startup pass returns, tens of seconds later.
+ requestBootFullPass(v, &backstopFullDue)
go func() {
runHAIngressStartup(agentCtx, openDeployStore, boxJudge, reg)
if agentCtx.Err() == nil {
diff --git a/internal/host/agent_test.go b/internal/host/agent_test.go
index bb956e1b8..8860e504f 100644
--- a/internal/host/agent_test.go
+++ b/internal/host/agent_test.go
@@ -1262,6 +1262,41 @@ func TestFastTickActsOnSerialChangeNotBoot(t *testing.T) {
}
}
+// TestUnindexedBootRunsOneFullPass pins P3 (#1008 T9): a restarted box with
+// no record view (every fleet box) has no backstop rebuild to request the
+// boot full pass, so RunAgent requests it. The fast loop's first tick, which
+// only SEEDS the present serial (no replay of its legs), runs that one full
+// pass instead of leaving the box unreconciled until instancesLoop, a minute
+// away. An armed box's request stays the backstop's.
+func TestUnindexedBootRunsOneFullPass(t *testing.T) {
+ env := newFastFixture(t)
+ now := time.Unix(1754640000, 0)
+ // The label written while the agent was down: a present serial.
+ if err := release.BumpSerial(context.Background(), env.store, now); err != nil {
+ t.Fatalf("BumpSerial: %v", err)
+ }
+ var due atomic.Bool
+ var passes int
+ d := env.deps(func() { passes++ })
+ d.fullDue = &due
+ requestBootFullPass(nil, &due)
+ fastTick(context.Background(), d, now) // seeds the serial and runs the boot pass
+ if passes != 1 || due.Load() {
+ t.Fatalf("unindexed boot: passes=%d due=%v, want one pass and the request taken", passes, due.Load())
+ }
+ fastTick(context.Background(), d, now.Add(10*time.Second)) // unchanged serial, nothing due
+ if passes != 1 {
+ t.Fatalf("boot pass must run once, got %d", passes)
+ }
+
+ var due2 atomic.Bool
+ live := release.NewDirStore(t.TempDir())
+ requestBootFullPass(provision.NewRecordView(live, release.NewChangeWatch(live)), &due2)
+ if due2.Load() {
+ t.Fatal("an armed box's boot pass is the backstop's to request")
+ }
+}
+
// TestFastTickClampsFullPasses pins the 5s clamp: a bump landing inside the
// window is DEFERRED (the acted serial is not recorded), and the next tick
// past the window fires it — a burst of console writes costs one pass set
diff --git a/internal/host/changeindex.go b/internal/host/changeindex.go
index 120d66033..5cce83ff3 100644
--- a/internal/host/changeindex.go
+++ b/internal/host/changeindex.go
@@ -145,6 +145,20 @@ func viewStore(ctx context.Context, live release.Store) (s release.Store, epoch
return sn.Store(live), sn.Epoch, true
}
+// requestBootFullPass asks the fast converge loop for one full pass at boot
+// when no record view is armed (every fleet box; any box with the index
+// off). An armed box gets that request from recordViewBackstop's first
+// rebuild; an unarmed one has no rebuild, and the fast loop's first tick only
+// seeds a present serial, so without this the first reconcile after a restart
+// was instancesLoop's, a minute away (#1008 T9, P3). It is a convergence
+// pass, not a replay: the serial's restart, wake and schedule legs still
+// treat the bumps behind the seed as history.
+func requestBootFullPass(v *provision.RecordView, due *atomic.Bool) {
+ if v == nil {
+ due.Store(true)
+ }
+}
+
// recordViewBackstopLoop is the backstop (spec §4.4): Rebuild at start and
// every release.ChangeIndexBackstop, jittered by +-10%, each followed by the
// unrestricted full pass, so every leg is re-run over everything at least