You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user sets SKILLSPECTOR_MODEL to an unknown model ID that isn't in any provider's model_registry.yaml, SkillSpector silently falls back to a 128k context length default (_FALLBACK_CONTEXT_LENGTH). If the model's actual context window is smaller, this causes oversized batches that get truncated by the API — or the API call fails entirely at runtime with an opaque error.
There is no upfront validation that the configured model is recognized, and no warning that token budgeting is using fallback values. Users discover the problem only after a scan fails partway through.
Reproduction
export SKILLSPECTOR_PROVIDER=openai
export SKILLSPECTOR_MODEL=gpt-4o-mini-2024-07-18-preview
# Model ID typo — not in model_registry.yaml
skillspector scan ./my-skill/
Current behavior: Scan starts, uses 128k fallback context length. If the real model has 8k context, batches overflow and the API returns truncation errors or partial results mid-scan.
Expected behavior: Warning at startup that gpt-4o-mini-2024-07-18-preview is not in the model registry, showing the fallback values being used. Optionally, a strict mode that refuses to run with unvalidated models.
Proposed Implementation
Option A: Warn on startup (default behavior)
importlogginglogger=logging.getLogger(__name__)
forslot, modelinMODEL_CONFIG.items():
ctx=_provider.get_context_length(model)
ifctxisNone:
logger.warning(
"Model '%s' (slot: %s) not found in model_registry.yaml. ""Using fallback context length (%d). Token budgeting may be ""inaccurate — add the model to the registry or verify the model ID.",
model, slot, _FALLBACK_CONTEXT_LENGTH,
)
Option B: Opt-in strict mode
ifos.environ.get("SKILLSPECTOR_STRICT_MODEL_VALIDATION", "").lower() =="true":
unknown= [
f" {slot}: {model}"forslot, modelinMODEL_CONFIG.items()
if_provider.get_context_length(model) isNone
]
ifunknown:
raiseValueError(
"Strict model validation enabled. Unknown models:\n"+"\n".join(unknown)
+"\nAdd them to model_registry.yaml or disable ""SKILLSPECTOR_STRICT_MODEL_VALIDATION."
)
Both options can coexist: warn by default, fail-fast when strict mode is enabled.
Related
models glm-5.2, glm-5.1, kimi-k2.7-code, deepseek-v4-flash fail #129 (OPEN): Models like glm-5.2, kimi-k2.7-code, deepseek-v4-flash fail at runtime. Upfront validation would catch many of these cases before the scan starts, giving users actionable feedback instead of mid-scan API errors.
PR feat(report): add analysis_completeness field to JSON output #160 (MERGED): Added analysis_completeness field to report partial results when analyzers fail. Model validation would prevent some of these partial-result scenarios by catching bad configuration early.
Token budget miscalculation from unvalidated models can also cause silent quality degradation — the semantic analyzer may truncate skill source code without warning, producing lower-quality findings.
Scope
Add model validation loop after MODEL_CONFIG construction in constants.py (~15 lines)
Add SKILLSPECTOR_STRICT_MODEL_VALIDATION env var support (~10 lines)
Tests: known model passes, unknown model warns, strict mode raises
Documentation: add model validation section to README
Summary
When a user sets
SKILLSPECTOR_MODELto an unknown model ID that isn't in any provider'smodel_registry.yaml, SkillSpector silently falls back to a 128k context length default (_FALLBACK_CONTEXT_LENGTH). If the model's actual context window is smaller, this causes oversized batches that get truncated by the API — or the API call fails entirely at runtime with an opaque error.There is no upfront validation that the configured model is recognized, and no warning that token budgeting is using fallback values. Users discover the problem only after a scan fails partway through.
Reproduction
Current behavior: Scan starts, uses 128k fallback context length. If the real model has 8k context, batches overflow and the API returns truncation errors or partial results mid-scan.
Expected behavior: Warning at startup that
gpt-4o-mini-2024-07-18-previewis not in the model registry, showing the fallback values being used. Optionally, a strict mode that refuses to run with unvalidated models.Proposed Implementation
Option A: Warn on startup (default behavior)
Option B: Opt-in strict mode
Both options can coexist: warn by default, fail-fast when strict mode is enabled.
Related
analysis_completenessfield to report partial results when analyzers fail. Model validation would prevent some of these partial-result scenarios by catching bad configuration early.Scope
MODEL_CONFIGconstruction inconstants.py(~15 lines)SKILLSPECTOR_STRICT_MODEL_VALIDATIONenv var support (~10 lines)