fix(email): persist session metadata across restarts by removing underscore key prefix
linuztx committed
Mar 15, 2026 at 18:03 UTC
c6435b450ff14f7d3c87b57fb1caaecaa155054e
1 file changed
+8
-7
plugins/_email_integration/helpers/dispatcher.py
+8
-7
@@ -12,13 +12,14 @@ from typing import Literal
12
# Matches: [a0-xxxxxxxx] at end of subject
13
_THREAD_ID_RE = re.compile(r"\[a0-([a-zA-Z0-9]+)\]")
14
15
-# Context data keys
16
-CTX_EMAIL_HANDLER = "_email_handler"
17
-CTX_EMAIL_SENDER = "_email_sender"
18
-CTX_EMAIL_THREAD_ID = "_email_thread_id"
19
-CTX_EMAIL_SUBJECT = "_email_subject"
20
-CTX_EMAIL_MESSAGE_ID = "_email_message_id"
21
-CTX_EMAIL_REFERENCES = "_email_references"
15
+# Context data keys (no underscore prefix — must persist across restarts)
16
+CTX_EMAIL_HANDLER = "email_handler"
17
+CTX_EMAIL_SENDER = "email_sender"
18
+CTX_EMAIL_THREAD_ID = "email_thread_id"
19
+CTX_EMAIL_SUBJECT = "email_subject"
20
+CTX_EMAIL_MESSAGE_ID = "email_message_id"
21
+CTX_EMAIL_REFERENCES = "email_references"
22
+# Transient — consumed per-reply, not persisted
23
CTX_EMAIL_ATTACHMENTS = "_email_response_attachments"
24
25
DispatchAction = Literal["new_chat", "continue_chat", "intervene_soft", "intervene_hard"]