{"record":{"id":"3bd14d7bddcda0c4","repo":"odysseus-dev/odysseus","slug":"failed-to-save-compacted-history","errorCode":null,"errorMessage":"Failed to save compacted history","messagePattern":"Failed to save compacted history","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"routes/session_routes.py","lineNumber":1035,"sourceCode":"                headers=headers,\n                timeout=60,\n            )\n        except Exception as e:\n            logger.error(\"Manual compaction failed: %s\", e)\n            raise HTTPException(500, \"Compaction failed\")\n\n        summary_msg = ChatMessage(\n            role=\"system\",\n            content=f\"[Conversation summary]\\n{summary}\",\n            metadata={\n                \"compacted\": True,\n                \"summarized_count\": len(older),\n                \"timestamp\": utcnow_naive().isoformat(),\n            },\n        )\n        new_history = [summary_msg] + recent\n        if not session_manager.replace_messages(session_id, new_history):\n            raise HTTPException(500, \"Failed to save compacted history\")\n\n        return {\n            \"ok\": True,\n            \"summarized\": len(older),\n            \"kept\": len(recent),\n            \"message_count\": len(new_history),\n        }\n\n    @router.post(\"/sessions/auto-sort\")\n    def auto_sort_sessions(request: Request, skip_llm: bool = False):\n        \"\"\"Use AI to categorize all sessions into folders.\n\n        Phase 1 deletes empty/throwaway sessions and Phase 2 asks the LLM\n        to assign folders. When `skip_llm=true` the endpoint returns\n        after Phase 1 — used by the \"Tidy (no AI)\" UI affordance so\n        users can clean junk without spending tokens.\n        \"\"\"\n        from src.llm_core import llm_call","sourceCodeStart":1017,"sourceCodeEnd":1053,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/session_routes.py#L1017-L1053","documentation":"Error \"Failed to save compacted history\" thrown in odysseus-dev/odysseus.","triggerScenarios":"Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.","commonSituations":"See trigger scenarios.","solutions":["Check disk space and storage permissions, then retry.","Review server logs for the history save error."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}