Repository navigation
Add per-session Monitor telemetry - #8
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands Codexometer’s Monitor to report per-root-session local telemetry (including explicitly linked spawned agents), adds compact response-cycle stats (calls/TTFT/output), tracks account quota windows with a labeled local-only attribution estimate, and updates documentation and versioning to v0.4.0.
Changes:
- Reworked Monitor rendering to show one metrics+graph row per root session, with paging via Page Up/Page Down and mouse wheel.
- Added quota window snapshotting/sync and per-session “EST LOCAL-ONLY” attribution based on local token share.
- Extended local rollout parsing to group spawned descendants, avoid inherited-history double counting, and extract output-token + TTFT pulses.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents per-session grouping, response telemetry, quota attribution, navigation, and bumps referenced version to v0.4.0. |
| main.go | Updates demo fetcher to emit per-session model-call + TTFT telemetry for Monitor. |
| main_test.go | Updates version output expectation to v0.4.0. |
| internal/version/version.go | Bumps maintained fallback version to 0.4.0. |
| internal/version/version_test.go | Updates fallback version test to 0.4.0. |
| internal/ui/view_test.go | Updates Monitor header expectation (“MONITOR READOUT”). |
| internal/ui/monitor.go | Implements per-session Monitor rendering, response stats formatting, quota readout rendering, and dynamic bucket span labeling. |
| internal/ui/monitor_test.go | Adds/updates tests for per-root sampling, response telemetry, quota attribution/reset behavior, and row paging/navigation. |
| internal/ui/model.go | Adds Monitor state for per-session data, boundary sampling, quota window tracking, and new input handling for paging. |
| internal/codex/live_usage.go | Adds session grouping (root + spawned agents), inherited-history boundary handling, and extraction of output-token + TTFT pulses. |
| internal/codex/live_usage_test.go | Adds coverage for pulse extraction, grouping, inherited-history handling, and source-shape parsing. |
Suppressed comments (1)
internal/codex/live_usage.go:410
- Same issue for
cursor.turnTimings: allocating and copying on every overflow adds avoidable overhead once the history reachestelemetryHistoryMax. A simple reslice keeps the newest entries without per-event allocations.
if len(cursor.turnTimings) > telemetryHistoryMax {
cursor.turnTimings = append([]LiveTurnTiming(nil), cursor.turnTimings[len(cursor.turnTimings)-telemetryHistoryMax:]...)
}
💡 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.
What changed
0.3.0to0.4.0Why
The previous Monitor combined all local Codex activity into one total. That made simultaneous CLI sessions indistinguishable and could not show whether usage originated in a root interaction or its spawned agents. It also showed throughput without the response cadence, responsiveness, or output size behind it.
Correctness and hardening
Codex child rollouts may include inherited parent telemetry. Current rollouts expose an ordinal ownership boundary; older rollouts are separated using the child session timestamp. Inherited cumulative totals establish a baseline without being reported as new usage. Graph buckets wait for a boundary fetch rather than closing from stale telemetry, and late-discovered roots use their own observation lifetime for rates and first-bucket duration.
Response telemetry is derived only from appended local rollout records after Monitor Start.
CALLSmeans upstream model-response cycles, not complete user turns; a tool-using turn may make several calls. Output size comes from the provider-reportedlast_token_usage, and TTFT comes from the persisted completed-turn timing. Records that omit either measurement still count as activity but display that individual reading asN/A, preventing a stale earlier value from masquerading as the latest one. Retained final-response text is neither decoded nor stored.Quota attribution is hardened as follows:
EST LOCAL-ONLY; concurrent account activity outside the visible local sessions is explicitly documented as a contaminating factor<1PP, and an unchanged integer reading saysNO INTEGER ΔUser impact
Monitor users can now compare independent Codex sessions side by side, see the number of linked agents contributing to each root, identify which session produced the largest share of locally observed activity, and navigate all rows responsively on shorter terminals.
Each row also gives a compact sense of model activity and responsiveness without crowding out the graph: how many response cycles occurred, how recently, the latest and slowest TTFT, and the latest and largest output.
The per-session quota value is deliberately labelled
EST: Codex does not expose direct session-to-quota attribution, so Codexometer apportions observed percentage-point movement by local token share. Estimates are marked partial for incomplete baselines and suppressed across detected resets.Validation
go test ./...go test -race -cover ./...go vet ./...codexometer v0.4.0