UAT: plan.py uses with suppress(Exception) for actor registry initialization — silently hides actor setup failures with no diagnostic output #5698

Open
opened 2026-04-09 08:40:10 +00:00 by HAL9000 · 1 comment
Owner

Summary

src/cleveragents/cli/commands/plan.py uses with suppress(Exception) at two locations (lines 903 and 1006) to silently suppress all exceptions during actor registry initialization. This means failures in ensure_built_in_actors() or ensure_default_mock_actor() are completely invisible to users and operators.

Code Locations

# plan.py line 903 (in tell/use command setup)
with suppress(Exception):
    if actor_registry:
        actor_registry.ensure_built_in_actors()
    if testing_mode:
        container.actor_service().ensure_default_mock_actor()

# plan.py line 1006 (in execute command setup)
with suppress(Exception):
    if actor_registry:
        actor_registry.ensure_built_in_actors()
    if testing_mode:
        container.actor_service().ensure_default_mock_actor()

Expected Behavior (per CONTRIBUTING.md)

Per CONTRIBUTING.md:

Only catch exceptions when you can meaningfully handle them (e.g., retry logic, resource cleanup, adding context). Otherwise, let them propagate.

Actor registry initialization is a critical setup step. If ensure_built_in_actors() fails (e.g., due to a database error, configuration issue, or programming error), the subsequent command will fail with a confusing "actor not found" error rather than a clear "actor initialization failed" message.

Actual Behavior

If actor registry initialization fails:

  1. The exception is silently swallowed
  2. The command continues with an empty/partial actor registry
  3. The user sees a confusing downstream error like ValidationError: Actor 'anthropic/claude-3-5-sonnet' not found instead of the root cause

Impact

  • Users cannot diagnose why built-in actors are unavailable
  • Programming errors in ensure_built_in_actors() are hidden during development
  • Database errors during actor initialization are invisible

Fix Required

Replace suppress(Exception) with a specific exception type or add logging:

try:
    if actor_registry:
        actor_registry.ensure_built_in_actors()
    if testing_mode:
        container.actor_service().ensure_default_mock_actor()
except Exception:
    logger.warning("Actor registry initialization failed", exc_info=True)
    # Continue — actor commands will fail with a more specific error

Or narrow to expected exceptions:

try:
    if actor_registry:
        actor_registry.ensure_built_in_actors()
except (DatabaseError, ConfigurationError):
    pass  # Actor registry unavailable; commands requiring actors will fail with clear error

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Summary `src/cleveragents/cli/commands/plan.py` uses `with suppress(Exception)` at two locations (lines 903 and 1006) to silently suppress all exceptions during actor registry initialization. This means failures in `ensure_built_in_actors()` or `ensure_default_mock_actor()` are completely invisible to users and operators. ## Code Locations ```python # plan.py line 903 (in tell/use command setup) with suppress(Exception): if actor_registry: actor_registry.ensure_built_in_actors() if testing_mode: container.actor_service().ensure_default_mock_actor() # plan.py line 1006 (in execute command setup) with suppress(Exception): if actor_registry: actor_registry.ensure_built_in_actors() if testing_mode: container.actor_service().ensure_default_mock_actor() ``` ## Expected Behavior (per CONTRIBUTING.md) Per CONTRIBUTING.md: > **Only catch exceptions when you can meaningfully handle them** (e.g., retry logic, resource cleanup, adding context). Otherwise, let them propagate. Actor registry initialization is a critical setup step. If `ensure_built_in_actors()` fails (e.g., due to a database error, configuration issue, or programming error), the subsequent command will fail with a confusing "actor not found" error rather than a clear "actor initialization failed" message. ## Actual Behavior If actor registry initialization fails: 1. The exception is silently swallowed 2. The command continues with an empty/partial actor registry 3. The user sees a confusing downstream error like `ValidationError: Actor 'anthropic/claude-3-5-sonnet' not found` instead of the root cause ## Impact - Users cannot diagnose why built-in actors are unavailable - Programming errors in `ensure_built_in_actors()` are hidden during development - Database errors during actor initialization are invisible ## Fix Required Replace `suppress(Exception)` with a specific exception type or add logging: ```python try: if actor_registry: actor_registry.ensure_built_in_actors() if testing_mode: container.actor_service().ensure_default_mock_actor() except Exception: logger.warning("Actor registry initialization failed", exc_info=True) # Continue — actor commands will fail with a more specific error ``` Or narrow to expected exceptions: ```python try: if actor_registry: actor_registry.ensure_built_in_actors() except (DatabaseError, ConfigurationError): pass # Actor registry unavailable; commands requiring actors will fail with clear error ``` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 08:46:47 +00:00
Author
Owner

Label compliance fix applied:

  • Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Label compliance fix applied: - Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#5698
No description provided.