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) <noreply@anthropic.com>
This commit is contained in:
AIOSAI
2026-06-04 01:06:36 -07:00
co-authored by Claude Opus 4.8
parent f3b3ebad9b
commit 89fa2c1db2
+6
View File
@@ -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