Class: Protege::AlertMailer
- Inherits:
-
ApplicationMailer
- Object
- ActionMailer::Base
- ApplicationMailer
- Protege::AlertMailer
- Defined in:
- app/mailers/protege/alert_mailer.rb
Overview
Operational alert mail — emailed to the platform admin when an inference run fails and cannot be
recovered. A sibling of the Gateway's bounce notices (ApplicationMailer): both are operational
mail the engine originates itself, not agent conversation (so neither goes through
Gateway.deliver, which is agent/thread-scoped). Sent by Protege::Subscribers::Alerter off the
InferenceFailedEvent; the recipients and sender come from config.failure_alerts.
The alert is deliberately trigger-agnostic — it carries only the error and the run's correlation id,
not agent/message specifics, so the same notice serves agent-based and non-agent failures
alike (the correlation id is the thread back to the full trace). The body renders from
alert_mailer/inference_failed.text.erb through the engine's mailer text layout — the engine's
first template-rendered mail (the bounce notices use inline bodies).
Instance Method Summary collapse
-
#inference_failed(error_class:, error_message:, correlation_id:) ⇒ Mail::Message
Alert the configured recipients that an inference run failed.
Methods inherited from ApplicationMailer
#access_denied_bounce, #attachment_rejected_bounce, #unrouted_bounce
Instance Method Details
#inference_failed(error_class:, error_message:, correlation_id:) ⇒ Mail::Message
Alert the configured recipients that an inference run failed.
:to and :from are read from config.failure_alerts. There is no valid default sender — a
deliverable :from must be an address at a registered EmailDomain (so the self-hosted MTA
DKIM-signs it), so the Alerter only invokes this mailer once :from is configured; it is passed
through verbatim here rather than defaulted.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/mailers/protege/alert_mailer.rb', line 27 def inference_failed(error_class:, error_message:, correlation_id:) @error_class = error_class @error_message = @correlation_id = correlation_id alerts = Protege.configuration.failure_alerts mail( from: alerts[:from], to: alerts[:to], subject: "[Protege] Inference failed: #{error_class}" ) end |