mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 18:37:24 +00:00
fix(usage): keep deleted worktrees' sessions in the Orca usage totals (#41218)
Usage attribution only knew live worktrees, so deleting one moved its sessions out of the Orca scope on the next scan and Stats & Usage totals went down. Remember every worktree Orca has had in a small usage-owned history and attribute against live plus remembered worktrees, with live rows claiming reused paths first. The history loads off the main thread, scans wait for it, and an unreadable or newer file is never overwritten.
This commit is contained in:
@@ -11,7 +11,7 @@ import type {
|
||||
OpenCodeUsageSnapshot,
|
||||
OpenCodeUsageSummary
|
||||
} from '../../shared/opencode-usage-types'
|
||||
import type { Store } from '../persistence/loading-store/store'
|
||||
import type { UsageWorktreeSource } from '../usage/worktree-attribution/usage-worktree-metadata'
|
||||
import type {
|
||||
OpenCodeUsageDailyAggregate,
|
||||
OpenCodeUsagePersistedState,
|
||||
@@ -50,7 +50,7 @@ export class OpenCodeUsageStore extends UsageProviderStoreLifecycle<
|
||||
OpenCodeUsagePersistedState,
|
||||
'hasAnyOpenCodeData'
|
||||
> {
|
||||
constructor(store: Pick<Store, 'getRepos' | 'getAllWorktreeMeta'>) {
|
||||
constructor(store: UsageWorktreeSource) {
|
||||
super(store, {
|
||||
tokenUsage: {
|
||||
provider: 'opencode',
|
||||
|
||||
Reference in New Issue
Block a user