Skip to content

[Bug] Attachments (images/PDFs) become permanently unreadable after auto-compaction, and search_conversation never being invoked #14708

Closed

Description

@Dhrhciebcy

Environment

Where are you using Unsloth?

  • Unsloth desktop application
  • Unsloth web UI (unsloth studio)
  • Unsloth CLI
  • Python package or notebook
  • Colab or Kaggle

Operating system and version:
Windows 11 24H2

GPU model(s) and accelerator backend:
NVIDIA CUDA — RTX 5090 Mobile

Versions:

  • Unsloth: v0.1.909-beta, but the problem was probably already there since some few versions
  • Package: 2026.10.7, but the problem was probably already there since some few versions
  • Desktop: 0.1.909-beta, but the problem was probably already there since some few versions
  • llama.cpp: custom build (TheTom), commit 30d6881 — identical to the build used before the regression appeared

What happened?

Two related regressions, both triggered by the same event: the auto-compaction of a chat.

(1) Attachments attached in earlier turns become completely inaccessible after compaction.
Before a compaction, the model can quote attached documents and images verbatim — including line-by-line content. Immediately after a compaction cycle, every attachment that lived in an evicted turn is gone: images, PDFs, text/markdown documents alike. The model no longer sees them, cannot quote them, and does not even know they existed.

(2) After compaction, the model stops calling search_conversation — almost always.
Before the regression, search_conversation was often invoked (it was pratically always the first thing the model did immediately after undergoing chat compaction) whenever the user refers to earlier content, or even just to maintain consistency with what was being said (for instance, he would look for what had been stated in the most recent messages exchanged with the user).

Now instead, after the chat has been compacted, the tool is essentially never called again, even if it is still listed as available and often the question clearly requires recall. This appears to compound problem (1): the model neither has the attachment in context nor tries to retrieve it.

Both symptoms reproduce identically on local GGUF models and on API-connected models, and identically in the desktop app and in the web UI. Since the llama.cpp build is unchanged from when this worked, this looks like a backend / context-assembly issue rather than a frontend or model-side one.

Steps to reproduce:

  1. Start a chat with auto-compaction enabled and a context window small enough that compaction triggers within ~20 turns (e.g. 32k–70k; I had 128k).
  2. Early in the chat, attach a document (PDF or .md) and an image containing a unique marker string (e.g. K7-4912). Ask the model to quote a specific line / report the marker → it does so correctly.
  3. Continue the conversation with enough turns (long tool outputs help) to trigger the first auto-compaction. Confirm the compaction banner/notice appears.
  4. In a later turn, ask again: "quote the exact third line of the document I attached earlier" / "what was the marker in the image I sent earlier?"
  5. Observe the tool-call panel for that turn.

Expected behavior:

  • Attachment content from evicted turns remains reachable — recoverable through search_conversation (the archive should index extracted text / OCR output and preserve file references).
  • search_conversation keeps being invoked after compaction, as it is before compaction. Recall is the only mechanism that compensates for eviction, so losing it defeats the purpose of rolling context.

Actual behavior:

  • Step 4: the model has no knowledge of any attachment. No partial recall, no garbled recollection — total absence, as if the attachment had never been sent.
  • Step 5: no search_conversation call appears in the turn's tool calls. The model answers from the remaining visible context only, and drifts off the established decisions/conventions of the chat.

Model and operation involved:

Inference — Studio chat tab, auto-compaction (rolling context window) + per-thread archive retrieval.

  • Local: Qwen 3.8-27B-Q5_K_M + mmproj, via llama.cpp backend
  • Remote: Qwen 3.8 Flash Next-IQ3_S via Strata backend (OpenAI-compatible)
    Same behaviour on both paths, same on desktop app and web UI.

Diagnostics and logs

BEFORE the regression: the screenshot below shows the first part of the model's response after the chat had been compacted. As you can see, the first thing it did was search through the previous messages.

Image

AFTER the regression: the screenshot below once again shows the first part of the model's response, following a chat compaction process. As you can see, unlike before, it made no attempt whatsoever to review previous messages or invoke search_conversation.

Image

Activity

  1. added
    feature request
    on Oct 22, 2026
  2. debojyoti-dev commented on Oct 22, 2026

    @debojyoti-dev
    Contributor

    I am working on it

  3. removed their assignment
    on Oct 23, 2026
  4. danielhanchen commented on Oct 23, 2026

    @danielhanchen
    Member

    Fixed! With API-connected models, auto-compaction trimmed the oldest turns without saving them to the conversation archive, so attached documents were lost and search_conversation was never offered. Trimmed turns are now archived, the relevant ones are handed back to the model on the turn the chat compacts, and search_conversation plus the compaction notice are available on later turns (fixed in #14731, with archive ordering for attachment turns fixed in #14768). Text inside images is still not indexed, and if a local GGUF chat still loses attachments, the server log will show conversation_archive.ingest_failed when the embedding server could not start.
    To update: Unsloth Desktop will have an update banner. For Studio, use unsloth studio update. For Docker, use docker exec <container> unsloth-studio-update. Reopen if it still happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfeature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions