Auto-install impacket at tool import time#92
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a runtime fallback to ensure the network-ops Impacket-based tools can run even in environments that do not honor dependencies.python / dependencies.scripts, by attempting to install impacket when the tool module is imported.
Changes:
- Added an import-time
_ensure_impacket_installed()fallback that installsimpacketviasys.executable -m pipif it is not importable. - Updated the provisioning script to also install
impacketwhen missing. - Bumped capability version and added a
checksentry to validateimpacketis importable.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| capabilities/network-ops/tools/impacket.py | Adds an import-time fallback installer for impacket to prevent ModuleNotFoundError at runtime. |
| capabilities/network-ops/scripts/install_coercion_tools.sh | Ensures impacket is installed during sandbox provisioning as an additional safety net. |
| capabilities/network-ops/capability.yaml | Bumps version and adds an impacket import check to capability validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Runtime doesn't process dependencies.python or dependencies.scripts, so impacket is never installed into the runtime's Python. Add _ensure_impacket_installed() that runs at module import — if `import impacket` fails, it pip-installs it via sys.executable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add 120s timeout to pip subprocess to prevent hangs on network issues - Catch TimeoutExpired and OSError in addition to CalledProcessError - Add DREADNODE_SKIP_AUTO_INSTALL=1 env var to disable auto-install in tests/CI - Stop suppressing pip stderr in install script so failures are diagnosable Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c795238 to
1cedaff
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runtime doesn't process
dependencies.pythonor rundependencies.scripts— confirmed across three agent sessions where impacket tools fail withModuleNotFoundErrordespite capability v2.1.1 being loaded.Fixed
ModuleNotFoundErroron runtimes that skipdependencies.python—_ensure_impacket_installed()runs at module import and pip-installs impacket viasys.executable -m pipifimport impacketfails