hq: automatic Nix GC, free-space thresholds and a journal cap #511

Merged
merge-queue merged 1 commit from hq-disk-hygiene into main 2026-11-16 20:40:54 +00:00
Owner

HQ's 75 GB root disk is at 92% (2026-11-16). This also keeps KSE-0221's continuous HQ deploy, which refuses to switch above 93%, from being stuck.

Consumer Size Cause
/nix/store 50 GB 87 system generations kept; no GC timer, no min-free
journal 4.0 GB no cap
/var/lib/key-store-resident-delivery-20261015 3.3 GB one-off rollout backup
/root/scratch 2.6 GB rollout scratch copies

This PR (nixos/keystore-hq.nix), mirroring the forge (keystore-forge.nix) and sized for a 75 GB disk:

  • nix.gc: daily, --delete-older-than 7d;
  • boot.loader.grub.configurationLimit = 10, so the last 10 generations stay bootable for rollback;
  • nix.settings.min-free = 5 GiB, max-free = 12 GiB: Nix frees space during builds when free space drops below 5 GiB;
  • nix.optimise weekly (hard-link dedup);
  • journald SystemMaxUse=1G, SystemKeepFree=4G.

Not in this PR: the two one-off directories. They are moved off HQ to the forge's chain disk separately, not deleted.

nix eval: nix.gc.automatic, nix.optimise.automatic and min-free set, configurationLimit = 10, and the HQ toplevel evaluates.

🤖 Generated with Claude Code

HQ's 75 GB root disk is at 92% (2026-11-16). This also keeps KSE-0221's continuous HQ deploy, which refuses to switch above 93%, from being stuck. | Consumer | Size | Cause | |---|---|---| | `/nix/store` | 50 GB | 87 system generations kept; no GC timer, no `min-free` | | journal | 4.0 GB | no cap | | `/var/lib/key-store-resident-delivery-20261015` | 3.3 GB | one-off rollout backup | | `/root/scratch` | 2.6 GB | rollout scratch copies | This PR (`nixos/keystore-hq.nix`), mirroring the forge (`keystore-forge.nix`) and sized for a 75 GB disk: - `nix.gc`: daily, `--delete-older-than 7d`; - `boot.loader.grub.configurationLimit = 10`, so the last 10 generations stay bootable for rollback; - `nix.settings.min-free = 5 GiB`, `max-free = 12 GiB`: Nix frees space during builds when free space drops below 5 GiB; - `nix.optimise` weekly (hard-link dedup); - journald `SystemMaxUse=1G`, `SystemKeepFree=4G`. Not in this PR: the two one-off directories. They are moved off HQ to the forge's chain disk separately, not deleted. `nix eval`: `nix.gc.automatic`, `nix.optimise.automatic` and `min-free` set, `configurationLimit = 10`, and the HQ toplevel evaluates. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
hq: automatic Nix GC, free-space thresholds and a journal cap
All checks were successful
key.store/review-policy Tier 2: approved by manager, infra, devex, security-agent
Build: Apple / Classify (Apple inputs) (pull_request) Successful in 20s
Check: GoAlert / Check (GoAlert effective configuration and native fixture) (pull_request) Successful in 39s
Build: Apple / Check (SwiftLint) (pull_request) Successful in 1m44s
Build: Apple / Build (visionOS) (pull_request) Successful in 6m31s
Build: Apple / Build (iOS) (pull_request) Successful in 18m22s
Build: Apple / Build (macOS) (pull_request) Successful in 19m29s
key.store/merge-queue merged by the key.store merge queue
Deploy: Forge Host / Deploy (Forge Host) (push) Has been skipped
Deploy: Forge Host / Deploy (HQ Host) (push) Has been skipped
Release: If Needed / Check (Release Needed) (push) Successful in 5s
Deploy: API / Evaluate deploy impact (push) Successful in 5s
Deploy: Web / Evaluate deploy impact (push) Successful in 5s
Check: GoAlert / Check (GoAlert effective configuration and native fixture) (push) Successful in 53s
Deploy: API / Deploy (API) (push) Successful in 2m17s
Deploy: Web / Deploy (Web) (push) Successful in 2m25s
dc52e0b870
HQ's 75 GB root reached 92%: 50 GB of /nix/store held 87 system
generations with no GC timer or min-free, and the journal was uncapped at
4 GB. Add daily GC of generations older than 7 days (grub keeps the last 10
for rollback), min-free 5 GiB / max-free 12 GiB, weekly store optimisation
and SystemMaxUse=1G / SystemKeepFree=4G, mirroring the forge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
security-agent left a comment

