Skip to content

feat(llm): add QMD_ALLOW_LLM env override for the CI kill-switch - #780

Open
kingkillery wants to merge 1 commit into
tobi:mainfrom
kingkillery:qmd-allow-llm-override
Open

feat(llm): add QMD_ALLOW_LLM env override for the CI kill-switch#780
kingkillery wants to merge 1 commit into
tobi:mainfrom
kingkillery:qmd-allow-llm-override

Conversation

@kingkillery

Copy link
Copy Markdown

Problem

LlamaCpp hard-disables all LLM operations (expandQuery, generate, rerank, embedBatch) whenever process.env.CI is set:

Error: LLM operations are disabled in CI (set CI=true)

The guard exists for a good reason — CI test pipelines shouldn't download/load multi-GB models — but CI=1 is also set by coding-agent harnesses (Claude Code, Codex, and similar tools set it for every shell they spawn). In those sessions qmd vsearch / qmd query fail hard, with no way to override.

Change

Add an explicit QMD_ALLOW_LLM environment override:

Value Behavior
1 / true LLM ops enabled, even when CI is set
0 / false LLM ops force-disabled, even outside CI
unset unchanged — original !!process.env.CI detection

Also consolidates the four duplicated inline guard throws into a single assertLlmEnabled() helper whose error message states the remedy:

LLM operations are disabled (CI env detected or QMD_ALLOW_LLM=0). Set QMD_ALLOW_LLM=1 to override.

Compatibility

  • Default behavior is byte-for-byte unchanged when QMD_ALLOW_LLM is unset — test:unit (which relies on CI=true to stay model-free) is unaffected.
  • QMD_ALLOW_LLM=0 gives non-CI environments a way to guarantee no model loads, which wasn't possible before.

Verification

  • tsc -p tsconfig.build.json --noEmit — clean
  • vitest run test/llm.test.ts under CI=true with the override unset — 30 passed, 31 skipped (model-gated), 0 failed
  • Manually verified in an agent session (CI=1): qmd vsearch previously threw, works with QMD_ALLOW_LLM=1, and still throws with the override unset

CI=1 is set by agent harnesses, not just CI pipelines, so the blanket LLM disable false-positived in agent sessions. QMD_ALLOW_LLM=1 force-enables LLM ops, =0 force-disables, unset keeps original CI detection. Consolidates four duplicated guard throws into assertLlmEnabled().
@PowderAddicts

PowderAddicts commented Jul 22, 2026 via email

Copy link
Copy Markdown

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