Skip to content

fix(context_chat): Reschedule indexing upon triggerInitialImport call - #13945

Open
marcelklehr wants to merge 1 commit into
mainfrom
fix/context-chat-re-import
Open

marcelklehr wants to merge 1 commit into
mainfrom
fix/context-chat-re-import

Conversation

@marcelklehr

@marcelklehr marcelklehr commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

triggerInitialImport() was a no-op, so wiping the context chat vector store left all previously indexed mails out of the index for good. ScheduleJob also only reset mailboxes that still had a pending task, which skipped exactly the fully imported ones.

triggerInitialImport() now re-queues ScheduleJob for every account. ScheduleJob backfills each synchronized mailbox from the start and then removes itself; it waits for the initial sync because that sync does not emit NewMessagesSynchronized.

The FixBackgroundJobs repair step re-adds ScheduleJob on every app upgrade, causing one re-scan per upgrade. Context chat skips re-embedding unchanged items, so this was accepted over adding a "done" column to mail_cc_tasks.

This is important to get in soon, because we're planning to do a full context_chat wipe with the next context_chat release.

馃 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

triggerInitialImport() was a no-op, so wiping the context chat vector
store left all previously indexed mails out of the index for good.
ScheduleJob also only reset mailboxes that still had a pending task,
which skipped exactly the fully imported ones.

triggerInitialImport() now re-queues ScheduleJob for every account.
ScheduleJob backfills each synchronized mailbox from the start and
then removes itself; it waits for the initial sync because that sync
does not emit NewMessagesSynchronized.

The FixBackgroundJobs repair step re-adds ScheduleJob on every app
upgrade, causing one re-scan per upgrade. Context chat skips
re-embedding unchanged items, so this was accepted over adding a
"done" column to mail_cc_tasks.

Assisted-by: ClaudeCode:claude-opus-5.5
Signed-off-by: Marcel Klehr <mklehr@gmx.net>

foreach ($cachedMailboxes as $mailbox) {
try {
$this->taskService->findByMailboxId($mailbox->getId());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this removal related to the above cachedMailboxes change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it makes sure that we do not require the task to exist when scheduling a task

@kesselb

kesselb commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

I think we should address/finish #13443 first. Due to the changes on main vs stable5.13/stable5.12 that might require a different way to solve it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted This PR contains AI-assisted commits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants