Skip to content

Deduplicate Codex usage across Pi forked sessions - #8602

Open
arisgysel-design wants to merge 1 commit into
omacom:quattrofrom
arisgysel-design:fix/8564-pi-usage-dedupe
Open

Deduplicate Codex usage across Pi forked sessions#8602
arisgysel-design wants to merge 1 commit into
omacom:quattrofrom
arisgysel-design:fix/8564-pi-usage-dedupe

Conversation

@arisgysel-design

Copy link
Copy Markdown

Summary

  • count inherited Pi messages only once across parent and fork session files
  • keep new fork responses and unrelated short-ID collisions distinct
  • derive active sessions from Pi's parentSession lineage so scan order cannot change session totals

Testing

  • bash test/shell.d/agent-usage-codex-scanner-test.sh
  • python3 -m py_compile bin/omarchy-agent-usage-codex
  • bash bin/omarchy commands --check (437 commands)

Fixes #8564

Copilot AI balanced review requested due to automatic review settings August 27, 2026 15:03

Copilot AI 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.

Pull request overview

Deduplicates inherited Codex usage across Pi/OMP fork lineages while preserving usage from new responses and unrelated ID collisions.

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.

Changes:

  • Uses message identity and parentSession ancestry for deterministic usage attribution.
  • Expands scanner tests for forks, scan ordering, and ID collisions.

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 Deduplicates inherited messages and recalculates session ownership.
test/shell.d/agent-usage-codex-scanner-test.sh Tests fork accounting and collision handling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Brams-s

Brams-s commented Sep 6, 2026

Copy link
Copy Markdown

Related native-collector correction: #10531 skips repeated token_count notifications carrying an unchanged cumulative snapshot. I reproduced one 110-token request becoming 220 tokens in current quattro.

It stays within scan_native_codex_sessions() plus cache invalidation and tests; Pi lineage/deduplication remains with this PR. I checked that your current patch applies cleanly alongside it. Linking them so the two distinct duplication cases can be reviewed together without combining their implementations.

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.

Codex usage is counted again after forking or cloning a Pi session

3 participants