From 1d95780fff05991fc5b76e999645e1f5ec3ad55e Mon Sep 17 00:00:00 2001 From: Ciphercat <78522797+0xrsydn@users.noreply.github.com> Date: Mon, 16 Mar 2026 01:15:13 +0000 Subject: [PATCH] fix: missing minisweagent_path module + add nix checks - Patch upstream pyproject.toml to include minisweagent_path in py-modules - Copy mini-swe-agent/src/minisweagent into package for importability - Add 3 nix checks: package-contents, cli-commands, doctor - All binaries tested: hermes, hermes-agent, hermes-acp - hermes gateway, config, status, claw migrate all verified working --- checks.nix | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 5 ++++ package.nix | 14 +++++++++- 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 checks.nix diff --git a/checks.nix b/checks.nix new file mode 100644 index 0000000..72645a7 --- /dev/null +++ b/checks.nix @@ -0,0 +1,76 @@ +{ pkgs, hermes-agent }: + +{ + # Verify package contents — binaries exist and are executable + package-contents = pkgs.runCommand "hermes-package-contents" { } '' + set -e + + echo "=== Checking binaries ===" + test -x ${hermes-agent}/bin/hermes || (echo "FAIL: hermes binary missing"; exit 1) + test -x ${hermes-agent}/bin/hermes-agent || (echo "FAIL: hermes-agent binary missing"; exit 1) + test -x ${hermes-agent}/bin/hermes-acp || (echo "FAIL: hermes-acp binary missing"; exit 1) + echo "PASS: All binaries present" + + echo "=== Checking version ===" + ${hermes-agent}/bin/hermes version 2>&1 | grep -q "Hermes Agent" || (echo "FAIL: version check"; exit 1) + echo "PASS: Version check" + + 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 + if [ ! -e "$SITE/$mod" ] && [ ! -e "$SITE/$mod.py" ]; then + echo "FAIL: Missing module $mod" + exit 1 + fi + done + echo "PASS: All key modules present" + + echo "=== Checking wrapped PATH includes runtime deps ===" + cat ${hermes-agent}/bin/hermes | grep -q "PATH" || (echo "FAIL: hermes not wrapped with PATH"; exit 1) + echo "PASS: PATH wrapping" + + echo "=== All checks passed ===" + mkdir -p $out + echo "ok" > $out/result + ''; + + # Verify hermes CLI subcommands are accessible + cli-commands = pkgs.runCommand "hermes-cli-commands" { } '' + set -e + export HOME=$(mktemp -d) + + echo "=== Checking hermes --help ===" + ${hermes-agent}/bin/hermes --help 2>&1 | grep -q "gateway" || (echo "FAIL: gateway subcommand missing"; exit 1) + ${hermes-agent}/bin/hermes --help 2>&1 | grep -q "claw" || (echo "FAIL: claw subcommand missing"; exit 1) + ${hermes-agent}/bin/hermes --help 2>&1 | grep -q "config" || (echo "FAIL: config subcommand missing"; exit 1) + ${hermes-agent}/bin/hermes --help 2>&1 | grep -q "cron" || (echo "FAIL: cron subcommand missing"; exit 1) + ${hermes-agent}/bin/hermes --help 2>&1 | grep -q "skills" || (echo "FAIL: skills subcommand missing"; exit 1) + ${hermes-agent}/bin/hermes --help 2>&1 | grep -q "acp" || (echo "FAIL: acp subcommand missing"; exit 1) + echo "PASS: All subcommands accessible" + + echo "=== Checking hermes config ===" + ${hermes-agent}/bin/hermes config 2>&1 | grep -q "Config:" || (echo "FAIL: config output"; exit 1) + echo "PASS: Config command" + + echo "=== Checking hermes claw migrate --help ===" + ${hermes-agent}/bin/hermes claw migrate --help 2>&1 | grep -q "OpenClaw" || (echo "FAIL: claw migrate"; exit 1) + echo "PASS: Claw migrate" + + echo "=== All CLI checks passed ===" + mkdir -p $out + echo "ok" > $out/result + ''; + + # Verify doctor runs without crashing + doctor = pkgs.runCommand "hermes-doctor" { } '' + set -e + export HOME=$(mktemp -d) + + echo "=== Running hermes doctor ===" + ${hermes-agent}/bin/hermes doctor 2>&1 | grep -q "Python" || (echo "FAIL: doctor"; exit 1) + echo "PASS: Doctor runs successfully" + + mkdir -p $out + echo "ok" > $out/result + ''; +} diff --git a/flake.nix b/flake.nix index deb3555..566087b 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,11 @@ default = self.packages.${system}.hermes-agent; }; + checks = import ./checks.nix { + inherit pkgs; + hermes-agent = self.packages.${system}.hermes-agent; + }; + devShells.default = pkgs.mkShell { packages = [ self.packages.${system}.hermes-agent ]; }; diff --git a/package.nix b/package.nix index cf3272e..af89874 100644 --- a/package.nix +++ b/package.nix @@ -147,7 +147,19 @@ pythonPackages.buildPythonApplication { # Don't run tests during build doCheck = false; - # mini-swe-agent is included via fetchSubmodules and referenced at runtime + # Upstream pyproject.toml is missing minisweagent_path 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 + + # 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 . + fi + ''; postFixup = '' # Wrap binaries with runtime deps on PATH