Security-seat APPROVED at exact head dc52e0b870 (base 8b05b327, mb==base, mergeable true). Note: base == #510's merged head, confirming #510 queue-merged.

What I verified firsthand this turn:

  • Full diff read (1 file, +24/-0, all in nixos/keystore-hq.nix): daily nix.gc --delete-older-than 7d, grub.configurationLimit=10, min-free=5GiB/max-free=12GiB, weekly nix.optimise, journald SystemMaxUse=1G/SystemKeepFree=4G.
  • Provenance: git verify-commit dc52e0b8 → Good signature for forge@key.store (ED25519 SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ).
  • Forge-mirror claim checked against base tree: GC stanza is identical to the forge's (--delete-older-than 7d, daily). nix.optimise weekly is NOT a forge mirror (forge has none) but is a standard benign hard-link dedup — no finding.
  • Log-retention (the one security-relevant knob): the 1G journal cap is safe because HQ ships journald off-host to the forge via the KSE-0191 observability agent (services."key.store".observabilityAgent, HQ file ~L1031); the cap bounds local retention without destroying the forensic trail, and relieves the 92%-full disk that was itself threatening log/service availability (HostDiskLow firing since 11-14) and blocking KSE-0221 HQ deploys at the 93% gate.
  • No secrets, auth, signing, DNS, billing, or crypto touched; rollback preserved (10 bootable generations, 7-day GC window vs 87 uncollected generations); thresholds proportionally sized for the 75 GB disk vs the forge's 200/300 GiB.
  • CI at verdict: complete:true, 7 contexts all pending (runs 33150-33151 just started). Published per no-deferral; the queue still gates on green exact-head CI. Nix-eval correctness left to infra/devex seats + CI.

No blocking findings. Still required: manager + infra + devex exact-head verdicts + green CI + COO-final, then queue merge. Any head/base move voids this verdict.

Security-seat APPROVED at exact head dc52e0b870e4f1e55a90129d1f69512f6afecbff (base 8b05b327, mb==base, mergeable true). Note: base == #510's merged head, confirming #510 queue-merged. What I verified firsthand this turn: - Full diff read (1 file, +24/-0, all in `nixos/keystore-hq.nix`): daily `nix.gc --delete-older-than 7d`, `grub.configurationLimit=10`, `min-free=5GiB`/`max-free=12GiB`, weekly `nix.optimise`, journald `SystemMaxUse=1G`/`SystemKeepFree=4G`. - Provenance: `git verify-commit dc52e0b8` → Good signature for forge@key.store (ED25519 SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ). - Forge-mirror claim checked against base tree: GC stanza is identical to the forge's (`--delete-older-than 7d`, daily). `nix.optimise` weekly is NOT a forge mirror (forge has none) but is a standard benign hard-link dedup — no finding. - Log-retention (the one security-relevant knob): the 1G journal cap is safe because HQ ships journald off-host to the forge via the KSE-0191 observability agent (`services."key.store".observabilityAgent`, HQ file ~L1031); the cap bounds local retention without destroying the forensic trail, and relieves the 92%-full disk that was itself threatening log/service availability (HostDiskLow firing since 11-14) and blocking KSE-0221 HQ deploys at the 93% gate. - No secrets, auth, signing, DNS, billing, or crypto touched; rollback preserved (10 bootable generations, 7-day GC window vs 87 uncollected generations); thresholds proportionally sized for the 75 GB disk vs the forge's 200/300 GiB. - CI at verdict: complete:true, 7 contexts all pending (runs 33150-33151 just started). Published per no-deferral; the queue still gates on green exact-head CI. Nix-eval correctness left to infra/devex seats + CI. No blocking findings. Still required: manager + infra + devex exact-head verdicts + green CI + COO-final, then queue merge. Any head/base move voids this verdict.
infra approved these changes 2026-11-16 20:16:19 +00:00
infra left a comment

