Skip to content

fix(cli): surface blocked native module imports instead of a generic child failure - #1167

Open
Varshith-Kali wants to merge 2 commits into
NVIDIA:mainfrom
Varshith-Kali:fix/1166-wdac-ormsgpack-diagnostic
Open

Varshith-Kali wants to merge 2 commits into
NVIDIA:mainfrom
Varshith-Kali:fix/1166-wdac-ormsgpack-diagnostic

Conversation

@Varshith-Kali

Copy link
Copy Markdown
Contributor

Fixes #1166

Problem

On Windows endpoints managed by Windows Application Control (WDAC), every scan fails: WDAC blocks the unsigned ormsgpack .pyd at import, and the recursive runner then hides the real error behind the generic "A recursive child scan failed before complete inspection." line, repeated once per child.

Verified on main: ormsgpack is not a direct dependency and is never imported by SkillSpector source. It arrives transitively through langgraph-checkpoint (pulled in by langgraph), and the CLI imports the graph lazily, so the import fails on the first graph.invoke of any scan. yara-python is a direct dependency (yara-python>=4.5.0, imported in nodes/analyzers/static_yara.py) with the same signing status, so it is the next block once ormsgpack is resolved.

What this PR does

This is a diagnostics fix, not a loader workaround:

  1. Surface the real error. A recursive child failure caused by a blocked native import now reports the generic line followed by a diagnostic naming the blocked module, and the diagnostic is also recorded in the aggregate analysis_completeness.limitations, so it shows up in the JSON, text, and SARIF reports. Other child failures keep exactly the generic message, and no raw exception text is ever copied into a report.
  2. Fail fast. When the scan workflow cannot load because a native module is blocked, the scan exits 2 immediately with a clear diagnostic: which module was blocked, that every scan fails while it cannot load, and the workarounds (run in WSL or the provided Docker image, or ask an administrator to allowlist the SkillSpector install directory in the WDAC policy). In recursive mode the remaining children are not attempted, since each would fail the same way.
  3. Document the prerequisite. README now has a Windows Application Control (WDAC) section under Installation, naming both affected modules and pointing at the signed-wheel tracking in this issue.

What it deliberately does not do

No pure-Python ormsgpack shim. langgraph-checkpoint depends on ormsgpack semantics, and a shim risks silent serialization changes. Signed wheels are an NVIDIA-side action, tracked in #1166.

Detection scope

The diagnostic triggers only for an ImportError/OSError that reads like a refused native load (DLL load failure, policy block, code integrity) and names a module. A module that is simply not installed (No module named ...) and unrelated errors keep their existing handling.

Testing

  • New tests/unit/test_wdac_native_import.py (12 tests): detection of policy-blocked and plain DLL load failures for ormsgpack and yara, no misclassification of missing modules or unrelated errors, LazyGraph import failure surfacing as GraphLoadError, recursive child failure naming the module and stopping remaining children, single-skill scan failing fast with the diagnostic on stderr, and the generic message preserved exactly for non-import child crashes.
  • tests/unit/test_cli.py: 558 passed, 4 skipped. tests/unit/test_graph_proxy.py: 5 passed. Related suites (test_lazy_workflow_imports, test_mcp_server, test_cli_entry, test_sarif, test_cleanup, test_mcp_registry, test_cli_subprocess): 322 passed.
  • ruff check and ruff format --check clean on the changed files.
  • One pre-existing failure exists in the wider unit suite and is unrelated to this change: test_anthropic_provider.py::test_native_claude_55_accepts_default_temperature_in_request_and_provenance fails with KeyError: 'temperature' on pristine main too, verified by running it with this change stashed.

Verification limit

I could not verify this on a real WDAC-managed Windows endpoint from my environment; the failure mode is reproduced in tests by simulating the blocked-import error path. The exact OS wording on a managed endpoint may differ from the simulated message, so the detector keys on the load-failure phrasing rather than one exact string. Happy to adjust the wording once tested against a real endpoint; the reporter offered to try a candidate branch.

…child failure

On Windows endpoints managed by Windows Application Control, the unsigned
ormsgpack .pyd is blocked at import, so every scan fails, and the recursive
runner repeats the generic child failure message without naming the cause.

Detect a refused native extension load at graph import time and raise a
GraphLoadError naming the blocked module, with workarounds (WSL, Docker, or
a policy allowlist). Single-skill scans fail fast with that diagnostic;
recursive scans report it on the first failed child, record it in the
aggregate limitations, and stop instead of repeating the same failure.
Other child failures keep exactly the generic message, and no raw exception
text is copied into reports. README documents the WDAC prerequisite.

Fixes NVIDIA#1166

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SkillSpector Review]

Decision — Changes Requested.

Value and readiness — Surfacing the blocked module from #1166 would make managed-Windows scan failures actionable. The fail-fast behavior needs a reliable boundary between loading the workflow and running an individual child.

Material findings

  • [Required] src/skillspector/cli.py:1721–1725,3274–3288 — The first catch translates errors from the whole graph.invoke() call. The recursive catch also independently treats any child ImportError or OSError that looks like a DLL import failure as systemic. A native import failure during execution of an already-loaded workflow, for example in a lazy component reached by one child, then omits every subsequent child and tells users that every scan fails. Restrict recursive early termination to the typed load failure raised by LazyGraph._get_compiled(). Keep an execution-time DLL failure local to the failed child. Test both boundaries with a loader failure and a first-child execution failure followed by a successful child. The current recursive test injects a raw error into invoke() and therefore validates the ambiguous case. Invocation and handling · Loader

PIC tradeoffs — A typed load failure supports a single diagnostic and a short exit while retaining coverage when one child fails independently.

Verification and gaps — Reviewed the complete diff, lazy import, streaming and non-streaming paths, recursive aggregate, tests, and the diagnostic in #1166. All six hosted checks succeeded. The Windows error wording is from the issue and the PR fixtures simulate it. Review was static.

Reviewed head 72ef0b52d4d8cfdac32d6da4fce2084d21f821e4.

The invoke and stream catches translated every ImportError or OSError from the whole workflow run into a GraphLoadError, and the recursive runner treated any child error that looked like a DLL load failure as systemic. A native import failure raised while an already loaded workflow executed (a lazy component reached by one child) therefore omitted every subsequent child.

Only LazyGraph._get_compiled() produces a GraphLoadError now. _run_graph_scan propagates execution errors unchanged, and the recursive runner aborts early only for GraphLoadError. Execution-time DLL failures stay local to the failed child with the generic message. Tests cover both boundaries: a loader failure still stops the remaining children, and a first-child execution failure is followed by a successful child.

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
@Varshith-Kali

Copy link
Copy Markdown
Contributor Author

Fixed in 73aa7e7. The invoke and stream catches in _run_graph_scan no longer translate errors from the whole workflow run, so only LazyGraph._get_compiled() produces a GraphLoadError and execution errors propagate unchanged. The recursive runner now aborts early only for GraphLoadError; an execution-time DLL failure stays local to the failed child with the generic message and no systemic limitation. Tests cover both boundaries: test_recursive_load_failure_surfaces_blocked_native_error injects the typed load failure and stops the remaining children, and test_recursive_execution_import_failure_stays_local_to_failed_child injects a raw first-child execution failure followed by a successful child (both attempted, no omitted children). Two _run_graph_scan tests pin the propagation boundary directly. test_wdac_native_import.py: 15 passed; ruff clean.

This branch has not been deployed

No deployments
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.

Windows Application Control blocks ormsgpack .pyd at import; every scan fails with silent per-skill 'recursive child scan failed'

2 participants