4 Commits

Author SHA1 Message Date
Bingxi Zhao (Frank)
ebcebd4723 Unify migration locks and plugin environments, and cover compatibility boundaries 2026-11-06 02:04:52 +08:00
Antonio-Faure
75d65b7dea fix(tutor): retry a failed source attribution after a cooldown 2026-11-01 10:35:58 +01:00
yuanyyt
58afb10b57 fix: harden tutor-thread source recovery
Persist a structured selection_source beside the assistant prompt, and use
the legacy sidebar prompt's containing message, role and selection to
disambiguate repeated text. Scan every user message for a quote, refuse to
guess between several, and make the backfill conditional so a concurrent move
or detach wins.

Serialize PocketBase preference merges with a lock that spans event loops,
not one asyncio lock per loop, and validate client-supplied anchors on turns
and organization updates. Detach threads when the message they point at is
deleted.
2026-10-30 15:55:21 +08:00
yuanyyt
50f1d9f529 feat: recover the source message of legacy tutor threads
Threads created before the attribution existed kept only the passage:
selection threads store it in tutor_selected_text, newer side chats as a
quote attachment. Match that passage against the parent transcript with
the Markdown projection selection grounding uses, and record the source
only when exactly one message contains it.

The scan is recorded per thread and runs when the thread list is read,
so it happens once; touch=false keeps the thread's place in the list.
2026-10-30 13:55:29 +08:00