Skip to content

feat(ui): refresh machine stats every minute (OH-59) - #34

Merged
andorcassian merged 1 commit into
devfrom
feature/OH-59-metrics-refresh-1min
Nov 9, 2026
Merged

andorcassian merged 1 commit into
devfrom
feature/OH-59-metrics-refresh-1min

Conversation

@andorcassian

@andorcassian andorcassian commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

What changes

Machine stats in the sidebar now refresh every minute instead of every 3 minutes, as requested.

  • MACHINE_METRICS_REFRESH_MS in @happier-dev/protocol goes from 180 000 to 60 000 ms. That one constant drives the poll interval, the row's "Previous reading · stale" threshold and the saved-reading freshness, so all three change together.
  • The sidebar line now reads "Refreshes every minute while visible." in all 12 locales.
  • Polling still stops when the window or section is hidden, and a reconnecting or foregrounded host is still read immediately.

Validation

  • RED → GREEN: the store test (machineMetricsStore.test.ts) and the hook test (useMachineMetrics.test.ts) now pin a 60-second cadence. Both failed on the 180-second constant with no read at 60 s, then passed. Machine-metrics owner and locale tests: 38 passed.

  • Chrome, machines.monitoring.oh59.spec.ts (whole file): 4/4 pass in 5.2 min, down from about 6 at the old interval. The cadence test now asserts from request timestamps instead of exact counts, because a one-minute cadence makes counts depend on timing:

    • reads come 55–75 s apart before the disconnect;
    • reconnecting triggers a prompt read;
    • navigation and collapsing the section add no reads.

    Measured gaps between requests to the real host: 59.1 s, plus 120.1 s across the deliberate disconnect.

  • Typechecks pass for UI, tests and protocol.

  • Hosted CI run 42636162230: attempt 1 failed only in newSession.resumeId.browseFill.spec.ts, a /new navigation timeout in a spec that doesn't touch machine metrics. The same spec flaked the same way on PR fix(ui): tell users how to get host metrics on unsupported machines (OH-59) #17 and passed on PR feat(ui): read host metrics from released CLIs through the machine shell (OH-59) #33 and on dev. The failed jobs were rerun once, and attempt 2 passed.

  • Not run: full suites (CI owns them) and native app QA.

Scope and deferrals

  • Cost: each visible host is read three times as often. A host on the fork CLI pays a 1 s CPU sample per read. A released-CLI host runs the fixed shell read: about 2 s of top on macOS, or a PowerShell start and about 45 KB of GPU counters on Windows. That happens only while the sidebar section is visible.
  • Native QA stays deferred. The 0.3 port disposition is blocked because the destination checkout is absent.

Tracks OH-59.

Machine monitoring now reads each visible host every 60 seconds instead of every
180. The shared MACHINE_METRICS_REFRESH_MS owner drives the poll interval, the
stale marker and the saved-reading freshness, so all three move together. The
sidebar copy says "every minute" in all 12 locales.

The browser spec now asserts the real cadence from request timestamps (55-75 s
between reads, no extra reads from navigation or collapsing) instead of exact
counts, which a one-minute cadence makes timing-dependent.
@andorcassian
andorcassian marked this pull request as ready for review November 9, 2026 15:56
@andorcassian
andorcassian merged commit 5db19cc into dev Nov 9, 2026
88 of 90 checks passed
@andorcassian
andorcassian deleted the feature/OH-59-metrics-refresh-1min branch November 9, 2026 16:12
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