Skip to content

feat(pi): auto-detect oh-my-pi (omp) sessions - #1338

Closed
sgfeniex wants to merge 1 commit into
ccusage:mainfrom
sgfeniex:feat/pi-omp-support
Closed

feat(pi): auto-detect oh-my-pi (omp) sessions#1338
sgfeniex wants to merge 1 commit into
ccusage:mainfrom
sgfeniex:feat/pi-omp-support

Conversation

@sgfeniex

@sgfeniex sgfeniex commented Jun 18, 2026

Copy link
Copy Markdown

oh-my-pi (omp) is a widely used pi fork that writes identical JSONL session files with the same message.usage schema.

Auto-detect ~/.omp/agent/sessions alongside ~/.pi/agent/sessions when neither --pi-path nor PI_AGENT_DIR is set, so omp users get usage reports without having to pass --pi-path manually.

Both directories are scanned and entries are deduplicated by the loader; setting PI_AGENT_DIR or --pi-path overrides detection and scans only the given paths.

Closes #1193


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Auto-detect ~/.omp/agent/sessions alongside ~/.pi/agent/sessions so oh-my-pi users get usage reports without setting --pi-path or PI_AGENT_DIR.

  • New Features
    • When neither --pi-path nor PI_AGENT_DIR is set, scan both default dirs; overrides scan only the provided paths.
    • Loader deduplicates entries across sources.
    • Docs updated in the getting started guide and pi guide; added tests for detection logic.

Written for commit c0241a9. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added automatic discovery of oh-my-pi (omp) session directories alongside pi-agent sessions.
    • The tool now auto-scans both ~/.pi/agent/sessions and ~/.omp/agent/sessions when custom paths aren’t specified.
  • Documentation

    • Updated the guides and pi adapter README to clarify default session-path autodetection and how scanning behavior changes with PI_AGENT_DIR/--pi-path.
  • Tests

    • Added coverage for detecting default session directories when both, one, or neither exists.

oh-my-pi (omp) is a widely used pi fork that writes identical JSONL
session files with the same message.usage schema. Auto-detect
~/.omp/agent/sessions alongside ~/.pi/agent/sessions when neither
--pi-path nor PI_AGENT_DIR is set, so omp users get usage reports
without having to pass --pi-path manually. Both directories are scanned
and entries are deduplicated by the loader; setting PI_AGENT_DIR or
--pi-path overrides detection and scans only the given paths.

Closes ccusage#1193

Signed-off-by: Stefan Giroux <[email protected]>
@pullfrog

pullfrog Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

no API key found — this repo is configured to use deepseek/deepseek-v4-pro, which needs DEEPSEEK_API_KEY, but the runner has no key for it.

