mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
927ceb7817
The instrumentor test serves `strands.*` stubs through a meta-path finder, but the import machinery reads the parent module's `__path__` BEFORE it consults any finder, so every submodule import died with "'strands' is not a package" and the finder never ran. It only ever passed because earlier test modules left `agents.*` cached in `sys.modules`, which skipped the `from strands... import` lines entirely. Adding `build_reasoning_agent()` at agent_server import time broke that accident: its `from strands.models.openai_responses import ...` sits inside the function body, so module caching cannot hide it and the whole suite went red. Give the three package-like stubs (`strands`, `strands.models`, `strands.types`) an empty `__path__` so the finder is reached, and drop the stub entries from `sys.modules` afterwards so the real-package probe later in the file does not inherit a `strands` whose empty `__path__` hides the installed submodules. Suite is now green both as a whole and file by file, which it was not before on either this branch or main.