Skip to content

Expand quota insight and monitor attention - #12

Merged
merefield merged 4 commits into
mainfrom
agent/quota-insight
Aug 13, 2026
Merged

merefield merged 4 commits into
mainfrom
agent/quota-insight

Conversation

@merefield

@merefield merefield commented Aug 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • surface optional effective monthly credit limits as responsive Quota meters
  • treat backend spend-control hard stops as exhausted and show available credit balance telemetry
  • identify the quota meter responsible for Watch, Near, and Exhausted states
  • celebrate a clean 0% account with RESET FRESH // GO!
  • add a clearly labelled linear exhaustion projection to Consumption Pace
  • persist theme, Quota view, benchmark filter, and benchmark rank weighting in the platform config directory
  • add per-session Monitor attention states for definite input, definite approval, and inferred quiet sessions
  • read exact waitingOnApproval and waitingOnUserInput flags from the default shared Unix app-server when available
  • harden benchmark costing against unknown future token classes and show responsive pricing provenance in the Benchmark footer
  • document shared-daemon/client setup, attention limitations, pricing assumptions, and an observed-quota-capacity roadmap item
  • bump the maintained source version to v0.6.0

Why

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

  • Monthly limits use their reported remaining percentage, reset time, and exact used/limit details. The API does not expose their cycle start, so Codexometer explicitly says CYCLE START UNAVAILABLE and does not invent reset-cycle progress.
  • Consumption Pace projects the current average burn linearly from the calculated window start. It labels the result as a linear projection and hides it when timing is insufficient.
  • On Unix, Codexometer probes the default shared app-server control socket and reads runtime status only for observed thread IDs. Exact approval and input flags take precedence over every fallback.
  • Without exact daemon status, a held writer lock plus a durable completed-turn event produces INPUT NEEDED. An otherwise open session with no token or rollout activity for three minutes produces the deliberately uncertain CHECK SESSION badge.
  • APPROVAL NEEDED is never inferred from inactivity. Any new activity clears CHECK SESSION, and closing a standalone CLI releases its writer lock and clears attention messaging.
  • Waiting child-agent state is folded into its root. Mixed linked states are prioritized as definite approval, definite input, then inferred check.
  • Attention detection retains no question, approval, response, command, reasoning, or conversation content.
  • The managed shared-daemon lifecycle is Unix-only. Windows continues to use portable writer-lock and rollout fallback detection; the README also documents the local WebSocket client setup and its current Codexometer limitation.
  • Unknown benchmark usage fields make API-equivalent cost unavailable instead of being silently treated as free. Published pricing has a source URL and retrieval date, shown responsively on sufficiently wide Benchmark terminals.
  • Saved preferences contain presentation choices only. Missing, malformed, or unreadable preferences never block startup.
  • A short terminal can surrender the decorative header spacer when that single row is required to fit all horizontal meters. Normal layouts retain the spacing.

Validation

  • go test -race -cover ./...
    • root: 56.4%
    • internal/codex: 84.6%
    • internal/ui: 91.4%
    • internal/version: 81.0%
  • go vet ./...
  • git diff --check
  • local executable reports codexometer v0.6.0
  • standalone builds completed for:
    • macOS amd64 and arm64
    • Linux amd64 and arm64
    • Windows amd64 and arm64
  • responsive regression coverage includes five simultaneous displays: 5-hour, weekly, monthly credit, and two additional-bucket limits across every Quota view at 40×24, 80×24, and 120×40

@merefield
merefield marked this pull request as ready for review August 13, 2026 12:19
@merefield
merefield requested a lite review from Copilot August 13, 2026 12:19

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

Comment thread internal/codex/filelock_unix.go Resolved
@merefield
merefield merged commit c71336b into main Aug 13, 2026
8 of 9 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