iachat/spec/models/concerns
Tanmay Deep Sharma 7acd239c70
fix: call authorization_error! on IMAP auth failures (#13560)
## Notion document

https://www.notion.so/chatwoot/Email-IMAP-Issue-30aa5f274c928062aa6bddc2e5877a63?showMoveTo=true&saveParent=true

## Description

PLAIN IMAP channels (non-OAuth) were silently retrying failed
authentication every minute, forever. When credentials are
wrong/expired, Net::IMAP::NoResponseError was caught and logged but
channel.authorization_error! was never called — so the Redis error
counter never incremented, reauthorization_required? was never set, and
admins were never notified. OAuth channels already had this handled
correctly via the Reauthorizable concern.
Additionally, Net::IMAP::ResponseParseError (raised by non-RFC-compliant
IMAP servers) was falling through to the StandardError catch-all,
flooding
Estimated impact before fix: ~70–75 broken IMAP inboxes generating
~700k–750k wasted Sidekiq jobs/week.

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules
2026-02-26 18:01:23 +05:30
..
access_tokenable_shared.rb chore: Update dependencies to the latest versions (#5033) 2022-07-15 09:51:59 +07:00
account_email_rate_limitable_spec.rb feat: add per-account daily rate limit for outbound emails (#13411) 2026-02-03 02:06:51 +05:30
assignment_handler_shared.rb feat(perf): Cache labels on the conversation model (#8527) 2023-12-11 18:27:55 -08:00
auto_assignment_handler_shared.rb fix: assignee_changed callback not getting triggered during conversation creation (#9334) 2024-05-06 11:48:17 -07:00
avatarable_shared.rb feat: speed up circleci and github actions (#12849) 2025-11-19 15:32:48 +05:30
backoffable_shared.rb fix: call authorization_error! on IMAP auth failures (#13560) 2026-02-26 18:01:23 +05:30
cache_keys_spec.rb feat: expiry for cache keys [CW-3038] (#8793) 2024-01-29 15:27:26 +05:30
captain_featurable_spec.rb feat: add global config for captain settings (#13141) 2026-01-12 19:54:19 +05:30
json_schema_validator_spec.rb feat: Add support for minutes in auto resolve feature (#11269) 2025-05-07 00:36:15 -07:00
liquidable_shared.rb feat: Add liquid template support for WhatsApp template parameters (#12227) 2025-08-21 16:44:51 +05:30
out_of_offisable_shared.rb chore: Limit objects returned by conversation API (#2721) 2021-07-31 21:19:42 +05:30
reauthorizable_shared.rb feat: Instagram reauthorization (#11221) 2025-04-03 14:30:48 +05:30
switch_locale_spec.rb fix: test failures due to parallelisation in ci (#12924) 2025-11-21 16:33:29 +05:30