- Coerce missing `stopReason`, token counts, and timestamps at the parser boundary to satisfy database NOT NULL constraints.
- Skip assistant entries missing essential model attribution or usage data instead of aborting the sync process.
- Filter invalid tool call blocks that lack required identifiers to ensure successful database insertion.
- Resolved a crash occurring when syncing legacy session files that lack usage cost breakdowns.
- Updated cost resolution to fallback to catalog pricing when stored cost is unavailable or zero.
- Adjusted yelling, profanity, and anguish criteria to reduce false-positive metrics.
- Implemented refined regex patterns for negation, blame, and noise reduction.
- Incremented the backfill key to v8 to accommodate updated signal definitions.
- Expanded test suite to validate new constraints for yelling, exclusion words, and sentiment triggers.
getSessionEntry in packages/stats/src/parser.ts previously read the entire session file into memory and parsed every entry just to find one by ID. It now streams the file line-by-line via readLines and returns on the first matching entry, stopping I/O and parsing early. In packages/stats/src/gain-aggregator.ts, readSnapcompactRecords now stats snapcompact-savings.jsonl and caches parsed records keyed by mtimeMs and size, reusing them when the append-only journal has not changed. Cutoff filtering, per-request session:toolCallId deduplication, and project filtering are still applied per call. Verified with bun test test/gain-aggregator.test.ts in packages/stats (3 pass, 0 fail, 16 expect() calls, 1 file, 757.00ms) and bun run check:types.
Closes#4251
- Allowed the priority premium-request fixture to set assistant message `api` values.
- Covered direct Anthropic priority traffic with `api: "anthropic-messages"` so premium-request backfill follows API-family classification.
- Migrated global service tier settings to a per-model-family architecture (OpenAI, Anthropic, Google).
- Implemented `ServiceTierByFamily` mapping to allow independent configuration and resolution per provider.
- Added automatic migration logic for legacy service tier and fast-mode application settings.
- Updated telemetry, session management, and task execution to support provider-specific tier resolution.