feat(llm): add QMD_ALLOW_LLM env override for the CI kill-switch - #780
Open
kingkillery wants to merge 1 commit into
Open
feat(llm): add QMD_ALLOW_LLM env override for the CI kill-switch#780kingkillery wants to merge 1 commit into
kingkillery wants to merge 1 commit into
Conversation
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().
|
Dear tobi/qmd,
We would like to acknowledge that we have received your request and a ticket has been created.
A support representative will be reviewing your request and will send you a personal response.(usually within 24-48 hours).
Thank you for your patience.
…On Wed, Jul 22 2026, at 07:40 PM, tobi/qmd ***@***.***> wrote:
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 You can view, comment on, or merge this pull request online at: #780 (#780) Commit Summary cb0729e feat(llm): add QMD_ALLOW_LLM env override for CI kill-switch (cb0729e) File Changes
( 1 file) (https://github.com/tobi/qmd/pull/780/files) M src/llm.ts
(26) (https://github.com/tobi/qmd/pull/780/files#diff-9d1147e1eeafc554ffa50a5890c4cc45e3ca64c5cbdce2c20c5b181b40550b4b) Patch Links: https://github.com/tobi/qmd/pull/780.patch (https://github.com/tobi/qmd/pull/780.patch) https://github.com/tobi/qmd/pull/780.diff (https://github.com/tobi/qmd/pull/780.diff)
—
Reply to this email directly, view it on GitHub, or (#780?email_source=notifications&email_token=BRF3HG4NHSXMBTVPX5GTCX35GEKBVA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DCMJRGIYTSOJXG6THEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVRTG633UMVZF6Y3MNFRWW) unsubscribe. (https://github.com/notifications/unsubscribe-auth/BRF3HG5YACKUTOGDWDSKQH35GEKBVAVCNFSNUABGKJSXA33TNF2G64TZHMYTCMJSGM3DKMZQGE5US43TOVSTWNBZGUZDKMZSGY4DNILWAI)
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and (https://github.com/notifications/mobile/ios/BRF3HG77BKNYN6JNNQ5Y6AL5GEKBVA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DCMJRGIYTSOJXG6THEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVJTG633UMVZF62LPOM) Android. Download it today! (https://github.com/notifications/mobile/android/BRF3HG7RCSYXD4MODE5XDQT5GEKBVA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DCMJRGIYTSOJXG6THEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE)
You are receiving this because you are subscribed to this thread. Message ID: <tobi/qmd/pull/780 @ github . com> [
{
***@***.***": "http://schema.org",
***@***.***": "EmailMessage",
"potentialAction": {
***@***.***": "ViewAction",
"target": "#780?email_source=notifications\u0026email_token=BRF3HG2AX6VTBJIEG3IXHND5GEKBVA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DCMJRGIYTSOJXG6THEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ",
"url": "#780?email_source=notifications\u0026email_token=BRF3HG2AX6VTBJIEG3IXHND5GEKBVA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DCMJRGIYTSOJXG6THEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
***@***.***": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
LlamaCpphard-disables all LLM operations (expandQuery,generate,rerank,embedBatch) wheneverprocess.env.CIis set:The guard exists for a good reason — CI test pipelines shouldn't download/load multi-GB models — but
CI=1is also set by coding-agent harnesses (Claude Code, Codex, and similar tools set it for every shell they spawn). In those sessionsqmd vsearch/qmd queryfail hard, with no way to override.Change
Add an explicit
QMD_ALLOW_LLMenvironment override:1/trueCIis set0/false!!process.env.CIdetectionAlso consolidates the four duplicated inline guard throws into a single
assertLlmEnabled()helper whose error message states the remedy:Compatibility
QMD_ALLOW_LLMis unset —test:unit(which relies onCI=trueto stay model-free) is unaffected.QMD_ALLOW_LLM=0gives non-CI environments a way to guarantee no model loads, which wasn't possible before.Verification
tsc -p tsconfig.build.json --noEmit— cleanvitest run test/llm.test.tsunderCI=truewith the override unset — 30 passed, 31 skipped (model-gated), 0 failedCI=1):qmd vsearchpreviously threw, works withQMD_ALLOW_LLM=1, and still throws with the override unset