Skip to content

Add a dedicated pi agent usage collector - #10330

Open
surim0n wants to merge 2 commits into
omacom:quattrofrom
surim0n:fix/pi-usage-collector
Open

Add a dedicated pi agent usage collector#10330
surim0n wants to merge 2 commits into
omacom:quattrofrom
surim0n:fix/pi-usage-collector

Conversation

@surim0n

@surim0n surim0n commented Sep 5, 2026

Copy link
Copy Markdown

Summary

Fixes #8270.

Add a dedicated local Pi/Oh My Pi usage record for every backend, including OpenRouter. Claude and Codex no longer aggregate Pi/OMP transcripts; native and opencode collection remains intact.

Changes

  • Discover default/configured session directories, Pi/OMP profiles, the explicit Pi session-directory override, and OMP XDG locations.
  • Count physical aliases and inherited fork responses once using lineage-scoped response identity, not globally unique short IDs. Cover OMP cost-reset forks and missing UUID parents.
  • Preserve exclusive per-response token categories and local-calendar windows; skip malformed records, counters, dates and parent paths.
  • Make caching optional, serialized, date/root-aware, and safe after empty forced scans or failed writes. Invalidation is best effort if the filesystem refuses both replacement and deletion.
  • Invalidate Codex caches from before the Pi split to prevent transitional double counting.
  • Label the record Local usage, not Subscription, and update existing documentation.

Validation

  • 25 Pi regressions plus the original four scanner assertions pass in UTC and Pacific/Kiritimati (UTC+14).
  • Claude, Codex, Claude limits, Fireworks, updater, agents-panel, plugin validation and first-party manifest schema suites pass in isolated Bash 5/Linux tests.
  • Full test/cli, metadata validation, Python compilation and git diff --check pass. Minimal-container CLI runs emit existing missing-theme-directory warnings. No full test/all pass is claimed.
  • Real updater integration discovers and writes pi.json; extracted panel functions select Local usage and make a nonempty record visible.
  • No live Quickshell/graphical acceptance run is claimed.

Coordination

Related active work: #8602 (fork deduplication), #9546 (profiles), #8345 (roots/cache identity), and #8649 (OMP collector). After this split, Pi fixes must target the dedicated collector rather than unused Claude/Codex Pi scanners. Agree on OMP ownership before adding another record.

Generated with Devin

pi and oh-my-pi sessions are currently folded into the Claude and Codex collectors, which only count Anthropic and openai-codex providers. Users on any other backend (OpenRouter, Kimi, etc.) never see their usage in the agents panel.

Add bin/omarchy-agent-usage-pi to scan ~/.pi and ~/.omp sessions for any provider, and stop counting those sessions in the Claude and Codex collectors.

Fixes omacom#8270

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@surim0n
surim0n marked this pull request as draft September 8, 2026 03:50
Make local usage caching date-aware, optional and safe after empty or
failed refreshes. Validate transcript records, discover configured
session roots and profiles, and deduplicate inherited responses without
conflating independent short IDs or mutable billing fields.

Invalidate pre-split Codex caches, label Pi as local usage, and cover
the regressions in both UTC and UTC+14.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@surim0n
surim0n marked this pull request as ready for review September 8, 2026 04:15
@surim0n

surim0n commented Sep 8, 2026

Copy link
Copy Markdown
Author

Pushed f481aa5 after a deeper audit. Added cache/date/write-failure regressions, malformed-record handling, configured roots/profiles, fork and physical-alias deduplication, and Codex cache-transition coverage. All 25 Pi tests plus the original assertions pass in UTC and UTC+14; adjacent collector/updater tests and the CLI suite pass in isolated Linux. The description documents validation limits and overlap with #8602, #9546, #8345 and #8649. Pi is labeled Local usage; no quota or cost is inferred.

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.

Agents panel never appears for active pi users on non-Anthropic/non-Codex backends (e.g. OpenRouter)

1 participant