🤖 fix: attribute session usage sources and dedupe abort cleanup#2627
🤖 fix: attribute session usage sources and dedupe abort cleanup#2627ibetitsmike wants to merge 1 commit intomainfrom
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17ddca6fef
ℹ️ 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".
17ddca6 to
8f55612
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f55612f93
ℹ️ 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".
8f55612 to
d5c7e7b
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Add source-level session usage attribution and harden stream abort cleanup so interrupted streams cannot double-count token usage or continue consuming work after a soft interrupt.
Background
We needed clearer attribution for high input-token sessions (main chat vs. system overhead) and identified interrupt-path races that could overcount usage during abort handling.
Implementation
SessionUsageSourcecategories (main,system1,plan,subagent) and threaded attribution through:SessionUsageService)AIService,System1ToolWrapper)WorkspaceStore)bySourcecosts aligned with repricedbyModeltotals using blended session component rates, preventing stale source-cost displays after pricing/mapping changes.Validation
make static-checkbun test src/node/services/streamManager.test.ts src/node/services/sessionUsageService.test.ts src/browser/stores/WorkspaceStore.test.ts src/common/orpc/schemas/chatStats.test.tsRisks
Generated with
mux• Model:openai:gpt-5.3-codex• Thinking:xhigh• Cost:$13.74