fix(dashboard): count the built-in miner in the mode-aware RAM floor - #825
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_mbheadroom 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.enabledis 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 thelow_ramalert edge — route through the one sharedlow_ram_floor_gb, and theLOW_RAM_GBflat 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 --testfrontend — 296 passed (unchanged, as expected).make lintgreen;make test-patch-coveragevs this base — 100% (7/7 lines).🤖 Generated with Claude Code