mirror of
https://github.com/stablyai/orca.git
synced 2026-10-31 00:57:45 +00:00
Codex usage no longer double-counts forked sessions: forks copy the parent's token_count events with fresh timestamps, so cumulative events are now keyed on turn id + totals (timestamp fallback when no turn id); the turn id is kept in the incremental-scan checkpoint and the usage cache is rebuilt once. Fixes #19139 Supersedes #19152 Co-authored-by: Jio Kim <26668612+MeroZemory@users.noreply.github.com>
15 lines
672 B
TypeScript
15 lines
672 B
TypeScript
import type { UsageProvider } from '../usage/usage-provider-contract'
|
|
import { scanCodexUsageFilesViaWorker } from '../usage/usage-scan-worker-spawn'
|
|
import type { CodexUsageDailyAggregate, CodexUsageSession } from './types'
|
|
|
|
// Rescan older caches: v5 deduplicates forks across sessions; v6 adds per-request long-context counts;
|
|
// v7 keys fork copies on turn id because forks rewrite copied timestamps.
|
|
export const CODEX_USAGE_SCHEMA_VERSION = 7
|
|
|
|
export const codexUsageProvider = {
|
|
id: 'codex',
|
|
label: 'Codex',
|
|
schemaVersion: CODEX_USAGE_SCHEMA_VERSION,
|
|
scan: scanCodexUsageFilesViaWorker
|
|
} satisfies UsageProvider<CodexUsageSession, CodexUsageDailyAggregate>
|