ThunderAI icon indicating copy to clipboard operation
ThunderAI copied to clipboard

AI tags disappearing after sync, manually set tags remain

Open Kosmoshn opened this issue 9 months ago • 15 comments

The problem

I am using the tagging functionality of ThunderAI and they are generated just fine, added to the mail and look like usual tags.

However, after restarting TB, or switching to another folder and switching back, they disappear. This is probably a sync error with the IMAP server, where they are not synced to the server properly. Then, during the next sync, TB can't find the tags on the server and deletes them from the local mail. My mail server supports tags and I run into the issue on all of my providers anyway, e.g. Gmail.

When I set the tags manually, it works as inteded. So I guess there is something wrong with the step that sends the tags to the server. Nonetheless, on rare occasions, the AI generated tags stay as intended, but I could not reproduce when it happens exactly. Removing the tags works, btw, but the manually set tags reappear after sync again as well. This makes me curious if it is something related to TB itself and not TAI?

I'm not using other tagging addons, it doesn't matter how long TB was running before tagging, there is no specific action before or after that causes this behavior.

Which Operative System are you using?

Win11 25H2 (Build 26200.7840)

Which version of Thunderbird are you using?

148.0 German

Which version of ThunderAI has the issue?

4.0.0

Which integration are you using?

Ollama API

Anything in the Thunderbird console logs that might be useful?

nothing I could identifiy

Additional information

Hope I could help improving

Kosmoshn avatar Feb 28 '26 12:02 Kosmoshn

ThunderAI uses the standard Thunderbird API to add tags. I need to test this in version 148. Thank you for your report.

micz avatar Feb 28 '26 12:02 micz

I tested Thunderbird 148 with a gmail account and it works as expected. The tags are added to the message and they are still there after a Thunderbird reload.

Do you have any other addon installed?

micz avatar Mar 01 '26 23:03 micz

I’m not sure whether you’ve run into the same issue as I have: when I add tags, if any generated tag includes my local language (Chinese), the tag I add disappears. When I specified in the prompt that the generated tag language must be English only, it went back to normal.

Runarry avatar Mar 05 '26 02:03 Runarry

@Runarry I think this is a different problem. I filed issue #689. Please follow that issue to be updated on this problem. Thank you.

micz avatar Mar 05 '26 05:03 micz

@Kosmoshn Do the disappearing tags contain particular characters other than standard ones?

micz avatar Mar 05 '26 23:03 micz

@Kosmoshn May you try the pre-release version v4.0.2pre1? Thank you.

micz avatar Mar 06 '26 22:03 micz

@micz thank you very much for the question and pre-release.

  1. the disappearing tags do not contain particular characters other than standard ones.
  2. the pre-release version v4.0.2pre1 did not change that behavior. I tried with different email providers and gmail, as well as my university show the issue.

So, I think this is something related to my local installation and I will look into it if I find the time.

Kosmoshn avatar Mar 08 '26 22:03 Kosmoshn

I'm experiencing a similar problem : Tags are added by Thunder AI automatically when receiving new mail :

Image

When I click on a mail to view its content, the tags disappears :

Image

No message in the debug console.

Thunder AI config for tags :

Image

Prompt (in french) :

Analyse le texte de l’e-mail suivant et génère un tableau JSON de tags résumant son contenu. Utilise des thèmes, des sujets clés et des descripteurs pertinents comme tags. Assure-toi que les tags soient concis et en lien direct avec le contenu de l’e-mail. Texte du courriel : {%mail_text_body%} Considérez les détails suivants pour le contexte :

  • Expéditeur : {%author%}
  • Destinataires : {%recipients%}
  • Liste CC : {%cc_list%}
  • Sujet du courriel : {%mail_subject%} Génère les tags en te basant sur le texte de l’e-mail et le contexte, en ignorant les informations inutiles ou les détails sans importance. Génère une réponse uniquement au format JSON. La sortie doit être uniquement un tableau JSON de tags, sans commentaire ni texte supplémentaire. Voici un exemple du format JSON à utiliser : { "tags" : ["tag1", "tag2", "tag3", "tag4", "tag5"] }

Mer0me avatar Apr 01 '26 06:04 Mer0me

Please activate the debug log, clear the console, then add the tags to an email using the context menu "Add tags" item. May you then post the log here? (check it out for any sensitive information before posting it)

Do the tags remain on the email?

