Include archived Codex sessions in usage reports (rebased, supersedes #663)#667
Open
ozymandiashh wants to merge 1 commit into
Open
Include archived Codex sessions in usage reports (rebased, supersedes #663)#667ozymandiashh wants to merge 1 commit into
ozymandiashh wants to merge 1 commit into
Conversation
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.
Rebases #663 by @gt-zhangshihao03 onto current
mainand opens it as a maintainer PR. The original had a merge conflict withmainafter #656 landed; the code is unchanged from #663 apart from resolving a README provider-table conflict. The original commit authorship is preserved.What it does
Discovers Codex
rollout-*.jsonlfiles from the flat~/.codex/archived_sessionsdirectory in addition to the date-partitioned~/.codex/sessions/YYYY/MM/DD, using the same metadata validation and project attribution for both. Archiving a Codex conversation (which moves its rollout file toarchived_sessions) no longer erases its historical usage from reports.Maintainer verification
codex:${forkedFromId||sessionId}:${cumulativeTotal}:…) via aseenKeysset created once and shared across all sources (src/parser.ts). Identical content at two paths yields identical keys, so the second copy is skipped. Confirmed on code.readdir(sessionsDir).catch(() => [])change lets a home with nosessions/directory fall through to the archived scan. The regression test builds a fresh temp home containing onlyarchived_sessions/, so it genuinely exercises that path (the old early-return would have failed it).firstTimestampand sorts, rather than relying on discovery order.npx tsc --noEmitclean;npx vitest run tests/providers/codex.test.tsgreen (22 tests).Fixes #662
Supersedes #663 (original work by @gt-zhangshihao03)