bug(application): Error suppression in ParallelStrategyExecutor violates CONTRIBUTING.md #9072

Open
opened 2026-04-14 07:07:45 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Commit Message: fix(application): Stop suppressing exceptions in ParallelStrategyExecutor
  • Branch: bugfix/m-error-suppression-parallel-strategy-executor

Background and context

The ParallelStrategyExecutor in acms_pipeline.py suppresses exceptions that occur during strategy execution, which is a direct violation of the error handling guidelines in CONTRIBUTING.md.

Current behavior

The _execute_single and _execute_parallel methods in ParallelStrategyExecutor have try...except Exception blocks that catch all exceptions. The exception is logged, and the circuit breaker is updated, but the exception is not re-raised. This suppresses any errors that might occur during strategy execution, leading to silent failures that are difficult to debug.

Code Evidence:

# src/cleveragents/application/services/acms_pipeline.py:387
        try:
            result = list(strategy.assemble(fragments, scoped_budget))
            elapsed = time.monotonic() - start
            self._circuit_breaker.record_success(strategy.name)
            self._logger.info(
                "Strategy executed",
                strategy=strategy.name,
                fragments_returned=len(result),
                elapsed_ms=round(elapsed * 1000, 1),
            )
            return result
        except Exception:
            elapsed = time.monotonic() - start
            self._circuit_breaker.record_failure(strategy.name)
            self._logger.warning(
                "Strategy failed",
                strategy=strategy.name,
                elapsed_ms=round(elapsed * 1000, 1),
                exc_info=True,
            )
            return []
# src/cleveragents/application/services/acms_pipeline.py:433
                try:
                    result = future.result(timeout=0)
                    self._circuit_breaker.record_success(name)
                    collected.extend(result)
                    self._logger.info(
                        "Strategy executed (parallel)",
                        strategy=name,
                        fragments_returned=len(result),
                    )
                except Exception:
                    self._circuit_breaker.record_failure(name)
                    self._logger.warning(
                        "Strategy failed (parallel)",
                        strategy=name,
                        exc_info=True,
                    )

Violation of CONTRIBUTING.md:

The CONTRIBUTING.md file explicitly states: "CRITICAL: Do not suppress errors. Let exceptions propagate to top-level execution."

Expected behavior

Exceptions that occur during strategy execution should not be suppressed. While a single failing strategy should not crash the entire pipeline, the errors should be collected and reported in a more transparent way. For example, a custom exception could be raised that contains information about which strategies failed and why.

Acceptance criteria

  • The try...except Exception blocks in _execute_single and _execute_parallel are modified to not suppress exceptions.
  • Errors from failing strategies are collected and reported in a way that is visible to the caller of the pipeline.

Subtasks

  • Modify the exception handling in _execute_single to not suppress exceptions.
  • Modify the exception handling in _execute_parallel to not suppress exceptions.
  • Consider raising a custom exception to report strategy failures.
  • Tests (Behave): Add scenarios to verify that exceptions during strategy execution are propagated correctly.
  • Verify coverage >=97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message
    matches the Commit Message in Metadata exactly, followed by a blank line,
    then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in
    Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and
    merged before this issue is marked done.

Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit Message**: `fix(application): Stop suppressing exceptions in ParallelStrategyExecutor` - **Branch**: `bugfix/m-error-suppression-parallel-strategy-executor` ## Background and context The `ParallelStrategyExecutor` in `acms_pipeline.py` suppresses exceptions that occur during strategy execution, which is a direct violation of the error handling guidelines in `CONTRIBUTING.md`. ## Current behavior The `_execute_single` and `_execute_parallel` methods in `ParallelStrategyExecutor` have `try...except Exception` blocks that catch all exceptions. The exception is logged, and the circuit breaker is updated, but the exception is not re-raised. This suppresses any errors that might occur during strategy execution, leading to silent failures that are difficult to debug. **Code Evidence:** ```python # src/cleveragents/application/services/acms_pipeline.py:387 try: result = list(strategy.assemble(fragments, scoped_budget)) elapsed = time.monotonic() - start self._circuit_breaker.record_success(strategy.name) self._logger.info( "Strategy executed", strategy=strategy.name, fragments_returned=len(result), elapsed_ms=round(elapsed * 1000, 1), ) return result except Exception: elapsed = time.monotonic() - start self._circuit_breaker.record_failure(strategy.name) self._logger.warning( "Strategy failed", strategy=strategy.name, elapsed_ms=round(elapsed * 1000, 1), exc_info=True, ) return [] ``` ```python # src/cleveragents/application/services/acms_pipeline.py:433 try: result = future.result(timeout=0) self._circuit_breaker.record_success(name) collected.extend(result) self._logger.info( "Strategy executed (parallel)", strategy=name, fragments_returned=len(result), ) except Exception: self._circuit_breaker.record_failure(name) self._logger.warning( "Strategy failed (parallel)", strategy=name, exc_info=True, ) ``` **Violation of CONTRIBUTING.md:** The `CONTRIBUTING.md` file explicitly states: "**CRITICAL: Do not suppress errors. Let exceptions propagate to top-level execution.**" ## Expected behavior Exceptions that occur during strategy execution should not be suppressed. While a single failing strategy should not crash the entire pipeline, the errors should be collected and reported in a more transparent way. For example, a custom exception could be raised that contains information about which strategies failed and why. ## Acceptance criteria - The `try...except Exception` blocks in `_execute_single` and `_execute_parallel` are modified to not suppress exceptions. - Errors from failing strategies are collected and reported in a way that is visible to the caller of the pipeline. ## Subtasks - [ ] Modify the exception handling in `_execute_single` to not suppress exceptions. - [ ] Modify the exception handling in `_execute_parallel` to not suppress exceptions. - [ ] Consider raising a custom exception to report strategy failures. - [ ] Tests (Behave): Add scenarios to verify that exceptions during strategy execution are propagated correctly. - [ ] Verify coverage >=97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. --- **Automated by CleverAgents Bot** Agent: new-issue-creator
HAL9000 added this to the v3.0.0 milestone 2026-04-14 07:12:07 +00:00
HAL9000 modified the milestone from v3.0.0 to v3.4.0 2026-04-14 07:37:27 +00:00
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.

Dependencies

No dependencies set.

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