carlos / platform Public

host: runs witness picks a real queued run at ready

The Task 4 runs witness noted a record with no run, so it showed only
that ready drains notes. It now queues a real run after the runs boot
pass has read the records (the boot pass is held in its owned-route
check on a run already queued at boot), notes it from the first tick,
and asserts the first tick launches nothing and ready's runs pass picks
it: one launch, record picked by this box. Fails without the catch-up.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev eb870914bb1a92b448e0764e7eeffe7fb031a431 parent 894b72d
1 file changed, +48 −20
  • internal/host/fastboot_test.go +48 −20

CI failed — run details

Intent

Human

<task-notification> <task-id>acfdf5f043a273cf9</task-id> <tool-use-id>toolu_01Ub3jcEcJgGCH1U8C8RKToM</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_WITH_CONCERNS. The fleet box's first full pass now runs as soon as the moves views are built, with no tick sleep, and the seeds run beside it. Commit: `894b72d7` "host: run the boot full pass on arming, seeds beside it" (on fleet-first-reconcile-fix). Tests: all 5 required witnesses (a, b, c, a sidecar one, a runs one) plus a wiring check failed on the old order (RED) and pass now. Race-clean over 3 runs. 432 related host tests pass, 1 env-gated skip; census tests, vet, and darwin and windows builds pass. Moved vs kept: moved restartSeed, sidecarWakeSeed, runRunsBootPass, sd.converge and systemLeg.observe onto their own goroutine beside the first tick (they read the routes as they stood before the first pass), and removed the first tick's sleep. The loop waits for the seeds before tick 2 and only then wires in the legs that read them (the restart and sidecar wake legs, restartGain and the system leg). Kept before the pass: refreshMovesHolds, refreshOfflineView and the pass's own inputs. Estimated saving: about 2.2 to 3.2 s on Task 2's 60 ms model, plus about 0.8 s more where runs are armed. Concerns: 1. Restart, wake and schedule requests landing in the first ~0.8 s after arming (more with more records) are now treated as history. 2. The runs boot pass and schedule converge run beside the first full pass. Both already overlap it in production and lock themselves; if the brief's "no pass beside the tick" rule covers them, they can move to just after tick 1. 3. I added one runs pass at ready to pick up runs the first tick saw but could not act on yet. Census card is not reviewed (as instructed): docs/superpowers/notes/census-proposal-fleet-first-reconcile-speed-4.md Report: /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>241163</subagent_tokens><tool_uses>72</tool_uses><duration_ms>1753089</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>brfe41rks</task-id> <tool-use-id>toolu_01PHBozPjN7qzkMFCqAgBNkk</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/68be7e6f-7841-4936-9fa0-2041da778685/tasks/brfe41rks.output</output-file> <status>completed</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; echo "Task 4: DONE_WITH_CONCERNS 894b72d7; Astra review r1 started" &gt;&gt; $W/progress.md; $W/astra-review.sh $W/task-4-review-prompt.md $W/task-4-review-astra.md; tail -4 $W/task-4-review-astra.md" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 28.3 g CO₂e (3,302,697 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/internal/host/fastboot_test.go b/internal/host/fastboot_test.go
index 263ef3e0d..80e60f8df 100644
--- a/internal/host/fastboot_test.go
+++ b/internal/host/fastboot_test.go
@@ -283,40 +283,68 @@ func TestFastBootWakesASidecarTheFirstPassMints(t *testing.T) {
}
}
-// TestFastBootActsOnTheRunsTheFirstTickNoted: the first tick's runs pass
-// can start before the runs boot pass has finished, and then acts on
-// nothing (runsWorker.booted) and keeps reconcile's notes. ready runs one
-// more runs pass once the boot pass is done, so those notes are taken now,
-// not at the next full pass.
+// TestFastBootActsOnTheRunsTheFirstTickNoted: a run queued after the runs
+// boot pass has read the records, and noted by the first tick's reconcile
+// while that boot pass is still running, is picked neither by the first
+// tick's runs pass (runsWorker.booted) nor by the boot pass (its listing is
+// older). ready's runs pass picks it, rather than the next full pass.
func TestFastBootActsOnTheRunsTheFirstTickNoted(t *testing.T) {
swapBootSteps(t)
ctx := context.Background()
f := newFastFixture(t)
- w := newRunsWorker(f.store, func(string) (*registry.Route, error) { return nil, nil }, nil, t.TempDir(), "box-1", "boot-1")
+ // A run already queued at boot, on a row this box does not serve. The
+ // boot pass reads it with every other record, then asks whether it owns
+ // the row: the test holds it there, after its listing, before it is done.
+ const other = "other.example.com"
+ earlier := runRecord()
+ earlier.Host = other
+ if err := provision.CreateRecord(ctx, f.store, earlier); err != nil {
+ t.Fatal(err)
+ }
+ if _, err := provision.SetRecordRun(ctx, f.store, earlier.Account, earlier.App, other,
+ provision.RunAdmit(provision.RunAdmission{ID: "run_zyxwvutsrqponmlkjihgfedcba", By: "op@example.com", Deadline: time.Now().Add(time.Minute)})); err != nil {
+ t.Fatal(err)
+ }
+ listed, release := make(chan struct{}), make(chan struct{})
+ var once sync.Once
+ owned := runOwnedRoute(runHost)
+ routes := func(h string) (*registry.Route, error) {
+ if h == other {
+ once.Do(func() { close(listed); <-release })
+ return nil, nil
+ }
+ return owned(h)
+ }
+ var launched execLog
+ w := testWorker(f.store, routes, "box-1", "boot-1", &launched)
+ w.dataDir = t.TempDir()
+ w.booted.Store(false) // a fresh agent: the boot pass has not run
prev := armedRuns.Load()
armedRuns.Store(w)
t.Cleanup(func() { armedRuns.Store(prev) })
- barrier := make(chan struct{})
- bootRunsPass = func(ctx context.Context) { <-barrier; runRunsBootPass(ctx) }
+ bootRunsPass = runRunsBootPass
bootRunsNotes = runRunsPass
+ var id string
d, b := bootFixture(t, f, func() {
- w.note(provision.Record{Host: "one.example.com"}) // reconcile's note
- runRunsPass(ctx) // the full pass's runs leg
+ <-listed // the boot pass has read the records, and is held
+ var rec provision.Record
+ rec, id = queueRun(t, f.store, time.Now().Add(time.Minute))
+ w.note(rec) // reconcile's note
+ runRunsPass(ctx) // the full pass's runs leg
})
ready := b.start(ctx, d, func() { fastTick(ctx, d, time.Unix(1762382167, 0)) })
- noted := func() int {
- w.mu.Lock()
- defer w.mu.Unlock()
- return len(w.noted)
+ if n := launched.count(); n != 0 {
+ t.Fatalf("%d runs launched by the first tick, want 0: a runs pass acted before the boot pass finished", n)
}
- if n := noted(); n != 1 {
- t.Fatalf("%d notes after the first tick, want 1 kept: the runs pass acted before the boot pass finished", n)
- }
- close(barrier)
+ close(release)
ready()
- if n := noted(); n != 0 {
- t.Fatalf("%d notes left after ready, want 0: the first tick's notes wait for the next full pass", n)
+ if n := launched.count(); n != 1 {
+ t.Fatalf("%d runs launched after ready, want 1: the queued run the first tick noted waits for the next full pass", n)
+ }
+ got, err := provision.GetRecord(ctx, f.store, "bab", "shop", runHost)
+ if err != nil || got.ActiveRun == nil || got.ActiveRun.ID != id || got.ActiveRun.State != provision.RunPicked || got.ActiveRun.Box != "box-1" {
+ t.Fatalf("record after ready: %+v, %v; want run %s picked by box-1", got.ActiveRun, err, id)
}
}