Repository navigation
FEAT: make Monitor always on - #29
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
A Monitor start-fetch failure can leave the monitor in a paused state without initializing timestamps, causing Resume to keep elapsed time/rate stuck at zero until Reset.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR makes the Monitor feature always-on, replacing the previous Start/Stop workflow with Pause/Resume and Reset while adding adaptive polling, bounded graph history, and a shared app-server-aware status light across the UI.
Changes:
- Auto-start Monitor on initial refresh; add Pause/Resume + Reset semantics and exclude paused intervals from recorded totals.
- Add adaptive polling cadence, 5-second caching of daemon thread-status reads, and bound Monitor graph/sample history.
- Add keyboard navigation for Monitor rows (Up/Down selection,
xto close selected session) and share a unified status-light indicator between tab rail and Monitor label.
File summaries
| File | Description |
|---|---|
| README.md | Updates docs for always-on Monitor, new shortcuts, and status-light behavior. |
| main.go | Extends demo live-usage snapshot with app-server health/working flags. |
| internal/ui/theme.go | Adds success/successDim palette colors for Monitor status indicator. |
| internal/ui/tabs.go | Always renders Monitor light and colors it based on app-server health + activity. |
| internal/ui/tabs_test.go | Updates tab-label and indicator-color expectations for new status light behavior. |
| internal/ui/monitor.go | Replaces Start/Stop controls with Pause/Resume + Reset; adds selected-row styling and updated empty-state messaging. |
| internal/ui/monitor_test.go | Updates Monitor lifecycle tests for auto-start, pause/resume, reset, adaptive polling, bounded history, and keyboard row selection. |
| internal/ui/model.go | Implements new Monitor state machine, auto-start hook, adaptive polling scheduling, status syncing, bounded history, and keyboard selection/dismiss actions. |
| internal/codex/live_usage.go | Reports app-server status/working signals and propagates into LiveUsageSnapshot. |
| internal/codex/live_usage_test.go | Adds coverage for new app-server health/working snapshot fields. |
| internal/codex/daemon_status_unix.go | Adds 5-second caching for daemon thread status reads keyed by thread set. |
| internal/codex/daemon_status_unix_test.go | Verifies status caching behavior and cache invalidation rules. |
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟢 Approval recommended
The changes are cohesive, include substantial unit test updates for the new Monitor lifecycle and daemon-status caching, and no correctness issues were found in the updated state-machine and health/indicator logic.
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🔵 Needs a closer look
The changes introduce a broad Monitor lifecycle/state-machine overhaul plus new health signal derivation/caching, which warrants final human review despite strong test coverage.
Review details
- Files reviewed: 12/12 changed files
- Comments generated: 0 new
- Review effort level: Lite
Summary
Root cause fixed
The first status-light implementation treated the optional app-server control socket as the health authority, then overcorrected by treating every held writer lock as active work. The Monitor now uses locks only as health evidence, reconciled lifecycle/daemon state for work, and visible attention badges for amber. Dismissed session rows do not keep the global light amber.
Testing
go test ./...go test -race ./...go vet ./...