Skip to content

Address stopwatch performance review - #3

Merged
merefield merged 1 commit into
mainfrom
agent/address-stopwatch-review
Aug 11, 2026
Merged

merefield merged 1 commit into
mainfrom
agent/address-stopwatch-review

Conversation

@merefield

@merefield merefield commented Aug 11, 2026 •

Copy link
Copy Markdown
Owner

What changed

  • extracts pure dashboard and Stopwatch geometry so mouse hover/click hit-testing no longer renders the terminal view
  • reuses the same geometry for rendering and hit-testing, including compact, error, empty-quota, and Stopwatch layouts
  • continues consuming known rollout cursors every second while throttling recent-session discovery to five seconds
  • reduces full-tree discovery to five minutes while preserving forced full discovery on Stop
  • moves Stopwatch from the fifth presentation to the second, immediately after Bars
  • bumps the maintained patch version to v0.1.1
  • updates responsive layout, discovery-cadence, style-order, and interaction tests

Why

This follows up on the two Copilot review comments left after #2 was merged:

The original implementation performed redundant rendering for every mouse motion event and walked session directories on every one-second telemetry poll. These changes preserve responsive interaction and fresh final readings while substantially reducing repeated CPU, allocation, and filesystem work.

User impact

Stopwatch hover and clicks remain aligned with the rendered controls but require no render work during hit-testing. Existing sessions continue updating every second; newly created rollouts appear within approximately five seconds, and Stop always forces complete discovery. Stopwatch is now one press of s away from the default Bars view.

Validation

  • go test -race -cover ./...
  • go vet ./...
  • local Linux build
  • Linux, macOS, and Windows cross-builds on amd64 and arm64

@merefield
merefield force-pushed the agent/address-stopwatch-review branch from 5c7d972 to 73e549c Compare August 11, 2026 12:48
@merefield
merefield requested a lite review from Copilot August 11, 2026 12:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR follows up on the Stopwatch performance review by separating “pure” layout geometry from rendering so mouse hit-testing no longer triggers full terminal rendering, and by throttling filesystem discovery in live token telemetry while still consuming known cursors every second. It also reorders the presentation cycle to place Stopwatch immediately after Bars and bumps the maintained version to v0.1.1.

Changes:

  • Introduces shared dashboard + stopwatch layout geometry used consistently for rendering and mouse hit-testing (including compact/error/empty states).
  • Throttles Codex session discovery (5s incremental, 5m full) while preserving per-second consumption of already-known rollout cursors and forcing full discovery on Stop.
  • Reorders meter styles (Stopwatch becomes #2) and updates version strings/tests to v0.1.1.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
README.md Updates presentation order (Stopwatch #2) and bumps documented version/install examples to v0.1.1.
main_test.go Updates expected --version output to v0.1.1.
internal/version/version.go Bumps maintained fallback version to 0.1.1.
internal/version/version_test.go Updates fallback-version assertion to 0.1.1.
internal/ui/view.go Uses dashboardLayout() geometry to size meter/stopwatch areas without recomputing heights from rendered strings.
internal/ui/view_test.go Updates style-grid classification test for reordered meter styles.
internal/ui/theme.go Reorders meterStyleID so Stopwatch is second; updates style names accordingly.
internal/ui/stopwatch.go Extracts pure stopwatch geometry (layoutStopwatchArea) and reuses it for rendering + hit-testing.
internal/ui/stopwatch_test.go Verifies rendered stopwatch control rectangles match pure layout geometry and updates hit-testing assertions.
internal/ui/model.go Replaces footer hit-testing via ansi.Strip(m.View()) parsing with geometry-based dashboardLayout() + footerButtonLayout().
internal/ui/model_test.go Updates style-cycle expectations and adds a geometry-vs-render hit test across multiple sizes/states.
internal/ui/meters.go Updates usesMeterGrid logic to explicit style set (reflecting new enum order).
internal/ui/meters_test.go Refactors tests to iterate explicit “quota meter” styles rather than relying on enum ordering.
internal/codex/live_usage.go Adds discovery throttling (discoveryEvery, fullDiscoveryEvery) while still consuming known rollout cursors each fetch.
internal/codex/live_usage_test.go Adds coverage for throttled discovery behavior and adjusts existing tests to force discovery when needed.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@merefield
merefield marked this pull request as ready for review August 11, 2026 12:52
@merefield
merefield merged commit 02909dd into main Aug 11, 2026
7 checks passed
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.

2 participants