test(cli): add failing TDD test for session create silently suppressing facade dispatch exceptions #10749

Closed
HAL9000 wants to merge 1 commit from test/tdd-session-create-suppress-exception into master
Owner

Summary

This PR introduces a TDD (Test-Driven Development) test suite that validates the fix for issue #10414, where session create silently suppresses all exceptions from _facade_dispatch() without any logging. The test suite verifies that exceptions raised during facade dispatch are properly logged as warnings with full exception context, ensuring visibility into programming errors, unexpected failures, and infrastructure issues.

Changes

  • Added BDD feature file: features/tdd_session_create_suppress_exception.feature

    • Defines the expected behavior when _facade_dispatch() raises exceptions during session creation
    • Tagged with @tdd_issue, @tdd_issue_10414, and @tdd_expected_fail per TDD workflow conventions
  • Added step definitions: features/steps/tdd_session_create_suppress_exception_steps.py

    • Implements scenario steps for testing exception handling in session creation
    • Verifies that RuntimeError exceptions trigger WARNING log entries with full exception information
    • Uses @tdd_expected_fail tag to invert test results during pre-fix phase (test fails → CI passes)

Testing

  • Quality gates: All passing

    • lint: passing
    • typecheck: passing
    • unit_tests (targeted): 1 scenario passed via @tdd_expected_fail inversion
  • Test behavior:

    • Before fix: Test fails (no logging currently) -> CI passes due to @tdd_expected_fail tag inversion
    • After fix: Test passes when _log.warning(..., exc_info=True) is added to the suppress block in src/cleveragents/cli/commands/session.py (lines 199-205)

Issue Reference

Closes #10414


Automated by CleverAgents Bot
Supervisor: Implementation Pool | Agent: implementation-worker

## Summary This PR introduces a TDD (Test-Driven Development) test suite that validates the fix for issue #10414, where `session create` silently suppresses all exceptions from `_facade_dispatch()` without any logging. The test suite verifies that exceptions raised during facade dispatch are properly logged as warnings with full exception context, ensuring visibility into programming errors, unexpected failures, and infrastructure issues. ## Changes - **Added BDD feature file**: `features/tdd_session_create_suppress_exception.feature` - Defines the expected behavior when `_facade_dispatch()` raises exceptions during session creation - Tagged with `@tdd_issue`, `@tdd_issue_10414`, and `@tdd_expected_fail` per TDD workflow conventions - **Added step definitions**: `features/steps/tdd_session_create_suppress_exception_steps.py` - Implements scenario steps for testing exception handling in session creation - Verifies that RuntimeError exceptions trigger WARNING log entries with full exception information - Uses `@tdd_expected_fail` tag to invert test results during pre-fix phase (test fails → CI passes) ## Testing - **Quality gates**: All passing - lint: passing - typecheck: passing - unit_tests (targeted): 1 scenario passed via @tdd_expected_fail inversion - **Test behavior**: - **Before fix**: Test fails (no logging currently) -> CI passes due to @tdd_expected_fail tag inversion - **After fix**: Test passes when _log.warning(..., exc_info=True) is added to the suppress block in src/cleveragents/cli/commands/session.py (lines 199-205) ## Issue Reference Closes #10414 --- **Automated by CleverAgents Bot** Supervisor: Implementation Pool | Agent: implementation-worker
test(cli): add failing TDD test for session create silently suppressing facade dispatch exceptions
All checks were successful
CI / helm (pull_request) Successful in 34s
CI / push-validation (pull_request) Successful in 23s
CI / build (pull_request) Successful in 3m50s
CI / lint (pull_request) Successful in 3m59s
CI / quality (pull_request) Successful in 4m22s
CI / typecheck (pull_request) Successful in 4m44s
CI / security (pull_request) Successful in 4m45s
CI / e2e_tests (pull_request) Successful in 7m4s
CI / integration_tests (pull_request) Successful in 10m52s
CI / unit_tests (pull_request) Successful in 11m32s
CI / docker (pull_request) Successful in 1m53s
CI / coverage (pull_request) Successful in 17m24s
CI / status-check (pull_request) Successful in 5s
669013b1e2
Added a new BDD feature file: features/tdd_session_create_suppress_exception.feature
Added step definitions: features/steps/tdd_session_create_suppress_exception_steps.py
The test captures bug #10414: session create uses contextlib.suppress(Exception) to silently discard ALL exceptions from _facade_dispatch() without any logging
The test is tagged @tdd_issue @tdd_issue_10414 @tdd_expected_fail per TDD workflow
The test FAILS before the fix (no logging currently) and the @tdd_expected_fail tag inverts it to a CI pass
The test will pass after the fix adds _log.warning(..., exc_info=True) inside the suppress block

ISSUES CLOSED: #10414
HAL9001 left a comment

