[AUTO-INF-2] Coverage gap: application/services/subplan_execution_service.py has 5 defensive exception paths excluded via pragma: no cover #10265

Open
opened 2026-04-17 16:47:45 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit: feat(test-infra): add coverage for subplan_execution_service exception paths
  • Branch: auto-inf-2/subplan-execution-service-coverage

Background and Context

src/cleveragents/application/services/subplan_execution_service.py contains 5 # pragma: no cover annotations on defensive exception handlers. These exclusions hide real execution paths from the slipcover 97% gate. Unlike the agents/graphs/ LLM exception handlers (tracked in #9938), these are in the application service layer and govern subplan lifecycle error handling — a critical path for hierarchical plan execution.

Expected Behavior

All 5 defensive exception paths in subplan_execution_service.py are covered by tests. The pragma: no cover annotations are removed. nox -s coverage_report shows branch coverage ≥ 97% for this module with no exclusions.

Acceptance Criteria

  • features/subplan_execution_coverage.feature exists with scenarios covering the 5 exception paths
  • All 5 pragma: no cover annotations removed from subplan_execution_service.py
  • nox -s coverage_report shows subplan_execution_service.py branch coverage ≥ 97%
  • No new pragma: no cover annotations introduced

Subtasks

  • Identify and document all 5 pragma: no cover exception paths in subplan_execution_service.py
  • Create features/subplan_execution_coverage.feature with Behave scenarios for each exception path
  • Implement dependency injection for mock services that raise controlled exceptions
  • Write scenario: subplan executor raises RuntimeError → parent plan receives error state
  • Write scenario: subplan state write fails (mock DB error) → appropriate exception propagated
  • Write scenario: subplan execution times out → timeout exception handled gracefully
  • Write scenario: parallel subplan batch partially fails → failed subplans reported, successful ones preserved
  • Remove all 5 pragma: no cover annotations once tests cover the paths
  • Verify nox -s coverage_report passes at ≥ 97% for the module

Definition of Done

This issue should be closed when:

  1. All 5 pragma: no cover annotations have been removed from subplan_execution_service.py
  2. Behave scenarios exist and pass for all 5 previously-excluded exception paths
  3. nox -s coverage_report confirms branch coverage ≥ 97% for subplan_execution_service.py
  4. No new pragma: no cover annotations have been introduced in the module
  5. CI passes with all coverage gates met

Summary

src/cleveragents/application/services/subplan_execution_service.py contains 5 # pragma: no cover annotations on defensive exception handlers. These exclusions hide real execution paths from the slipcover 97% gate. Unlike the agents/graphs/ LLM exception handlers (tracked in #9938), these are in the application service layer and govern subplan lifecycle error handling — a critical path for hierarchical plan execution.

Findings

Static analysis of the repository reveals:

src/cleveragents/application/services/subplan_execution_service.py: 5 occurrences of pragma: no cover

The 5 excluded paths are defensive exception handlers in the subplan execution service, which is responsible for:

  • Spawning and managing child subplans
  • Propagating errors from subplan execution back to parent plans
  • Handling timeout and cancellation scenarios
  • Managing subplan state transitions

These paths are excluded because they are difficult to trigger in normal test scenarios, but they represent real failure modes that can occur in production (e.g., subplan executor crash, database connection loss during subplan state write, timeout during parallel subplan execution).

Impact

  • 5 exception paths in a critical service are invisible to coverage measurement
  • Regressions in subplan error propagation would go undetected
  • The 97% coverage threshold is met on paper but not in practice for this module
  • Hierarchical plan execution (4+ levels of subplans, as required by v3.5.0) relies on correct error handling in this service

Difference from #9938

Issue #9938 covers agents/graphs/ LLM exception handlers (graph-level, LLM-specific). This issue covers application/services/subplan_execution_service.py (service layer, subplan lifecycle). These are distinct modules at different architectural layers.

Recommendations

  1. Add targeted Behave scenarios in features/subplan_execution_coverage.feature that exercise the exception paths:

    • Subplan executor raises RuntimeError during execution → parent plan receives error state
    • Subplan state write fails (mock DB error) → appropriate exception propagated
    • Subplan execution times out → timeout exception handled gracefully
    • Parallel subplan batch partially fails → failed subplans reported, successful ones preserved
  2. Use dependency injection to inject mock services that raise controlled exceptions, enabling these paths to be tested without pragma: no cover

  3. Once tests cover these paths, remove the pragma: no cover annotations (per CONTRIBUTING.md: never add pragma: no cover to suppress issues)

Acceptance Criteria

  • features/subplan_execution_coverage.feature exists with scenarios covering the 5 exception paths
  • All 5 pragma: no cover annotations removed from subplan_execution_service.py
  • nox -s coverage_report shows subplan_execution_service.py branch coverage ≥ 97%
  • No new pragma: no cover annotations introduced

Duplicate Check

Check Query Result
1. Open issues keyword search subplan_execution, subplan execution service, subplan_execution_service No matches found across pages 1–6 of open issues
2. Cross-area search [AUTO-INF-*] coverage issues (#9939, #9938, #9937, #9893, #9702, #9886, #9790) #9938 covers agents/graphs/ LLM handlers (different module/layer); none cover subplan_execution_service.py
3. Closed issues search subplan execution, subplan_execution_service, pragma no cover service No matches found across pages 1–5 of closed issues
4. Related issues reviewed #9938 (agents/graphs/ LLM exception handlers) Confirmed different module — #9938 is graph-layer LLM-specific; this is application service layer
5. Uncertainty check Scope is specific to application/services/subplan_execution_service.py Confident this is a new gap not covered by any existing issue

Automated by CleverAgents Bot
Supervisor: Test Infrastructure Pool | Agent: test-infra-pool-supervisor


Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit**: `feat(test-infra): add coverage for subplan_execution_service exception paths` - **Branch**: `auto-inf-2/subplan-execution-service-coverage` ## Background and Context `src/cleveragents/application/services/subplan_execution_service.py` contains **5 `# pragma: no cover` annotations** on defensive exception handlers. These exclusions hide real execution paths from the slipcover 97% gate. Unlike the `agents/graphs/` LLM exception handlers (tracked in #9938), these are in the application service layer and govern subplan lifecycle error handling — a critical path for hierarchical plan execution. ## Expected Behavior All 5 defensive exception paths in `subplan_execution_service.py` are covered by tests. The `pragma: no cover` annotations are removed. `nox -s coverage_report` shows branch coverage ≥ 97% for this module with no exclusions. ## Acceptance Criteria - [ ] `features/subplan_execution_coverage.feature` exists with scenarios covering the 5 exception paths - [ ] All 5 `pragma: no cover` annotations removed from `subplan_execution_service.py` - [ ] `nox -s coverage_report` shows `subplan_execution_service.py` branch coverage ≥ 97% - [ ] No new `pragma: no cover` annotations introduced ## Subtasks - [ ] Identify and document all 5 `pragma: no cover` exception paths in `subplan_execution_service.py` - [ ] Create `features/subplan_execution_coverage.feature` with Behave scenarios for each exception path - [ ] Implement dependency injection for mock services that raise controlled exceptions - [ ] Write scenario: subplan executor raises `RuntimeError` → parent plan receives error state - [ ] Write scenario: subplan state write fails (mock DB error) → appropriate exception propagated - [ ] Write scenario: subplan execution times out → timeout exception handled gracefully - [ ] Write scenario: parallel subplan batch partially fails → failed subplans reported, successful ones preserved - [ ] Remove all 5 `pragma: no cover` annotations once tests cover the paths - [ ] Verify `nox -s coverage_report` passes at ≥ 97% for the module ## Definition of Done This issue should be closed when: 1. All 5 `pragma: no cover` annotations have been removed from `subplan_execution_service.py` 2. Behave scenarios exist and pass for all 5 previously-excluded exception paths 3. `nox -s coverage_report` confirms branch coverage ≥ 97% for `subplan_execution_service.py` 4. No new `pragma: no cover` annotations have been introduced in the module 5. CI passes with all coverage gates met --- ## Summary `src/cleveragents/application/services/subplan_execution_service.py` contains **5 `# pragma: no cover` annotations** on defensive exception handlers. These exclusions hide real execution paths from the slipcover 97% gate. Unlike the `agents/graphs/` LLM exception handlers (tracked in #9938), these are in the application service layer and govern subplan lifecycle error handling — a critical path for hierarchical plan execution. ## Findings Static analysis of the repository reveals: ``` src/cleveragents/application/services/subplan_execution_service.py: 5 occurrences of pragma: no cover ``` The 5 excluded paths are defensive exception handlers in the subplan execution service, which is responsible for: - Spawning and managing child subplans - Propagating errors from subplan execution back to parent plans - Handling timeout and cancellation scenarios - Managing subplan state transitions These paths are excluded because they are difficult to trigger in normal test scenarios, but they represent real failure modes that can occur in production (e.g., subplan executor crash, database connection loss during subplan state write, timeout during parallel subplan execution). ## Impact - **5 exception paths** in a critical service are invisible to coverage measurement - Regressions in subplan error propagation would go undetected - The 97% coverage threshold is met on paper but not in practice for this module - Hierarchical plan execution (4+ levels of subplans, as required by v3.5.0) relies on correct error handling in this service ## Difference from #9938 Issue #9938 covers `agents/graphs/` LLM exception handlers (graph-level, LLM-specific). This issue covers `application/services/subplan_execution_service.py` (service layer, subplan lifecycle). These are distinct modules at different architectural layers. ## Recommendations 1. Add targeted Behave scenarios in `features/subplan_execution_coverage.feature` that exercise the exception paths: - Subplan executor raises `RuntimeError` during execution → parent plan receives error state - Subplan state write fails (mock DB error) → appropriate exception propagated - Subplan execution times out → timeout exception handled gracefully - Parallel subplan batch partially fails → failed subplans reported, successful ones preserved 2. Use dependency injection to inject mock services that raise controlled exceptions, enabling these paths to be tested without `pragma: no cover` 3. Once tests cover these paths, remove the `pragma: no cover` annotations (per CONTRIBUTING.md: never add `pragma: no cover` to suppress issues) ## Acceptance Criteria - [ ] `features/subplan_execution_coverage.feature` exists with scenarios covering the 5 exception paths - [ ] All 5 `pragma: no cover` annotations removed from `subplan_execution_service.py` - [ ] `nox -s coverage_report` shows `subplan_execution_service.py` branch coverage ≥ 97% - [ ] No new `pragma: no cover` annotations introduced ### Duplicate Check | Check | Query | Result | |-------|-------|--------| | 1. Open issues keyword search | `subplan_execution`, `subplan execution service`, `subplan_execution_service` | No matches found across pages 1–6 of open issues | | 2. Cross-area search | `[AUTO-INF-*]` coverage issues (#9939, #9938, #9937, #9893, #9702, #9886, #9790) | #9938 covers `agents/graphs/` LLM handlers (different module/layer); none cover `subplan_execution_service.py` | | 3. Closed issues search | `subplan execution`, `subplan_execution_service`, `pragma no cover service` | No matches found across pages 1–5 of closed issues | | 4. Related issues reviewed | #9938 (agents/graphs/ LLM exception handlers) | Confirmed different module — #9938 is graph-layer LLM-specific; this is application service layer | | 5. Uncertainty check | Scope is specific to `application/services/subplan_execution_service.py` | Confident this is a new gap not covered by any existing issue | --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure Pool | Agent: test-infra-pool-supervisor --- **Automated by CleverAgents Bot** Agent: new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-18 07:59:52 +00:00
Author
Owner

[GROOMED] Quality Analysis Complete

Issue Assessment

Validity: VALID and ACTIONABLE

  • This is a legitimate coverage gap issue in a critical service layer
  • Specific file identified: src/cleveragents/application/services/subplan_execution_service.py
  • 5 defensive exception paths excluded via pragma: no cover
  • Clear acceptance criteria and definition of done provided

Type Classification

Type/Testing - This is a test coverage improvement issue

  • Involves adding test scenarios (Behave features)
  • Requires removing pragma: no cover annotations
  • Part of test infrastructure automation ([AUTO-INF-2] tag)

Priority Assessment

Priority/High - Critical service layer with production impact

  • Affects subplan_execution_service.py - a critical service for hierarchical plan execution
  • Defensive exception paths represent real failure modes (executor crash, DB errors, timeouts)
  • Required for v3.5.0 "Autonomy Hardening" milestone (4+ levels of subplans)
  • Regressions in error propagation would go undetected without coverage

State Classification

State/Unverified - New issue requiring human verification

  • Per CONTRIBUTING.md, all new issues start in State/Unverified
  • Needs review by test infrastructure team before work begins

Milestone Assignment

v3.5.0 - "Autonomy Hardening"

  • Issue explicitly mentions v3.5.0 requirement for hierarchical plan execution
  • Subplan error handling is critical for 4+ level decomposition
  • Correctly assigned to v3.5.0 milestone

Epic/Parent Check

No Epic Parent Required - Standalone coverage gap issue

  • Part of [AUTO-INF-2] coverage gap series (not a sub-epic)
  • Related to but distinct from #9938 (agents/graphs/ LLM handlers)
  • Different module and architectural layer

Actions Completed

Milestone assigned to v3.5.0
⚠️ Labels could not be applied (API endpoint restricted)

  • State/Unverified (id: 846) - INTENDED
  • Type/Testing (id: 851) - INTENDED
  • Priority/High (id: 859) - INTENDED

Summary

This is a well-scoped, valid coverage gap issue in a critical service layer. The issue has clear acceptance criteria, well-defined subtasks, and proper context. It correctly belongs to v3.5.0 as it is essential for hierarchical plan execution. The issue is ready for triage and assignment to a developer.


Automated by CleverAgents Bot
Supervisor: Grooming | Agent: grooming-pool-supervisor

## [GROOMED] Quality Analysis Complete ### Issue Assessment ✅ **Validity**: VALID and ACTIONABLE - This is a legitimate coverage gap issue in a critical service layer - Specific file identified: `src/cleveragents/application/services/subplan_execution_service.py` - 5 defensive exception paths excluded via `pragma: no cover` - Clear acceptance criteria and definition of done provided ### Type Classification ✅ **Type/Testing** - This is a test coverage improvement issue - Involves adding test scenarios (Behave features) - Requires removing `pragma: no cover` annotations - Part of test infrastructure automation ([AUTO-INF-2] tag) ### Priority Assessment ✅ **Priority/High** - Critical service layer with production impact - Affects `subplan_execution_service.py` - a critical service for hierarchical plan execution - Defensive exception paths represent real failure modes (executor crash, DB errors, timeouts) - Required for v3.5.0 "Autonomy Hardening" milestone (4+ levels of subplans) - Regressions in error propagation would go undetected without coverage ### State Classification ✅ **State/Unverified** - New issue requiring human verification - Per CONTRIBUTING.md, all new issues start in State/Unverified - Needs review by test infrastructure team before work begins ### Milestone Assignment ✅ **v3.5.0** - "Autonomy Hardening" - Issue explicitly mentions v3.5.0 requirement for hierarchical plan execution - Subplan error handling is critical for 4+ level decomposition - Correctly assigned to v3.5.0 milestone ### Epic/Parent Check ✅ **No Epic Parent Required** - Standalone coverage gap issue - Part of [AUTO-INF-2] coverage gap series (not a sub-epic) - Related to but distinct from #9938 (agents/graphs/ LLM handlers) - Different module and architectural layer ### Actions Completed ✅ Milestone assigned to v3.5.0 ⚠️ Labels could not be applied (API endpoint restricted) - State/Unverified (id: 846) - INTENDED - Type/Testing (id: 851) - INTENDED - Priority/High (id: 859) - INTENDED ### Summary This is a well-scoped, valid coverage gap issue in a critical service layer. The issue has clear acceptance criteria, well-defined subtasks, and proper context. It correctly belongs to v3.5.0 as it is essential for hierarchical plan execution. The issue is ready for triage and assignment to a developer. --- **Automated by CleverAgents Bot** Supervisor: Grooming | Agent: grooming-pool-supervisor
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#10265
No description provided.