Commit 0b2c3a6
fix: suppress stderr during parent package loading
Fixes "No module named 'agents'" error shown during startup when using
fully qualified agent paths that include intermediate package directories.
Issue: When loading agents from paths like /path/agents/my_agent.py,
the loader tries to import parent packages. If those __init__.py files
have import errors, Python prints error messages to stderr even though
the errors are caught and handled.
Solution:
- Added contextlib.redirect_stderr() to suppress error output during
parent package initialization
- Errors are still caught and logged at DEBUG level for troubleshooting
- Agent loading still works correctly (errors are non-critical)
Impact:
- Cleaner startup experience with no confusing error messages
- Agent functionality unchanged
- All 161 tests passing
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent d7cac92 commit 0b2c3a6
1 file changed
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
| 120 | + | |
| 121 | + | |
118 | 122 | | |
119 | | - | |
| 123 | + | |
| 124 | + | |
120 | 125 | | |
121 | | - | |
122 | | - | |
123 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
124 | 131 | | |
125 | 132 | | |
126 | 133 | | |
| |||
0 commit comments