← Back to Pull requests

feat(mail): add Mail tab with Send test mail action #22

Closed
unknown closed this pull request without merging on Aug 21, 2026 07:19 UTC
View on GitHub
unknown unknown commented on Aug 19, 2026 05:26 UTC
Author

Summary

Adds a Mail tab to the database pane, a Send test mail action, and a mail_audit MCP tool, so outbound mail config can be checked and diagnosed without leaving the TUI — and by an agent, not just a human at the screen.

Mail tab

  • New Mail tab (m shortcut) runs odoo-db mail <db>, which answers one nested object (neutralization status, config parameters, per-company alias domains, addresses, outgoing mail servers, relevant modules) instead of a flat row list. Because the sections don't share columns, panes/mail.py doesn't route through the generic DataTable like every other db tab — it renders each non-empty section as its own Rich table into the log body, outgoing mail servers first (whether mail leaves the box at all is the most important question), with a neutralized-database banner leading everything else.

  • Test-catcher, known-relay, and neutralization-stub detection surface as summary lines naming the affected server(s), not per-row columns — a bare "server(s) above" is ambiguous once there's more than one relay, and archived (active=False) rows are excluded from every summary since they swallow nothing.

  • The mail-servers table itself is 7 columns, not 9: creds folds smtp_user/smtp_pass into one cell and encryption/auth folds smtp_encryption/smtp_authentication, since the wider layout truncated host:port — the column the audit is actually for — at an 80-column terminal.

  • Company/OdooBot/admin addresses are now resolved through ir_model_data external ids on the odoo-db side rather than a hardcoded partner id or login = 'admin'/'__system__' — matching on login silently dropped the admin row once that login was renamed, the normal state on odoo.sh. A row that can't be resolved is still shown, as (record missing), never silently dropped.

  • A missing per-company alias domain now reads as (not set — normal for a clean 17+ install) unless legacy pre-17 ICP config is still present, in which case it reads as NOT SET despite legacy ICP config still present — stuck v16-to-17 migration! — a bare alias_domain_id IS NULL flags nearly every real Odoo 17+ database on its own, so it's not a useful signal by itself.

  • New Send test mail action prompts for a recipient via PromptScreen (a new text-input sibling to ConfirmScreen) and sends one real mail.mail via odoo_activity/scripts/send_test_mail.py, from the connecting user's own company address, with force_always_send so it sends synchronously instead of waiting on the mail queue cron.

  • run_odooly_script now accepts extra positional args (--to <address>) so scripts beyond --env can take parameters.

  • stringify renders None cells as blank instead of the literal string "None" — caught live against a real host, where every unset config_parameters row read "None".
  • MCP server (oa-mcp)

  • New mail_audit tool exposes the same mail-config bundle to an MCP client/agent. Kept out of db_query's scoped command set rather than added there: odoo-db's mail answers one nested object, not the flat row list every db_query command shares — the same reason the TUI renders it through its own panes/mail.py instead of the generic table pane. smtp_user/smtp_pass follow the same launch-time-only masking rule as db_query's params.

  • Fixed a pre-existing bug (present since the very first mcp_server.py commit) where mcp dev's Inspector crashed with NameError: name 'Worker' is not defined before listing any tool: from __future__ import annotations postpones every annotation to a string, and mcp dev loads this file via importlib.util.spec_from_file_location without registering it in sys.modules, so typing.get_type_hints() can't re-resolve those strings against the file's own globals. Removed the future import — every type used in an annotation here is already defined before it's referenced, so evaluating eagerly costs nothing and sidesteps the dynamic-loader gap. import odoo_activity.mcp_server (how oa-mcp itself starts) was never affected, only mcp dev.

  • README updated: keybindings table, Toolbox section, Mail tab description, tab list per mode, and the MCP server section.
  • Result


    <img width="1865" height="590" alt="image" src="https://github.com/user-attachments/assets/fbe7e5dc-2afa-4412-bfe6-d4700da20581" />

    mail_audit verified end-to-end through the real MCP protocol (MCP Inspector, mcp dev odoo_activity/mcp_server.py) against local odoo_db, returning the expected bundle shape.

    Test plan

  • tests/test_tui.py — render_mail (per-section tables, empty bundle, test-catcher/known-relay/neutralization-stub warnings naming the affected server(s), archived-row exclusion, (record missing)/clean-install-vs-stuck-migration wording, tolerance of an older odoo-db missing the newer flags), Mail tab wiring, Send test mail prompt/action flow

  • tests/test_odooly.py — send_test_mail.py (including the Record-vs-int create() regression), stringify(None)

  • tests/test_mcp_server.py — mail_audit (launch-time-only masking, single-object unwrapping, non-JSON/odoo-db-missing fallbacks), smoke-tested end-to-end

  • Manual: m tab and Send test mail against a real instance; mail_audit through MCP Inspector against local odoo_db
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: xaviedoanhduy Review duration: 2992m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #22"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%