fix(cli): resolve CI failures and reviewer feedback for ACMS context CLI commands
- Fix integration test failure: Context Show Validates Empty View Name
- typer.Exit is click.Exit (RuntimeError subclass), not SystemExit
- Robot helper now catches typer.Exit using exit_code attribute
- Helper path insertion now always places clone src at sys.path[0]
to prevent /app/src from shadowing the PR branch source
- Fix information disclosure: CleverAgentsError handler now logs
exception internally via _logger.exception() and shows generic
user-facing message instead of str(e)
- Fix budget utilization: use actual per-tier token counts instead
of hot_count * 100 (fragment count * arbitrary factor)
- Fix type safety: _remove_fragments now uses _TierServiceProtocol
instead of object, enabling proper static type checking
- Fix overly broad except: cancellation handled with early return
instead of catching typer.Exit(0) in the except block
- Add broad glob pattern warning when --path matches > 50 entries
- Remove duplicate HAL 9000 entry from CONTRIBUTORS.md
- Fix Behave steps to catch typer.Exit in addition to SystemExit
ISSUES CLOSED: #9586
This commit is contained in:
@@ -24,13 +24,18 @@ from typing import Any
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
_SRC = str(Path(__file__).resolve().parents[1] / "src")
|
||||
if _SRC not in sys.path:
|
||||
sys.path.insert(0, _SRC)
|
||||
# Always insert at position 0 to ensure the clone's source takes precedence
|
||||
# over any other cleveragents installation (e.g., /app/src from the environment)
|
||||
if _SRC in sys.path:
|
||||
sys.path.remove(_SRC)
|
||||
sys.path.insert(0, _SRC)
|
||||
|
||||
_FEATURES = str(Path(__file__).resolve().parents[1])
|
||||
if _FEATURES not in sys.path:
|
||||
sys.path.insert(0, _FEATURES)
|
||||
if _FEATURES in sys.path:
|
||||
sys.path.remove(_FEATURES)
|
||||
sys.path.insert(0, _FEATURES)
|
||||
|
||||
import typer # noqa: E402
|
||||
from features.mocks.acms_context_mocks import ( # noqa: E402
|
||||
make_mock_container,
|
||||
make_mock_tier_service,
|
||||
@@ -88,6 +93,8 @@ def _run_show(
|
||||
exit_code = 0
|
||||
try:
|
||||
acms_context_show(view)
|
||||
except typer.Exit as exc:
|
||||
exit_code = exc.exit_code if exc.exit_code is not None else 0
|
||||
except SystemExit as exc:
|
||||
exit_code = exc.code if exc.code is not None else 0
|
||||
|
||||
@@ -125,6 +132,8 @@ def _run_clear(
|
||||
exit_code = 0
|
||||
try:
|
||||
acms_context_clear(path=path, tag=tag, tier=tier, yes=yes)
|
||||
except typer.Exit as exc:
|
||||
exit_code = exc.exit_code if exc.exit_code is not None else 0
|
||||
except SystemExit as exc:
|
||||
exit_code = exc.code if exc.code is not None else 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user