MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / attachReferencesChain

Function attachReferencesChain

internal/agent/hitl_api.go:156–165  ·  view source on GitHub ↗

attachReferencesChain rebuilds the References chain on a HITL-approved SendRequest by looking up the parent inbound's raw message via email_message_id. Required because the pending-outbound row only persists the parent's Message-ID, not its raw message — without re-deriving here, HITL-protected repl

(ctx context.Context, store hitlInboundLookup, agentID string, req *outbound.SendRequest)

Source from the content-addressed store, hash-verified

154// than refusing the send. Callers must keep ReplyToMessageID populated
155// regardless; only References is filled in here.
156func attachReferencesChain(ctx context.Context, store hitlInboundLookup, agentID string, req *outbound.SendRequest) {
157 if req.ReplyToMessageID == "" {
158 return
159 }
160 inbound, err := store.GetInboundByEmailMessageID(ctx, agentID, req.ReplyToMessageID)
161 if err != nil || inbound == nil {
162 return
163 }
164 req.References = outbound.BuildReferencesChain(inbound.RawMessage, req.ReplyToMessageID)
165}
166
167// hitlInboundLookup is the narrow store contract attachReferencesChain
168// needs. Defined as an interface so tests can stub it without spinning

Calls 2

BuildReferencesChainFunction · 0.92