fix: daemon resource thresholds incompatible with macOS#1078
Open
ezhilvendhan wants to merge 1 commit intoruvnet:mainfrom
Open
fix: daemon resource thresholds incompatible with macOS#1078ezhilvendhan wants to merge 1 commit intoruvnet:mainfrom
ezhilvendhan wants to merge 1 commit intoruvnet:mainfrom
Conversation
The daemon canRunWorker() resource check has two threshold defaults that prevent workers from ever executing on macOS: 1. maxCpuLoad: 2.0 — os.loadavg() returns system-wide load (not per-core), so an 8-core Mac under normal workload reports ~8-16, far exceeding 2.0. Changed to 0 (dynamic) with core-aware threshold of cpus().length * 3. 2. minFreeMemoryPercent: 20 — macOS os.freemem() only reports truly unused RAM (not reclaimable cache), typically showing 1-5% on a Mac even with plenty available. Changed to 1%. Also removed hardcoded --quiet flag from background daemon spawn that suppressed all worker event logging to the log file. Fixes ruvnet#1077
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.
Summary
Fixes #1077 — Daemon workers never execute on macOS due to unrealistic resource thresholds in
canRunWorker().Three issues fixed:
maxCpuLoad: 2.0too low for multi-core systems —os.loadavg()returns system-wide load (not per-core). An 8-core Mac under normal workload reports ~8-16, far exceeding 2.0. Changed to dynamic core-aware threshold (os.cpus().length * 3).minFreeMemoryPercent: 20incompatible with macOS —os.freemem()on macOS only reports truly unused RAM, excluding reclaimable cached/purgeable memory. A typical Mac shows 1-5% "free" even with plenty available. Changed default to 1%.--quietflag hardcoded in background daemon spawn —daemon.tsline 217 hardcoded--quiet, suppressing all worker event logging to the daemon log file, making diagnosis impossible.Changes
worker-daemon.ts: ChangedmaxCpuLoaddefault from2.0to0(signals dynamic threshold). UpdatedcanRunWorker()to compute core-aware threshold when config is 0.worker-daemon.ts: ChangedminFreeMemoryPercentdefault from20to1.daemon.ts: Removed hardcoded--quietflag from background process spawn.Test plan
mapworker executes immediately on macOS (was permanently deferred before)auditworker starts after 120s offsetcodebase-map.jsonmetrics file is writtenrunCount > 0Context
The combination of low thresholds + the deadlock in
processPendingWorkers()(addressed separately in #1052) means zero workers ever execute on macOS. This PR fixes the root cause while #1052 fixes the amplification.