Usage: include reset and deleted session archives#43215
Usage: include reset and deleted session archives#43215frankekn merged 5 commits intoopenclaw:mainfrom
Conversation
Greptile SummaryThis PR fixes a real under-counting bug: usage aggregation and session discovery previously ignored Two logic issues need attention before merging:
Confidence Score: 3/5
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 007b6378db
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79a501581f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
943fe08 to
afa5239
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: afa5239c1d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b167ed4975
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
|
||
| for (const entry of entries) { | ||
| if (!entry.isFile() || !entry.name.endsWith(".jsonl")) { | ||
| if (!entry.isFile() || !isUsageCountedSessionTranscriptFileName(entry.name)) { |
There was a problem hiding this comment.
Filter archived sessions by transcript activity window
Including *.jsonl.reset.*/*.jsonl.deleted.* in discovery here makes the existing mtime-based date filter inaccurate for archived transcripts, because archive rename time is often much newer than the messages inside the file. If a user deletes an old session today and then requests a recent range (for example, last 7 days), that archive is discovered even when it has no in-range activity; sessions.usage applies limit before loading per-session usage, so these zero-usage rows can displace real in-range sessions. This path should gate archive inclusion on transcript timestamps (or drop sessions with no in-range usage before limiting).
Useful? React with 👍 / 👎.
b167ed4 to
5cf4c67
Compare
5cf4c67 to
49ed6c2
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Merged via squash.
Thanks @rcrick! |
Summary
*.jsonlsession transcripts and skipped archived*.jsonl.reset.*/*.jsonl.deleted.*transcripts./new, session reset, or deleting old sessions.resetanddeletedtranscript archives, and per-session usage detail falls back to archived transcripts when the active file no longer exists.*.jsonl.bak.*archives are still excluded to avoid double-counting backup copies.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
OPENCLAW_STATE_DIRpointed at temp test state dirsSteps
*.jsonl, archived*.jsonl.reset.*, archived*.jsonl.deleted.*, and backup*.jsonl.bak.*.Expected
bakarchives are not counted.Actual
*.jsonltranscripts were counted, so reset/deleted usage was omitted.Evidence
Targeted tests run:
Result: 23 tests passed.
Human Verification (required)
What you personally verified (not just CI), and how:
bak; loaded summary/timeseries/logs from archived reset transcript fallback.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
src/config/sessions/artifacts.ts,src/infra/session-cost-usage.ts,src/gateway/server-methods/usage.tsRisks and Mitigations
resetanddeletedarchives are included;bakremains excluded, with test coverage for that boundary.