Skip to content

hardening: cache-scope escape hatch, promptSource on large lines, distinct Grok 4.5 rows - #1031

Merged
iamtoruk merged 4 commits into
mainfrom
fix/pre-release-hardening
Aug 18, 2026
Merged

hardening: cache-scope escape hatch, promptSource on large lines, distinct Grok 4.5 rows#1031
iamtoruk merged 4 commits into
mainfrom
fix/pre-release-hardening

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

Three small pre-release hardening items, separate commits.

  1. CODEBURN_CACHE_SCOPE=all — escape hatch for perf(cache): shard the session cache by provider and month, load only the months a query needs #1007's month-scoped shard loads: one line at the loadCache chokepoint forces a full read; memo key becomes all so a resident serve reuses it; deliberately not in PROVIDER_ENV_VARS (read policy, must not invalidate caches). Documented in docs/architecture.md + CHANGELOG. Test: scoped load under the env equals the unscoped load and the memo is shared. Real data: a fixed past range (export --from 2026-08-16 --to 2026-08-17, 8,217 calls) is identical modulo generated with and without the env.
  2. promptSource kept for > 32 KB lines (fixes parser: add promptSource to LARGE_ROOT_FIELDS and remove the >32 KB head/tail workaround #1030, fully closes parser: parseLargeJsonl drops isSidechain/promptSource for lines > 32 KB #1023): added to LARGE_ROOT_FIELDS; optimize: detect recurring context pasted at the start of sessions #1021's head/tail regex workaround in isMachineWrittenPrompt deleted (it only looked at 2 KB from each end). No cache change — optimize re-scans raw JSONL. Test with a > 32 KB line carrying promptSource:"sdk" + isSidechain:true; the existing > 32 KB exclusion test now passes via the parsed field.
  3. Grok 4.5 rows distinguishable (fixes models: grok-4.5-build and grok-4.5 collapse to one 'Grok 4.5' display name, showing duplicate rows #1029): grok-4.5-build collapsed onto grok-4.5 in getShortModelName's prefix match — used by the menubar and model-breakdown too — so the fix is SHORT_NAMES['grok-4.5-build'] = 'Grok 4.5 (build)' (longest-first wins). Display only; ids and pricing untouched. Real data: two Grok 4.5 rows → Grok 4.5 (build) $33.44 + Grok 4.5 $0.41.

tsc clean · npm test 2906 · test:locks 26 · app 503.

The month-scoped load a ranged query takes is a behaviour change on a warm
cache with no way back except deleting it. Drop the scope in loadCache, the
one place every caller (including the resident serve) routes through, so a
suspect scoped read can be compared against a full one in place.

Read policy only: deliberately not in PROVIDER_ENV_VARS, so setting or
unsetting it invalidates nothing.
parseLargeJsonl dropped promptSource for exactly the lines SDK-generated
prompts live on, so the recurring-context detector regex-scanned the ends of
the raw line for it. Add the field to LARGE_ROOT_FIELDS (tiny scalar,
add-only, isSidechain already there) and delete the workaround: it read only
2 KB from each end, so a flag further in was missed.

No cache change: optimize scans the raw JSONL each run, so promptSource never
has to persist on CachedFile.

Fixes #1030. With #994 this closes #1023.
Reports bucket rows by model id and label them afterwards, so the two ids
collapsing onto one display name printed what looked like the same row twice
with different numbers. Give the variant its own SHORT_NAMES entry, which the
longest-first match picks over the grok-4.5 prefix. Display only: ids are
untouched, so nothing re-parses and no cost moves.

Fixed in the shared table rather than the grok provider so the menubar and
model-breakdown, which call getShortModelName directly, get it too.

Fixes #1029.
@iamtoruk
iamtoruk merged commit 6325b42 into main Aug 18, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant