Class: Protege::Current

Inherits:
ActiveSupport::CurrentAttributes
  • Object
show all
Defined in:
app/models/protege/current.rb

Overview

Thread-local, per-run state for a single Protege processing pass.

Subclasses ActiveSupport::CurrentAttributes, so every attribute declared here is reset automatically at the start of each web request and each Active Job execution. Values must therefore be set explicitly at the origin of each run and are never carried implicitly from one run to the next.

Within the LOGI pipeline this is the carrier for the correlation ID that ties a single inbound email to every downstream event. AgentMailbox#process sets correlation_id from the inbound email's RFC 2822 Message-ID; InferenceJob#perform and ConsoleInferenceJob#perform restore it at the top of the job. This lets the trace token flow from Gateway ingress through Inference without being threaded through every method signature.

Examples:

Set the correlation ID at the ingress boundary

Protege::Current.correlation_id = mail.message_id