From 89fa2c1db27b807c18a960581e0a05cd5bfeb760 Mon Sep 17 00:00:00 2001 From: AIOSAI Date: Thu, 4 Jun 2026 01:06:36 -0700 Subject: [PATCH] fix(aipass): surface module errors instead of masking as 'Unknown command' route_command swallowed any handle_command exception and let main() print a misleading 'Unknown command', hiding real failures (e.g. the Windows aipass-init error the e2e harness hit). It now also prints the failing module + traceback to stderr. Bool contract unchanged; 24/24 aipass unit tests pass. This makes the masked Windows init failure diagnosable. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/aipass/aipass/apps/aipass.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/aipass/aipass/apps/aipass.py b/src/aipass/aipass/apps/aipass.py index a3a8427f..555fb7f8 100644 --- a/src/aipass/aipass/apps/aipass.py +++ b/src/aipass/aipass/apps/aipass.py @@ -17,6 +17,7 @@ Auto-discovery architecture: import sys import importlib +import traceback from pathlib import Path from typing import List, Any @@ -59,7 +60,12 @@ def route_command(command: str, args: List[str], modules: List[Any]) -> bool: if module.handle_command(command, args): return True except Exception as e: + # A module that owns this command but fails must not be masked as + # "Unknown command" — surface the real error (and traceback) to + # stderr so failures are diagnosable instead of silently swallowed. logger.error(f"[AIPASS] Module {module.__name__} error: {e}") + print(f"[AIPASS] {module.__name__.split('.')[-1]} failed: {e}", file=sys.stderr) + traceback.print_exc(file=sys.stderr) return False