carlos / platform Public

activator: race-free worker tick barrier in the R1 witnesses

The rig's tick helper decided whether a worker start was dispatched by
reading wk.starting after the tick. A start can finish first and clear
it, so a completed start read as none (Astra re-review, round 2).

The helper now reads the jobs worker's startDone channel before and
after rootfsTick. A dispatch makes a new channel; when it differs, the
helper always waits on it, closed already or not. wk.starting is never
read. TestWorkerUnlabelledFenceBacksOff also checks that the dispatched
starts land at the same times as the record reads.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev e5a77903856fb278feb34095499bb5dd292b3f2f parent 6018c07
1 file changed, +30 −9
  • internal/activator/pendingwake_linux_test.go +30 −9

CI failed — run details

Intent

Human

<task-notification> <task-id>ac1b40faeaa034e33</task-id> <tool-use-id>toolu_01BfVnZ8zrJehezh5x3Gxgc9</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ac77363b-5830-422c-9f38-d7f2540dd398/tasks/ac1b40faeaa034e33.output</output-file> <status>completed</status> <summary>Agent "Implement Task 1: R1 wake fence" 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 Commits: - c8b6eb49 activator: fence stale unlabelled fleet wakes under the lease (R1) - 6018c076 activator: R1 fence review fixes (sentinels, worker backoff, barriers) Tests: the brief's activator `-run` set plus `TestInvalidFleetIdentity` passes, and so do the host fleet-wake tests. The new `TestWorkerUnlabelledFenceBacksOff` sees record reads at exactly 0, 2, 6, 14, 30, 62, 122 and 182 s. With the fix removed it fails, reading every 2 s. Concerns: 1. **Shared backoff:** as ruled, the fence reuses the worker's crash backoff. A worker that installs after a long fence keeps that grown backoff, so a crash soon after can enter the crash loop sooner than a fresh worker would. Resetting it on install, or giving the fence its own field, would avoid this. 2. **Old flaky test:** `TestRootfsWorkerPendingNeedsNoProof` sometimes fails on a `t.TempDir` cleanup error. It fails the same way on base e27f469d. I checked by putting the base files back briefly, then restored mine and reset the index to HEAD. 3. Still open from round 1: the brief's `TestAgent.*Fleet` pattern matches no host test, and the new error detail text may need copy review. Report: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-fleet-record-labels/.superpowers/sdd/2026-11-14-fleet-record-labels/task-1-report.md (fix round 1 section appended)</result> <usage><subagent_tokens>200695</subagent_tokens><tool_uses>19</tool_uses><duration_ms>331205</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>bowztp15t</task-id> <tool-use-id>toolu_01WPjsq1Hi5iQcGvqwnniB8s</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ac77363b-5830-422c-9f38-d7f2540dd398/tasks/bowztp15t.output</output-file> <status>completed</status> <summary>Background command "Run Astra scoped re-review of T1 fixes" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 7.48 g CO₂e (778,120 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-fleet-record-labels, 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/pendingwake_linux_test.go b/internal/activator/pendingwake_linux_test.go
index dd0c87725..1cb617bad 100644
--- a/internal/activator/pendingwake_linux_test.go
+++ b/internal/activator/pendingwake_linux_test.go
@@ -1172,17 +1172,32 @@ func (r *unlabelledWorkerRig) reads() []time.Time {
return slices.Clone(r.readAt)
}
-// tick runs one resident tick and waits for any worker start it began
-// to finish (wk.startDone), so its outcome is settled before the caller
-// looks. It reports whether a start ran.
+// startDone is the jobs worker's current start channel (nil: none yet),
+// read under a.mu.
+func (r *unlabelledWorkerRig) startDone(t *testing.T) chan struct{} {
+ t.Helper()
+ r.a.mu.Lock()
+ defer r.a.mu.Unlock()
+ e := r.a.entries[r.rt.Host]
+ if e == nil || e.rootfsWorkers["jobs"] == nil {
+ t.Fatal("the entry has no jobs worker")
+ }
+ return e.rootfsWorkers["jobs"].startDone
+}
+
+// tick runs one resident tick and, when it dispatched a worker start,
+// waits for that start to finish, so its outcome is settled before the
+// caller looks. A dispatch makes a new startDone channel
+// (restartRootfsWorkerLocked), so the channel is compared before and
+// after the tick; the new one is always waited on, closed already or not.
+// wk.starting is never read: a start can finish before the tick returns.
+// It reports whether a start was dispatched.
func (r *unlabelledWorkerRig) tick(t *testing.T) bool {
t.Helper()
+ before := r.startDone(t)
r.a.rootfsTick()
- r.a.mu.Lock()
- wk := r.a.entries[r.rt.Host].rootfsWorkers["jobs"]
- starting, done := wk.starting, wk.startDone
- r.a.mu.Unlock()
- if !starting {
+ done := r.startDone(t)
+ if done == nil || done == before {
return false
}
select {
@@ -1240,8 +1255,11 @@ func TestWorkerUnlabelledFenceBacksOff(t *testing.T) {
r := newUnlabelledWorkerRig(t)
r.labelled.Store(true)
start := r.clk.now()
+ var dispatched []time.Duration
for range 200 {
- r.tick(t)
+ if r.tick(t) {
+ dispatched = append(dispatched, r.clk.now().Sub(start))
+ }
r.clk.advance(time.Second)
}
var got []time.Duration
@@ -1258,6 +1276,9 @@ func TestWorkerUnlabelledFenceBacksOff(t *testing.T) {
if !slices.Equal(got, want) {
t.Fatalf("record reads at %v, want %v", got, want)
}
+ if !slices.Equal(dispatched, want) {
+ t.Fatalf("worker starts dispatched at %v, want one per read at %v", dispatched, want)
+ }
r.a.mu.Lock()
wk := r.a.entries[r.rt.Host].rootfsWorkers["jobs"]
restarts, crashLoop, backoff := wk.restarts, wk.crashLoop, wk.backoff