carlos / platform Public

activator: test a queued first wake still execs its candidate (R2 P2)

A planned first wake queued 2.5 s behind a held slot, against a 2 s
health window and a 1 s verdict floor, still execs B once admitted.
Fails when wakeStart is set at the request rather than at admission.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev d7671518a913712ac1fcdf15dce80df836e8ad32 parent fdb698f
1 file changed, +37 −0
  • internal/activator/wakeslots_test.go +37 −0

CI failed — run details

Intent

Human

<task-notification> <task-id>b4fgebe5f</task-id> <tool-use-id>toolu_01Hjf9Ey2Q8PB66BaNLGNhH7</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/9fdb19f6-7964-4108-a723-1323c2914a76/tasks/b4fgebe5f.output</output-file> <status>completed</status> <summary>Background command "Wait for Astra round 2 to finish" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>bn8hoe8op</task-id> <tool-use-id>toolu_01RLvBzE9gU6qZ8tj6wAbovM</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/9fdb19f6-7964-4108-a723-1323c2914a76/tasks/bn8hoe8op.output</output-file> <status>completed</status> <summary>Background command "Wait for round 2 log to finish" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>bft0dbf1a</task-id> <tool-use-id>toolu_011jeN9fRGLq6d7RZz5uEHeL</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/9fdb19f6-7964-4108-a723-1323c2914a76/tasks/bft0dbf1a.output</output-file> <status>completed</status> <summary>Background command "Wait for round 2 final verdict" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 25.0 g CO₂e (3,045,848 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on wake-storm-cap, 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/activator/wakeslots_test.go b/internal/activator/wakeslots_test.go
index 948484c66..cddc0b409 100644
--- a/internal/activator/wakeslots_test.go
+++ b/internal/activator/wakeslots_test.go
@@ -197,3 +197,40 @@ func TestWakeSlotHealthWindowStartsAtAdmission(t *testing.T) {
t.Fatalf("wakeStart %v is before admission %v: the queue ate the health window", got, admittedAfter)
}
}
+
+// A planned first wake that queues for a slot longer than B's whole health
+// window still execs B once admitted: the window is counted from admission,
+// so the queue never decides which build boots (Astra R2 P2). Counted from
+// the request, 2.5 s queued against a 2 s window would leave B under the
+// 1 s verdict floor and boot the good build instead.
+func TestWakeSlotQueuedFirstWakeStillExecsTheCandidate(t *testing.T) {
+ shrinkFirstWake(t, 3*time.Second, time.Second, 50*time.Millisecond)
+ shrinkVerdictFloor(t, time.Second)
+ dir := t.TempDir()
+ good, next := stagedID(t, dir, "v1"), stagedID(t, dir, "v2")
+ a, b, evs := planActivator(t, WakePlan{Boot: next, Mode: ModeOverlap, FirstWake: true, Fallback: &good, Check: slowFirstCheck(0)})
+ a.wakeSlots = make(chan struct{}, 1)
+ hold := a.acquireWakeSlot(context.Background(), "other.example.com")
+ out := make(chan error, 1)
+ go func() {
+ done, err := a.beginRequest(context.Background(), testRoute("one.example.com"))
+ if err == nil {
+ done()
+ }
+ out <- err
+ }()
+ time.Sleep(2500 * time.Millisecond)
+ if gens := b.started(); len(gens) != 0 {
+ t.Fatalf("spawned %+v while every slot was held", gens)
+ }
+ hold()
+ if err := <-out; err != nil {
+ t.Fatalf("the queued first wake: %v", err)
+ }
+ if gens := b.started(); len(gens) != 1 || gens[0].Build != "v2" {
+ t.Fatalf("spawned %+v, want the candidate v2: queue time must not spend its health window", gens)
+ }
+ if ev := evs.wait(t, GenHealthy); !ev.FirstWake || ev.Gen.Build != "v2" {
+ t.Fatalf("healthy event = %+v, want v2's first wake", ev)
+ }
+}