Count omp and pi profile sessions in the agent usage collectors - #9546
Open
This-Is-NPC wants to merge 1 commit into
Open
Count omp and pi profile sessions in the agent usage collectors#9546This-Is-NPC wants to merge 1 commit into
This-Is-NPC wants to merge 1 commit into
Conversation
`omp --profile=<name>` (and pi's equivalent) relocates the whole agent tree under <base>/profiles/<name>/. The Claude and Codex collectors only ever scanned <base>/agent/sessions, so a subscription driven entirely through a profile was invisible to the agents panel: no tokens by day, no tokens by model, no prompt or session counts. Discover the profile roots alongside the default one. Sessions are keyed by file path, so a profile adds sessions instead of double-counting the default root, and a missing or unreadable profiles directory leaves the existing behavior untouched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014zFbJcDEEpV5BAmsH6kAB3
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.
The problem
omp --profile=<name>(and pi's equivalent) relocates the whole agent tree under<base>/profiles/<name>/. The Claude and Codex collectors only ever scanned<base>/agent/sessions:So a subscription driven entirely through a profile is invisible to the agents panel — no tokens by day, no tokens by model, no prompt or session counts. On my machine
omp --profile=codexhad 916 session files with 125,638openai-codexassistant messages under~/.omp/profiles/codex/agent/sessions, none of it counted.What made it hard to spot is that the Codex tab was not empty: it was showing the opencode fallback numbers only, which quietly stop the day you switch away from opencode.
The fix
pi_session_roots()discovers the profile roots alongside the default one, in both collectors. Sessions are already keyed by file path, so a profile adds sessions instead of double-counting the default root, and a missing or unreadableprofiles/directory leaves today's behavior untouched.The helper is duplicated across the two scripts, matching how
cache_root()andread_fresh_json()are already duplicated there.Verification
Real data on an Arch box running omarchy 4.0.2,
omarchy-agent-usage-codex --force, before → after:totalPromptstotalSessionstodayPromptstodayTotalTokensThe last two days of
recentDayswent from0/0to real numbers. The Claude collector picked up the profile's Anthropic subagent traffic the same way (10 more prompts today, in my case).Both scanner tests grow a profile session and assert it lands in
todayTotalTokensandmodelUsage.agent-usage-codex-scanner-test.sh,agent-usage-claude-scanner-test.sh,agent-usage-claude-limits-test.sh,agent-usage-fireworks-scanner-test.sh,agent-usage-update-test.shandagents-rename-migration-test.shall pass.🤖 Generated with Claude Code
https://claude.ai/code/session_014zFbJcDEEpV5BAmsH6kAB3