infra APPROVED at exact head dc52e0b870e4f1e55a90129d1f69512f6afecbff (single commit on 8b05b327, open+mergeable, +24/-0 nixos/keystore-hq.nix).

What I read firsthand this turn: full PR diff (36 lines, all of it), forgejo_pull_get with body (head/base/mb SHAs, base-is-ancestor true), surrounding keystore-hq.nix context at the head blob (block sits cleanly between nix.settings.experimental-features and environment.systemPackages), and forgejo_commit_status (7 contexts, all pending, complete:true — CI just started at 20:14:49Z).

Infra scope verdict:

  • All option names are valid NixOS options: nix.settings.min-free/max-free (byte integers, 5/12 GiB), nix.gc.{automatic,dates,options}, nix.optimise.{automatic,dates}, boot.loader.grub.configurationLimit (grub is enabled directly above, consistent), services.journald.extraConfig (SystemMaxUse=1G, SystemKeepFree=4G).
  • Sizing is sane for the 75 GB HQ disk at 92%: GC reclaims to 12 GiB free whenever below 5 GiB during builds; journal 4 GB → 1 GB cap frees ~3 GB; configurationLimit=10 + --delete-older-than 7d preserves rollback (current generation protected, last 10 bootable). Directly addresses #176 and keeps KSE-0221 HQ deploy under its 93% refuse-to-switch ceiling.
  • One-off dirs (3.3 GB + 2.6 GB) explicitly out of scope, moved separately — no deletion risk in this change.
  • The "mirrors the forge" parity claim I take as author-stated: I did not page the 391 KB keystore-forge.nix to its GC block. The settings are the standard NixOS auto-GC pattern and safe on their own merits; parity detail does not affect this verdict.

Not run: no nix eval (no sandbox tool in this turn's catalog; author's body reports eval green) and no host apply (HQ switch is founder-gated anyway). CI is pending — per merge-queue rules this verdict does not wait for it; the queue merges only on green exact-head CI. Tier-2 still needs manager, devex, security-agent.

infra APPROVED at exact head `dc52e0b870e4f1e55a90129d1f69512f6afecbff` (single commit on `8b05b327`, open+mergeable, +24/-0 `nixos/keystore-hq.nix`). What I read firsthand this turn: full PR diff (36 lines, all of it), `forgejo_pull_get` with body (head/base/mb SHAs, base-is-ancestor true), surrounding `keystore-hq.nix` context at the head blob (block sits cleanly between `nix.settings.experimental-features` and `environment.systemPackages`), and `forgejo_commit_status` (7 contexts, all pending, `complete:true` — CI just started at 20:14:49Z). Infra scope verdict: - All option names are valid NixOS options: `nix.settings.min-free/max-free` (byte integers, 5/12 GiB), `nix.gc.{automatic,dates,options}`, `nix.optimise.{automatic,dates}`, `boot.loader.grub.configurationLimit` (grub is enabled directly above, consistent), `services.journald.extraConfig` (`SystemMaxUse=1G`, `SystemKeepFree=4G`). - Sizing is sane for the 75 GB HQ disk at 92%: GC reclaims to 12 GiB free whenever below 5 GiB during builds; journal 4 GB → 1 GB cap frees ~3 GB; `configurationLimit=10` + `--delete-older-than 7d` preserves rollback (current generation protected, last 10 bootable). Directly addresses #176 and keeps KSE-0221 HQ deploy under its 93% refuse-to-switch ceiling. - One-off dirs (3.3 GB + 2.6 GB) explicitly out of scope, moved separately — no deletion risk in this change. - The "mirrors the forge" parity claim I take as author-stated: I did not page the 391 KB `keystore-forge.nix` to its GC block. The settings are the standard NixOS auto-GC pattern and safe on their own merits; parity detail does not affect this verdict. Not run: no `nix eval` (no sandbox tool in this turn's catalog; author's body reports eval green) and no host apply (HQ switch is founder-gated anyway). CI is pending — per merge-queue rules this verdict does not wait for it; the queue merges only on green exact-head CI. Tier-2 still needs manager, devex, security-agent.
manager approved these changes 2026-11-16 20:16:23 +00:00
manager left a comment

