{"record":{"id":"21052d3041c776fc","repo":"HKUDS/DeepTutor","slug":"preferences-md-is-not-auto-consolidated","errorCode":null,"errorMessage":"preferences.md is not auto-consolidated","messagePattern":"preferences\\.md is not auto-consolidated","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"deeptutor/services/memory/consolidator/modes/_shims.py","lineNumber":80,"sourceCode":"        language=language,\n        user_label=user_label,\n        on_event=on_event,\n    )\n    if not apply_ops:\n        _rollback_new_entries(\"L2\", surface, result.new_entry_ids)\n    return _to_consolidate_result(result)\n\n\nasync def consolidate_l3(\n    slot: L3Slot,\n    *,\n    language: str = \"en\",\n    user_label: str = \"anonymous\",\n    on_event: OnEvent | None = None,\n    apply_ops: bool = True,\n) -> ConsolidateResult:\n    if slot == \"preferences\":\n        raise ValueError(\"preferences.md is not auto-consolidated\")\n    result = await run_update(\n        \"L3\",\n        slot,\n        language=language,\n        user_label=user_label,\n        on_event=on_event,\n    )\n    if not apply_ops:\n        _rollback_new_entries(\"L3\", slot, result.new_entry_ids)\n    return _to_consolidate_result(result)\n\n\ndef _to_consolidate_result(result: UpdateResult) -> ConsolidateResult:\n    reason = (\n        \"no new input\"\n        if result.no_new_input\n        else f\"applied via chunk-update ({result.facts_added} added)\"\n    )","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/services/memory/consolidator/modes/_shims.py#L62-L98","documentation":"The memory consolidator deliberately excludes the 'preferences' L3 slot from automatic consolidation, because preferences.md is curated manually. Any attempt to run consolidate_l3 (or update_l3) with slot='preferences' raises this ValueError by design.","triggerScenarios":"Calling consolidate_l3(slot=\"preferences\") or update_l3(\"L3\", \"preferences\") — the guard fires immediately, before any LLM work.","commonSituations":"Looping over all L3 slots generically (e.g. for slot in list_l3_slots(): consolidate_l3(slot)) without excluding 'preferences'; refactoring code that previously treated preferences like any other slot.","solutions":["Skip the 'preferences' slot in any batch loop over L3 slots","Use the dedicated preferences update API/manual editing path if you need to change preferences.md","Filter the slot list before consolidating: slots = [s for s in slots if s != 'preferences']"],"exampleFix":"# before\nfor slot in all_l3_slots:\n    await consolidate_l3(slot)\n# after\nfor slot in all_l3_slots:\n    if slot != \"preferences\":\n        await consolidate_l3(slot)","handlingStrategy":"validation","validationCode":"AUTO_CONSOLIDABLE = lambda slot: slot != \"preferences\"\n\nfor slot in l3_slots:\n    if AUTO_CONSOLIDABLE(slot):\n        await consolidate_l3(slot)","typeGuard":"def is_auto_consolidated(slot: str) -> bool:\n    \"\"\"Type/narrowing guard: True if consolidate_l3 accepts this slot.\"\"\"\n    return slot != \"preferences\"","tryCatchPattern":"try:\n    await consolidate_l3(slot)\nexcept ValueError as e:\n    if \"not auto-consolidated\" in str(e):\n        continue  # preferences slot; skip\n    raise","preventionTips":["Maintain one exclusion list for 'preferences' shared by consolidate and audit code paths"],"tags":["memory","consolidation","guard-clause","deepseek-tutor"],"backgroundTag":"excluded-slot-guard","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}