Skip to content

docs(env): document OMNIROUTE_CORPUS_CACHE_SIZE so Docs Gates goes green again - #11576

Merged
diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.51from
ntdatt812:fix/env-doc-sync-corpus-cache-size
Aug 26, 2026
Merged

diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.51from
ntdatt812:fix/env-doc-sync-corpus-cache-size

Conversation

@ntdatt812

Copy link
Copy Markdown
Contributor

The gate is red for everyone

Docs Gates (fast-path) fails on every PR right now, whatever the PR changes.
From my own run on release/v3.8.51
(job):

Env var contract sync report
============================
Code references:          594 unique vars
In .env.example:          783 unique vars
In docs/reference/ENVIRONMENT.md: 801 unique vars

  ✗ In code but missing from .env.example: 1
     - OMNIROUTE_CORPUS_CACHE_SIZE
  ✓ In .env.example but missing from ENVIRONMENT.md: none
  ✓ In ENVIRONMENT.md but missing from .env.example: none

✗ Env / docs contract is out of sync.

check:env-doc-sync is the third link in the check:docs-all chain, so it takes the
whole Docs Gates job down with it.

Cause

#11491
(721ee2a03, today) put an LRU bound on the local-corpus index cache:

// src/lib/localCorpus/configured.ts:41
const maxCacheSize = Math.max(1, parseInt(process.env.OMNIROUTE_CORPUS_CACHE_SIZE || "5", 10) || 5);

The variable is real and works; it just never reached .env.example or
docs/reference/ENVIRONMENT.md, and the contract checker requires both.

The fix

Documents it in both files, in the Memory Optimization section next to the other
cache-size knobs (PROMPT_CACHE_MAX_SIZE, SEMANTIC_CACHE_MAX_SIZE, …), which is where
a reader tuning a low-RAM box would look for it. Behaviour documented from the code:
default 5, LRU eviction of the least-recently-used root, clamped to a minimum of 1,
non-numeric falls back to the default.

No allowlist entry — the variable is a legitimate operator knob, so it belongs in the
contract rather than in the checker's exception list.

Verification

The checker's own parsers, run against the two files after the change:

env.example parsed: 784          (CI reported 783)
ENVIRONMENT.md parsed: 802       (CI reported 801)
OMNIROUTE_CORPUS_CACHE_SIZE in .env.example  -> true
OMNIROUTE_CORPUS_CACHE_SIZE in ENVIRONMENT.md -> true

Both counts land exactly one above what the failing job reported, and the only name in
the failure list is now present in both sets — so the three runEnvDocSync diffs are
all empty.

npx prettier --check docs/reference/ENVIRONMENT.md   # All matched files use Prettier code style!

Docs-only; no code, no tests.

cheaper-inference#11491 added an LRU bound on the local-corpus index cache, read from
`OMNIROUTE_CORPUS_CACHE_SIZE` in `src/lib/localCorpus/configured.ts`, but the
variable never reached `.env.example` or `docs/reference/ENVIRONMENT.md`.

`check:env-doc-sync` enforces that every env var referenced in source appears in
both files, so it now exits 1 on every branch:

    ✗ In code but missing from .env.example: 1
       - OMNIROUTE_CORPUS_CACHE_SIZE

That check runs inside `check:docs-all`, which is the "Docs Gates (fast-path)"
job — so the gate is red for every PR that touches docs or code, regardless of
what the PR changes.

Documents the variable in both files, in the Memory Optimization section it
belongs to alongside the other cache-size knobs.
@diegosouzapw
diegosouzapw merged commit eccb660 into cheaper-inference:release/v3.8.51 Aug 26, 2026
11 of 16 checks passed
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…een again (cheaper-inference#11576)

Merged via /merge-batch (lote 2026-08-26, v3.8.51). Boarded no worktree combinado junto com outras ~30 PRs; validação única: typecheck/complexity/cognitive-complexity/changelog-integrity verdes, file-size rebaseado onde necessário (crescimento legítimo), lint com os mesmos 228 achados pré-existentes confirmados via sonda contra o tip puro (não introduzidos por este lote), e ~370 testes focados (unit + vitest) passando. Obrigado pela contribuição.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants