UAT: Silent exception suppression in plan use command hides project context propagation errors #3874

Open
opened 2026-04-06 07:04:47 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/plan-use-silent-exception-suppression
  • Commit Message: fix(cli): replace bare except pass in plan use with debug-level logging
  • Milestone: (none — backlog, see note below)
  • Parent Epic: #362

Bug Report

Feature Area: Error Handling and Resilience
Severity: Medium
Found by: UAT automated testing

What Was Tested

The plan use command in src/cleveragents/cli/commands/plan.py (around line 1829) was analyzed for compliance with the CONTRIBUTING.md exception propagation rules.

Expected Behavior (from CONTRIBUTING.md)

Errors must never be suppressed. Exceptions should be allowed to propagate up to the top-level execution handler.
Catch-all exception handlers should not be used unless they re-raise the exception.
Exceptions should only be caught when there is a meaningful way to handle them.

Actual Behavior

The plan use command silently swallows exceptions when propagating project context settings to the plan with a bare except Exception: pass:

# src/cleveragents/cli/commands/plan.py lines ~1810-1830
        try:
            # ... project context propagation logic ...
            if not execution_env_priority and proj_priority:
                from cleveragents.domain.models.core.plan import (
                    ExecutionEnvPriority,
                )
                plan.execution_env_priority = ExecutionEnvPriority(
                    proj_priority,
                )
                has_overrides = True
        except Exception:
            pass  # Project context not available; skip propagation  <-- VIOLATION

Why This Is a Problem

  1. No logging: If project context propagation fails (e.g., database error, invalid state), there is zero diagnostic information.
  2. Violates CONTRIBUTING.md: The rule states exceptions should only be caught when there is a meaningful recovery action. A bare pass is not meaningful.
  3. Silent data loss: If ExecutionEnvPriority construction fails or the project context lookup fails, the plan silently proceeds without the intended configuration. The user has no idea their project context settings were not applied.
  4. Masks configuration issues: If the project context service is broken, this silently hides the problem.

Replace the bare pass with a debug-level log:

        except Exception:
            logger.debug(
                "Project context propagation failed (non-fatal, skipping)",
                exc_info=True,
            )

Code Location

  • File: src/cleveragents/cli/commands/plan.py
  • Lines: ~1810-1830
  • Function: lifecycle_use_plan or similar plan use handler

Subtasks

  • Locate the exact except Exception: pass block in src/cleveragents/cli/commands/plan.py around line 1829
  • Replace the bare pass with logger.debug("Project context propagation failed (non-fatal, skipping)", exc_info=True)
  • Ensure a logger instance is available in the relevant scope (add module-level logger if missing)
  • Add or update Behave unit test scenarios covering the exception path to verify the debug log is emitted
  • Run nox -e lint and nox -e typecheck to confirm no regressions
  • Run nox -e unit_tests and nox -e coverage_report to confirm coverage >= 97%

Definition of Done

  • All subtasks above are completed
  • The bare except Exception: pass is replaced with a logger.debug(...) call that includes exc_info=True
  • No new # type: ignore suppressions introduced
  • A Behave scenario covers the exception path and asserts the debug log is emitted
  • A Git commit is created with the exact first line: fix(cli): replace bare except pass in plan use with debug-level logging
  • The commit is pushed to branch fix/plan-use-silent-exception-suppression
  • A pull request is submitted, reviewed, and merged
  • All nox stages pass
  • Coverage >= 97%

Backlog note: This issue was discovered during autonomous operation
on milestone v3.3.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/plan-use-silent-exception-suppression` - **Commit Message**: `fix(cli): replace bare except pass in plan use with debug-level logging` - **Milestone**: *(none — backlog, see note below)* - **Parent Epic**: #362 ## Bug Report **Feature Area:** Error Handling and Resilience **Severity:** Medium **Found by:** UAT automated testing ### What Was Tested The `plan use` command in `src/cleveragents/cli/commands/plan.py` (around line 1829) was analyzed for compliance with the CONTRIBUTING.md exception propagation rules. ### Expected Behavior (from CONTRIBUTING.md) > Errors must **never** be suppressed. Exceptions should be allowed to propagate up to the top-level execution handler. > Catch-all exception handlers should not be used unless they re-raise the exception. > Exceptions should only be caught when there is a meaningful way to handle them. ### Actual Behavior The `plan use` command silently swallows exceptions when propagating project context settings to the plan with a bare `except Exception: pass`: ```python # src/cleveragents/cli/commands/plan.py lines ~1810-1830 try: # ... project context propagation logic ... if not execution_env_priority and proj_priority: from cleveragents.domain.models.core.plan import ( ExecutionEnvPriority, ) plan.execution_env_priority = ExecutionEnvPriority( proj_priority, ) has_overrides = True except Exception: pass # Project context not available; skip propagation <-- VIOLATION ``` ### Why This Is a Problem 1. **No logging**: If project context propagation fails (e.g., database error, invalid state), there is zero diagnostic information. 2. **Violates CONTRIBUTING.md**: The rule states exceptions should only be caught when there is a meaningful recovery action. A bare `pass` is not meaningful. 3. **Silent data loss**: If `ExecutionEnvPriority` construction fails or the project context lookup fails, the plan silently proceeds without the intended configuration. The user has no idea their project context settings were not applied. 4. **Masks configuration issues**: If the project context service is broken, this silently hides the problem. ### Recommended Fix Replace the bare `pass` with a debug-level log: ```python except Exception: logger.debug( "Project context propagation failed (non-fatal, skipping)", exc_info=True, ) ``` ### Code Location - File: `src/cleveragents/cli/commands/plan.py` - Lines: ~1810-1830 - Function: `lifecycle_use_plan` or similar plan use handler ## Subtasks - [ ] Locate the exact `except Exception: pass` block in `src/cleveragents/cli/commands/plan.py` around line 1829 - [ ] Replace the bare `pass` with `logger.debug("Project context propagation failed (non-fatal, skipping)", exc_info=True)` - [ ] Ensure a `logger` instance is available in the relevant scope (add module-level logger if missing) - [ ] Add or update Behave unit test scenarios covering the exception path to verify the debug log is emitted - [ ] Run `nox -e lint` and `nox -e typecheck` to confirm no regressions - [ ] Run `nox -e unit_tests` and `nox -e coverage_report` to confirm coverage >= 97% ## Definition of Done - [ ] All subtasks above are completed - [ ] The bare `except Exception: pass` is replaced with a `logger.debug(...)` call that includes `exc_info=True` - [ ] No new `# type: ignore` suppressions introduced - [ ] A Behave scenario covers the exception path and asserts the debug log is emitted - [ ] A Git commit is created with the exact first line: `fix(cli): replace bare except pass in plan use with debug-level logging` - [ ] The commit is pushed to branch `fix/plan-use-silent-exception-suppression` - [ ] A pull request is submitted, reviewed, and merged - [ ] All nox stages pass - [ ] Coverage >= 97% > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.3.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
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.

Blocks
#362 Epic: Security & Safety Hardening
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3874
No description provided.