odysseus-dev/odysseus · error · HTTPException

Nothing old enough to compact

Error message

Nothing old enough to compact

What it means

A 400 guard in compact_session: after reserving the recent tail (up to 8 messages), no older messages remain to summarize, so compaction would be a no-op. Fires when the whole history fits inside the kept recent window.

Solutions

  1. Wait until the conversation has older messages beyond the keep window.
  2. Lower the compaction threshold if appropriate.
Defensive patterns

Strategy: validation

When it happens

Trigger: 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.

Common situations: See trigger scenarios.


AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14). Data as JSON: /api/errors/78c3407ae4881f2c. Report an issue: GitHub.

Appendix: source

Thrown at routes/session_routes.py:984

        """Summarize older messages into one compacted history entry."""
        _verify_session_owner(request, session_id)
        try:
            session = session_manager.get_session(session_id)
        except KeyError:
            raise HTTPException(404, f"Session {session_id} not found")
        _reject_compact_during_active_run(session_id)

        history = list(session.history or [])
        if len(history) < 6:
            raise HTTPException(400, "Not enough messages to compact")

        # Keep a small recent tail verbatim. The prior half-chat/20-message
        # tail made manual compaction look like it did nothing on normal chats.
        recent_keep = min(8, max(4, len(history) // 4))
        older = history[:-recent_keep]
        recent = history[-recent_keep:]
        if not older:
            raise HTTPException(400, "Nothing old enough to compact")

        from src.context_compactor import SELF_SUMMARY_SYSTEM_PROMPT
        from src.endpoint_resolver import resolve_endpoint
        from src.llm_core import llm_call_async

        owner = getattr(session, "owner", None) or effective_user(request)
        url, model, headers = resolve_endpoint("utility", owner=owner)
        if not url or not model:
            url, model, headers = session.endpoint_url, session.model, session.headers
        if not url or not model:
            raise HTTPException(400, "No model configured for compaction")

        prior_compactions = sum(
            1 for m in history
            if _message_metadata(m).get("compacted") or "[Conversation summary" in _message_text(m)
        )
        prompt = SELF_SUMMARY_SYSTEM_PROMPT.replace(
            "{count}", str(len(older))

View on GitHub (pinned to f9235ebbf1)