carlos / platform Public

host: arm the nightly restore drill by default (#898)

carlos-hibernate-verify.timer moves from inertUnits to enabledUnits
(member backups slice 2a, D4), so bootstrap and a self-update apply
enable and start it on every box; armedUnits starts it as a .timer.
carlos-restore-verify.timer stays inert until an operator stages
litestream.

A box with nothing to drill runs and exits 0 (Task 5): no
CARLOS_HIBERNATE_BUCKET exits at once; an empty fleet publishes
nothing, or an empty record in place of an old one.

The service's header now names the per-box key control/verify/<ref>.json
and the agent-written inputs it reads: <data>/monitor/self.json and, on
a group box, verify-assign.json.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev b63ba33a6775939ad67b57b69911ce5a44ec1351 parent ddfbd4d
3 files changed, +41 −17
  • internal/host/bootstrap.go +11 −4
  • internal/host/host_test.go +14 −6
  • internal/host/units/carlos-hibernate-verify.service +16 −7

CI failed — run details

Intent

Human

<task-notification> <task-id>a620408b003157c26</task-id> <tool-use-id>toolu_01FLjmkyAnbUeVMyFReNmzUD</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ab362fc0-f177-4a7f-a92e-4a29ea210aad/tasks/a620408b003157c26.output</output-file> <status>completed</status> <summary>Agent "Implement slice 2a Task 5" 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. Both fixes from round 1 are in. **Commits:** `ddfbd4df ops: hibernate-verify publishes on a clock; no_record holds (#898)`, on top of `6de4a16f`. Not pushed. **Fix 1 (publishing on a clock):** a separate ticker now publishes every 10 minutes, whatever the host in progress is doing. It skips a tick when nothing new has finished, and it still merges into the record loaded at run start, on the publisher's own 30-second context. The ticker is stopped and its goroutine has exited before the final publish, so nothing publishes after it. - **New test:** host a finishes at minute 4 and host b blocks. The 10-minute tick still publishes a, so the bucket holds what a crash at that point would leave. After the run ends, a further tick is not taken and no extra publish happens. **Fix 2 (`no_record`):** `dbverify.ReasonNoRecord` holds the streak like `not_reached` and `no_assignment`. It is used only when the record is missing as the test begins. A record deleted mid-test stays `record_changed` and still counts toward the alert. - **Tests:** a Merge test that `no_record` holds the streak, plus both cases over four nights: missing at the start gives streak 0, deleted mid-test gives streak 4. - A retired record also counts as `no_record`, because `provision.GetRecord` reads it as absent. **Tests:** all pass: `go test ./internal/ops -run 'Hibernat|Verify|OldestFirst'` (36 tests) and `./internal/dbverify -run 'Merge|Publish|RemoveHost'`. The new ticker and `no_record` tests ran 3 times under `-race` with no races. Vet, build and the darwin/windows builds are clean. **Concerns:** Task 8 needs copy labels for three reason codes that aren't in Task 0's list: `no_record`, `plan_moved` and `record_unreadable`. The blocked-download test still stubs the whole restore, deferred as you directed. **Report (fix section appended):** `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups-2a/.superpowers/sdd/2026-11-11-member-backups-slice2a/task-5-report.md`</result> <usage><subagent_tokens>256116</subagent_tokens><tool_uses>14</tool_uses><duration_ms>331388</duration_ms></usage> </task-notification>

Attributed to this commit: 24.4 g CO₂e (3,138,800 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on member-backups-2a, 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/bootstrap.go b/internal/host/bootstrap.go
index fc9044183..08ad88e22 100644
--- a/internal/host/bootstrap.go
+++ b/internal/host/bootstrap.go
@@ -156,7 +156,11 @@ const journaldConf = "# Written by carlos bootstrap (discussion #111). Do not ed
// on a marker file surviving a crash. The litestream + restore-verify units install
// everywhere but stay inert until an operator stages /data/litestream.env and
// generates /etc/litestream.yml (`carlos ops litestream`) — a box with no
-// replication bucket is unaffected. carlos-relay.service (relay spec §3) is
+// replication bucket is unaffected. carlos-hibernate-verify.timer, the
+// nightly restore drill of the activator-owned replicas, is armed
+// everywhere (member backups slice 2a, D4): a box with nothing to drill
+// runs and exits 0, publishing at most an empty record in place of an old
+// one. carlos-relay.service (relay spec §3) is
// enabled AND started fleet-wide, unlike the edge: its
// ConditionPathExists=/etc/carlos/relay-masters makes the start a no-op on
// every box the operator has not armed with a region master.
@@ -174,7 +178,10 @@ var enabledUnits = []string{"carlos-edge.service", relayUnitName, "carlos-adopt.
"carlos-instance-control.socket",
// The ingress drain (W6 spec §5.2). Enabled, never started here: its
// BindsTo= would start the edge with it. The edge starts it (Upholds=).
- ingressDrainUnit}
+ ingressDrainUnit,
+ // The nightly restore drill (member backups slice 2a, D4). The timer,
+ // not the oneshot: armedUnits starts it, and it starts the service.
+ "carlos-hibernate-verify.timer"}
// ingressDrainUnit runs the ingress drain in its stop, before every tenant
// unit's stop and the edge's (W6 spec §5.2).
@@ -182,8 +189,8 @@ const ingressDrainUnit = "carlos-edge-drain.service"
// inertUnits are installed everywhere and deliberately never armed by
// bootstrap or by a self-update apply: restore-verify until an operator
-// stages litestream, hibernate-verify by long-standing choice.
-var inertUnits = []string{"carlos-restore-verify.timer", "carlos-hibernate-verify.timer"}
+// stages litestream.
+var inertUnits = []string{"carlos-restore-verify.timer"}
// bootstrapPlan is what `bootstrap -root <dir> -plan-json` prints: the
// arming list of THIS binary, so a self-update apply arms what the new
diff --git a/internal/host/host_test.go b/internal/host/host_test.go
index 282f06716..57ab8fceb 100644
--- a/internal/host/host_test.go
+++ b/internal/host/host_test.go
@@ -1332,7 +1332,10 @@ func TestBootstrapPlanJSONNamesWhatALiveRunArms(t *testing.T) {
p := currentBootstrapPlan()
want := map[string]bool{"carlos-edge.service": true, "carlos-adopt.timer": true, "carlos-adopt.path": true,
"carlos-stage.path": true, "carlos-restart.path": true, "carlos-system-update.path": true, "carlos-system-recover.service": true,
- "data-instances.mount": true, "run-carlos-instances.mount": true, "run-carlos-logs.mount": true}
+ "data-instances.mount": true, "run-carlos-instances.mount": true, "run-carlos-logs.mount": true,
+ // The nightly restore drill is armed by default (member backups
+ // slice 2a, D4): a box with nothing to drill runs and exits 0.
+ "carlos-hibernate-verify.timer": true}
got := map[string]bool{}
for _, u := range p.Enabled {
got[u] = true
@@ -1345,12 +1348,17 @@ func TestBootstrapPlanJSONNamesWhatALiveRunArms(t *testing.T) {
if got["carlos-system-update.service"] {
t.Error("the path-triggered oneshot must not be enabled: it is started by its .path")
}
- inert := map[string]bool{}
- for _, u := range p.Inert {
- inert[u] = true
+ // Only restore-verify stays inert: it waits on an operator staging
+ // litestream.
+ if !slices.Equal(p.Inert, []string{"carlos-restore-verify.timer"}) {
+ t.Errorf("inert = %v, want only carlos-restore-verify.timer", p.Inert)
}
- if !inert["carlos-restore-verify.timer"] || !inert["carlos-hibernate-verify.timer"] {
- t.Errorf("inert = %v", p.Inert)
+ // Enabling a timer arms it at the next boot; a live run must start it.
+ if !slices.Contains(p.Armed, "carlos-hibernate-verify.timer") {
+ t.Errorf("armed = %v, lacks carlos-hibernate-verify.timer", p.Armed)
+ }
+ if slices.Contains(p.Enabled, "carlos-hibernate-verify.service") {
+ t.Error("the drill's oneshot must not be enabled: its timer starts it")
}
// And systemctlPlan starts no service but the relay, whatever is
// enabled — the relay is safe because its ConditionPathExists gates it
diff --git a/internal/host/units/carlos-hibernate-verify.service b/internal/host/units/carlos-hibernate-verify.service
index 3d0880649..13cd5a7a1 100644
--- a/internal/host/units/carlos-hibernate-verify.service
+++ b/internal/host/units/carlos-hibernate-verify.service
@@ -7,14 +7,23 @@
# drilled — the first thing to learn whether a hibernating tenant's replica
# restores clean was a real user's wake.
#
-# This restores each of those replicas into a private tmp, integrity-checks
-# it, and publishes a per-host verdict to the deployment bucket
-# (control/restore-verify.json) so the result is readable WITHOUT a session on
-# this box. A damaged replica leaves the unit 'failed'; a replica the pass
-# could not reach is recorded 'unverified' and does not fail the run.
+# This restores each of those replicas into an on-disk scratch dir,
+# integrity-checks it, and publishes a per-host verdict to this box's own
+# record in the deployment bucket (control/verify/<ref>.json) so the result
+# is readable WITHOUT a session on this box. A damaged replica leaves the
+# unit 'failed'; a replica the pass could not reach is recorded 'unverified'
+# and does not fail the run.
#
-# Inert until /etc/carlos/host.env carries CARLOS_HIBERNATE_BUCKET — a box
-# with no hibernating instances prints that and exits 0.
+# <ref> is this box's reference, which only the agent knows: the drill reads
+# it from <data>/monitor/self.json, which the agent rewrites every few
+# minutes, and refuses to run on a stale or missing one. On a group box it
+# also reads <data>/monitor/verify-assign.json and drills only the HA hosts
+# assigned to this box.
+#
+# Armed on every box by bootstrap (the timer). A box whose host.env carries
+# no CARLOS_HIBERNATE_BUCKET exits 0 at once; one with no hibernating
+# instances to drill exits 0 too, publishing nothing, or an empty record in
+# place of one it published before.
[Unit]
Description=carlos hibernate-verify (restore-drill the activator-owned replicas)
After=network-online.target carlos-edge.service