The ingress flow implements anti-loop, whitelist, idempotency, and dispatch wiring correctly, but the threading step is incomplete: it only looks at In-Reply-To and ignores References.
Expected flow
IMAP ingress -> check/filter rules -> threading resolution -> save RECEIVED -> dispatch
Within the threading step, the spec says:
if In-Reply-To or References is present, find the parent task in DB and inherit thread_id
otherwise use message_id as the new thread_id
Evidence
requirements.md:73-75 requires parent lookup via In-Reply-To / References
README.md:12 advertises threading via In-Reply-To / References
internal/mail/imap.go:247-283 only extracts In-Reply-To and uses that single header for parent lookup
checkpoints/002-feedback.md:15 already noted that References fallback was still missing
Why this is a problem
Many email clients preserve conversation history primarily through References. When In-Reply-To is absent but References is present, the bridge will incorrectly start a new thread_id instead of attaching the message to the existing conversation.
That breaks the downstream dispatch contract because:
the wrong thread_id is saved on ingress
OpenClaw receives the wrong session_id
thread history retrieval for dispatch can miss prior completed messages
Expected behavior
Parse both In-Reply-To and References
When In-Reply-To is missing, fall back to the most relevant message ID from References
Reuse the parent thread_id before dispatching
Impact
Thread continuity is broken for valid reply emails that rely on References instead of In-Reply-To, causing context loss in dispatch.
## Summary
The ingress flow implements anti-loop, whitelist, idempotency, and dispatch wiring correctly, but the threading step is incomplete: it only looks at `In-Reply-To` and ignores `References`.
## Expected flow
`IMAP ingress -> check/filter rules -> threading resolution -> save RECEIVED -> dispatch`
Within the threading step, the spec says:
- if `In-Reply-To` or `References` is present, find the parent task in DB and inherit `thread_id`
- otherwise use `message_id` as the new `thread_id`
## Evidence
- `requirements.md:73-75` requires parent lookup via `In-Reply-To` / `References`
- `README.md:12` advertises threading via `In-Reply-To` / `References`
- `internal/mail/imap.go:247-283` only extracts `In-Reply-To` and uses that single header for parent lookup
- `checkpoints/002-feedback.md:15` already noted that `References` fallback was still missing
## Why this is a problem
Many email clients preserve conversation history primarily through `References`. When `In-Reply-To` is absent but `References` is present, the bridge will incorrectly start a new `thread_id` instead of attaching the message to the existing conversation.
That breaks the downstream dispatch contract because:
- the wrong `thread_id` is saved on ingress
- OpenClaw receives the wrong `session_id`
- thread history retrieval for dispatch can miss prior completed messages
## Expected behavior
- Parse both `In-Reply-To` and `References`
- When `In-Reply-To` is missing, fall back to the most relevant message ID from `References`
- Reuse the parent `thread_id` before dispatching
## Impact
Thread continuity is broken for valid reply emails that rely on `References` instead of `In-Reply-To`, causing context loss in dispatch.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
The ingress flow implements anti-loop, whitelist, idempotency, and dispatch wiring correctly, but the threading step is incomplete: it only looks at
In-Reply-Toand ignoresReferences.Expected flow
IMAP ingress -> check/filter rules -> threading resolution -> save RECEIVED -> dispatchWithin the threading step, the spec says:
In-Reply-ToorReferencesis present, find the parent task in DB and inheritthread_idmessage_idas the newthread_idEvidence
requirements.md:73-75requires parent lookup viaIn-Reply-To/ReferencesREADME.md:12advertises threading viaIn-Reply-To/Referencesinternal/mail/imap.go:247-283only extractsIn-Reply-Toand uses that single header for parent lookupcheckpoints/002-feedback.md:15already noted thatReferencesfallback was still missingWhy this is a problem
Many email clients preserve conversation history primarily through
References. WhenIn-Reply-Tois absent butReferencesis present, the bridge will incorrectly start a newthread_idinstead of attaching the message to the existing conversation.That breaks the downstream dispatch contract because:
thread_idis saved on ingresssession_idExpected behavior
In-Reply-ToandReferencesIn-Reply-Tois missing, fall back to the most relevant message ID fromReferencesthread_idbefore dispatchingImpact
Thread continuity is broken for valid reply emails that rely on
Referencesinstead ofIn-Reply-To, causing context loss in dispatch.