feat(system): S65 night shift — fix 14 branches from fresh-eyes CLI testing (#147)

* docs: update HERALD.md — S63-S64, standards 32, fresh-eyes CLI results

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat(system): S65 night shift — fix 14 branches from fresh-eyes CLI testing (FPLAN-0154)

14 branches dispatched across 3 phases, all fixes verified.

Phase 1 (critical): backup dry-run flag check, ai_mail per-ID branch detection,
flow introspection gate removal, drone atomic writes + empty file guard,
commons 3-strategy caller detection.

Phase 2 (patterns): spawn argparse --help + create --dry-run, skills create --help,
api introspection routing fix (6 commands), trigger empty JSON guard,
seedgo @ prefix consistency + conftest.

Phase 3 (polish): prax ghost module archived + real status output, daemon update
digest + 13 error cascade fixes + branch-health all-branches, memory search
timeout message + hidden modules in help, cli drone_adapter archived + standalone verified.

3,410 tests (+80), seedgo 99% avg, 0 failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
AIPass
2026-03-30 13:29:48 -07:00
committed by GitHub
co-authored by Claude Opus 4.6
parent a9b30e9e51
commit 26bb4a3157
60 changed files with 1254 additions and 564 deletions
@@ -65,7 +65,7 @@ def fetch_models_from_api(api_key: str) -> List[Dict]:
# Make API request
logger.info(f"[{MODULE_NAME}] Requesting models from OpenRouter API")
response = requests.get(
response = requests.get( # type: ignore[attr-defined]
OPENROUTER_API_URL,
headers=headers,
timeout=DEFAULT_TIMEOUT
@@ -144,7 +144,7 @@ def get_generation_metrics(generation_id: str, api_key: str) -> Optional[Dict[st
}
# Query the generation endpoint
response = requests.get(
response = requests.get( # type: ignore[attr-defined]
GENERATION_ENDPOINT,
params={"id": generation_id},
headers=headers,
+8 -8
View File
@@ -72,25 +72,25 @@ def handle_command(command: str, args: List[str]) -> bool:
# Log operation
json_handler.log_operation(f"api_key_{command}", {"command": command})
# Standalone commands — route before introspection gate
# Route all commands before introspection gate
if command == "list-providers":
list_providers()
return True
if command == "init":
init_env()
return True
if command == "get-key":
get_key(args)
return True
if command == "validate":
validate_key(args)
return True
# NO-ARGS GATE (seedgo standard)
# NO-ARGS GATE (seedgo standard) — only for unrecognized subcommands
if not args:
print_introspection()
return True
# Arg-required commands
if command == "get-key":
get_key(args)
elif command == "validate":
validate_key(args)
return True
except Exception as e:
logger.error(f"Error in api_key.handle_command: {e}")
@@ -132,7 +132,7 @@ def handle_command(command: str, args: List[str]) -> bool:
# Log operation
json_handler.log_operation(f"openrouter_{command}", {"command": command})
# Standalone commands — route before introspection gate
# Route all commands before introspection gate
if command == "test":
test_connection()
return True
@@ -142,16 +142,15 @@ def handle_command(command: str, args: List[str]) -> bool:
if command == "status":
check_status()
return True
if command == "call":
make_call(args)
return True
# NO-ARGS GATE (seedgo standard)
# NO-ARGS GATE (seedgo standard) — only for unrecognized subcommands
if not args:
print_introspection()
return True
# Arg-required commands
if command == "call":
make_call(args)
return True
except Exception as e:
logger.error(f"Error in openrouter_client.handle_command: {e}")
+11 -10
View File
@@ -142,27 +142,28 @@ def handle_command(command: str, args: List[str]) -> bool:
# Log operation
json_handler.log_operation(f"usage_{command}", {"command": command})
# Standalone commands — route before introspection gate
# Route all commands before introspection gate
if command == "stats":
show_stats()
return True
if command == "session":
show_session()
return True
if command == "track":
track_usage(args)
return True
if command == "caller-usage":
show_caller_usage(args)
return True
if command == "cleanup":
cleanup_data(args)
return True
# NO-ARGS GATE (seedgo standard)
# NO-ARGS GATE (seedgo standard) — only for unrecognized subcommands
if not args:
print_introspection()
return True
# Arg-required commands
if command == "track":
track_usage(args)
elif command == "caller-usage":
show_caller_usage(args)
elif command == "cleanup":
cleanup_data(args)
return True
except Exception as e:
logger.error(f"Error in usage_tracker.handle_command: {e}")
+31 -6
View File
@@ -165,16 +165,41 @@ def test_handle_command_help_gate_short_flag(mock_jh, mock_header, mock_console)
@patch(PATCH_CONSOLE)
@patch(PATCH_HEADER)
@patch(PATCH_SUCCESS)
@patch(PATCH_ERROR)
@patch(PATCH_JSON_HANDLER)
def test_handle_command_introspection_gate(mock_jh, mock_header, mock_console):
"""get-key with no args should trigger print_introspection and return True."""
@patch(PATCH_KEYS)
def test_handle_command_get_key_no_args_defaults_to_openrouter(
mock_keys, mock_jh, mock_error, mock_success, mock_header, mock_console
):
"""get-key with no args should execute with default provider 'openrouter'."""
mock_keys.get_api_key.return_value = "sk-or-test-key-123"
result = api_key.handle_command("get-key", [])
assert result is True
# Introspection gate fires after log_operation
mock_jh.log_operation.assert_called_once()
# Introspection prints the header "API Key Module Introspection"
mock_header.assert_called_with("API Key Module Introspection")
mock_keys.get_api_key.assert_called_once_with("openrouter")
mock_header.assert_called_with("Get API Key - openrouter")
@patch(PATCH_CONSOLE)
@patch(PATCH_HEADER)
@patch(PATCH_SUCCESS)
@patch(PATCH_ERROR)
@patch(PATCH_JSON_HANDLER)
@patch(PATCH_KEYS)
def test_handle_command_validate_no_args_defaults_to_openrouter(
mock_keys, mock_jh, mock_error, mock_success, mock_header, mock_console
):
"""validate with no args should execute with default provider 'openrouter'."""
mock_keys.get_api_key.return_value = "sk-or-test-key-123"
mock_keys.validate_key.return_value = True
result = api_key.handle_command("validate", [])
assert result is True
mock_keys.get_api_key.assert_called_once_with("openrouter")
mock_header.assert_called_with("Validate API Key - openrouter")
@patch(PATCH_CONSOLE)
+20 -4
View File
@@ -124,18 +124,19 @@ def test_handle_command_help_gate(mock_console, mock_header, mock_jh, mock_help)
mock_jh.log_operation.assert_not_called()
@patch(f"{_MOD}.print_introspection")
@patch(f"{_MOD}.error")
@patch(f"{_MOD}.json_handler")
@patch(f"{_MOD}.header")
@patch(f"{_MOD}.console")
def test_handle_command_introspection_gate(mock_console, mock_header, mock_jh, mock_intro):
"""'call' with no args triggers introspection instead of make_call."""
def test_handle_command_call_no_args_executes(mock_console, mock_header, mock_jh, mock_error):
"""'call' with no args should execute (show error), not show introspection."""
from aipass.api.apps.modules import openrouter_client
result = openrouter_client.handle_command("call", [])
assert result is True
mock_intro.assert_called_once()
mock_error.assert_called()
assert "Prompt required" in mock_error.call_args[0][0]
# =============================================
@@ -609,6 +610,21 @@ def test_make_call_no_model_shows_error(mock_console, mock_header, mock_error):
assert "Model required" in mock_error.call_args[0][0]
@patch(f"{_MOD}.error")
@patch(f"{_MOD}.json_handler")
@patch(f"{_MOD}.header")
@patch(f"{_MOD}.console")
def test_handle_command_call_no_args_shows_error(mock_console, mock_header, mock_jh, mock_error):
"""call with no args should show error, not introspection."""
from aipass.api.apps.modules import openrouter_client
result = openrouter_client.handle_command("call", [])
assert result is True
mock_error.assert_called_once()
assert "Prompt required" in mock_error.call_args[0][0]
# =============================================
# list_models — error on fetch failure
# =============================================
+5 -4
View File
@@ -154,18 +154,19 @@ def test_handle_command_help_gate(mock_jh, mock_header, mock_console, mock_help)
mock_jh.log_operation.assert_not_called()
@patch(f"{PATCH_ROOT}.print_introspection")
@patch(f"{PATCH_ROOT}.error")
@patch(f"{PATCH_ROOT}.console")
@patch(f"{PATCH_ROOT}.header")
@patch(f"{PATCH_ROOT}.json_handler")
def test_handle_command_introspection_gate(mock_jh, mock_header, mock_console, mock_intro):
"""'track' with empty args triggers introspection gate."""
def test_handle_command_track_no_args_executes(mock_jh, mock_header, mock_console, mock_error):
"""'track' with empty args should execute (show error), not show introspection."""
from aipass.api.apps.modules import usage_tracker
result = usage_tracker.handle_command("track", [])
assert result is True
mock_intro.assert_called_once()
mock_error.assert_called()
assert "Generation ID required" in mock_error.call_args[0][0]
@patch(f"{PATCH_ROOT}.console")