Skip to content

fix(system): compute network speed from raw byte counts - #36281

Merged
RohanK6 merged 1 commit into
mainfrom
crew/conductor/r56-system-net-rate
Nov 13, 2026
Merged

RohanK6 merged 1 commit into
mainfrom
crew/conductor/r56-system-net-rate

Conversation

@RohanK6

@RohanK6 RohanK6 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

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_metrics took 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_net counters 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

  • Per-poller speed state for _prev_net.
  • Changing how the totals (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_net keeps 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_kbs improves.

Removes nothing: no key, field or setting changes.

Tests

  • test/test_handlers_system_windows_probes.py: test_speed_below_the_megabyte_rounding_step_is_reported feeds 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

@RohanK6
RohanK6 requested review from a team and KiroCrewCaptain as code owners November 13, 2026 01:45
@RohanK6
RohanK6 requested a review from mbriones98 November 13, 2026 01:45
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 13, 2026
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision ee4b4aaabbd25492a3e82031fdfa21249103701e touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of ee4b4aaabbd25492a3e82031fdfa21249103701e — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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 ships

Inventory (2 items) — 2 justified

Intent: make the dashboard's network speed show real low and moderate traffic rates instead of 0 KB/s or fixed steps. FIX.

  1. Network speed reads small rates accurately; the shown MB totals are unchanged — justified
  2. A regression test feeds sub-0.1 MB traffic over a frozen 2 s interval and asserts 10.0 / 3.0 KB/s — justified

[FIRST-PRINCIPLES-REVIEWED] ee4b4aa

Description read

[DESCRIPTION-READ] 1adf0d990714369cba4561c50e9f8d39de93845c2c57b619c9596e6a487a4119

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of ee4b4aaabbd25492a3e82031fdfa21249103701e — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • _prev_net is annotated dict[str, float] but now holds integer byte totals. Mypy accepts this, but the name and type no longer say "bytes", which is the thing the next reader needs to know.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed ee4b4aaabbd25492a3e82031fdfa21249103701e — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] ee4b4aa

Verdict parsed from the review's SHA-scoped output markers for commit ee4b4aaabbd25492a3e82031fdfa21249103701e.

False positive or not applicable? A repository writer can comment:
/ai-review override fable ee4b4aaabbd25492a3e82031fdfa21249103701e false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of ee4b4aaabbd25492a3e82031fdfa21249103701e and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] ee4b4aa

False positive or not applicable? A repository writer can comment:
/ai-review override gpt ee4b4aaabbd25492a3e82031fdfa21249103701e false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 13, 2026
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
@RohanK6
RohanK6 force-pushed the crew/conductor/r56-system-net-rate branch from feb62e9 to ee4b4aa Compare November 13, 2026 03:51
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Nov 13, 2026
@RohanK6
RohanK6 enabled auto-merge (squash) November 13, 2026 14:04

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@RohanK6
RohanK6 merged commit 772622b into main Nov 13, 2026
131 of 145 checks passed
@RohanK6
RohanK6 deleted the crew/conductor/r56-system-net-rate branch November 13, 2026 14:07
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 13, 2026
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.

System metrics network speed reads 0 KB/s for light traffic

2 participants