test(providers): add failing scenario for silent token-count exception swallowing #10889

Merged
HAL9000 merged 1 commits from tdd/m3-token-count-silent-failure into master 2026-04-28 10:12:06 +00:00

1 Commits

Author SHA1 Message Date
HAL9000 a4aeea3e7c test(providers): add failing scenario for silent token-count exception swallowing
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 1m3s
CI / quality (pull_request) Successful in 1m22s
CI / typecheck (pull_request) Successful in 1m27s
CI / security (pull_request) Successful in 1m30s
CI / build (pull_request) Successful in 34s
CI / push-validation (pull_request) Successful in 22s
CI / helm (pull_request) Successful in 28s
CI / integration_tests (pull_request) Successful in 3m38s
CI / e2e_tests (pull_request) Successful in 4m27s
CI / unit_tests (pull_request) Successful in 4m50s
CI / docker (pull_request) Successful in 2m9s
CI / coverage (pull_request) Successful in 11m51s
CI / status-check (pull_request) Successful in 3s
Adds a TDD issue-capture test for bug #10395. The
_estimate_token_usage() method in LangChainChatProvider contains a
bare except Exception: return 0 block that silently swallows any
exception raised by the LLM's get_num_tokens() call, returning 0
instead of propagating the error. Downstream cost tracking then
records zero tokens, producing inaccurate cost estimates with no
visible error signal to the caller or operator.

The new Behave scenario in
features/tdd_langchain_token_count_silent_failure.feature is tagged
@tdd_issue, @tdd_issue_10395, and @tdd_expected_fail. The assertion
fails against the current unfixed code (confirming the bug exists),
and the @tdd_expected_fail tag inverts the result so CI reports the
scenario as passed until the fix is merged.

ISSUES CLOSED: #10395
2026-04-28 09:57:57 +00:00