mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-07-29 10:55:35 +00:00
* fix(copilot): bill CLI input and cache tokens from session.shutdown Copilot CLI sessions (~/.copilot/session-state/*/events.jsonl) recorded only outputTokens, because the parser read assistant.message events and ignored the session.shutdown rollup. That rollup is the sole on-disk source of a CLI session's input, cache-read and cache-write tokens, so cost was underreported (in the reported case 35k+ cache-read tokens were dropped entirely). Handle session.shutdown in the CLI (non-transcript) JSONL path and emit one supplementary call per model from modelMetrics.<model>.usage. The per-turn assistant.message events keep owning output tokens, tools and turn structure; the shutdown call contributes only the input and cache tokens they lack, with output excluded, so no dimension double-counts and the combined cost equals the full CLI-measured cost. usage.inputTokens is cache-inclusive (input + cache_read + cache_write), so the cache components are subtracted to recover the uncached input calculateCost expects. These are real counts written by the CLI, so costIsEstimated is false. Sessions without session.shutdown (crashed or still running) keep the exact previous output-only behavior, and the VS Code, JetBrains and OTel paths are untouched. Bump the copilot entry in PROVIDER_PARSE_VERSIONS so already-cached CLI sessions re-parse and pick up the corrected tokens and cost. * fix(copilot): never emit an empty-timestamp shutdown call A session.shutdown without its own timestamp and without sessionStartTime produced a call with an empty timestamp, which the date-range filters in parser.ts drop silently, erasing exactly the tokens this feature bills. Fall back to the last stamped event in the session. * fix(cache): durable orphans survive provider fingerprint changes Bumping a durable provider's PROVIDER_PARSE_VERSIONS changed its env fingerprint, and getOrCreateProviderSection replaced the whole section on mismatch. For copilot OTel orphans the discarded cache entry is the only remaining record of pruned spans, so the first post-upgrade run silently and permanently erased month-to-date history. Carry forward exactly the entries whose source no longer exists; present sources still drop and re-parse under the new fingerprint, which is the point of a bump. Regression test forges a pre-upgrade fingerprint on a pruned-source orphan and asserts it stays counted and cached across the transition. |
||
|---|---|---|
| .. | ||
| antigravity.test.ts | ||
| claude-config-dirs.test.ts | ||
| cline.test.ts | ||
| codebuff.test.ts | ||
| codewhale.test.ts | ||
| codex.test.ts | ||
| copilot.test.ts | ||
| crush.test.ts | ||
| cursor-agent.test.ts | ||
| cursor-bubble-dedup.test.ts | ||
| cursor-large-db-cap.test.ts | ||
| cursor-real-tokens.test.ts | ||
| cursor-workspace-breakdown.test.ts | ||
| cursor.test.ts | ||
| devin.test.ts | ||
| droid.test.ts | ||
| forge.test.ts | ||
| gemini.test.ts | ||
| grok.test.ts | ||
| hermes.test.ts | ||
| ibm-bob.test.ts | ||
| kilo-code.test.ts | ||
| kimi.test.ts | ||
| kiro.test.ts | ||
| lingtai-tui.test.ts | ||
| mistral-vibe.test.ts | ||
| mux.test.ts | ||
| omp.test.ts | ||
| open-design.test.ts | ||
| openclaw.test.ts | ||
| opencode-file.test.ts | ||
| opencode.test.ts | ||
| pi.test.ts | ||
| roo-code.test.ts | ||
| vercel-gateway.test.ts | ||
| vscode-cline-parser.test.ts | ||
| warp.test.ts | ||
| zcode.test.ts | ||
| zed.test.ts | ||
| zerostack.test.ts | ||