Skip to content

fix(runtime): load Windows-generated guards from memory - #29

Open
erichare wants to merge 1 commit into
AgentToolkit:mainfrom
erichare:fix/windows-memory-loader-packages
Open

fix(runtime): load Windows-generated guards from memory#29
erichare wants to merge 1 commit into
AgentToolkit:mainfrom
erichare:fix/windows-memory-loader-packages

Conversation

@erichare

@erichare erichare commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • normalize both Windows and POSIX path separators when deriving in-memory module names
  • cover realistic nested Windows-generated FileTwin imports and allow/deny execution
  • preserve and restore sys.modules state in the regression test

Root cause

ToolGuard 0.2.21 only replaced / when converting generated file paths to Python module names. Langflow serializes Windows-generated policy paths with \\, so load_toolguards_from_memory registered and imported invalid module names and raised ModuleNotFoundError.

Test plan

  • pytest tests/runtime (18 passed)
  • ruff check src/toolguard/runtime/runtime.py tests/runtime/test_runtime_memory.py
  • ruff format --check src/toolguard/runtime/runtime.py tests/runtime/test_runtime_memory.py
  • git diff --check

Related to langflow-ai/langflow#14050 and LE-2094.

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.

1 participant