evolts21 avatar Apr 01 '26 06:04 evolts21

When I use the context menu to add tags, the tags remain if I click on the messages but disappear when I click on another imap folder.

Here is the console log when it happens :

[ThunderAI Logger | mzta-background] [startWorking] WorkingLevel: 1 mzta-logger.js:35:44
[ThunderAI Logger | mzta-background] Starting from the HTML body if present and converting to plain text... mzta-logger.js:35:44
[ThunderAI Logger | mzta-background] Special prompt: Analyse le texte de l’e-mail suivant et génère un tableau JSON de tags résumant son contenu. Utilise des thèmes, des sujets clés et des descripteurs pertinents comme tags. Assure-toi que les tags soient concis et en lien direct avec le contenu de l’e-mail.
Texte du courriel : The mail Content
Considérez les détails suivants pour le contexte :
- Expéditeur : sender <[email protected]>
- Destinataires : [email protected]
- Liste CC : {%cc_list%}
- Sujet du courriel : Subject
Génère les tags en te basant sur le texte de l’e-mail et le contexte, en ignorant les informations inutiles ou les détails sans importance.
Génère une réponse uniquement au format JSON. La sortie doit être uniquement un tableau JSON de tags, sans commentaire ni texte supplémentaire. Voici un exemple du format JSON à utiliser :
{
"tags" : ["tag1", "tag2", "tag3", "tag4", "tag5"]
} 
Limitez le nombre de tags à 3. 
Les tags doivent être écrits en français. 
Utilisez uniquement les balises de cette liste séparée par des virgules: chenil, communication, compostière, dsi, nextcloud, proxy, réseau, sauvegarde, sécurité, thunderbird. mzta-logger.js:35:44
[ThunderAI Logger | mzta_specialCommand] integration: ollama mzta-logger.js:35:44
XHRPOST
http://10.30.1.31:11434/api/chat
[HTTP/1.1 200 OK 1005ms]

