Repository navigation
Description
What I'm seeing
I was reading through the MCP server's "honest accounting" fields (the ones added so a caller can tell a static-only scan from a full semantic one), and I think the availability check is wired to the wrong resolver, so it misreports availability, and it disables the LLM pass in a configuration where the CLI would happily run it.
run_scan() decides whether the semantic pass can run by calling resolve_provider_credentials(), which only ever resolves the active provider's credentials (mcp_server.py:77-83). The model the graph actually constructs, though, comes from create_chat_model(), and that one falls back to a plain OpenAI client (OPENAI_API_KEY / OPENAI_BASE_URL) when the active provider is not configured (providers/__init__.py:120-148). So the gate and the construction path disagree, and the gate is the stricter of the two.
Walking the code (commit 7bc9c0f)
src/skillspector/mcp_server.py:77-83, the gate, which feeds straight into the state the graph runs on:llm_available = resolve_provider_credentials() is not None llm_used = use_llm and llm_available state = {..., "use_llm": llm_used}
resolve_provider_credentials()is active-provider-only (providers/__init__.py:95-101).- The default NVIDIA provider reads only
NVIDIA_INFERENCE_KEY(providers/nv_build/provider.py:49-54), so with justOPENAI_API_KEYset it returnsNone, andllm_availablecomes outfalse. - There is already a resolver that mirrors the real fallback,
resolve_chat_model_credentials()(providers/__init__.py:111-117), which falls through to the OpenAI provider exactly the waycreate_chat_model()does. The gate just is not using it.
Reproduction
With SKILLSPECTOR_PROVIDER unset (the default NVIDIA path), NVIDIA_INFERENCE_KEY unset, and OPENAI_API_KEY set, call scan_skill (or run_scan(target, use_llm=True)) on any skill.
- What I get:
"llm_available": false,"llm_used": false,"scan_mode": "static-only", and the semantic pass never runs, even though the equivalent CLI scan on the same environment does run it. - What I expected: the OpenAI fallback credential is usable, so
llm_availableshould betrueand the pass should run.
Why it matters
The accounting fields quietly tell an agent that a clean static-only result was the best available, when a full scan was right there. An agent gating installs on the verdict acts on a weaker scan than it could have had.
What I think the fix is
Gate availability on resolve_chat_model_credentials() rather than resolve_provider_credentials(), so the MCP server's llm_available lines up with what create_chat_model() will actually do. I might be missing a reason the MCP path was deliberately scoped to the active provider only, so if that gating is intentional please say so on the issue; otherwise I am happy to put up the one-line change with a test.
Related
- OpenAI fallback uses active provider default model #38, the sibling OpenAI-fallback defect (
get_chat_model()pairing the OpenAI client with a non-OpenAI default model label). Same corner of the provider code, different bug. - The broader "do not silently degrade to static-only, say so explicitly" thread (Fix Anthropic provider: strip unsupported numeric-bound keywords from tool schemas #3, Anthropic provider silently falls back to static — LLM analyzers 400 on minimum/maximum in tool schema #4, Stage 2: one failed batch aborts the entire meta-analyzer pass and silently falls back to static #9, and the discussion on feat(analyzer): no detection for SSRF / cloud-metadata credential theft #62). This bug is that principle failing at the MCP layer.
Activity
wernerkasselman-au commentedon Jul 24, 2026
Closing: the gate defect reported here is fixed on main (
fd25398), though by a different route than the one I proposed in #204.What fixed it
run_scan()no longer gates onresolve_provider_credentials(). It now usesllm_available, _ = is_llm_available()(src/skillspector/mcp_server.py:76, imported at:36), and that value flows intollm_used, the graph state, and the reportedllm_available/llm_used/scan_mode.llm_utils.is_llm_available()(src/skillspector/llm_utils.py:90) is capability-aware and strictly broader than what #204 proposed:claude_cli,codex_cli,gemini_cli) are checked viaprovider.is_available(), so an authenticated binary with no API key is correctly reported available.resolve_chat_model_credentials()alone would have reported those unavailable._resolve_llm_credentials()->resolve_chat_model_credentials()(llm_utils.py:113-117), which is the OpenAI-fallback path this issue asked for.The reason the fallback fires in the environment I reported is that
has_provider_binding()(src/skillspector/providers/__init__.py:92-94) keys off the_INJECTED_PROVIDERContextVar, which is set only byuse_provider(), not offSKILLSPECTOR_PROVIDER. So withSKILLSPECTOR_PROVIDERunset the environment is unbound,resolve_chat_model_credentials()(:188-197) skips its early return and reaches_openai_fallback_provider().Re-running the exact repro from this issue on
fd25398(SKILLSPECTOR_PROVIDERunset,NVIDIA_INFERENCE_KEYunset,OPENAI_API_KEYset):llm_availableis nowtruewhere it wasfalse. Regression coverage for the resolver lives attests/unit/test_llm_utils.py:260-265. Note that no test pins this at the MCP boundary: the tests attests/unit/test_mcp_server.py:39/57/72monkeypatchis_llm_available, and the two at:83/:139use injected providers, which is thehas_provider_binding() == Truebranch rather than this one. Arun_scan-level test with real env vars would be worth adding.Caveat worth recording: the semantic pass still yields nothing here
Anyone retesting this environment should know that
llm_available: truedoes not yet mean the LLM pass works. It does not, for a reason unrelated to the gate.build_contextunconditionally sets"model_config": build_model_config()(src/skillspector/nodes/build_context.py:249).build_model_config()(src/skillspector/constants.py:70-73) resolves every slot fromget_metadata_provider(), which in this environment isNvBuildProvider, and it is credential-blind: it never consults which client will actually be constructed. The analyzers then pass those labels explicitly intoget_chat_model(model=...), which short-circuits the OpenAI-aware default in_resolve_default_chat_model().Observed on
fd25398in the same environment:That is a DeepSeek model ID on a client pointed at
api.openai.com. A bareget_chat_model()correctly returnsgpt-5.4, but the graph never takes that path, so the OpenAI-aware default is effectively unreachable for analyzer calls.This is the same class of defect as #38 ("OpenAI fallback uses active provider default model"), which is closed. Its fix covered
_resolve_default_chat_model()and does not cover themodel_configpath, so this variant is currently untracked. It deserves its own issue rather than reopening this one, since the gate bug reported here is genuinely resolved.Two smaller observations from the same investigation, also unrelated to the gate:
run_scancomputesllm_available/llm_used/scan_modefrom the pre-scan gate and never reconciles them against what the run actually did. WithOPENAI_BASE_URLpointed at a dead port it still returnedllm_used: true, scan_mode: "static+llm"._build_metadatasetsllm_degradedonly when every logged call fails (src/skillspector/nodes/report.py:497), so a partially failed LLM stage reportsllm_available: trueandmeta_analysis_applied: true.Thanks to everyone who looked at this.