To fix: add the key as a GitHub Actions secret (referenced from your workflow's env: block) or as a Pullfrog secret in the console — or switch this repo to a different model (free models need no key).

Open repo secrets → · Configure model → · Setup docs → · Ask in Discord →

Pullfrog  | Rerun failed job ➔View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds ~/.omp/agent/sessions as a second auto-detected default session directory in the pi adapter alongside ~/.pi/agent/sessions. A new helper and constant replace the previous single-path probe, with documentation updates describing the dual-path behavior.

Changes

OMP Auto-Detection for Pi Adapter

Layer / File(s) Summary
DEFAULT_SESSION_DIRS constant, helper, call site, and tests
rust/crates/ccusage/src/adapter/pi/paths.rs
Adds both default session paths, discovers existing directories through default_session_dirs, updates paths, and tests both, single, and absent directory cases.
Documentation updates
rust/crates/ccusage/src/adapter/pi/README.md, docs/guide/pi/index.md, docs/guide/getting-started.md
Documents automatic detection of pi-agent and oh-my-pi session directories and the behavior of explicit path overrides.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: enhancement

Suggested reviewers: ryoppippi

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding automatic OMP session detection in the pi adapter.
Linked Issues check ✅ Passed The code and docs add ~/.omp/agent/sessions fallback detection for pi, matching issue #1193's OMP support request.
Out of Scope Changes check ✅ Passed The diff stays focused on OMP session autodetection, related docs, and tests without unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch feat/pi-omp-support

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

This PR was auto-closed. Only contributors approved with lgtm can open PRs. Open an issue first.

Maintainers review auto-closed issues and reopen worthwhile ones. Issues that do not meet the quality bar in CONTRIBUTING.md may not be reopened or receive a reply.

If a maintainer replies lgtmi, your future issues will stay open. If a maintainer replies lgtm, your future issues and PRs will stay open.

See CONTRIBUTING.md.

@github-actions github-actions Bot closed this Jun 18, 2026
@ryoppippi ryoppippi reopened this Jun 21, 2026
@yenba

yenba commented Jul 5, 2026

Copy link
Copy Markdown

Bump, would love to see omp support!

cobra91 added a commit to cobra91/better-ccusage that referenced this pull request Jul 19, 2026
Read the JSONL session files that pi and its widely used fork oh-my-pi
(omp) write under ~/.pi/agent/sessions and ~/.omp/agent/sessions, and
normalize each billable assistant message into the shared UsageData
shape, aggregated alongside the other 6 sources.

Both directories are auto-detected when neither PI_AGENT_DIR nor a
custom path is set (matches upstream ccusage PR ccusage/ccusage#1338).
Entries are deduplicated by the loader's createUniqueHash, so a session
file present in both directories is counted once.

Token accounting is additive (the Claude model): the four buckets
(input/output/cacheRead/cacheWrite) are independent and summed, with NO
subtraction of cached tokens from input (unlike Codex). The
totalTokens fallback folds the surplus into output_tokens when output
is 0 (matches upstream's apply_total_token_fallback).

Cost: emits message.usage.cost.total (USD) so the default 'auto' cost
mode uses it directly; 'calculate' mode recomputes from tokens.

Per upstream omp PR #1338, models are NOT prefixed ([pi]/[omp]): both
default directories share the 'pi' source label and pricing lookup.

17 new inline tests (record accept/reject, cache buckets, totalTokens
fallback, non-object cost, zero-token/no-model skip, omp vs pi dedup,
nested path extraction, path resolution, totalTokens fallback unit).

Docs: new guide pi.md, README + env var (PI_AGENT_DIR) + sidebar.
Backward compat verified: monthly --compact runs without regression.

Ported from upstream ccusage (pi adapter default branch + PR #1338).
cobra91 added a commit to cobra91/better-ccusage that referenced this pull request Jul 19, 2026
* feat(pi): add pi / oh-my-pi usage adapter with omp auto-detection

Read the JSONL session files that pi and its widely used fork oh-my-pi
(omp) write under ~/.pi/agent/sessions and ~/.omp/agent/sessions, and
normalize each billable assistant message into the shared UsageData
shape, aggregated alongside the other 6 sources.

Both directories are auto-detected when neither PI_AGENT_DIR nor a
custom path is set (matches upstream ccusage PR ccusage/ccusage#1338).
Entries are deduplicated by the loader's createUniqueHash, so a session
file present in both directories is counted once.

Token accounting is additive (the Claude model): the four buckets
(input/output/cacheRead/cacheWrite) are independent and summed, with NO
subtraction of cached tokens from input (unlike Codex). The
totalTokens fallback folds the surplus into output_tokens when output
is 0 (matches upstream's apply_total_token_fallback).

Cost: emits message.usage.cost.total (USD) so the default 'auto' cost
mode uses it directly; 'calculate' mode recomputes from tokens.

Per upstream omp PR #1338, models are NOT prefixed ([pi]/[omp]): both
default directories share the 'pi' source label and pricing lookup.

17 new inline tests (record accept/reject, cache buckets, totalTokens
fallback, non-object cost, zero-token/no-model skip, omp vs pi dedup,
nested path extraction, path resolution, totalTokens fallback unit).

Docs: new guide pi.md, README + env var (PI_AGENT_DIR) + sidebar.
Backward compat verified: monthly --compact runs without regression.

Ported from upstream ccusage (pi adapter default branch + PR #1338).

* fix(pi): correct 'unparseable' typo flagged by typos spell-check

ci(spell): unparseable -> unparsable

* fix(pi): integrate sourceFilter gate from #51 into pi loader blocks

Rebased onto main (which merged #51 adding source filtering via
`better-ccusage <source> <report>`). The pi load blocks in the 3
loaders (loadDailyUsageData, loadSessionData, loadSessionBlockData)
were added before #51 and lacked the sourceFilter gate, so
`better-ccusage pi daily` would not isolate pi. Wrap each pi block in
`if (sourceFilter == null || sourceFilter === 'pi')` to match the
devin/codex/opencode pattern.

Verified e2e: `better-ccusage pi daily` now isolates pi; global
`daily` still aggregates all sources (backward compat).

* docs: accurate source inventory (7 tools) + fork positioning vs upstream

The README 'About'/'Why the Fork' and the docs index/getting-started
sections were outdated: they listed only Claude/Droid/ZCode and framed
the fork as 'ccusage only supports Claude Code'. Both are now inaccurate
— better-ccusage supports 7 sources and upstream ccusage has itself
diverged into a Rust workspace with its own source set.

- README: new 'Supported data sources' table (7 tools + data locations),
  rewritten 'Why the fork' covering multi-source AND multi-provider,
  explicit divergence note (TS monorepo vs Rust workspace), pi added
  to tagline + source-filter examples.
- docs/index.md: intro mentions all 7 tools; 'Why better-ccusage'
  rewritten with the same multi-source + multi-provider framing and the
  upstream-divergence callout.
- getting-started.md: prerequisites list all 7 tools and the SQLite
  runtime requirement (Node 22.13+ for zcode/opencode/devin).

* fix(pi): dedup multi-dir entries in adapter + correct doc links

Address CodeRabbit major review (2x): loadSessionData and
loadSessionBlockData don't run the createUniqueHash gate on non-Claude
source loops, so pi (which scans BOTH ~/.pi and ~/.omp) could
double-count sessions present in both directories. Fix at the adapter
boundary: processPiSessions now deduplicates by message.id (which
encodes sessionId + timestamp + model + token buckets) before returning,
so no entry set is counted twice regardless of the loader.

Test 'deduplicates omp vs pi' updated: same content in both dirs now
yields 1 entry (was 2, relying on downstream dedup that doesn't exist
for these loaders). New test 'keeps distinct sessions that share a
timestamp' verifies genuinely different sessions are preserved.

Also drop speculative pi/omp GitHub links from docs/guide/pi.md (the
repos are not verified; pi is a product, not an open CLI repo) and add
pi to the devin.md source list.
@ryoppippi

Copy link
Copy Markdown
Member

@pullfrog review it
@codesmith review it
@cubic review it
@coderabbitai review it

@ryoppippi

Copy link
Copy Markdown
Member

@pullfrog resolve conflicts

@cubic-dev-ai

cubic-dev-ai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@pullfrog review it
@codesmith review it
@cubic review it
@coderabbitai review it

@ryoppippi I have started the AI code review. It will take a few minutes to complete.

@blacksmith-sh

blacksmith-sh Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

On it, I'm reviewing the PR changes now.

View with Codesmith

@pullfrog

pullfrog Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Resolved the merge conflicts between feat/pi-omp-support and origin/main and verified the resolution with cargo test -p ccusage pi (57 tests passed).

Files resolved:

  • docs/guide/pi/index.md — kept the omp auto-detection row/paragraph and integrated the named stores section. Updated the named-store example to a non-default path (myfork) so it does not conflict with the now-default ~/.omp/agent/sessions scan.
  • rust/crates/ccusage/src/adapter/pi/paths.rs — combined the new default pi + omp directory detection with the existing named-store helpers and tests, keeping everything pub(crate).

However, the push failed:

remote: Permission to sgfeniex/ccusage.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/sgfeniex/ccusage.git/': The requested URL returned error: 403

maintainerCanModify is enabled, but the runner token still cannot push to the fork. A maintainer with write access to sgfeniex/ccusage (or the author) will need to pull the resolved commit and push it, or the conflicts can be re-resolved locally on the PR branch.

Task list (4/4 completed)
  • Check out PR and fetch base branch
  • Attempt merge and detect conflicts
  • Resolve any merge conflicts
  • Verify resolution and push

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | via Pullfrog | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

@ryoppippi: I’ll review the changes.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@blacksmith-sh

blacksmith-sh Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@ryoppippi

@pullfrog review it
@codesmith review it
@cubic review it
@coderabbitai review it

I reviewed the diff on the PR head (c0241a9). Here's my assessment.

Verdict: looks good, safe to merge. The change is minimal, correct, and well-tested, and it follows the repo's cross-cutting docs flow (getting-started, pi guide, and the adapter README are all updated in the same commit).

What I checked:

  • default_session_dirs in rust/crates/ccusage/src/adapter/pi/paths.rs:42 returns .pi before .omp in a deterministic order, filtering each by is_dir(). The override precedence in paths() is right: --pi-path wins, then PI_AGENT_DIR, then auto-detect, so the "overrides scan only the given paths" claim in the description holds.
  • The dedup claim is accurate. load_entries_inner (loader.rs:27) keeps a single seen set across all returned paths and dedups by parser::entry_id (content-based: project + session_id + timestamp + tokens + cost), so genuinely distinct pi/omp sessions are both counted while overlapping content collapses.
  • The four tests cover every dir-presence combination and assert exact vector equality (including order). They line up with the Fixture API (create_dir_all/root() both return tempdir.join(...)), so the equality assertions are valid.

Two minor, non-blocking notes:

  1. Symlinked default dirs get read twice. If a user has ~/.omp/agent/sessions symlinked to ~/.pi/agent/sessions (plausible for a fork that reuses config), is_dir() follows symlinks so both paths are returned and every file is parsed twice. The entry-level dedup makes this correct (no double counting), just wasteful I/O. The codex adapter dedupes at the file/path level (codex/paths.rs) instead; not worth adopting that here unless it shows up in practice. This also mirrors existing_path_list, which doesn't canonicalize either, so it's consistent with current behavior.

  2. Override drops omp auto-detect. Setting PI_AGENT_DIR (e.g. a pi user customizing only their pi path) silently stops scanning ~/.omp. That's the documented, intentional tradeoff, so fine, just flagging it as the one behavioral sharp edge for anyone reading later.

I didn't run cargo test locally (bare sandbox, full crate build is slow); CI is the source of truth and the tests are straightforward. No code changes needed from me.

View with Codesmith

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/guide/getting-started.md`:
- Line 172: Update the pi-agent entry in the getting-started documentation to
state that ~/.omp/agent/sessions is auto-scanned only when neither PI_AGENT_DIR
nor the --pi-path option is set; preserve the existing PI_AGENT_DIR path
description.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2dd43b71-1734-4992-8677-71e3c86b5290

📥 Commits

Reviewing files that changed from the base of the PR and between 02843ad and c0241a9.

📒 Files selected for processing (4)
  • docs/guide/getting-started.md
  • docs/guide/pi/index.md
  • rust/crates/ccusage/src/adapter/pi/README.md
  • rust/crates/ccusage/src/adapter/pi/paths.rs

- Codebuff: `${CODEBUFF_DATA_DIR:-~/.config/manicode}`
- Hermes Agent: `${HERMES_HOME:-~/.hermes}/state.db`
- pi-agent: `${PI_AGENT_DIR:-~/.pi/agent/sessions}`
- pi-agent: `${PI_AGENT_DIR:-~/.pi/agent/sessions}` (also auto-scans `~/.omp/agent/sessions` for oh-my-pi)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Qualify OMP auto-detection by the override condition.

When PI_AGENT_DIR is set, the adapter returns those paths and does not scan ~/.omp/agent/sessions. Update this entry to say OMP is auto-scanned only when neither PI_AGENT_DIR nor --pi-path is set.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/guide/getting-started.md` at line 172, Update the pi-agent entry in the
getting-started documentation to state that ~/.omp/agent/sessions is
auto-scanned only when neither PI_AGENT_DIR nor the --pi-path option is set;
preserve the existing PI_AGENT_DIR path description.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="docs/guide/getting-started.md">

<violation number="1" location="docs/guide/getting-started.md:172">
P3: The parenthetical "(also auto-scans `~/.omp/agent/sessions` for oh-my-pi)" is unconditionally attached to the `PI_AGENT_DIR` line, implying OMP is always scanned. However, looking at `paths.rs`, when `PI_AGENT_DIR` or `--pi-path` is set the adapter returns early and never reaches `default_session_dirs`. Consider qualifying this, e.g., "(when no override is set, also auto-scans `~/.omp/agent/sessions` for oh-my-pi)" to match the actual behavior documented in `docs/guide/pi/index.md`.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

- Codebuff: `${CODEBUFF_DATA_DIR:-~/.config/manicode}`
- Hermes Agent: `${HERMES_HOME:-~/.hermes}/state.db`
- pi-agent: `${PI_AGENT_DIR:-~/.pi/agent/sessions}`
- pi-agent: `${PI_AGENT_DIR:-~/.pi/agent/sessions}` (also auto-scans `~/.omp/agent/sessions` for oh-my-pi)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The parenthetical "(also auto-scans ~/.omp/agent/sessions for oh-my-pi)" is unconditionally attached to the PI_AGENT_DIR line, implying OMP is always scanned. However, looking at paths.rs, when PI_AGENT_DIR or --pi-path is set the adapter returns early and never reaches default_session_dirs. Consider qualifying this, e.g., "(when no override is set, also auto-scans ~/.omp/agent/sessions for oh-my-pi)" to match the actual behavior documented in docs/guide/pi/index.md.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/guide/getting-started.md, line 172:

<comment>The parenthetical "(also auto-scans `~/.omp/agent/sessions` for oh-my-pi)" is unconditionally attached to the `PI_AGENT_DIR` line, implying OMP is always scanned. However, looking at `paths.rs`, when `PI_AGENT_DIR` or `--pi-path` is set the adapter returns early and never reaches `default_session_dirs`. Consider qualifying this, e.g., "(when no override is set, also auto-scans `~/.omp/agent/sessions` for oh-my-pi)" to match the actual behavior documented in `docs/guide/pi/index.md`.</comment>

<file context>
@@ -169,7 +169,7 @@ If ccusage shows no data, check:
    - Codebuff: `${CODEBUFF_DATA_DIR:-~/.config/manicode}`
    - Hermes Agent: `${HERMES_HOME:-~/.hermes}/state.db`
-   - pi-agent: `${PI_AGENT_DIR:-~/.pi/agent/sessions}`
+   - pi-agent: `${PI_AGENT_DIR:-~/.pi/agent/sessions}` (also auto-scans `~/.omp/agent/sessions` for oh-my-pi)
    - Goose: standard Goose data roots or `GOOSE_PATH_ROOT`
    - Kilo: `${KILO_DATA_DIR:-~/.local/share/kilo}`
</file context>
Suggested change
- pi-agent: `${PI_AGENT_DIR:-~/.pi/agent/sessions}` (also auto-scans `~/.omp/agent/sessions` for oh-my-pi)
- pi-agent: `${PI_AGENT_DIR:-~/.pi/agent/sessions}` (also auto-scans `~/.omp/agent/sessions` for oh-my-pi when no override is set)

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — Auto-detect oh-my-pi (omp) session directories alongside pi-agent defaults, scan both when no override is set, and update the pi adapter docs and tests.

  • Auto-detect both ~/.pi/agent/sessions and ~/.omp/agent/sessions when neither --pi-path nor PI_AGENT_DIR is set.
  • Replace the single default path with an ordered list in rust/crates/ccusage/src/adapter/pi/paths.rs while keeping the override paths behavior unchanged.
  • Add fixture-backed unit tests covering all default-directory combinations (both present, only pi, only omp, neither).
  • Update user-facing docs in docs/guide/pi/index.md and docs/guide/getting-started.md to describe the new auto-detection behavior.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | Using Kimi K2 (free via Pullfrog for OSS) | 𝕏

@codesmith

Copy link
Copy Markdown

@ryoppippi
I have no connection to this repository!!!!
Please don't mention!!!!!!

@ryoppippi

Copy link
Copy Markdown
Member

sorry! i'll take care of it

@ryoppippi

Copy link
Copy Markdown
Member

@pullfrog plz fix conflicts

@pullfrog

pullfrog Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

I resolved the merge conflicts in PR #1338 and verified the changes, but I cannot push the resolution to the fork branch.

What I did:

  • Merged origin/main into feat/pi-omp-support.
  • Resolved conflicts in docs/guide/pi/index.md and rust/crates/ccusage/src/adapter/pi/paths.rs, keeping both the PR's oh-my-pi auto-detection and the main branch's named-store support.
  • Ran cargo test -p ccusage pi -- --nocapture — all 57 pi-related tests passed.
  • Committed the resolution locally.

Blocker:
pullfrog_push_branch failed with a 403 permission error when trying to push to the fork sgfeniex/ccusage:

remote: Permission to sgfeniex/ccusage.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/sgfeniex/ccusage.git/': The requested URL returned error: 403

The resolved merge commit is on the local pr-1338 branch, but because the environment is ephemeral it will be lost unless the branch can be pushed. The most likely fix is ensuring the fork grants github-actions[bot] (or the Pullfrog app) write access to the PR branch.

Task list (4/5 completed)
  • Checkout PR branch and identify base branch
  • Attempt merge with origin/main and check for conflicts
  • Resolve any merge conflicts manually
  • Verify resolution with build/test
  • Commit and push resolved branch

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | via Pullfrog | Using Kimi K2 (free via Pullfrog for OSS) (DeepSeek Pro not used — the program covers this model; add its provider key to run your pick) | 𝕏

@ryoppippi

Copy link
Copy Markdown
Member

Thanks for putting this together, and sorry for the slow reply.

Since this PR was opened, #1397 landed named pi-format stores, which covers this use case in a more general way. omp is the documented example for it:

{
	"$schema": "https://ccusage.com/config-schema.json",
	"pi": {
		"stores": [
			{ "name": "omp", "path": "~/.omp/agent/sessions" }
		]
	}
}

That reports omp alongside the default pi agent in ccusage daily / monthly / weekly / session, under its own omp agent name with [omp]-prefixed model labels, so the two sources stay separately attributable.

Auto-detecting ~/.omp/agent/sessions as a default pi path would also conflict with that feature. resolve_named_pi_store_paths seeds its owner map from the default pi paths and rejects overlaps, so anyone using the config above would hit a hard error on startup:

Invalid ccusage config: pi.stores name 'omp' paths overlap default pi store

I verified this by porting the change onto current main (the pi adapter has since moved to rust/adapters/pi/): the documented config loads fine on main, and fails with the error above once this change is applied.

The code itself is good — main just grew a different solution in the meantime. Closing for that reason. Thanks again for the contribution, and for following up on #1193.

@ryoppippi ryoppippi closed this Jul 27, 2026
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.

Feat: Add OMP Directory Support

4 participants