Skip to content

FEAT: make Monitor always on - #29

Merged
merefield merged 6 commits into
mainfrom
codex/always-on-monitor
Aug 23, 2026
Merged

merefield merged 6 commits into
mainfrom
codex/always-on-monitor

Conversation

@merefield

@merefield merefield commented Aug 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • start Monitor automatically and replace stopwatch controls with Pause/Resume and Reset
  • exclude paused activity, use adaptive polling, cache daemon status reads, and bound graph history
  • add keyboard row selection with Up/Down and X to close the selected session
  • combine shared app-server status, local writer locks, and visible attention state for the Monitor light: flash amber when a visible session needs input, approval, or a check; otherwise flash green while working, stay green while healthy and idle, turn red only when observably stopped, and remain dim when unknown or paused

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 ./...

@merefield merefield changed the title [codex] make Monitor always on FEAT: make Monitor always on Aug 23, 2026
@merefield
merefield marked this pull request as ready for review August 23, 2026 10:45
@merefield
merefield requested a lite review from Copilot August 23, 2026 10:45

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.

🟡 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, x to 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.

Comment thread internal/ui/model.go Resolved

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.

🟢 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

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.

🔵 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

@merefield
merefield merged commit bf18410 into main Aug 23, 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