carlos / platform Public

activator: a held wake's re-read row is admitted again right after the re-read, before the planner can materialize anything for it (Task 7 round 2, P2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 2fe34113b4f79aa6b5ccc3406697e02420878524 parent 92e1922
2 files changed, +32 −13
  • internal/activator/activator.go +10 −9
  • internal/activator/rootfs_gate_test.go +22 −4

CI failed — run details

Intent

Human

<task-notification> <task-id>a063b426b7b12b8e4</task-id> <tool-use-id>toolu_01UCoXcDSCmNkDoBQEQLkw9r</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/723ae101-0fd7-40c3-a758-6adf1597efb2/tasks/a063b426b7b12b8e4.output</output-file> <status>completed</status> <summary>Agent "Plan 3 Task N1 implementer" 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 Astra's three round-2 P2s applied, N1 can close. Commit: 70053b74. This round changed only tests: the binary-launch guard plus three new fixtures. No production code changed. 1. **Strict starts:** the guard now counts the strict-group starts as launches, so they may only appear in the two checked spawn functions, after the runtime refusal. Fixture: `strict.go`. 2. **Package-level code:** the guard now also inspects package-level `var` and `const` values, so a launch hidden in one is caught. Fixture: `pkgvar.go`. 3. **The refusal must refuse:** the guard now checks that the runtime refusal is passed the function's own route, tests `err != nil`, and returns that same error at once. Fixture: `refusals.go` (inverted condition, wrong route, swallowed error). Tests: each item also has a mutation in real code that makes the guard fail, and all were reverted. The invariant guards, all 10 guard fixtures and the full activator package (64.8 s) pass. gofmt is clean, and vet passes on linux and darwin. Concerns: - Vet on windows fails on an existing `unix.Mkfifo` call in `activator_test.go`, which this change does not touch. CI only builds windows, so it does not run into this. - `TestBinaryLaunchesAskTheRuntimeFirst` still needs adding to the guard regex in common.md; no current pattern matches its name. Report (round 2 note appended): /home/paulca/amadan.net/carlos/platform/.claude/worktrees/rootfs-apps-3/.superpowers/sdd/2026-10-24-rootfs-apps-3-lifecycle/task-N1-report.md</result> <usage><subagent_tokens>439579</subagent_tokens><tool_uses>8</tool_uses><duration_ms>246706</duration_ms></usage> </task-notification>

diff --git a/internal/activator/activator.go b/internal/activator/activator.go
index 70c9212dd..32cd4716d 100644
--- a/internal/activator/activator.go
+++ b/internal/activator/activator.go
@@ -2334,6 +2334,16 @@ func (a *Service) doWake(ctx context.Context, e *actEntry) (*wokenInstance, erro
e.route = rt
}
a.mu.Unlock()
+ // 0.66. The row the admission judged is the row everything
+ // after acts on (INV-3): a re-read that changed any gate field
+ // is admitted again, in full, right here, before the planner
+ // (which may materialize a build), the publication and the
+ // lease.
+ if rootfsGateKey(rt) != admittedRow {
+ if err := a.rootfsStartRefusal(ctx, rt); err != nil {
+ return w, err
+ }
+ }
}
}
@@ -2369,15 +2379,6 @@ func (a *Service) doWake(ctx context.Context, e *actEntry) (*wokenInstance, erro
}
}
- // 0.9. The row the admission judged is the row the lease and restore
- // act on (INV-3): a re-read since step 0.4 (the held wake's, 0.65) that
- // changed any gate field is admitted again, in full, before Acquire.
- if rootfsGateKey(rt) != admittedRow {
- if err := a.rootfsStartRefusal(ctx, rt); err != nil {
- return w, err
- }
- }
-
// 1. The lease first: everything after this line is done as the prefix's
// single writer. Contention is not retried here — on one box it means a
// previous incarnation hasn't released; tell the client to come back after
diff --git a/internal/activator/rootfs_gate_test.go b/internal/activator/rootfs_gate_test.go
index 02041d725..88abfceae 100644
--- a/internal/activator/rootfs_gate_test.go
+++ b/internal/activator/rootfs_gate_test.go
@@ -798,8 +798,10 @@ func (s *seqTable) Get(string) (*registry.Route, error) {
// The same through the held wake's second read (step 0.65): the row is
// nested at step 0's refresh, so the cheap re-check passes, and foreign at
-// the re-read after the wait for root. Step 0.9 admits the row the lease
-// acts on, in full, before Acquire.
+// the re-read after the wait for root. Step 0.66 admits the re-read row in
+// full right after the re-read: before the planner (whose production form
+// may materialize a build), so the refused row is never planned,
+// materialized or leased.
func TestAdmissionFollowsTheHeldWakesReread(t *testing.T) {
eb, _ := newRootfsBackend(t)
nested := rootfsRoute(eb)
@@ -812,11 +814,27 @@ func TestAdmissionFollowsTheHeldWakesReread(t *testing.T) {
a.HeldTarget = func(string) HeldWake { return HeldWake{Held: true, Target: "v1"} }
b.startable = func(ctx context.Context, rt registry.Route) error { return eb.rootfsStartable(ctx, rt) }
a.Routes = &seqTable{rows: []registry.Route{nested, foreign}}
+ var pmu sync.Mutex
+ planned := 0
+ a.Planner = func(context.Context, registry.Route) WakePlan {
+ pmu.Lock()
+ planned++
+ pmu.Unlock()
+ b.mu.Lock()
+ b.ident.materializes++ // the production planner's Materialize for a Version "" row
+ b.mu.Unlock()
+ return WakePlan{}
+ }
_, err := a.beginRequest(context.Background(), nested)
if err == nil || !errors.Is(err, errRootfsNotAdmitted) || !strings.Contains(err.Error(), "nested isolation") {
t.Fatalf("wake = %v, want the re-read (foreign) row refused before the lease", err)
}
- if got := b.gateCounts(); got.acquires != 0 || got.restores != 0 {
- t.Fatalf("the re-read row reached the lease: %+v", got)
+ if got := b.gateCounts(); got.acquires != 0 || got.restores != 0 || got.materialized != 0 {
+ t.Fatalf("the re-read row reached the planner's materialization or the lease: %+v", got)
+ }
+ pmu.Lock()
+ defer pmu.Unlock()
+ if planned != 0 {
+ t.Fatalf("the refused row was planned %d times", planned)
}
}