Repository navigation
Expand quota insight and monitor attention - #12
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands Codexometer’s quota, monitor, and benchmark telemetry so the UI reflects spend controls, monthly credit limits, per-session attention needs, and pricing provenance, while also persisting a small set of presentation preferences and bumping the maintained version to v0.6.0.
Changes:
- Extend quota metering and health signaling to include effective monthly credit limits, spend-control hard stops, credit balance footer telemetry, and a “fresh reset” 0%-usage state.
- Add monitor “attention” states (input/approval/check) with stronger signals when a shared Unix app-server daemon is available; otherwise fall back to rollout + writer-lock heuristics.
- Harden benchmark costing against unknown future usage token classes and surface pricing provenance in the Benchmark footer; persist UI presentation preferences across runs.
Reviewed changes
Copilot reviewed 33 out of 34 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents new quota/monitor/benchmark behaviors, shared daemon setup, preference persistence, and updates version references. |
| main.go | Wires in preference-store-backed UI construction; updates demo session attention and auth-check messaging. |
| main_test.go | Updates version/auth-check output expectations to match new strings. |
| internal/version/version.go | Bumps maintained fallback version to 0.6.0. |
| internal/version/version_test.go | Updates fallback version test expectation. |
| internal/ui/view.go | Adds optional header spacer, quota signal label truncation, credits footer info, and benchmark pricing provenance footer/hyperlink. |
| internal/ui/view_test.go | Updates quota view expectations for monthly meter; adds tests for credits footer and benchmark provenance footer responsiveness/centering. |
| internal/ui/quota_status.go | Introduces quota “signal” (health + cause), fresh-reset state, spend-control exhausted handling, and responsive cause compaction. |
| internal/ui/quota_status_test.go | Adds coverage for signal cause selection, spend-control exhausted, monthly limit signaling, and fresh-reset behavior. |
| internal/ui/preferences.go | Implements preference storage (load/apply/save) in the platform config dir and integrates it with the UI model. |
| internal/ui/preferences_test.go | Tests preference restoration, persistence on UI actions, invalid preference safety, and file round-trips. |
| internal/ui/monitor.go | Renders attention badges/status and highlights attention sessions with warning styling. |
| internal/ui/monitor_test.go | Adds test ensuring attention reasons are distinctly labeled and visually highlighted. |
| internal/ui/model.go | Persists preferences on theme/view/filter/rank changes; adjusts layout to drop header spacer when needed; propagates attention into monitor sessions. |
| internal/ui/meters.go | Adds monthly meter details line, distinguishes looping vs non-looping meter titles, improves reset gauge messaging, and adds linear projection to Consumption Pace. |
| internal/ui/meters_test.go | Adds projection behavior tests and verifies monthly meter details without inventing cycle progress. |
| internal/codex/types.go | Adds meter kind/details, monthly individual limit meter construction, and credit-status selection helper. |
| internal/codex/types_test.go | Extends meters test to include monthly limit + credit status; adds deterministic credit fallback test. |
| internal/codex/live_usage.go | Adds attention tracking via rollout lifecycle events, writer-lock probing, and optional exact status via shared daemon provider. |
| internal/codex/live_usage_test.go | Adds extensive tests for attention lifecycle inference, writer-lock behavior, daemon exact-status precedence, and root/child attention propagation. |
| internal/codex/filelock_windows.go | Adds Windows file lock detection for writer-lock inference. |
| internal/codex/filelock_windows_test.go | Adds Windows test helper for holding/releasing a writer lock. |
| internal/codex/filelock_unix.go | Adds non-Windows file lock detection via unix.Flock for writer-lock inference. |
| internal/codex/filelock_unix_test.go | Adds non-Windows test helper for holding/releasing a writer lock via unix.Flock. |
| internal/codex/daemon_status.go | Defines runtime status enums/provider interface and parsing of daemon status flags. |
| internal/codex/daemon_status_unix.go | Implements Unix shared-daemon status provider via a WebSocket-over-unix-socket control channel. |
| internal/codex/daemon_status_unix_test.go | Adds integration-style tests for the Unix daemon status provider and missing-socket fallback. |
| internal/codex/daemon_status_test.go | Adds unit tests for parsing daemon runtime status. |
| internal/codex/daemon_status_other.go | Provides a non-unix stub provider. |
| internal/codex/client_test.go | Extends fake app-server response and assertions to cover monthly limit, spend-control flag, and credits decoding. |
| internal/codex/benchmark.go | Adds pricing provenance constants and fails costing closed on unknown usage fields via custom JSON unmarshalling. |
| internal/codex/benchmark_test.go | Adds tests ensuring unknown usage fields invalidate costing and documented fields continue to pass. |
| go.mod | Adds gorilla/websocket and makes x/sys a direct dependency. |
| go.sum | Adds gorilla/websocket checksums. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RESET FRESH // GO!waitingOnApprovalandwaitingOnUserInputflags from the default shared Unix app-server when availableWhy
Codexometer already decoded monthly-limit, credit, and spend-control fields but discarded them when constructing visible meters and health status. That could leave the dashboard looking clear while an account-level spend control had stopped Codex. The global health label also did not identify which returned window caused a warning.
Persisted rollout data cannot reliably distinguish every approval prompt from a long-running local tool. A shared Codex app-server does expose exact per-thread waiting flags, while ordinary standalone CLI processes provide durable lifecycle records and per-thread writer locks. The Monitor now uses the strongest available signal without presenting inactivity as certainty.
Benchmark pricing is compiled into the binary and can become stale or incomplete when app-server usage schemas evolve. The footer now identifies the source and retrieval date, and costing fails closed if a future unknown token class appears.
Behavior and safeguards
CYCLE START UNAVAILABLEand does not invent reset-cycle progress.INPUT NEEDED. An otherwise open session with no token or rollout activity for three minutes produces the deliberately uncertainCHECK SESSIONbadge.APPROVAL NEEDEDis never inferred from inactivity. Any new activity clearsCHECK SESSION, and closing a standalone CLI releases its writer lock and clears attention messaging.Validation
go test -race -cover ./...internal/codex: 84.6%internal/ui: 91.4%internal/version: 81.0%go vet ./...git diff --checkcodexometer v0.6.0