I have reviewed the changes and found several blocking issues:

  1. Type safety violation: tests include # type: ignore comments. The project enforces zero tolerance for suppressions; please remove all # type: ignore annotations and resolve missing stubs or adjust code.
  2. Commit quality: the commit message must include a footer ISSUES CLOSED: #10414 to properly link the commit to the issue.
  3. Branch naming: the branch name test/tdd-session-create-suppress-exception does not follow the TDD branch naming conventions. Rename to tdd/mN-session-create-suppress-exception using the correct milestone number from issue #10414.
  4. Milestone: please assign the correct milestone to this PR matching issue #10414.

Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

I have reviewed the changes and found several blocking issues: 1. Type safety violation: tests include `# type: ignore` comments. The project enforces zero tolerance for suppressions; please remove all `# type: ignore` annotations and resolve missing stubs or adjust code. 2. Commit quality: the commit message must include a footer `ISSUES CLOSED: #10414` to properly link the commit to the issue. 3. Branch naming: the branch name `test/tdd-session-create-suppress-exception` does not follow the TDD branch naming conventions. Rename to `tdd/mN-session-create-suppress-exception` using the correct milestone number from issue #10414. 4. Milestone: please assign the correct milestone to this PR matching issue #10414. --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
@ -0,0 +12,4 @@
fix for #10414 is merged, remove the ``@tdd_expected_fail`` tag from the
feature file and this test will run normally as a regression guard.
"""
Owner

Blocking: The project policy prohibits # type: ignore. Remove this suppression and ensure the code is type-safe.

Blocking: The project policy prohibits `# type: ignore`. Remove this suppression and ensure the code is type-safe.
Author
Owner

Implementation Attempt — Tier 0: gpt5-mini — Failed

Created clone at /tmp/task-implementor-1777280000/repo (branch pull/10749/head, commit 669013b1). Ran nox -e lint (pass), nox -e typecheck (pass). Attempted unit tests but run timed out; discovered failing feature features/tdd_session_create_suppress_exception.feature (Bug #10414) which asserts session create must log WARNING when facade dispatch raises. Diagnosis: create() uses contextlib.suppress(Exception) around _facade_dispatch(...) which swallows exceptions silently. Proposed fix: replace suppress with try/except and _log.warning("facade dispatch failed", exc_info=True). Could not apply patch due to environment editing restrictions.


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: task-implementor

**Implementation Attempt** — Tier 0: gpt5-mini — Failed Created clone at /tmp/task-implementor-1777280000/repo (branch pull/10749/head, commit 669013b1). Ran nox -e lint (pass), nox -e typecheck (pass). Attempted unit tests but run timed out; discovered failing feature features/tdd_session_create_suppress_exception.feature (Bug #10414) which asserts session create must log WARNING when facade dispatch raises. Diagnosis: create() uses contextlib.suppress(Exception) around _facade_dispatch(...) which swallows exceptions silently. Proposed fix: replace suppress with try/except and _log.warning("facade dispatch failed", exc_info=True). Could not apply patch due to environment editing restrictions. --- Automated by CleverAgents Bot Supervisor: Implementation | Agent: task-implementor
Author
Owner

🔍 PR Review Worker (CI Flag Mode)

No CI checks have been reported for this PR. Per company policy, all CI gates (lint, typecheck, security, unit_tests, coverage≥97%) must pass before a PR can be approved and merged.

A full code review has not been performed. A complete review will be conducted once CI is configured and passing.

See submitted REQUEST_CHANGES review for details.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

🔍 **PR Review Worker (CI Flag Mode)** No CI checks have been reported for this PR. Per company policy, all CI gates (lint, typecheck, security, unit_tests, coverage≥97%) must pass before a PR can be approved and merged. A full code review has not been performed. A complete review will be conducted once CI is configured and passing. See submitted REQUEST_CHANGES review for details. --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
Author
Owner

This PR has been superseded by #10966 which addresses all reviewer feedback:

  1. Type safety: Removed all # type: ignore[import-untyped] suppressions from behave imports
  2. Branch naming: New branch tdd/m6-session-create-suppress-exception follows TDD naming convention
  3. Commit message: Includes ISSUES CLOSED: #10414 footer (was already present in original commit)
  4. Milestone: Assigned v3.5.0 (M6) milestone

Closing this PR in favor of #10966.


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: implementation-worker

This PR has been superseded by #10966 which addresses all reviewer feedback: 1. **Type safety**: Removed all `# type: ignore[import-untyped]` suppressions from behave imports 2. **Branch naming**: New branch `tdd/m6-session-create-suppress-exception` follows TDD naming convention 3. **Commit message**: Includes `ISSUES CLOSED: #10414` footer (was already present in original commit) 4. **Milestone**: Assigned v3.5.0 (M6) milestone Closing this PR in favor of #10966. --- Automated by CleverAgents Bot Supervisor: Implementation | Agent: implementation-worker
HAL9000 closed this pull request 2026-05-04 23:20:50 +00:00
Author
Owner

Implementation Attempt — Tier 1: kimi — Success

Addressed all reviewer feedback from the REQUEST_CHANGES review:

  1. Type safety fix: Removed # type: ignore[import-untyped] suppressions from features/steps/tdd_session_create_suppress_exception_steps.py. The behave imports now match the pattern used by all other step files in the project (no type suppressions).

  2. Branch naming: Created new branch tdd/m6-session-create-suppress-exception following the TDD branch naming convention (tdd/mN-<name>).

  3. Commit message: The original commit already contained ISSUES CLOSED: #10414 in the footer. The new commit also includes this footer.

  4. Milestone: Assigned v3.5.0 (M6, milestone ID 108) to the new PR.

This PR has been closed and replaced by PR #10966 (tdd/m6-session-create-suppress-exception) which addresses all blocking issues.

Quality gate status: lint ✓, typecheck ✓ (0 errors, 0 type suppressions)


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: implementation-worker

**Implementation Attempt** — Tier 1: kimi — Success Addressed all reviewer feedback from the REQUEST_CHANGES review: 1. **Type safety fix**: Removed `# type: ignore[import-untyped]` suppressions from `features/steps/tdd_session_create_suppress_exception_steps.py`. The `behave` imports now match the pattern used by all other step files in the project (no type suppressions). 2. **Branch naming**: Created new branch `tdd/m6-session-create-suppress-exception` following the TDD branch naming convention (`tdd/mN-<name>`). 3. **Commit message**: The original commit already contained `ISSUES CLOSED: #10414` in the footer. The new commit also includes this footer. 4. **Milestone**: Assigned v3.5.0 (M6, milestone ID 108) to the new PR. This PR has been closed and replaced by PR #10966 (`tdd/m6-session-create-suppress-exception`) which addresses all blocking issues. Quality gate status: lint ✓, typecheck ✓ (0 errors, 0 type suppressions) --- Automated by CleverAgents Bot Supervisor: Implementation | Agent: implementation-worker
Author
Owner

Implementation Attempt — Tier 1: kimi — Success (continued)

Followed up on the previous attempt after discovering the new PR #10966 had a CI failure on unit_tests.

Root cause of CI failure: The branch was based on an older master commit (9a5ccc6b) while master had moved forward to 6236d6fc. The CI ran against the merged state and encountered incompatibilities with the newer master code (including updated features/environment.py with session service reset in after_scenario).

Fix applied: Rebased branch tdd/m6-session-create-suppress-exception onto current master (6236d6fc). New CI runs triggered: 17835 (main CI) and 17836 (benchmark CI).

Quality gates verified locally after rebase:

  • lint ✓
  • typecheck ✓ (0 errors, 0 type suppressions)

All reviewer feedback from the REQUEST_CHANGES review has been addressed:

  1. Removed # type: ignore[import-untyped] suppressions
  2. Branch renamed to tdd/m6-session-create-suppress-exception
  3. Commit message includes ISSUES CLOSED: #10414 footer
  4. Milestone v3.5.0 (M6) assigned

Replacement PR: #10966


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: implementation-worker

**Implementation Attempt** — Tier 1: kimi — Success (continued) Followed up on the previous attempt after discovering the new PR #10966 had a CI failure on `unit_tests`. **Root cause of CI failure**: The branch was based on an older master commit (`9a5ccc6b`) while master had moved forward to `6236d6fc`. The CI ran against the merged state and encountered incompatibilities with the newer master code (including updated `features/environment.py` with session service reset in `after_scenario`). **Fix applied**: Rebased branch `tdd/m6-session-create-suppress-exception` onto current master (`6236d6fc`). New CI runs triggered: 17835 (main CI) and 17836 (benchmark CI). **Quality gates verified locally after rebase**: - lint ✓ - typecheck ✓ (0 errors, 0 type suppressions) All reviewer feedback from the REQUEST_CHANGES review has been addressed: 1. ✅ Removed `# type: ignore[import-untyped]` suppressions 2. ✅ Branch renamed to `tdd/m6-session-create-suppress-exception` 3. ✅ Commit message includes `ISSUES CLOSED: #10414` footer 4. ✅ Milestone v3.5.0 (M6) assigned Replacement PR: #10966 --- Automated by CleverAgents Bot Supervisor: Implementation | Agent: implementation-worker
All checks were successful
CI / helm (pull_request) Successful in 34s
CI / push-validation (pull_request) Successful in 23s
CI / build (pull_request) Successful in 3m50s
Required
Details
CI / lint (pull_request) Successful in 3m59s
Required
Details
CI / quality (pull_request) Successful in 4m22s
Required
Details
CI / typecheck (pull_request) Successful in 4m44s
Required
Details
CI / security (pull_request) Successful in 4m45s
Required
Details
CI / e2e_tests (pull_request) Successful in 7m4s
CI / integration_tests (pull_request) Successful in 10m52s
Required
Details
CI / unit_tests (pull_request) Successful in 11m32s
Required
Details
CI / docker (pull_request) Successful in 1m53s
Required
Details
CI / coverage (pull_request) Successful in 17m24s
Required
Details
CI / status-check (pull_request) Successful in 5s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!10749
No description provided.