feat(projects): Migration — alt-getaggte Nachrichten nachtraeglich in Projekte einsortieren
Projekt-Nachrichten aus der Zeit vor dem chat_backup-project_id-Feld (getaggt in conversation.jsonl seitfc0f91d, aber chat_backup fuehrte project_id erst abf51ad15) lagen in der UI im Hauptchat statt im Projekt. Die App/Diagnostic zeigen aus chat_backup.jsonl — dort fehlte der Tag. Neue Einmal-Migration (Brain-Lifespan) schreibt project_id aus conversation.jsonl per (role, text)-Match reihenfolge-erhaltend nach chat_backup.jsonl zurueck: - idempotent via Marker /shared/config/.chat_backup_projectid_backfill_v1 - nicht-destruktiv: legt .pre-backfill-v1.bak an, setzt nur LEERE project_ids, entfernt/aendert nie einen bestehenden Tag - atomar (tmp + os.replace) - Duplikate: Deque je (role, normtext) inkl. "" fuer Hauptthread → korrekte Zuordnung auch bei wiederholten Texten, kein faelschliches Taggen von Hauptchat-Interleaving Mit Logik-Tests (Zuordnung, Duplikat-Reihenfolge, Idempotenz) verifiziert. Nachrichten aus der Zeit bevor es Projekte gab bleiben untagged im Hauptchat. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -112,6 +112,17 @@ async def lifespan(app: FastAPI):
|
||||
except Exception as exc:
|
||||
logger.warning("Lifespan: spotify fast_patterns Migration: %s", exc)
|
||||
|
||||
# Einmalige Migration: project_id aus conversation.jsonl nach chat_backup.jsonl
|
||||
# zurueckschreiben, damit alt-getaggte Projekt-Nachrichten (getaggt bevor
|
||||
# chat_backup project_id fuehrte) in der UI wieder im richtigen Projekt
|
||||
# landen. Idempotent (Marker), nicht-destruktiv (.bak), atomar.
|
||||
try:
|
||||
import migrate_backfill_projectid
|
||||
res = migrate_backfill_projectid.run()
|
||||
logger.info("Lifespan: chat_backup project_id Backfill: %s", res)
|
||||
except Exception as exc:
|
||||
logger.warning("Lifespan: project_id Backfill Migration: %s", exc)
|
||||
|
||||
task = asyncio.create_task(background_mod.run_loop(agent))
|
||||
logger.info("Lifespan: Trigger-Loop gestartet")
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user