Skip to content

fix(dashboard): count the built-in miner in the mode-aware RAM floor - #825

Merged
VijitSingh97 merged 1 commit into
feat/phase2-bakery-imagefrom
fix/820-ram-floor-miner
Aug 1, 2026
Merged

fix(dashboard): count the built-in miner in the mode-aware RAM floor#825
VijitSingh97 merged 1 commit into
feat/phase2-bakery-imagefrom
fix/820-ram-floor-miner

Conversation

@VijitSingh97

Copy link
Copy Markdown
Collaborator

Closes #820 — the deferred follow-up from #812's review: the mode-aware RAM floor (3 GB base / +5 monero local / +6 tari local) predates the Both role and ignored the built-in miner's share.

The increment: 3 GB, and why

From the #797 hugepage follow-up's bench measurements (smaps, both sides holding pages concurrently): the miner's RandomX dataset is 3 GB outright as 3×1 GB pages (the unfragmented-pool case), or ~1168 × 2 MB ≈ 2.3 GB plus per-thread scratchpads and process overhead as 2 MB pages. 3 GB covers the reservation either way.

Deliberately not the 6 GB hugepages_reserve_extra_mb headroom render writes into the miner's config — that is pithead's own hugepage budget (PITHEAD_HUGEPAGES × 2 MB), which the existing container floors already represent. Adding it here would count p2pool's dataset twice. The honest increment is the miner's own footprint only.

The Both-role risk case now reads honestly: both local nodes + miner ⇒ floor 3+5+6+3 = 17, so a 16 GB box wears the warning — exactly the OOM edge #812's adversarial pass flagged. The bench shape (16 GB, remote Tari) stays clear at 3+5+3 = 11.

How the flag reaches the container

No env plumb: local_miner.enabled is a plain boolean, so the dashboard reads it live off the read-only masked-config mount it already holds (the same file the worker descriptors and energy block come from, present in both the compose and quadlet renders). Read per call, so a dashboard toggle moves the floor without a container restart; a missing/unreadable file reads false (DIY stacks without the mount never run the built-in miner). Both floor consumers — the top-bar Low RAM badge and the low_ram alert edge — route through the one shared low_ram_floor_gb, and the LOW_RAM_GB flat pin still wins.

The live pressure badge is untouched by design: it keys on MemAvailable, which already sees the miner's real usage. Badge text stays server-authored through the generic frontend component, so no frontend expectations move.

Tests

  • make test-dashboard — 1711 passed, coverage 96.59%. New: loader true/degraded-shapes, floor arithmetic (17 / 6 / 14), env-pin precedence, and the 15.6 GB Both-role badge flip.
  • node --test frontend — 296 passed (unchanged, as expected).
  • make lint green; make test-patch-coverage vs this base — 100% (7/7 lines).

🤖 Generated with Claude Code

The floor (3 base / +5 monero local / +6 tari local) predates the Both
role: with local_miner.enabled the miner holds its own RandomX dataset
alongside the stack's — 3 GB outright as 3x1 GB pages, ~2.4 GB plus
scratchpads as 2 MB pages (bench-measured via smaps) — so a 16 GB box
running both local nodes plus the miner sat under the floor's promise.

The floor now adds 3 GB when local_miner.enabled, read live off the
masked-config mount the dashboard already holds (no env plumb; a
dashboard toggle moves the floor without a restart). Deliberately NOT
the 6 GB headroom the miner's rendered config declares — that is the
stack's own hugepage budget, which the container floors already count;
adding it would count p2pool's dataset twice. Both floor consumers (the
top-bar badge and the low_ram alert edge) route through the one shared
function, and the LOW_RAM_GB flat pin still wins.

Closes #820

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@VijitSingh97
VijitSingh97 merged commit 38c0560 into feat/phase2-bakery-image Aug 1, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant