You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(copilot): count sessions from session-state when the export is off - #42
Copilot sessions can now show saved usage totals and per-model costs when OpenTelemetry exports are unavailable. These totals include request counts but not per-call Turns.
When export data exists for a session, its usage is shown from that data without combining it with saved totals.
Copilot availability checks now recognize saved session data and clarify when per-call details are unavailable.
Documentation
Updated setup and troubleshooting guidance to explain Copilot session data, export configuration, and feature limitations.
Reviewing files that changed from the base of the PR and between 5362247 and 7d608ad.
Files selected for processing: 5
.github/workflows/ci.yml
docs/backends.md
docs/sources.md
src/opentab/stores/copilot.py
tests/test_stores_copilot.py
Walkthrough
Copilot now recognizes saved session-state logs and uses their runtime usage totals when a session has no exported calls. Exported sessions remain based on OpenTelemetry data. Saved totals contribute to accounting but do not provide conversation turns.
CopilotStore converts saved per-agent, per-model usage into accounting totals. It applies only the checkpoint charge above the latest shutdown and excludes invalid numeric values. Cache version changes to 24.
Export precedence and session presentation src/opentab/stores/copilot.py, tests/test_stores_copilot.py, docs/sources.md
Sessions with exported calls use export data alone. Synthetic saved totals do not appear in conversation timelines or provide turn support. Tests and documentation cover these distinctions.
sequenceDiagram
participant CopilotStore
participant CopilotEvents
participant SessionStateLogs
CopilotStore->>CopilotEvents: List saved sessions
CopilotEvents->>SessionStateLogs: Read session-state event logs
CopilotStore->>CopilotEvents: Request usage summary for a session
CopilotEvents-->>CopilotStore: Return latest start, shutdown, and checkpoint data
CopilotStore->>CopilotStore: Fold totals only when the session has no exported calls
Loading
Possibly related PRs
hamidi-dev/opentab#37: Defines the cache format whose generation is incremented in this pull request.
Merge Risk: Moderate · previous review 53622
Saved-session accounting should handle malformed charge values before merging: one malformed log can prevent all Copilot sessions from loading. Availability messages and documentation also need corrections to accurately describe which saved sessions appear.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 21.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: counting Copilot sessions from session-state when export is disabled.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 21.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 28 functions across 7 files. (3 skipped: 3 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Tip
🎯 Customize your risk assessments
Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.
✅ Automatic approvals, with your rules
Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.
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.
Reviewing files that changed from the base of the PR and between 42f9c3d and 5362247.
Files selected for processing: 10
docs/backends.md
docs/sources.md
docs/troubleshooting.md
src/opentab/cli/doctor.py
src/opentab/sources.py
src/opentab/stores/cached.py
src/opentab/stores/copilot.py
src/opentab/stores/copilot_events.py
tests/test_doctor.py
tests/test_stores_copilot.py
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
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
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.
Summary by CodeRabbit
New Features
Documentation