Repository navigation
fix(system): compute network speed from raw byte counts - #36281
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. The fix is at the mechanism level: the rate now comes from raw byte counters instead of totals already rounded to 0.1 MB. What this change shipsInventory (2 items) — 2 justifiedIntent: make the dashboard's network speed show real low and moderate traffic rates instead of 0 KB/s or fixed steps. FIX.
[FIRST-PRINCIPLES-REVIEWED] ee4b4aa Description read[DESCRIPTION-READ] 1adf0d990714369cba4561c50e9f8d39de93845c2c57b619c9596e6a487a4119 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix moves the delta onto the raw counters, which is the actual cause, and keeps the payload keys and units the same. Notes
[DESIGN-REVIEWED] ee4b4aa Description read[DESCRIPTION-READ] 4aedc05d41de418895a4005715139989bc189d11d69c14755f9e4b4383c6804f That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
The speed was the difference of two MB totals already rounded to 0.1 MB, so it moved in 0.1 MB-per-interval steps and anything slower read 0 KB/s. Keep the raw byte counters between polls and round only the final rate. Fixes #36275
feb62e9 to
ee4b4aa
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: network speed is computed from raw byte counts so small rates are not rounded away, with a test.
Problem / Motivation
Goal: The system metrics network speed is computed from raw byte counters, so slow traffic no longer reads 0 KB/s.
_collect_system_metricstook the speed from the difference of two MB totals already rounded to 0.1 MB. The rate could only change in steps of 0.1 MB per poll interval: at a 5 s poll, about 20 KB/s, and larger when another poller of the shared_prev_netcounters shortened the interval.Why it matters
Light traffic (a chat streaming, a sync) shows 0 KB/s, and moderate traffic jumps between a few fixed values, so the network speed readout does not reflect what the machine is doing.
Not a goal
_prev_net.net_rx_mb/net_tx_mb) are shown.What changed (motivation → approach → change)
Symptom: low rates read 0 and rates move in fixed steps. Root cause: the delta is taken between rounded MB values. Change, in
src/kiro_crew/dashboard/handlers_system.py:_prev_netkeeps the raw byte totals and the rate is(bytes - previous bytes) / 1024 / dt, rounded once at the end. The reported totals are unchanged.Backwards compatibility
Compatible: the same keys with the same units; only the precision of
net_rx_kbs/net_tx_kbsimproves.Removes nothing: no key, field or setting changes.
Tests
test/test_handlers_system_windows_probes.py:test_speed_below_the_megabyte_rounding_step_is_reportedfeeds 20 KiB received and 6 KiB sent over a frozen 2 s interval and asserts 10.0 / 3.0 KB/s. On main both totals round to 10.0 MB, so the speed reads 0.Proof: PROVEN test/test_handlers_system_windows_probes.py::TestWindowsNetwork::test_speed_below_the_megabyte_rounding_step_is_reported
Manual verification
None beyond the test: the change is a backend arithmetic fix with no UI change.
Screenshots / video
Not applicable: backend only, no UI change.
Related Issues
Fixes #36275
Sibling sweep
Swept: git grep -n "_prev_net|_prev_cpu|_prev_sys_cpu" -- src/kiro_crew/dashboard
Sibling: src/kiro_crew/dashboard/handlers_system.py network speed -- changed here
Sibling: src/kiro_crew/dashboard/handlers_system.py process / system CPU % -- different, deltas of raw seconds and jiffies, not rounded values
Pattern harvest
Rule candidate: review-prompt
Pattern: a rate computed as the difference of two already-rounded totals loses everything below the rounding step; take the delta on raw counters and round once.
Overlap
Open PRs #31628, #31288 and #29602 also edit
handlers_system.py; none of their hunks touch the network block (lines 71-72, 762-777).Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.