Repository navigation
perf: defer provider SDK imports for static scans - #1164
Conversation
Load provider client modules only when LLM helpers need them. Keep pure sampling controls available to static provenance and retain existing chat_models control exports. Add fresh-process CLI regressions that reject provider SDK imports and preserve controls, disabled analyzer statuses, coverage and findings. Refs NVIDIA#865. AI assistance was used to investigate, implement and verify this change. Signed-off-by: Adem Vessell <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
[SkillSpector Review]
Decision — Approved.
Value and readiness — Static scans can skip importing chat-client SDKs while still producing provider-control provenance and coverage diagnostics. This addresses a bounded portion of #865 and is ready for maintainer review.
Material findings — None. Existing control imports remain available to callers, and the functions that need concrete chat-client classes import them on their semantic paths. The fresh-process tests cover successful reports, static findings and disabled semantic statuses with SDK imports blocked.
PIC tradeoffs — None requiring a decision. The PR leaves LangGraph startup in scope for separate work. Startup savings will vary by environment.
Verification and gaps — Read the full diff, compatibility re-exports, deferred call sites and the subprocess test assertions. All six hosted checks passed. Live provider behavior and cross-platform timing remain unverified in this static review.
Reviewed head bbe8944aabfb988aea3bfe0d5f2a428ac0600e26.
Static
--no-llmscans still load the OpenAI and Anthropic SDKs and their adapters before the disabled LLM nodes return. This change defers those imports until LLM helpers need them and keeps sampling-control parsing available to static report provenance without importing chat clients. Analyzer registration and reporting behavior are unchanged. LangGraph startup remains outside this change. Refs #865.Four fresh-process CLI regressions block provider SDK imports while checking clean scans, configured controls, disabled analyzer statuses and static findings. Local baseline/candidate reports agree apart from timestamps and generated finding IDs.
Validation on macOS arm64 / Python 3.13: lint, formatting, wheel build and 238 static/mocked integration tests pass. The full unit selection produced 27,002 passes and 10 environment-related failures. All 10 reproduced on pristine main and passed on both trees after correcting only local path and Unix-socket conditions; the original full run was not all green. I did not run the complete
make testtarget because it includes live provider/agent checks that may incur charges. Live provider/agent behavior and cross-platform validation remain untested.AI assistance was used to investigate, implement and verify this contribution.