Skip to content

feat(channels): add health telemetry and active connection probe to E… - #628

Closed
Preciousuche wants to merge 1 commit into
use-agent-os:mainfrom
Preciousuche:feat/channels-email-health-telemetry-probe
Closed

feat(channels): add health telemetry and active connection probe to E…#628
Preciousuche wants to merge 1 commit into
use-agent-os:mainfrom
Preciousuche:feat/channels-email-health-telemetry-probe

Conversation

@Preciousuche

Copy link
Copy Markdown
Contributor

Description

closes #625

### Summary
Enriches `EmailChannel.health_check()` with poll telemetry and introduces an active `probe()` method in `src/agentos/channels/email.py`.

### Problem
`EmailChannel.health_check()` previously returned only basic connection state and errors upon failure. Operators and health dashboards had no visibility into poll cadence (last poll timestamp or count of retrieved messages). Additionally, there was no way to actively test IMAP/SMTP reachability on demand without waiting for the background polling loop.

### Changes
- **Health Telemetry**: Populated `ChannelHealth.extra` with `imap_folder`, `poll_interval_s`, `last_poll_at` (ISO timestamp), `last_poll_count`, and `last_error`.
- **Active Probe**: Implemented `probe()` to perform lightweight, side-effect-free `NOOP` checks against IMAP and SMTP endpoints.
- **Connection Helper**: Factored out `_smtp_connect()` for clean reuse between `_smtp_send()` and `probe()`.
- **Unit Tests**: Added tests for telemetry capture and probe success/failure in `tests/test_channels/test_email_channel.py`.

### Verification
- `uv run pytest tests/test_channels/test_email_channel.py` (43 passed)
- `ruff check`, `ruff format`, and `mypy` all passed with 0 errors.

@andreapn

andreapn commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Closing along with #625, which I closed as wontfix. EmailChannel already implements health_check() (email.py:406) returning the same ChannelHealth shape as every other adapter, and the poll loop already maintains _connected, _last_error and _last_message_at — so the visibility gap the issue describes is not there. What remains in the proposal is an active IMAP/SMTP probe, which would make email the only adapter that opens sockets on a status poll and risks provider throttling on frequent health polls.

Full reasoning: #625 (comment)

If you want richer channel telemetry, a protocol-level change to ChannelHealth covering all adapters would be very welcome — please raise that as its own issue.

@andreapn andreapn closed this Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add Health Check Probe and Connection Observability to EmailChannel

3 participants