TDD: SimpleToolAgent.process swallows named-operation exceptions without logging — silent empty-string return hides failures #10481

Open
opened 2026-04-18 10:05:23 +00:00 by HAL9000 · 0 comments
Owner

Summary

This TDD issue captures the bug where SimpleToolAgent.process() in
src/cleveragents/reactive/stream_router.py silently swallows exceptions raised by
named operations, returning an empty string with no log output. The corresponding bug
issue depends on this TDD issue.

Bug Description

In SimpleToolAgent.process() at line 172 of stream_router.py:

try:
    return fn(content, meta, ctx)
except Exception:
    return ""

When a registered named operation raises an exception, the exception is caught and
discarded — no log message, no warning, no traceback. The caller receives an empty
string "" with no indication that anything went wrong. This makes debugging
impossible when a tool operation fails silently.

Deliverable

A Behave BDD feature file under features/ that captures the buggy behavior with
the appropriate TDD tags. The test must:

  1. Register a named operation that raises an exception
  2. Call SimpleToolAgent.process() with content that triggers the failing operation
  3. Assert that a warning log entry is emitted containing the exception message
  4. Be tagged with @tdd_issue, @tdd_issue_<N> (where N is the bug issue number),
    and @tdd_expected_fail

Background and Context

SimpleToolAgent.process() in stream_router.py contains a bare except Exception: return "" block that silently discards all exceptions from named operations. This pattern makes it impossible to diagnose failures in production or during testing — callers receive an empty string with no indication of what went wrong. This TDD issue must be filed and merged before the corresponding bug fix issue is opened, so that the failing test exists in the codebase before the fix is applied.

Expected Behavior

When a named operation registered with SimpleToolAgent raises an exception during process(), the agent should emit a warning-level log entry containing the exception message and type, so that callers and operators can diagnose the failure.

Acceptance Criteria

  • A Behave scenario exists that asserts a warning log is emitted when a named
    operation raises an exception in SimpleToolAgent.process()
  • The scenario is tagged with @tdd_issue, @tdd_issue_<N>, and @tdd_expected_fail
  • CI passes because @tdd_expected_fail inverts the result
  • The scenario fails (assertion fails) when the @tdd_expected_fail tag is removed
    and the bug is still present

Subtasks

  • Write a Behave feature file under features/ with a scenario that proves the
    bug exists (no log emitted when named operation raises)
  • Tag the scenario with @tdd_issue, @tdd_issue_<N>, and @tdd_expected_fail
  • Implement step definitions in the appropriate steps file
  • Verify the test fails (assertion fails) when run without the fix
  • Open a PR from a tdd/ branch to master

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.

Metadata

Field Value
Module src/cleveragents/reactive/stream_router.py
File stream_router.py line 172
Branch tdd/mN-stream-router-tool-exception-swallow
Commit Message test(tdd): capture SimpleToolAgent.process silent exception swallow

Automated by CleverAgents Bot
Agent: new-issue-creator

## Summary This TDD issue captures the bug where `SimpleToolAgent.process()` in `src/cleveragents/reactive/stream_router.py` silently swallows exceptions raised by named operations, returning an empty string with no log output. The corresponding bug issue depends on this TDD issue. ## Bug Description In `SimpleToolAgent.process()` at line 172 of `stream_router.py`: ```python try: return fn(content, meta, ctx) except Exception: return "" ``` When a registered named operation raises an exception, the exception is caught and discarded — no log message, no warning, no traceback. The caller receives an empty string `""` with no indication that anything went wrong. This makes debugging impossible when a tool operation fails silently. ## Deliverable A Behave BDD feature file under `features/` that captures the buggy behavior with the appropriate TDD tags. The test must: 1. Register a named operation that raises an exception 2. Call `SimpleToolAgent.process()` with content that triggers the failing operation 3. Assert that a warning log entry is emitted containing the exception message 4. Be tagged with `@tdd_issue`, `@tdd_issue_<N>` (where N is the bug issue number), and `@tdd_expected_fail` ## Background and Context `SimpleToolAgent.process()` in `stream_router.py` contains a bare `except Exception: return ""` block that silently discards all exceptions from named operations. This pattern makes it impossible to diagnose failures in production or during testing — callers receive an empty string with no indication of what went wrong. This TDD issue must be filed and merged before the corresponding bug fix issue is opened, so that the failing test exists in the codebase before the fix is applied. ## Expected Behavior When a named operation registered with `SimpleToolAgent` raises an exception during `process()`, the agent should emit a warning-level log entry containing the exception message and type, so that callers and operators can diagnose the failure. ## Acceptance Criteria - A Behave scenario exists that asserts a warning log is emitted when a named operation raises an exception in `SimpleToolAgent.process()` - The scenario is tagged with `@tdd_issue`, `@tdd_issue_<N>`, and `@tdd_expected_fail` - CI passes because `@tdd_expected_fail` inverts the result - The scenario fails (assertion fails) when the `@tdd_expected_fail` tag is removed and the bug is still present ## Subtasks - [ ] Write a Behave feature file under `features/` with a scenario that proves the bug exists (no log emitted when named operation raises) - [ ] Tag the scenario with `@tdd_issue`, `@tdd_issue_<N>`, and `@tdd_expected_fail` - [ ] Implement step definitions in the appropriate steps file - [ ] Verify the test fails (assertion fails) when run without the fix - [ ] Open a PR from a `tdd/` branch to `master` ## 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. ## Metadata | Field | Value | |-------|-------| | Module | `src/cleveragents/reactive/stream_router.py` | | File | `stream_router.py` line 172 | | Branch | `tdd/mN-stream-router-tool-exception-swallow` | | Commit Message | `test(tdd): capture SimpleToolAgent.process silent exception swallow` | --- **Automated by CleverAgents Bot** Agent: 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.

Dependencies

No dependencies set.

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