fix(ai_api): the agent surface reported an uptime of zero and a load average
Three fabrications on the tool surface an LLM reads, found by triaging the 884 `unwrap_or` fallback sites by blast radius rather than by count. A zero in a TUI gauge is cosmetic; a zero handed to an agent is a premise it reasons from. `get_system_info` returned `uptime_seconds: 0` and `boot_time: 0`, both marked "Would need platform-specific impl". The comment was stale: `stats::read_uptime` has had one on Linux, Windows and macOS the whole time. What was missing was a way to call it without constructing a `Simon` and collecting board information the caller does not want, so this adds a free `stats::uptime()`. Boot time is derived from it, and the two are present or absent together — deriving a timestamp from a clock that failed would be worse than reporting neither. `get_cpu_status` on macOS shelled out to `sysctl vm.loadavg` and published `load / ncpu * 100` as `usage_percent`. Load average is not utilization: it counts runnable *and* uninterruptible tasks, so a machine blocked on I/O reads high while its cores sit idle, and a saturated one with no queue reads low. It fell back to `0.0` when the sysctl failed — an idle machine — and named an unreadable CPU literally `"CPU"`. `platform::macos::read_cpu_stats` has existed since 5.2.0, wired only into the ontology. That makes four consumers found fabricating beside a real reader they never adopted, and the first that was CPU rather than memory. The note in HANDOFF now says why grepping for the reader's name does not find them: the ones still fabricating do not mention it. `hostname`, `kernel_version` and the CPU `model` used `unwrap_or_default()`, so a value that could not be read arrived as `""`. Those four fields are now `Option` on `SystemInfoDetails` (a breaking change to the type; one construction site). Verified on this host: `uptime_seconds` 137856 (38.3h) and a derived `boot_time` landing within two seconds of the kernel-start event in the System log — corroboration from a source the derivation does not touch. `model` reads "AMD Ryzen 9 9900X 12-Core Processor". fmt, clippy, both cross-target checks and 56 conformance tests pass; the macOS arm is type-checked against the real reader by the darwin target. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A
Adam Erickson committed
8961a1cd7850a5ebbeef85a2d8be7105fa896b48
Parent: 2f7be76