fix: handle upstream rename of minisweagent_path.py → mini_swe_runner.py

Upstream removed minisweagent_path.py in favor of mini_swe_runner.py,
breaking the nightly-package-contents check. Accept either module name
in checks and ensure both are patched into pyproject.toml py-modules.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rasyidan Akbar F. 2026-03-26 11:31:43 +07:00
commit 4f787c78f3
2 changed files with 13 additions and 3 deletions

View file

@ -17,12 +17,17 @@
echo "=== Checking key Python modules ==="
SITE=${hermes-agent}/lib/python3.12/site-packages
for mod in agent cli.py gateway cron tools run_agent.py model_tools.py minisweagent_path.py acp_adapter honcho_integration; do
for mod in agent cli.py gateway cron tools run_agent.py model_tools.py acp_adapter honcho_integration; do
if [ ! -e "$SITE/$mod" ] && [ ! -e "$SITE/$mod.py" ]; then
echo "FAIL: Missing module $mod"
exit 1
fi
done
# mini-swe: upstream renamed minisweagent_path.py → mini_swe_runner.py
if [ ! -e "$SITE/minisweagent_path.py" ] && [ ! -e "$SITE/mini_swe_runner.py" ]; then
echo "FAIL: Missing module minisweagent_path.py or mini_swe_runner.py"
exit 1
fi
echo "PASS: All key modules present"
echo "=== Checking wrapped PATH includes runtime deps ==="

View file

@ -226,14 +226,19 @@ pythonPackages.buildPythonApplication {
# Don't run tests during build
doCheck = false;
# Upstream pyproject.toml is missing minisweagent_path from py-modules.
# Also ensure mini-swe-agent/src is importable.
# Upstream pyproject.toml may be missing minisweagent_path / mini_swe_runner
# from py-modules. Also ensure mini-swe-agent/src is importable.
postPatch = ''
# Fix: add minisweagent_path.py to py-modules if missing from pyproject.toml
if [ -f minisweagent_path.py ] && ! grep -q minisweagent_path pyproject.toml; then
sed -i 's/py-modules = \[/py-modules = ["minisweagent_path", /' pyproject.toml
fi
# Fix: add mini_swe_runner.py to py-modules if missing (upstream rename)
if [ -f mini_swe_runner.py ] && ! grep -q mini_swe_runner pyproject.toml; then
sed -i 's/py-modules = \[/py-modules = ["mini_swe_runner", /' pyproject.toml
fi
# Make mini-swe-agent importable by copying src into the package
if [ -d mini-swe-agent/src/minisweagent ]; then
cp -r mini-swe-agent/src/minisweagent .