Repository navigation
Conversation
[Medium impact] The PR appears safe to merge, with the existing non-blocking refresh cost still present. Findings
SummaryAdds Oh My Pi usage to the agents panel.
No new actionable issues were found. Reviews (10) · Last reviewed commit: "Merge remote-tracking branch 'upstream/q..." · Reviewed by Greptile |
| parser.add_argument("--force", action="store_true") | ||
| parser.add_argument("--limits-only", action="store_true") | ||
| args = parser.parse_args() | ||
|
|
||
| binary = find_omp() | ||
| if not binary: | ||
| record = base_record(usageStatusText="omp unavailable", authHelpText="omp not found in PATH") | ||
| print(json.dumps(record, separators=(",", ":"), sort_keys=True)) | ||
| return 0 | ||
|
|
||
| data = run_stats(binary) |
|
Addressed all five — fix pushed. Balance gauge stays full + Exhausted balance disappears (findings 1–2, one root cause). Confirmed. DeepSeek's Stats timeout aborts collection. Confirmed — Limits refresh scans all stats. Ack — Collector mapping lacks tests. Added
|
DeepSeek's get-user-balance reports only remaining credits — granted and topped-up sum to the current total — and never the original funding amount, so treating granted + topped-up as "funded" pinned spent to 0 and left the panel's balance gauge permanently full. Report remaining alone with funded/spent at 0, and keep an exhausted $0.00 balance visible instead of dropping it. Also catch the stats subprocess timeout so a slow `omp stats` degrades to "no stats" rather than raising through the collector and leaving stale data. Add test/shell.d/agent-usage-omp-scanner-test.sh covering the stats mapping, session counting, run_stats failure/timeout paths, and the DeepSeek balance path.
Independent community review
Nice work on the The implementation cleanly integrates with the agents panel:
All test suites (
|
The omp collector had no assets/<id>.svg, so the panel hero fell back to the generic bar glyph next to Claude's and Codex's real marks. Ship the Oh My Pi logo (the Pi symbol with an orange plugin connector, from oh-my-pi's assets/icon.svg) as a white mark for dark surfaces plus a dark twin for light surfaces, following the codex.svg / codex-light.svg convention.
chessing234
left a comment
There was a problem hiding this comment.
please fix the usage aggregation and time-window handling below; the hourly and multi-provider fixtures reproduce incorrect totals.
| bucket["outputTokens"] = number(entry.get("totalOutputTokens")) | ||
| bucket["cacheReadInputTokens"] = number(entry.get("totalCacheReadTokens")) | ||
| bucket["cacheCreationInputTokens"] = number(entry.get("totalCacheWriteTokens")) | ||
| model_usage[model] = bucket |
There was a problem hiding this comment.
please accumulate these buckets instead of overwriting them: omp groups byModel by (model, provider) (upstream), so using the same model through two providers loses the first provider's usage. calling this function with 100 and 40 input tokens under the same model returns 40 instead of 140; please add that case to the fixture.
|
|
||
| return { | ||
| "todayPrompts": number( | ||
| next( |
There was a problem hiding this comment.
please sum all of today's request buckets here: current omp emits hourly buckets for its default 24-hour window (upstream), while next() keeps only the first hour. a fixture with 3 requests at midnight and 5 at 01:00 returns todayPrompts: 3 instead of 8.
|
|
||
|
|
||
| def run_stats(binary: str) -> dict | None: | ||
| """Run `omp stats --json` and return the parsed object, or None on failure.""" |
There was a problem hiding this comment.
please obtain the history needed for the seven-day and all-time fields before populating them: omp stats --json calls getDashboardStats() without a range, which in v18.4.4 filters the overall, model, and time-series data to the last 24 hours. the current mapping consequently fills older days with zero, reports a rolling day as all-time usage, and hides the tab after a day without requests even when older sessions exist.
- Sum per-model buckets across (model, provider) instead of overwriting - Sum all of today's hourly buckets for todayPrompts - Read seven-day and all-time fields from ~/.omp/stats.db, since `omp stats --json` reports only the last 24 hours
|
Addressed all three — fix pushed ( Model buckets accumulate across providers. Today's request buckets are summed. Seven-day and all-time fields read full history.
|
- Fetch DeepSeek balance regardless of recent usage so a quiet account still shows its credits - Stream the stats DB read instead of materializing every message - Fall back to the stats DB when omp stats fails instead of erasing the last record
…login When omp stats times out or fails, the collector kept the last good history but set authHelpText to the account prompt, so the panel told users to run 'omp login' for a transient stats failure. Point the help text at the actual problem instead and cover it in the scanner test.
|
Re-review pass after One responsible-disclosure-style note (not a blocker if this matches other collectors): |
A fresh omp install has no ~/.omp/agent/sessions/ directory: sessions live in the session_rollup table of ~/.omp/stats.db, which is also where the collector already reads its history. Counting loose JSONL files therefore reported 0 sessions on a real machine. Read today's and total sessions from session_rollup, keeping the JSONL glob as a fallback for older layouts, and cover both paths in the scanner test.
|
Thanks for the review. All three items are addressed, plus the Greptile notes:
Testing against a real omp 18.6.1 install surfaced one more correction: session counts were read from On the remaining Greptile note (
|
|
@chessing234 all three requested changes are addressed (plus the Greptile notes), and |
session_counts() read only started_at from session_rollup, so a session that began before midnight but ran into today was left out of todaySessions. The JSONL fallback (mtime) and the other collectors count any session with activity today, so the panel undercounted resumed and long-running sessions. Count a session toward today when max(started_at, ended_at) falls on today, and extend the fixture with a session started yesterday 23:00 that ended today 01:00.
|
@chessing234 the new Greptile note (today's sessions undercounted for a session resumed across midnight) is fixed in |
quattro gained a Grok provider in shell/plugins/agents; its manifest.json description and providers block conflicted with this branch's omp entry. Resolved by keeping both: the description names all five agents, and the providers block enables claude, codex, grok, fireworks, and omp.
…t-usage # Conflicts: # shell/plugins/agents/README.md # shell/plugins/agents/manifest.json
|
Merged The three changes you requested on Sep 30 are addressed:
Plus the Greptile follow-ups since: quiet-account balance ( Could you take another look and dismiss the changes-requested review if it's settled? Thanks. |
Summary
Adds an
omp(Oh My Pi) usage collector so the agents panel gains a tab for machines that code with omp, which today shows nothing because no collector covers it.omp is provider-agnostic, so unlike the claude/codex collectors (which read Anthropic/OpenAI transcript formats) this one reads omp's own statistics and reports them directly.
Changes
bin/omarchy-agent-usage-omp— new collector. Runsomp stats --jsonand maps its output into the standard record contract:~/.omp/agent/sessions/(whichomp statswalks but does not surface as a count).get-user-balancewith omp's own stored key (omp token deepseek) and reports the live remaining balance. DeepSeek exposes only remaining credits (granted / topped-up), never the original funding amount, so the record carriesremainingalone (funded/spentstay 0) and the panel shows a plain balance readout rather than a spend gauge.tierLabelis set toPrepaidonly in that case.shell/plugins/agents/manifest.json— registersompin the widget's defaultproviders.shell/plugins/agents/README.md— adds the collector row and anompsection.Notes
omp usagereturns no reports for it, solimitsstays empty and the tab shows the balance readout instead.todayTokensByModelis omitted:omp statsreports per-day totals and all-time per-model tokens, but not per-day-per-model tokens.Testing
./test/clipasses (112 ok, exit 0), including the command-metadata checks for the new executable bin.test/shell.d/agent-usage-omp-scanner-test.sh(new) covers theomp stats --jsonmapping, session counting,run_statsfailure/timeout paths, and the DeepSeek balance path.