[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.382958738Z","message":{"role":"assistant","content":"{\n"},"done":false}
{"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.41392685Z","message":{"role":"assistant","content":"\""},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.382958738Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\n\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.41392685Z\",\"message\":{\"role\":\"assistant\",\"content\":\"\\\"\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.444521213Z","message":{"role":"assistant","content":"tags"},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.444521213Z\",\"message\":{\"role\":\"assistant\",\"content\":\"tags\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.475080299Z","message":{"role":"assistant","content":"\""},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.475080299Z\",\"message\":{\"role\":\"assistant\",\"content\":\"\\\"\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.505622483Z","message":{"role":"assistant","content":" :"},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.505622483Z\",\"message\":{\"role\":\"assistant\",\"content\":\" :\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.536206095Z","message":{"role":"assistant","content":" [\""},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.536206095Z\",\"message\":{\"role\":\"assistant\",\"content\":\" [\\\"\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.566788956Z","message":{"role":"assistant","content":"communication"},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.566788956Z\",\"message\":{\"role\":\"assistant\",\"content\":\"communication\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.597360004Z","message":{"role":"assistant","content":"\","},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.597360004Z\",\"message\":{\"role\":\"assistant\",\"content\":\"\\\",\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.627926594Z","message":{"role":"assistant","content":" \""},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.627926594Z\",\"message\":{\"role\":\"assistant\",\"content\":\" \\\"\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.65850664Z","message":{"role":"assistant","content":"ré"},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.65850664Z\",\"message\":{\"role\":\"assistant\",\"content\":\"ré\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.689076817Z","message":{"role":"assistant","content":"seau"},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.689076817Z\",\"message\":{\"role\":\"assistant\",\"content\":\"seau\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.71961284Z","message":{"role":"assistant","content":"\","},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.71961284Z\",\"message\":{\"role\":\"assistant\",\"content\":\"\\\",\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.750175132Z","message":{"role":"assistant","content":" \""},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.750175132Z\",\"message\":{\"role\":\"assistant\",\"content\":\" \\\"\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.780739297Z","message":{"role":"assistant","content":"s"},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.780739297Z\",\"message\":{\"role\":\"assistant\",\"content\":\"s\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.811280139Z","message":{"role":"assistant","content":"é"},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.811280139Z\",\"message\":{\"role\":\"assistant\",\"content\":\"é\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.841827573Z","message":{"role":"assistant","content":"cur"},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.841827573Z\",\"message\":{\"role\":\"assistant\",\"content\":\"cur\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.872395166Z","message":{"role":"assistant","content":"ité"},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.872395166Z\",\"message\":{\"role\":\"assistant\",\"content\":\"ité\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.902944463Z","message":{"role":"assistant","content":"\"]\n"},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.902944463Z\",\"message\":{\"role\":\"assistant\",\"content\":\"\\\"]\\n\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.933503119Z","message":{"role":"assistant","content":"}"},"done":false}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.933503119Z\",\"message\":{\"role\":\"assistant\",\"content\":\"}\"},\"done\":false}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] buffer: {"model":"llama3.3-optimise:latest","created_at":"2026-04-01T07:31:38.964056855Z","message":{"role":"assistant","content":""},"done":true,"done_reason":"stop","total_duration":997745915,"load_duration":67551253,"prompt_eval_count":658,"prompt_eval_duration":345608843,"eval_count":20,"eval_duration":574966431}
mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] line: "{\"model\":\"llama3.3-optimise:latest\",\"created_at\":\"2026-04-01T07:31:38.964056855Z\",\"message\":{\"role\":\"assistant\",\"content\":\"\"},\"done\":true,\"done_reason\":\"stop\",\"total_duration\":997745915,\"load_duration\":67551253,\"prompt_eval_count\":658,\"prompt_eval_duration\":345608843,\"eval_count\":20,\"eval_duration\":574966431}" mzta-logger.js:35:44
[ThunderAI Logger | model-worker-ollama] AI full response: {
"tags" : ["communication", "réseau", "sécurité"]
} mzta-logger.js:35:44
[ThunderAI Logger | mzta_specialCommand] tokensDone: {
"tags" : ["communication", "réseau", "sécurité"]
} mzta-logger.js:35:44
[ThunderAI Logger | mzta-background] tags_current_email: ["communication","réseau","sécurité"] mzta-logger.js:35:44
[ThunderAI Logger | mzta-background] [stopWorking] WorkingLevel: 0 mzta-logger.js:35:44
[ThunderAI Logger | mzta-background] assign_tags data: {"messageId":44,"tags":["communication","réseau","sécurité"]} mzta-logger.js:35:44
[ThunderAI Logger | mzta-background] add_tags_exclusions_list: [] mzta-logger.js:35:44
[ThunderAI Logger | mzta-background] Assigned tags: ["$ta-jkgedmjvv2uxa8zb-communication","$ta-sfk0clj1vf5ycgud-réseau","$ta-xb2jqcr51ioqjrue-sécurité"] mzta-logger.js:35:44
Unicodify autocorrect module loaded. autocorrect.js:475:9
Unicodify autocorrect module loaded. autocorrect.js:475:9
Got message 
Object { type: "autocorrectContent" }
 from 
Object { contextId: 616, id: "[email protected]", envType: "content_child", url: "about:blank", tab: {…}, frameId: 0, origin: "null" }
BrowserCommunication.js:71:13
No callbacks for message type "autocorrectContent" registered. BrowserCommunication.js:77:17

When the tag is set manually on the same mail, it remains even if I click on another folder

Mer0me avatar Apr 01 '26 07:04 Mer0me

I suspect the problem are those é, we need to wait for @micz.

evolts21 avatar Apr 01 '26 08:04 evolts21

Ok, it's not a Thunder AI bug, it's a Thunderbird or Dovecot bug with non-ascii tags When I set manually an accented tag, it disappears too. Sorry for the inconvenience.

Mer0me avatar Apr 01 '26 08:04 Mer0me

Creating non accented tags in TB, then renaming tags with accents works. Thunder AI can now add tags from the existing list. If you want Thunder AI to create new tags when receiving, you should specify in the prompt that the new tags must not have special chars (not tested).

Mer0me avatar Apr 01 '26 08:04 Mer0me

I need to sanitize also accented characters and not only non-Unicode ones [#689]. I filed issue #732 and I'll release a fix shortly.

I also filed bug 2028635 asking to fix this in Thunderbird.

Thank you for reporting the issue.

micz avatar Apr 01 '26 20:04 micz

I need to sanitize also accented characters and not only non-Unicode ones [#689]. I filed issue #732 and I'll release a fix shortly.

Fixed in version 4.0.6.

micz avatar Apr 01 '26 21:04 micz