carlos / platform Public

ha: retain self-expiry ticks and refresh duty census evidence

Keep expiry waits deferred even when old peer suppression remains. Strengthen the peer-owned tick witness, replace pure equality coverage with restricted-acquire coverage, stabilize the retry clock, and refresh the slice census proposal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev f3d050f482bec14a5e095ba740542d92fe62652f parent 1cbdf6f
9 files changed, +47 −31
  • docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md +2 −2
  • docs/superpowers/notes/census-region-ha-p1b3b-t-claims.md +4 −4
  • internal/activator/haduties.go +1 −1
  • internal/activator/haduties_test.go +12 −0
  • internal/host/haduties_wiring_test.go +16 −1
  • internal/lease/haduty_test.go +0 −11
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-region-ha-p1b3b-t.tsv +10 −10
  • internal/schedule/haduties_test.go +1 −1

CI passed — run details

Intent

Attributed to this commit: 9.96 g CO₂e (1,225,348 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on region-ha-p1b3b-duties, 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/docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md b/docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md
index 37837b18c..1d0597fe2 100644
--- a/docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md
+++ b/docs/superpowers/notes/census-proposal-region-ha-p1b3b-t.md
@@ -15,7 +15,7 @@ Ruling `census-ruling-region-ha-p1b3b-t`. The independent reviewer approves or r
| `internal/activator/harelease.go` `Service.releaseHAClean` | sites | +whole:Route | Record advisory local-release basis only after ReleaseMarker succeeds. Add a whole-route argument to local duty bookkeeping; release order and lease authority unchanged. |
| `internal/activator/hawake.go` `ExecBackend.acquireClassified` | sites | +whole:Route | Select the restriction-only AcquireHAForDuty for background contexts, including sticky HA reclassification; observe successful ordinary acquires to clear stale suppression. Add a whole-route observer argument; no new authority. |
| `internal/host/schedule_wiring.go` `activatorDeliverer.deliverSelected` | sites | +whole:Route ×2 | Wrap local delivery in WithDuty so lease loss returns a deferred control result before timer bookkeeping. Add whole-route arguments; no remote forwarding. |
-| `internal/schedule/runner.go` `Runner.fire` | sites | -registry:Host ×4, -registry:Name ×2, -registry:Spec, -whole:Route ×6, -whole:Timer ×4 | Move existing delivery body to fireOwned; call WithDuty before token preparation and conditionally advance old recurring occurrences through one guarded registry method. Fewer direct timer/route reads in this wrapper. |
+| `internal/schedule/runner.go` `Runner.fire` | sites | -registry:Host ×4, -registry:Name ×2, -whole:Route ×5, -whole:Timer ×2 | Call WithDuty before token preparation; record non-deferred pre-delivery wake errors through the existing retry and event policy after timerStillDue. Adds spec and whole timer/route reads for record. Advance only known non-owner recurring occurrences through the existing registration/DueAt guard; no second outcome after callback execution. |
Envelopes re-pinned: `internal/activator`, `internal/boxchoice`, `internal/edge`, `internal/host`, `internal/lease`, `internal/registry`, `internal/schedule`.
@@ -55,6 +55,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/schedule/runner.go:Runner.fireOwned`: reads +registry:Host ×4, +registry:Name ×2, +registry:Spec ×2, +whole:Route ×9, +whole:Timer ×8; written legacy, accepted-legacy, frozen
- reads `internal/host/runs.go:runsWorker.pickup`: +registry:HA, +whole:Route; keeps legacy, task accepted-legacy
-Seal: `7e30dee4fb52370555ad173512d7f03782f0fbed725a8a6bf4f7e31f52c23668` → `de4605eaca89fe6173bb9c52b25f5dbe65a59dfe1a94bd4a13e46b6fd2a223ee`.
+Seal: `7e30dee4fb52370555ad173512d7f03782f0fbed725a8a6bf4f7e31f52c23668` → `3dff55f1b67755f6772c778e565b91838202965a4034484b94694c3a9c0550d9`.
Overlay: `internal/provision/testdata/plan14-root-reads-region-ha-p1b3b-t.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/notes/census-region-ha-p1b3b-t-claims.md b/docs/superpowers/notes/census-region-ha-p1b3b-t-claims.md
index cf03111da..1dc415b8f 100644
--- a/docs/superpowers/notes/census-region-ha-p1b3b-t-claims.md
+++ b/docs/superpowers/notes/census-region-ha-p1b3b-t-claims.md
@@ -9,19 +9,19 @@ internal/edge/wakeplacement.go:homeMap.wakeSnapshot Expose fresh compatible peer
internal/host/agent.go:runAgent Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation.
internal/host/schedule_wiring.go:newScheduleDeps Wire Runner.WithDuty before token access through the existing Service. No new read.
internal/host/schedule_wiring.go:activatorDeliverer.deliverSelected Wrap local delivery in WithDuty so lease loss returns a deferred control result before timer bookkeeping. Add whole-route arguments; no remote forwarding.
-internal/schedule/runner.go:Runner.fire Move existing delivery body to fireOwned; call WithDuty before token preparation and conditionally advance old recurring occurrences through one guarded registry method. Fewer direct timer/route reads in this wrapper.
+internal/schedule/runner.go:Runner.fire Call WithDuty before token preparation; record non-deferred pre-delivery wake errors through the existing retry and event policy after timerStillDue. Adds spec and whole timer/route reads for record. Advance only known non-owner recurring occurrences through the existing registration/DueAt guard; no second outcome after callback execution.
internal/activator/haduties.go:DutyForTick Read the observed timer through the shared old-occurrence predicate; once-timers are never aged out.
internal/activator/haduties.go:Service.Duty Pass the local route into dutyInput and the pure chooser. Advisory decision only; no acquire or start.
internal/activator/haduties.go:Service.WithDuty Read route host for owned-awake checks and pass provisioned managed instances to restricted singleflight wake before producer writes, including cached legacy rows that discover sticky HA at acquire. Other route kinds keep their path; no authority bypass.
-internal/activator/haduties.go:Service.allowDuty Read current lifetime, local state and cached view for each classified lease CAS round; invoke the pure restriction table and persist suppression or an expiry deadline. May refuse, never override ordinary acquire.
+internal/activator/haduties.go:Service.allowDuty Recheck lifetime and duty policy on every classified CAS round. Return a non-owner subtype only for a known foreign holder; self expiry and local denial remain deferred. Existing suppression writes and acquire restrictions retained; no read added.
internal/activator/haduties.go:Service.dutyInput Read HA classification/lifetime from the existing backend and route host, HA, replica, tunnel, import gate and status; read advisory DutyStore state and cached home projection outside a.mu. No new filesystem or bucket path.
internal/activator/haduties.go:Service.rememberDutyAcquired Read route host to clear peer suppression only after ordinary acquire succeeds, including visitor wakes. Local advisory state cannot authorize the lease.
internal/activator/haduties.go:Service.rememberDutyRelease Read route host to record successful local release basis keyed to the acquired host lifetime. Failed marker writes never reach this hook.
-internal/activator/haduties.go:Service.restrictDuty Pass the route into the chooser and callback; carry a private background context restriction and bind its host lifetime. No new I/O beyond dutyInput.
+internal/activator/haduties.go:Service.restrictDuty Bind background restriction to the host lifetime. Use existing duty state to distinguish known peer suppression from local denial before allowing timer aging; no new I/O beyond dutyInput.
internal/activator/haduties.go:dutyBackend Dispatch the existing backend by local route through SplitBackend, for HA classification and self identity. No new I/O.
internal/edge/wakeplacement.go:Edge.DutySnapshot Pass the route to the existing cached home projection; no store reads, network reads or new publication.
internal/host/runs.go:runsWorker.dutyStillOwned Read route HA/host and existing service classification; after sink construction require an HA route still held awake locally before RunPick. Refusal only.
-internal/host/runs.go:runsWorker.pickupOwned Move existing pickup body here under WithDuty; recheck held ownership after sink construction and gate detached execution too. Whole-route arguments added; existing request and record validation retained.
+internal/host/runs.go:runsWorker.pickupOwned Gate pickup and detached exec. When the detached gate refuses before exec, finish with the existing RefusedIncarnation result, close the picked sink and forget the active handle. Existing guarded sink Finish and cleanup paths are reused; no new input or path read.
internal/host/runs.go:runsWorker.pickup Wrap both bucket and relay pickup in the service duty gate; refuse an HA route when no gate exists. Reads HA and passes the route; existing pickup moved to pickupOwned.
internal/registry/timers.go:Registry.AdvanceDutyTimer Update only local recurring timer progress with registration, DueAt and NextAt comparisons. Read timer fields and existing registry sql/remote handles; no last-delivery stamp, once deletion or external path.
internal/schedule/runner.go:OldDutyTick Read timer kind and natural due occurrence; only recurring occurrences at least 15 minutes old qualify. No writes.
diff --git a/internal/activator/haduties.go b/internal/activator/haduties.go
index 821ee0466..2f062ebaa 100644
--- a/internal/activator/haduties.go
+++ b/internal/activator/haduties.go
@@ -326,7 +326,7 @@ func (a *Service) allowDuty(ctx context.Context, rt registry.Route, lifetime str
}
func dutyRefusal(i DutyInput, st DutyState) error {
- if i.LocalDenied || i.OwnedAwake || i.Lifetime == "" || i.Self.Ref == "" || i.Self.IID == "" || !i.Suppressed {
+ if i.LocalDenied || i.OwnedAwake || i.Lifetime == "" || i.Self.Ref == "" || i.Self.IID == "" || !i.Suppressed || !st.NotBefore.IsZero() {
return ErrDutyDeferred
}
if st.HolderRef != "" && st.HolderRef != "@unknown" && (st.HolderRef != i.Self.Ref || st.HolderIID != i.Self.IID) {
diff --git a/internal/activator/haduties_test.go b/internal/activator/haduties_test.go
index e972e3395..f8f01fc2d 100644
--- a/internal/activator/haduties_test.go
+++ b/internal/activator/haduties_test.go
@@ -470,3 +470,15 @@ func TestHADutyLocalDeniedRetainsTick(t *testing.T) {
t.Fatalf("err=%v lock reads=%d", err, lockGets(s.b, s.rt))
}
}
+
+func TestHADutySelfExpiryRetainsTick(t *testing.T) {
+ s := haHeldByB(t)
+ life := haFixOf(s.b).lifetime
+ if err := s.a.saveDuty(context.Background(), s.rt.Host, life, DutyState{}, DutyState{Basis: DutyLocalRelease, HolderRef: "b", HolderIID: "i-b", NotBefore: time.Now().Add(time.Minute)}); err != nil {
+ t.Fatal(err)
+ }
+ err := s.a.WithDuty(context.Background(), s.rt, func(context.Context) error { t.Error("expiry wait ran"); return nil })
+ if !errors.Is(err, ErrDutyDeferred) || errors.Is(err, schedule.ErrDutyNotOwner) || lockGets(s.b, s.rt) != 0 {
+ t.Fatalf("err=%v lock reads=%d", err, lockGets(s.b, s.rt))
+ }
+}
diff --git a/internal/host/haduties_wiring_test.go b/internal/host/haduties_wiring_test.go
index 502548422..7418fb0b7 100644
--- a/internal/host/haduties_wiring_test.go
+++ b/internal/host/haduties_wiring_test.go
@@ -42,7 +42,7 @@ func TestHADutyBeforeEveryProducer(t *testing.T) {
defer close(done)
return original(ctx, rt, f)
}
- if err := reg.UpsertTimer(registry.Timer{Host: rt.Host, Name: "tick", Kind: "schedule", Spec: "cron * * * * *", Path: "/job", NextAt: now.Unix()}); err != nil {
+ if err := reg.UpsertTimer(registry.Timer{Host: rt.Host, Name: "tick", Kind: "schedule", Spec: "cron * * * * *", Path: "/job", NextAt: now.Add(-time.Hour).Unix()}); err != nil {
t.Fatal(err)
}
sd.runner.Tick(context.Background())
@@ -51,6 +51,21 @@ func TestHADutyBeforeEveryProducer(t *testing.T) {
case <-time.After(time.Second):
t.Fatal("gate not called")
}
+
+ deadline := time.Now().Add(time.Second)
+ for sd.runner.Busy(rt.Host) && time.Now().Before(deadline) {
+ time.Sleep(time.Millisecond)
+ }
+ if sd.runner.Busy(rt.Host) {
+ t.Fatal("runner did not finish")
+ }
+ timer, err := reg.GetTimer(rt.Host, "tick")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if timer.NextAt <= now.Unix() || timer.Attempts != 0 || timer.LastAt != 0 {
+ t.Fatalf("peer-owned old tick: %+v", timer)
+ }
assertPeerDutyRead(t, fx, rt.Host)
if tokens.Load() != 0 {
t.Fatal("loser minted token")
diff --git a/internal/lease/haduty_test.go b/internal/lease/haduty_test.go
index ff4e07dc1..3ab01a683 100644
--- a/internal/lease/haduty_test.go
+++ b/internal/lease/haduty_test.go
@@ -76,17 +76,6 @@ func TestDutyAcquireRestrictionOnly(t *testing.T) {
})
}
-func TestDutyAcquireExpiryEquality(t *testing.T) {
- now := time.Now()
- v := hafresh.View{Lock: hafresh.Lock{Owner: hafresh.OwnerFor(hafresh.Self{Ref: "b", IID: "i-b"}, 1, true), ExpiresAt: now}}
- proofs := 0
- p := hafresh.Proofs{OwnerTerminated: func(string) (bool, error) { proofs++; return true, nil }}
- d := hafresh.DecideAcquire(v, hafresh.Self{Ref: "a", IID: "i-a"}, now, p)
- if d.Action != hafresh.ActHeld || proofs != 0 {
- t.Fatalf("equality: %+v proofs=%d", d, proofs)
- }
-}
-
func TestDutyAcquireRestrictionOnlyReclassifiedPeer(t *testing.T) {
haBox(t)
fx := leasetest.NewLockFixture(t)
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index e530d55ee..3d6c65fbe 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -67,4 +67,4 @@ plan14-root-reads-domains-zone-credentials.tsv 3b6cd29b87d2728254936722ab45fdadc
plan14-root-reads-devbox-identity.tsv 66a5df05f18f70c3162ad05aa316c1e69c0f053d54f8b682262c266d6aa50772
plan14-root-reads-region-ha-home-placement.tsv b0304f75d2c5f1b9818d0f282b89c00c00b33e3f9bf974031687527c191fb161
plan14-root-reads-storedoor-stream-get.tsv 7e30dee4fb52370555ad173512d7f03782f0fbed725a8a6bf4f7e31f52c23668
-plan14-root-reads-region-ha-p1b3b-t.tsv de4605eaca89fe6173bb9c52b25f5dbe65a59dfe1a94bd4a13e46b6fd2a223ee
+plan14-root-reads-region-ha-p1b3b-t.tsv 3dff55f1b67755f6772c778e565b91838202965a4034484b94694c3a9c0550d9
diff --git a/internal/provision/testdata/plan14-root-reads-region-ha-p1b3b-t.tsv b/internal/provision/testdata/plan14-root-reads-region-ha-p1b3b-t.tsv
index c4caadf74..f0d212677 100644
--- a/internal/provision/testdata/plan14-root-reads-region-ha-p1b3b-t.tsv
+++ b/internal/provision/testdata/plan14-root-reads-region-ha-p1b3b-t.tsv
@@ -8,15 +8,15 @@
@legacy 33abbadcf662e15febe8dd2b8f8866c830890cc4bd4c77583470d246a9094d65 internal/activator/haduties.go DutyForTick legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read the observed timer through the shared old-occurrence predicate; once-timers are never aged out. whole:Timer@120 f9a9c2fce154cf37b1d1e5ef03319ad0c4c546ad88a1aa78812b7401428995e5
@legacy 008e2ff03d5955fe5de43f0c98b7e5d7ec91773a58ed35544263401989edd905 internal/activator/haduties.go Service.Duty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Pass the local route into dutyInput and the pure chooser. Advisory decision only; no acquire or start. whole:Route@118 15122e8a380cccc304994a0f390ed0de98eb37a765d2362df73a0f6b79dae78e
@legacy 2506ebeb35560294d55dd2429da67f210297deb7283930c371c0ad3b3463e97e internal/activator/haduties.go Service.WithDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host for owned-awake checks and pass provisioned managed instances to restricted singleflight wake before producer writes, including cached legacy rows that discover sticky HA at acquire. Other route kinds keep their path; no authority bypass. registry:Host@584,registry:Host@673,whole:Route@143,whole:Route@422,whole:Route@503 69e34dcb9430c114b0765adffc97be60b72ea939c5c38296bffd7a3bec0d804d
-@legacy b3313445468ffe9a9eddabf7c87220ba985c729f53d3a0b1fc2dc58a9a41c3f4 internal/activator/haduties.go Service.allowDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read current lifetime, local state and cached view for each classified lease CAS round; invoke the pure restriction table and persist suppression or an expiry deadline. May refuse, never override ordinary acquire. registry:Host@1203,registry:Host@521,whole:Route@141,whole:Route@940 9e78355eed5edc26cfdbf789bbedc148656b534a36c09e350b5f086fec3e571e
+@legacy 4fcf0b24acbefc3e8efb7ec9e45504bdb03372a3b0302a513b18bbdba600cb0a internal/activator/haduties.go Service.allowDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Recheck lifetime and duty policy on every classified CAS round. Return a non-owner subtype only for a known foreign holder; self expiry and local denial remain deferred. Existing suppression writes and acquire restrictions retained; no read added. registry:Host@1237,registry:Host@555,whole:Route@141,whole:Route@974 2ed5e21384e91dfe599e1267994579859a267c7b9ca3a0da77ce8f93a048a552
@legacy 53ab473449de8d43122285c04d75ebac9dcbe370ff2105273450fceac91bdd0c internal/activator/haduties.go Service.dutyInput legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read HA classification/lifetime from the existing backend and route host, HA, replica, tunnel, import gate and status; read advisory DutyStore state and cached home projection outside a.mu. No new filesystem or bucket path. registry:HA@244,registry:Host@1079,registry:Host@122,registry:Host@510,registry:Host@576,registry:ImportGate@690,registry:Replica@657,registry:Status@714,registry:Status@733,registry:Tunnel@671,whole:Route@149,whole:Route@216,whole:Route@312,whole:Route@604,whole:Route@885 9cdbbbd19a900153cc5dd6959366c5ec6042816dcb7f97b46d85476823eaf1c5
@legacy b1d9a2c7b74809dbbf147374dd8f26208ccded1ed8b7ffee62f57e5aa632219e internal/activator/haduties.go Service.rememberDutyAcquired legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host to clear peer suppression only after ordinary acquire succeeds, including visitor wakes. Local advisory state cannot authorize the lease. registry:Host@163,registry:Host@234 74cb5761e354994ad43172ae0f4c4e4c5410a2792492f69d32d100c2dbabed46
@legacy dd7e1dea5a8679407e0e60ca4833e4f768ed3df6209f4029796adfa5df53ee7f internal/activator/haduties.go Service.rememberDutyRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host to record successful local release basis keyed to the acquired host lifetime. Failed marker writes never reach this hook. registry:Host@162,registry:Host@233 80319f17d46f84e3164bb46ff6ca0bd834f624288644c3f1b3a9fa0b789dc616
-@legacy c4d6d29d207ae6dc1a5c39be66fe25bba8d3ae9909d69a2e8b1e8a923d45a5e1 internal/activator/haduties.go Service.restrictDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Pass the route into the chooser and callback; carry a private background context restriction and bind its host lifetime. No new I/O beyond dutyInput. whole:Route@129,whole:Route@358 f97b6c06627dae97df6828ad57330d6e5b919fa999d9df13148cbae92f58d44b
+@legacy f4c08c7005e10fcb9013141f0fc1fa45a1cd4dab42f6b1a997c8cd21a46736ba internal/activator/haduties.go Service.restrictDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Bind background restriction to the host lifetime. Use existing duty state to distinguish known peer suppression from local denial before allowing timer aging; no new I/O beyond dutyInput. whole:Route@130,whole:Route@362 9402653561e1731804358972911dd3990a878a9034b512e13b45b2ac8fba8a9f
@legacy f75c174a45a57feeca885d61031026907fee317ebf2b2dacba6a25202e070187 internal/activator/haduties.go dutyBackend legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Dispatch the existing backend by local route through SplitBackend, for HA classification and self identity. No new I/O. whole:Route@235,whole:Route@240 835097870b1a956888da998aee935491325c48d7847d7bc5ba650a23306e2db2
@legacy 780da2b6b37d2fc6e2baa16c11257cb492226e4e553679ecc244186fb90d70d4 internal/edge/wakeplacement.go Edge.DutySnapshot legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Pass the route to the existing cached home projection; no store reads, network reads or new publication. whole:Route@108 fa66b0bb586cb9a3214d818fbe40181f3ca7d5655f5af4ac259377cf4d5c133d
@legacy e154d74a30627fba72d2c1f0dd79786d939df5bb9d54a7866d799ec855d90465 internal/host/runs.go runsWorker.dutyStillOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route HA/host and existing service classification; after sink construction require an HA route still held awake locally before RunPick. Refusal only. registry:HA@309,registry:Host@287,whole:Route@237 d7b9c563b32e042e798ffbd98633be9a8eb13eaa68b574693be5937b1cd95ded
-@legacy 0d9991b3248e1e05976753ae839c6455b55ed1ccfdf0a9a9580f534bb946de6b internal/host/runs.go runsWorker.pickupOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Move existing pickup body here under WithDuty; recheck held ownership after sink construction and gate detached execution too. Whole-route arguments added; existing request and record validation retained. whole:Route@1180,whole:Route@1927,whole:Route@1989,whole:Route@2050,whole:Route@956 2d17082c44e377da7680f5fa7e1af0fd052dfa3c6bf3f8c50ad71d1086937659
+@legacy 32bf4eac2498036ddb8b662a319b1ea1af72c75509b3c62ae283614b635abdc4 internal/host/runs.go runsWorker.pickupOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Gate pickup and detached exec. When the detached gate refuses before exec, finish with the existing RefusedIncarnation result, close the picked sink and forget the active handle. Existing guarded sink Finish and cleanup paths are reused; no new input or path read. whole:Route@1180,whole:Route@1946,whole:Route@2020,whole:Route@2288,whole:Route@956 8e426a60b8e738d2dec98df9788d37bcaecbc9726c745e22a39e17ddd9abfdee
@legacy 15e8e57aa35412027f3907fd0de751274f9e72641e5c16f6da4b88cb2acf7a37 internal/registry/timers.go Registry.AdvanceDutyTimer legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Update only local recurring timer progress with registration, DueAt and NextAt comparisons. Read timer fields and existing registry sql/remote handles; no last-delivery stamp, once deletion or external path. file:Exec@218,registry:DueAt@416,registry:Host@384,registry:Kind@143,registry:Name@392,registry:NextAt@171,registry:NextAt@425,registry:Registration@400,registry:remote@77,registry:sql@218,whole:remoteClient@79 ce0f893ed21cc2f5df3ca365f9b27d9904b969fd8fff1d68b4cd4f4676d0bb69
@legacy 7c6c9fedebd681f46078f51a51142fb1c5df461465e20fb86abf88bf3a2bb964 internal/schedule/runner.go OldDutyTick legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read timer kind and natural due occurrence; only recurring occurrences at least 15 minutes old qualify. No writes. registry:Kind@82,whole:Timer@71 b7f99aa2e76858e06675d9aa6b9266600423714cfd7585860eeed12021eaa0f0
@legacy 351bcef78f571f8c2b6d857aa635cc7e6806782b7a9741ec83fd10c7696da63f internal/schedule/runner.go Runner.fireOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Existing fire body moved beneath admission; deferred delivery now returns without recording a failure. Same token preparation, parsing, guarded row checks and delivery authority. registry:Host@248,registry:Host@390,registry:Host@696,registry:Host@842,registry:Name@257,registry:Name@399,registry:Spec@153,registry:Spec@265,whole:Route@1010,whole:Route@1207,whole:Route@1509,whole:Route@1572,whole:Route@1776,whole:Route@667,whole:Route@747,whole:Route@773,whole:Route@884,whole:Timer@1014,whole:Timer@113,whole:Timer@1211,whole:Timer@1311,whole:Timer@1513,whole:Timer@1780,whole:Timer@322,whole:Timer@888 6cfedad07127980fe70c6206ec8e2f994c2b6ffc2017b60ddaaeba4faeb0e25f
@@ -35,15 +35,15 @@ internal/host/schedule_wiring.go newScheduleDeps legacy accepted-legacy accepted
internal/activator/haduties.go DutyForTick legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read the observed timer through the shared old-occurrence predicate; once-timers are never aged out. whole:Timer@120 f9a9c2fce154cf37b1d1e5ef03319ad0c4c546ad88a1aa78812b7401428995e5
internal/activator/haduties.go Service.Duty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Pass the local route into dutyInput and the pure chooser. Advisory decision only; no acquire or start. whole:Route@118 15122e8a380cccc304994a0f390ed0de98eb37a765d2362df73a0f6b79dae78e
internal/activator/haduties.go Service.WithDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host for owned-awake checks and pass provisioned managed instances to restricted singleflight wake before producer writes, including cached legacy rows that discover sticky HA at acquire. Other route kinds keep their path; no authority bypass. registry:Host@584,registry:Host@673,whole:Route@143,whole:Route@422,whole:Route@503 69e34dcb9430c114b0765adffc97be60b72ea939c5c38296bffd7a3bec0d804d
-internal/activator/haduties.go Service.allowDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read current lifetime, local state and cached view for each classified lease CAS round; invoke the pure restriction table and persist suppression or an expiry deadline. May refuse, never override ordinary acquire. registry:Host@1203,registry:Host@521,whole:Route@141,whole:Route@940 9e78355eed5edc26cfdbf789bbedc148656b534a36c09e350b5f086fec3e571e
+internal/activator/haduties.go Service.allowDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Recheck lifetime and duty policy on every classified CAS round. Return a non-owner subtype only for a known foreign holder; self expiry and local denial remain deferred. Existing suppression writes and acquire restrictions retained; no read added. registry:Host@1237,registry:Host@555,whole:Route@141,whole:Route@974 2ed5e21384e91dfe599e1267994579859a267c7b9ca3a0da77ce8f93a048a552
internal/activator/haduties.go Service.dutyInput legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read HA classification/lifetime from the existing backend and route host, HA, replica, tunnel, import gate and status; read advisory DutyStore state and cached home projection outside a.mu. No new filesystem or bucket path. registry:HA@244,registry:Host@1079,registry:Host@122,registry:Host@510,registry:Host@576,registry:ImportGate@690,registry:Replica@657,registry:Status@714,registry:Status@733,registry:Tunnel@671,whole:Route@149,whole:Route@216,whole:Route@312,whole:Route@604,whole:Route@885 9cdbbbd19a900153cc5dd6959366c5ec6042816dcb7f97b46d85476823eaf1c5
internal/activator/haduties.go Service.rememberDutyAcquired legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host to clear peer suppression only after ordinary acquire succeeds, including visitor wakes. Local advisory state cannot authorize the lease. registry:Host@163,registry:Host@234 74cb5761e354994ad43172ae0f4c4e4c5410a2792492f69d32d100c2dbabed46
internal/activator/haduties.go Service.rememberDutyRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route host to record successful local release basis keyed to the acquired host lifetime. Failed marker writes never reach this hook. registry:Host@162,registry:Host@233 80319f17d46f84e3164bb46ff6ca0bd834f624288644c3f1b3a9fa0b789dc616
-internal/activator/haduties.go Service.restrictDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Pass the route into the chooser and callback; carry a private background context restriction and bind its host lifetime. No new I/O beyond dutyInput. whole:Route@129,whole:Route@358 f97b6c06627dae97df6828ad57330d6e5b919fa999d9df13148cbae92f58d44b
+internal/activator/haduties.go Service.restrictDuty legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Bind background restriction to the host lifetime. Use existing duty state to distinguish known peer suppression from local denial before allowing timer aging; no new I/O beyond dutyInput. whole:Route@130,whole:Route@362 9402653561e1731804358972911dd3990a878a9034b512e13b45b2ac8fba8a9f
internal/activator/haduties.go dutyBackend legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Dispatch the existing backend by local route through SplitBackend, for HA classification and self identity. No new I/O. whole:Route@235,whole:Route@240 835097870b1a956888da998aee935491325c48d7847d7bc5ba650a23306e2db2
internal/edge/wakeplacement.go Edge.DutySnapshot legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Pass the route to the existing cached home projection; no store reads, network reads or new publication. whole:Route@108 fa66b0bb586cb9a3214d818fbe40181f3ca7d5655f5af4ac259377cf4d5c133d
internal/host/runs.go runsWorker.dutyStillOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read route HA/host and existing service classification; after sink construction require an HA route still held awake locally before RunPick. Refusal only. registry:HA@309,registry:Host@287,whole:Route@237 d7b9c563b32e042e798ffbd98633be9a8eb13eaa68b574693be5937b1cd95ded
-internal/host/runs.go runsWorker.pickupOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Move existing pickup body here under WithDuty; recheck held ownership after sink construction and gate detached execution too. Whole-route arguments added; existing request and record validation retained. whole:Route@1180,whole:Route@1927,whole:Route@1989,whole:Route@2050,whole:Route@956 2d17082c44e377da7680f5fa7e1af0fd052dfa3c6bf3f8c50ad71d1086937659
+internal/host/runs.go runsWorker.pickupOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Gate pickup and detached exec. When the detached gate refuses before exec, finish with the existing RefusedIncarnation result, close the picked sink and forget the active handle. Existing guarded sink Finish and cleanup paths are reused; no new input or path read. whole:Route@1180,whole:Route@1946,whole:Route@2020,whole:Route@2288,whole:Route@956 8e426a60b8e738d2dec98df9788d37bcaecbc9726c745e22a39e17ddd9abfdee
internal/registry/timers.go Registry.AdvanceDutyTimer legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Update only local recurring timer progress with registration, DueAt and NextAt comparisons. Read timer fields and existing registry sql/remote handles; no last-delivery stamp, once deletion or external path. file:Exec@218,registry:DueAt@416,registry:Host@384,registry:Kind@143,registry:Name@392,registry:NextAt@171,registry:NextAt@425,registry:Registration@400,registry:remote@77,registry:sql@218,whole:remoteClient@79 ce0f893ed21cc2f5df3ca365f9b27d9904b969fd8fff1d68b4cd4f4676d0bb69
internal/schedule/runner.go OldDutyTick legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Read timer kind and natural due occurrence; only recurring occurrences at least 15 minutes old qualify. No writes. registry:Kind@82,whole:Timer@71 b7f99aa2e76858e06675d9aa6b9266600423714cfd7585860eeed12021eaa0f0
internal/schedule/runner.go Runner.fireOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1b3b-t;basis=Existing fire body moved beneath admission; deferred delivery now returns without recording a failure. Same token preparation, parsing, guarded row checks and delivery authority. registry:Host@248,registry:Host@390,registry:Host@696,registry:Host@842,registry:Name@257,registry:Name@399,registry:Spec@153,registry:Spec@265,whole:Route@1010,whole:Route@1207,whole:Route@1509,whole:Route@1572,whole:Route@1776,whole:Route@667,whole:Route@747,whole:Route@773,whole:Route@884,whole:Timer@1014,whole:Timer@113,whole:Timer@1211,whole:Timer@1311,whole:Timer@1513,whole:Timer@1780,whole:Timer@322,whole:Timer@888 6cfedad07127980fe70c6206ec8e2f994c2b6ffc2017b60ddaaeba4faeb0e25f
@@ -53,11 +53,11 @@ internal/activator/activator.go Service.wake legacy accepted-legacy accepted-leg
internal/activator/harelease.go Service.releaseHAClean legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: an HA entry's release, in order: host slice read empty through haHostEmpty (else errHostSliceUnproven and nothing written; the same check, moved into that helper by final fix F1), stop and join the files publisher, its final publish (2 min budget), the replica's final sync (Finish, 30 s), the local release record, then the release marker PUT (10 s), clean only when the final publish was complete and the sync and record succeeded; a failed PUT is a persisted lease obligation; +registry:Host, +whole:Route x4;rev3=census-ruling-region-ha-p1b3b-t;basis=Record advisory local-release basis only after ReleaseMarker succeeds. Add a whole-route argument to local duty bookkeeping; release order and lease authority unchanged. registry:Host@1825,whole:Route@102,whole:Route@1098,whole:Route@1236,whole:Route@1734,whole:Route@244 1d28991be7fe53f505751cde1f9822ffee9598d2eea3834eda94f42406315236
internal/activator/hawake.go ExecBackend.acquireClassified legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the acquire's classification: a legacy route (sidecar, hand-added or not an instance) takes lease.Acquire and refuses on an HA-format lock; otherwise isHA (a record read error fails the wake, never falls back to legacy); not HA takes lease.Acquire, and an HA-format lock there marks the host HA for good and continues; HA requires haContained before any lock request, then lease.AcquireHA with the same-box proof; held and refused leases map to errLeaseHeld and errLeaseRefused (leaseError); +registry:Host, +whole:Route x7;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: the HA acquire's Proofs gain OwnerTerminated (b.ownerTerminated(ctx, rt)) beside SameBoxEmpty; one more whole:Route site passes the route to ownerTerminated; nothing new is read; the proof is consulted only by hafresh.DecideAcquire for another box's expired HA lock;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 7, two-box fleet test): the two legacy acquires call b.acquireLegacy(ctx, prefix), which is acquireLegacyLease exactly when ExecBackend.LeaseIdentity is nil and LeaseTTL is 0 (the agent never sets them), otherwise lease.AcquireAs with that identity and TTL. The classification, the HA path and every refusal are unchanged. Read sites unchanged (9). Agent, not root.;rev3=census-ruling-region-ha-p1b3b-t;basis=Select the restriction-only AcquireHAForDuty for background contexts, including sticky HA reclassification; observe successful ordinary acquires to clear stale suppression. Add a whole-route observer argument; no new authority. registry:Host@106,whole:Route@1137,whole:Route@1256,whole:Route@1301,whole:Route@1898,whole:Route@195,whole:Route@1994,whole:Route@533,whole:Route@584,whole:Route@834 8b8632218aa6092a07d95d9eb9b19746693fdfb956363a4eadb64f864bfd4588
internal/host/schedule_wiring.go activatorDeliverer.deliverSelected legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-p1b3b-t;basis=Wrap local delivery in WithDuty so lease loss returns a deferred control result before timer bookkeeping. Add whole-route arguments; no remote forwarding. registry:Host@539,registry:Host@821,registry:Socket@185,registry:Socket@2615,registry:Socket@861,whole:Route@1741,whole:Route@1865,whole:Route@1941,whole:Route@2014,whole:Route@759 afd339dd7acde53dc86f0f55c0a83fa41845bb23825b94ac7fb11ace3330b648
-internal/schedule/runner.go Runner.fire hint E2 accepted-legacy;rev3=census-ruling-moves-offline-fixes;basis=root-route (main: J1) PROPOSED E46: captured claim selection and root journal mutation; root RPC outside service host exclusion; SQL/route data never grants root authority. Executing identity: service controller; root for inventory/retirement callbacks. moves-offline-fixes: with Skip set (only the agent's runner sets it, scheduleSkip), the row is read again before the token and a skipped host gets no token and no record; class and task unchanged;rev3=census-ruling-region-ha-p1b3b-t;basis=Move existing delivery body to fireOwned; call WithDuty before token preparation and conditionally advance old recurring occurrences through one guarded registry method. Fewer direct timer/route reads in this wrapper. registry:Spec@335,whole:Route@125,whole:Route@168,whole:Route@225,whole:Timer@129,whole:Timer@229,whole:Timer@298,whole:Timer@510 25c46087c5c8a2c94c9cfc471250388cf2f5573216b56b78b7549681e0ba497f
-@coverage internal/activator 48d49bb9e0bdd2818a615543a78f596e7eccbfd92ed5c72c11cc363767526261
+internal/schedule/runner.go Runner.fire hint E2 accepted-legacy;rev3=census-ruling-moves-offline-fixes;basis=root-route (main: J1) PROPOSED E46: captured claim selection and root journal mutation; root RPC outside service host exclusion; SQL/route data never grants root authority. Executing identity: service controller; root for inventory/retirement callbacks. moves-offline-fixes: with Skip set (only the agent's runner sets it, scheduleSkip), the row is read again before the token and a skipped host gets no token and no record; class and task unchanged;rev3=census-ruling-region-ha-p1b3b-t;basis=Call WithDuty before token preparation; record non-deferred pre-delivery wake errors through the existing retry and event policy after timerStillDue. Adds spec and whole timer/route reads for record. Advance only known non-owner recurring occurrences through the existing registration/DueAt guard; no second outcome after callback execution. registry:Spec@410,registry:Spec@626,whole:Route@125,whole:Route@200,whole:Route@269,whole:Route@454,whole:Timer@129,whole:Timer@273,whole:Timer@374,whole:Timer@458,whole:Timer@589,whole:Timer@801 7e8eb8e42de11c2c7a6f21d02a424875f74809343673be4e0009624765d63ac2
+@coverage internal/activator 364d577b0dc6d0784248ca7560f92d76bc04e569b64f1661babff1a77fc1485e
@coverage internal/boxchoice 6b3d6aaacf54a2c2705f5c93d7799e0d9790712e165c90ead6de91e845ae8b09
@coverage internal/edge 269c0490df6ee888eee703c1735881c4047f21bf78a104fc76b604313e9ae5a7
-@coverage internal/host 0f63fae6019558fce00632dacc864dd5f9bc3709b47354c0043dccca8eaa3cc0
+@coverage internal/host 88fe36e0d6b2b286d882b98285b245cc5b363741906cb90a4a12ce273f0fb964
@coverage internal/lease 99d42caf6e5253517696871e30beead3c37ad74a3cc61a763ec2e931bd2d8606
@coverage internal/registry d69a90af3d18e665f38f352423e92c1a344d5ec8ab5e7ee1220ea44e84a10058
-@coverage internal/schedule 94e801452a72b586d5b8530bdfd605e510c765d8db567245a97c61b2846bd71a
+@coverage internal/schedule 868ec987f9b3992c1df4f680e71f480edd62ba652718b87e7f2cf75236eacbe2
diff --git a/internal/schedule/haduties_test.go b/internal/schedule/haduties_test.go
index 78833d3b4..d67627cdf 100644
--- a/internal/schedule/haduties_test.go
+++ b/internal/schedule/haduties_test.go
@@ -93,7 +93,7 @@ func TestHADutyRegistrationGuard(t *testing.T) {
func TestHADutyWakeFailureBackoff(t *testing.T) {
reg, r := runnerFixture(t, &fakeDeliverer{})
- now := time.Now().Truncate(time.Second)
+ now := time.Date(2026, time.November, 3, 12, 0, 0, 0, time.UTC)
r.Now = func() time.Time { return now }
row := registry.Timer{Host: "a.bab.oncarlos.com", Name: "tick", Kind: "schedule", Spec: "every 1h", Path: "/job", NextAt: now.Unix(), DueAt: now.Unix()}
if err := reg.UpsertTimer(row); err != nil {