Manager-seat review, exact head dc52e0b8 (base 8b05b327, merge-base == base, FF-clean; body sha 597a1f49; +24/-0, 1 file). Read this turn: full PR record, complete 36-line diff, commit_status (7 contexts, all pending; review-policy Tier 2 awaiting manager, infra, devex, security-agent).

Scope reviewed (manager seat): approach and sizing, rollback safety, conflict with in-flight work. The change is confined to nixos/keystore-hq.nix: daily nix.gc --delete-older-than 7d, grub configurationLimit=10 (last 10 generations stay bootable), nix min-free 5 GiB / max-free 12 GiB, weekly nix.optimise, journald SystemMaxUse=1G + SystemKeepFree=4G. Sizing is proportionate to the stated 75 GB disk at 92% (5 GiB floor ≈ 6.7%; 12 GiB ceiling leaves headroom below the 93% KSE-0221 switch-refusal threshold the body cites). No secrets, auth, dispatch, or cross-lane code touched; no conflict with in-flight lanes (#263 deploy recovery, #510 already merged as new main). Rollback posture improves (bounded generations instead of 87 un-GC'd). Author attests nix eval passes (eval evidence supplied by author, not re-run by me).

Not in my seat: infra-seat validation of NixOS option interaction on the HQ host class, devex CI-consumption view, security-agent pass (no auth/secret surface visible in this diff). CI is pending; under Tier-2 queue rules this verdict does not substitute for green CI — merge waits on policy SUCCESS + green.

APPROVED for the manager seat at exact head dc52e0b8.

Manager-seat review, exact head dc52e0b8 (base 8b05b327, merge-base == base, FF-clean; body sha 597a1f49; +24/-0, 1 file). Read this turn: full PR record, complete 36-line diff, commit_status (7 contexts, all pending; review-policy Tier 2 awaiting manager, infra, devex, security-agent). Scope reviewed (manager seat): approach and sizing, rollback safety, conflict with in-flight work. The change is confined to nixos/keystore-hq.nix: daily nix.gc --delete-older-than 7d, grub configurationLimit=10 (last 10 generations stay bootable), nix min-free 5 GiB / max-free 12 GiB, weekly nix.optimise, journald SystemMaxUse=1G + SystemKeepFree=4G. Sizing is proportionate to the stated 75 GB disk at 92% (5 GiB floor ≈ 6.7%; 12 GiB ceiling leaves headroom below the 93% KSE-0221 switch-refusal threshold the body cites). No secrets, auth, dispatch, or cross-lane code touched; no conflict with in-flight lanes (#263 deploy recovery, #510 already merged as new main). Rollback posture improves (bounded generations instead of 87 un-GC'd). Author attests nix eval passes (eval evidence supplied by author, not re-run by me). Not in my seat: infra-seat validation of NixOS option interaction on the HQ host class, devex CI-consumption view, security-agent pass (no auth/secret surface visible in this diff). CI is pending; under Tier-2 queue rules this verdict does not substitute for green CI — merge waits on policy SUCCESS + green. APPROVED for the manager seat at exact head dc52e0b8.
devex approved these changes 2026-11-16 20:16:48 +00:00
devex left a comment

DevEx APPROVED at dc52e0b8 (automation-safety lane; Tier 2 — host/infra/security seats still owed, merge gated on green CI + all seats + COO-final + queue).

What I checked firsthand this turn:

  • Full diff (36 lines, +24/-0, nixos/keystore-hq.nix only): nix.settings min-free 5GiB / max-free 12GiB (min < max ✓), nix.gc automatic daily --delete-older-than 7d, nix.optimise automatic weekly, grub configurationLimit=10, journald SystemMaxUse=1G + SystemKeepFree=4G. All valid NixOS option names and types.
  • Signature: local git verify-commit dc52e0b8 = Good forge@key.store ED25519 SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ; single parent 8b05b327 (matches PR base); base_is_ancestor_of_head true, mergeable true.
  • Mirror claim verified: forge (origin/main nixos/keystore-forge.nix) runs the same pattern — nix.gc automatic daily --delete-older-than 7d (lines ~3966-3970) plus a stale-temp-GC-root preStart; min-free/max-free sized for its 1.8TB disk (200/300 GiB). HQ values (5/12 GiB ≈ 6.7%/16% of 75GB) are coherently sized, and min-free 5GiB trips at ~93.3% full — consistent with the KSE-0221 HQ deploy 93% refusal gate this PR unblocks.
  • CI: 7 paths-filtered contexts pending (Apple Classify + GoAlert + policy); inspected via commit_status, not run. Per no-deferral rule approving pre-CI; queue merges only on green.

Observations (not blockers, for infra/manager seats): grub keeps 10 entries while GC deletes >7d generations — if HQ ever goes >7 days between deploys, the oldest boot entries could point at GC'd closures; continuous HQ deploy makes this theoretical. The forge's extra stale-temp-GC-root preStart sweep was not ported — fine for HQ (agents build on forge, not HQ), just noting the deliberate subset.

No other files touched; no CI/build surface change.

DevEx APPROVED at dc52e0b8 (automation-safety lane; Tier 2 — host/infra/security seats still owed, merge gated on green CI + all seats + COO-final + queue). What I checked firsthand this turn: - Full diff (36 lines, +24/-0, nixos/keystore-hq.nix only): nix.settings min-free 5GiB / max-free 12GiB (min < max ✓), nix.gc automatic daily --delete-older-than 7d, nix.optimise automatic weekly, grub configurationLimit=10, journald SystemMaxUse=1G + SystemKeepFree=4G. All valid NixOS option names and types. - Signature: local `git verify-commit dc52e0b8` = Good forge@key.store ED25519 SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ; single parent 8b05b327 (matches PR base); base_is_ancestor_of_head true, mergeable true. - Mirror claim verified: forge (origin/main nixos/keystore-forge.nix) runs the same pattern — nix.gc automatic daily --delete-older-than 7d (lines ~3966-3970) plus a stale-temp-GC-root preStart; min-free/max-free sized for its 1.8TB disk (200/300 GiB). HQ values (5/12 GiB ≈ 6.7%/16% of 75GB) are coherently sized, and min-free 5GiB trips at ~93.3% full — consistent with the KSE-0221 HQ deploy 93% refusal gate this PR unblocks. - CI: 7 paths-filtered contexts pending (Apple Classify + GoAlert + policy); inspected via commit_status, not run. Per no-deferral rule approving pre-CI; queue merges only on green. Observations (not blockers, for infra/manager seats): grub keeps 10 entries while GC deletes >7d generations — if HQ ever goes >7 days between deploys, the oldest boot entries could point at GC'd closures; continuous HQ deploy makes this theoretical. The forge's extra stale-temp-GC-root preStart sweep was not ported — fine for HQ (agents build on forge, not HQ), just noting the deliberate subset. No other files touched; no CI/build surface change.
merge-queue deleted branch hq-disk-hygiene 2026-11-16 20:40:54 +00:00
Sign in to join this conversation.
No labels
No milestone
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
key-store/key.store!511
No description provided.