Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes Codex usage discovery for current Pi session locations while preserving legacy roots.
Changes:
- Adds normalized, deduplicated Pi session roots.
- Includes effective roots in cache identity and scanning.
- Expands scanner coverage for custom paths and aliases.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
bin/omarchy-agent-usage-codex |
Adds Pi root discovery, normalization, and cache isolation. |
test/shell.d/agent-usage-codex-scanner-test.sh |
Tests supported roots, aliases, custom paths, and caching. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Pi documents PI_CODING_AGENT_DIR as defaulting to ~/.pi/agent and has never written to ~/.config/pi on its own; sessions land there only when the variable points there. Falling back to ~/.config/pi scanned a directory Pi does not use, and the test called it Pi's default. The test now sets the variable to that directory, the layout the report describes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Reviewed and tested on a disposable Omarchy worker. The fix works, and I pushed one small correction to your branch. Reproduction. A temporary home with a Codex session under Pushed: b04d6e5. When Tests, on the worker at b04d6e5: Proportionality. The collector change is the size the problem needs. The roots have to be deduplicated, or setting the variable to Pi's default would count every session twice. The cache key has to include the roots, or changing the variable would serve the old scan until the cache expires. Not in this PR: Second opinion: none. The configured reviewer (Codex Medium) answered a ping but refused this review because its daily budget was spent. This review is one model's reasoning (Claude Opus 5.5), with no second opinion. It waits on that second opinion at this head, then on the maintainer. |
quattro now finds Pi and omp profile roots and keeps a per-file cache for native sessions, which both touch the code this branch changed. PI_CODING_AGENT_DIR becomes one more root beside the profiles, added only when set. Aliased roots are deduplicated by their resolved path but scanned under the path as given, because parentSession links name sessions by the path pi used and fork deduplication matches on it. The pi roots are hashed into the aggregate scan cache key only, so the per-file cache of native sessions survives a change of the variable. The variable's tests move to a fixture home of their own, so quattro's fork, profile and collision fixtures keep their totals. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pi expands only a leading ~ or ~/ in PI_CODING_AGENT_DIR and leaves ~name as a literal relative directory, so expanduser() sent ~name to another user's home or dropped it. And when the variable aliases a default root, Pi names a fork's parent by the variable's spelling: scanning the default spelling instead missed the parent and counted the fork as its own session. The variable's root now comes first, so deduplication keeps its spelling. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
A PI_CODING_AGENT_DIR that aliases a default root is scanned under one spelling, while a fork's parentSession carries whichever spelling Pi used when it was written, which differs for sessions forked before the variable was set. Comparing the strings left those forks without a parent, so each counted as a session of its own. Session paths and parent references are both resolved now, so either spelling finds the parent. Co-Authored-By: Claude Opus 5.5 <[email protected]> Co-Authored-By: Codex Medium <[email protected]>
|
This branch had started conflicting with The merge (7da230e). Two fixes from the second opinion:
Reproduction, on a disposable Omarchy worker. With Tests, on the worker at d6df764: Reviewed by Claude Opus 5.5, with Codex Medium as the second opinion. Its two findings above went beyond my own review; its last round was clean. It waits on the maintainer. |
|
A symlinked PI_CODING_AGENT_DIR or CODEX_HOME that was repointed kept its own spelling, so the cache key stayed the same and the old directory's totals were reused. Key by the resolved path instead.
|
Reviewed your two new commits (f04d577 and 22fa2f4) on a disposable Omarchy worker. Nothing found, and nothing pushed. What they fix. The aggregate scan cache was keyed by the spelling of Reproduction. Your new tests pass at 22fa2f4. They fail at d6df764, the head before your commits, and they fail again with either Tests, on the worker. At 22fa2f4, Second opinion. Reviewed by Claude Opus 5.5, with Codex Medium as the second opinion. It found no defects and agreed that the change is correct and the right size. Its independence is not guaranteed. It points out that the tests prove the aggregate cache is invalidated, but not the per-file cache. That is a gap in coverage, not a defect. This waits on the maintainer. |
|
Added a test (04750c7) for the per-file cache gap mentioned in the last review: with the aggregate cache dropped, repointing Disclosure: drafted with an AI assistant, reviewed and posted by me. |
|
Re-reviewed the new commit, 04750c7 (test: cover per-file cache after CODEX_HOME symlink is repointed). Nothing found. The new test does what it says. Both fixture sessions are the same size, Codex Medium reviewed the commit as a second opinion and agreed that it is sound and proportionate; it ran with access to this session's notes, so its independence is not guaranteed. It noted that a run crossing midnight between creating the fixtures and This is waiting on the maintainer. |
|
Re-checked after What happened on Checked on a disposable Omarchy worker. I ran a reproduction using the layout from #7194, with a Pi session under
On this pull request's old base (a85e29a), four of the five fail: the moved session is never counted. On What this branch does that
Second opinion. Codex Medium and muse-wonder via pi (thinking high) both reviewed this. Both agreed that This is waiting on the maintainer. My recommendation is to close it as already fixed by #14040, and #7194 with it. Thanks @Longado for the report and the fix, and for the symlink cases your tests found. |
Problem
The Agents panel only scans the legacy Pi session directory, so current Pi sessions under ~/.config/pi are missing from Codex usage totals.
Change
Tests
Fixes #7194