Skip to content

perf(llm): local chat model keeps the conversation cached across side requests - #4543

Merged
kovtcharov-amd merged 13 commits into
amd:mainfrom
kovtcharov:kalin/local-chat-two-slots
Oct 4, 2026
Merged

kovtcharov-amd merged 13 commits into
amd:mainfrom
kovtcharov:kalin/local-chat-two-slots

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

On a local llama.cpp model, the turn after almost every message stalled for 60–90s with no visible reason. Memory extraction, which runs after each turn, sends its own short prompt. With a single llama.cpp slot, the server first copies the conversation's KV cache to host RAM, which took 87s for a 30K-token Qwen3-30B context on a Radeon 8060S. The user's next turn queues behind that copy, and extraction hit its 60s limit and stored nothing. Chat-model loads on the llamacpp recipe now pass --parallel 2 --kv-unified --cache-ram 0 --slot-prompt-similarity 0.5. The second slot shares the one KV pool, so side requests no longer evict the conversation and the RAM copy is never needed.

TUI, local Qwen3-30B, same 9 everyday tasks before after
"Who is my manager?" (follow-up turn) 95.5s 3.5s
document questions 100–190s 21–32s
memories extracted 0 (all abandoned at 60s) 16 (4–41s each)

Measured directly against the server: a 29-token request after a 29.5K-token conversation took 87.4s with one slot and 0.2s with this change. Returning to the conversation stays cached at 0.3–0.9s.

Slots are pinned too. A longer session showed two slots aren't enough on their own: chosen by LRU, a memory extraction sometimes landed on the slot holding the conversation and overwrote it, and the next turn re-read 28–30K tokens (109–122 s). Local requests now go to id_slot 0 and extraction to id_slot 1. A server with one slot ignores the pin, and cloud requests carry none.

Same TUI, 13 consecutive turns, extraction on unpinned pinned
turns that re-read the whole conversation 2 of 4 (109 s, 122 s) 0 of 13
typical turn — 3–17 s, first token 0.5–1.4 s
memory extractions completed 2 of 4 (2 abandoned at 60 s) 12 of 12 (3–32 s)

Test plan

  • pytest tests/unit/test_lemonade_chat_slots.py: local requests are pinned to the conversation slot, cloud requests carry no slot, and extraction runs on the side slot. Also: chat loads get the flags; loads that already set their own flags (the embedders), loads with no context size, and FLM models are untouched.
  • pytest tests/test_lemonade_client.py tests/unit/test_lemonade_predownload_checks.py: same 26 failures as main, all needing a live server on :13305.
  • Live: the TUI agent's own load starts llama-server with the flags (checked in /api/v1/health launch_command); the 9-task batch gave the numbers above.

@github-actions github-actions Bot added llm LLM backend changes tests Test changes performance Performance-critical changes labels Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

Local llama.cpp chat models now load with a second slot that shares the conversation's memory. Side requests like memory extraction no longer push the conversation out to host RAM, which removes the 60–90s stalls between turns. The fix is small, opt-out (any caller passing its own flags keeps them), tested, and backed by live before/after numbers.

Nothing blocks merge. One thing is worth checking before release: the two slots now share one context budget. A conversation that already fills most of the window may leave no room for a side request, or the side request may squeeze the conversation. A quick run near the context limit would settle it.

Real-world evidence

N/A — no evidence bundle was produced for this run (backend load-flag change; real inference is deferred to the strix-halo lane). The PR description includes the author's own live measurements: a TUI 9-task batch with before/after latencies, and a direct server timing of 87.4s → 0.2s. Beyond those, this verdict rests on static review. I couldn't run the new tests here because pytest isn't installed on this runner.

🔍 Technical details

🟡 Shared KV pool at near-full context (src/gaia/llm/lemonade_client.py:364)
With --kv-unified, both slots draw from one pool of ctx_size cells. Before this change, the single slot always had the full window. GAIA budgets prompts against the loaded ctx_size, so picture a conversation at ~60K of 64K while memory extraction runs at the same time. llama.cpp will then either reject the side request for lack of KV space or evict cells from the idle conversation slot, and the second outcome brings back the full re-prefill this PR is removing. This is plausible rather than confirmed. Please run one extraction against a near-full conversation, or note the expected llama.cpp behaviour in the PR.

🟢 gaia init will persist these flags (src/gaia/installer/init_command.py:1359)
That call passes ctx_size and save_options=True, so CHAT_LLAMACPP_ARGS gets written into Lemonade's saved options for the model. It then applies to every later load, including loads from non-GAIA clients. If that's intended, fine. If not, skip the default when save_options is set.

🟢 Extra catalog round-trip on every chat load (src/gaia/llm/lemonade_client.py:1983)
_model_recipe fetches the full ?show_all=true catalog on every load that passes ctx_size. list_models already caches entries in self._model_metadata, so checking there first would skip the request on repeat loads:

    def _model_recipe(self, model_name: str) -> Optional[str]:
        """The catalog's recipe for *model_name* (``llamacpp``, ``flm``, ``cloud``…)."""
        cached = self._model_metadata.get(model_name)
        if cached and cached.get("recipe"):
            return cached["recipe"]
        for model in self.list_models(show_all=True).get("data", []):
            if _model_ids_match(model.get("id"), model_name):
                return model.get("recipe")
        return None

Strengths

  • The default is narrowly scoped: only llamacpp recipes, only chat loads with a ctx_size, and never when the caller set llamacpp_args. That keeps the embedder and code-index loads (--ubatch-size 2048) untouched.
  • The tests assert the outgoing /load payload shape rather than just checking that a call happened, and they cover the three negative cases (the caller's flags, no ctx, FLM).
  • The PR description shows the user-visible impact with real measurements, not just a claim.

@kovtcharov
kovtcharov force-pushed the kalin/local-chat-two-slots branch from 1837e8c to a037859 Compare October 1, 2026 21:48
@github-actions github-actions Bot added the agents label Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

🟡 Memory extraction may never finish on a model loaded with one slot. This push pins extraction to slot 1. The code comment says a one-slot server ignores the pin, but as far as I know llama.cpp doesn't: it looks up slot 1, finds nothing, and keeps deferring the request. If that's right, extraction times out every turn and memory quietly stops learning. That would happen whenever the model is already resident without --parallel 2, for example when Lemonade or another client loaded it, a caller passed its own llamacpp_args, or it's still loaded from before the upgrade.

Please run one extraction against a one-slot load to confirm. If it hangs, send the side-slot pin only when the loaded model is known to have two slots.

🔍 Technical details
  • src/gaia/agents/base/memory.py:1719 always sends id_slot=SIDE_SLOT. src/gaia/llm/lemonade_client.py:367 claims "A server with one slot ignores the pin."
  • In llama.cpp's server, a completion task with id_slot != -1 uses get_slot_by_id. When that returns nullptr, the task goes to queue_tasks.defer(...) and is retried indefinitely; nothing reports an error. Some older builds index slots[id] without a bounds check. I haven't verified this against the llama.cpp build Lemonade bundles, which is why it's a check rather than a confirmed bug.
  • EXTRACTION_TIMEOUT_S caps the wait, so the turn itself doesn't hang. The failure shows up only as a "extraction abandoned" warning, which is the silent-degradation pattern CLAUDE.md warns against.
  • The provider also pins id_slot=0 on every non-cloud model, FLM included. That's probably harmless, but it would be worth checking that FLM accepts the unknown field.

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

CI's Linux Unit Tests failure is a real bug, not a flake: _model_recipe() (lemonade_client.py:1983) calls list_models(show_all=True) unguarded, and any failure of that catalog fetch now aborts the whole model load — not just the llama.cpp-flag decision.

Reproduced locally against a minimal fixture server: a 404/error on GET /models?show_all=true propagates straight out of _load_model_leased, so load_model() raises instead of falling back to loading without the chat flags. This runs on every load that passes ctx_size without its own llamacpp_args — including non-llamacpp recipes (FLM, cloud) that only needed the catalog answer to learn "not llamacpp, skip it." That's a new hard network dependency (and a doubled round-trip) on a path that previously needed only the POST /load call to succeed.

🔍 Technical details
tests/integration/test_context_override_reload.py::test_startup_then_eviction_preserves_requested_window[16384,131072]

fails because its fixture serves GET /api/v1/models but not the ?show_all=true query string list_models(show_all=True) sends — _send_request raises LemonadeClientError on the resulting 404, uncaught by _model_recipe, uncaught by _load_model_leased. Verified directly:

client.load_model("Gemma-4-E4B-it-GGUF", ctx_size=16384, prompt=False)
# LemonadeClientError: Request failed with status 404: ...

Suggest wrapping the _model_recipe call in a narrow try/except (log + treat as "unknown recipe, don't inject flags") so a catalog hiccup degrades to the old behavior instead of failing the load outright.

Separately: the cache-correctness question this PR raises — could the new slots serve a stale/wrong conversation — checks out fine. GAIA resends the full messages array on every chat_completions call (stateless from the app side), so llama-server's slot/prefix matching is content-addressed, not keyed by session id; there's no cross-conversation leakage path here. The macOS-smoke and Windows-smoke CI failures are the known pre-existing flakes (reproduced identically on current main HEAD), unrelated to this change.

… requests

On a single llama.cpp slot, every request with its own prompt (memory
extraction, titles) first saved the conversation's KV cache to host RAM:
87s per switch for a 30K-token Qwen3-30B context on a Radeon 8060S, while
the user's next turn waited. Chat-model loads on the llamacpp recipe now
start with a second slot over one shared KV pool and no host prompt cache.
Left to LRU, a memory extraction landed on the slot holding the conversation and overwrote it; the next turn re-read 28-30K tokens (109-122s). Local requests now default to id_slot 0 and extraction uses id_slot 1; a one-slot server ignores the pin.
@kovtcharov
kovtcharov force-pushed the kalin/local-chat-two-slots branch from f307c8d to dc51e3a Compare October 2, 2026 08:09
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

The _model_recipe() network-failure bug from the earlier review is still unfixed — the two new commits only add slot-pinning (a separate, additive change) and don't touch _model_recipe/_load_model_leased's error handling.

Reproduced live: a fixture server that 404s on GET /models?show_all=true (any server that doesn't special-case that query string) still aborts the whole load_model() call. This is the actual cause of the current Linux Unit Tests failure — test_context_override_reload.py's loopback fixture 404s on that path, _model_recipe raises LemonadeClientError, and initialize_lemonade_for_agent fails before ever reaching POST /load.

🔍 Technical details

Local repro (src/gaia/llm/lemonade_client.py:1988-1992):

gaia.llm.lemonade_client.LemonadeClientError: Request failed with status 404: ...
  at list_models (lemonade_client.py:3364)
  at _model_recipe (lemonade_client.py:1990)
  at _load_model_leased (lemonade_client.py:4659)

Suggested fix is unchanged from the prior comment: wrap the _model_recipe() call in _load_model_leased in a narrow try/except LemonadeClientError that logs and falls back to "unknown recipe, skip the chat flags" rather than propagating out of the whole load.

Not blocking on CI alone — Windows/macOS smoke failures are the known, tracked, continue-on-error: true ones (#4565/#4566); the Linux failure is this bug.

Kalin Ovtcharov added 3 commits October 2, 2026 21:00
… load

Every chat load now asked the catalog for the model's recipe before deciding on the two-slot flags, and any failure of that request aborted the whole load — so a server that 404s on ?show_all=true (CI's loopback fixture, or a proxy) could no longer load a model at all.

The recipe lookup is now only for the speed-up: if the catalog can't be read, the load goes ahead without the chat flags and logs a warning saying so. An auth failure still fails the load, since POST /load would reject it too. A recipe already known from an earlier catalog read skips the extra round-trip.
…s one

llama.cpp defers a request pinned to a slot it lacks until the caller gives
up, so on a model loaded without --parallel 2 (by another client, with the
caller's own flags, or from before the upgrade) every extraction timed out.
The provider now reads the loaded model's slot count from /health and drops
a side-slot pin the model can't serve.
@kovtcharov

Copy link
Copy Markdown
Contributor Author

Fixed: memory extraction no longer pins itself to a slot the model doesn't have, so a model loaded with one slot can't stall it. The catalog-failure bug from the earlier comments was already fixed in 336a8e9a3.

  • Before sending the side-slot pin, the provider checks how many slots the loaded model actually has. A model launched without --parallel 2 (loaded by another client, with the caller's own flags, or from before the upgrade) gets the conversation slot instead, which is its only slot anyway.
  • Still open, and it needs hardware: a memory extraction against a conversation close to the context limit, to see how the shared KV pool behaves.
🔍 Technical details
  • New LemonadeClient.slot_count(model) reads /health. It takes --parallel/-np from the entry's launch_command, falls back to recipe_options.llamacpp_args, and returns 1 when neither one names a value.
  • LemonadeProvider.chat drops a requested id_slot other than CONVERSATION_SLOT when that slot is >= slot_count. The constant's comment no longer says a one-slot server ignores the pin.
  • Tests in tests/unit/test_lemonade_chat_slots.py cover the slot count from the launch command, from the args, with no flag, and for a different model, plus the side request on one-slot and two-slot loads.
  • gaia init persisting the chat flags through save_options is left as is. Lemonade's own auto-loads then get the second slot too, which is the behaviour we want.
  • This changes which slot memory extraction runs on, not any prompt, so it needs no eval rerun.

kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Oct 4, 2026
… point (amd#4657)

Right after `gaia init`, if GAIA's own Lemonade is stopped (after a
reboot, a crash, or `gaia lemonade embedded stop`), `gaia llm`, `gaia
chat`, `gaia api`, every agent constructor, the TUI and
`initialize_lemonade()` look for a system Lemonade. They find none and
tell the user to run the `gaia init` they already ran. Only the Agent UI
server started the right one. Now every start path checks one resolver
and starts GAIA's server through the daemon. If that start fails, the
daemon's error is shown and nothing tries a system install.

<details>
<summary>🔍 Technical details</summary>

- **Cause.** `ensure_ready` only started the embedded server when the
caller pinned no URL. The CLI pins env host and port, and the Agent base
pins the URL it resolved while the server was stopped. Both fell through
to `/daemon/v1/lemonade/start`, whose `LemonadeSupervisor` only knows
`resolve_lemonade()`. `LemonadeClient.initialize` / `launch_server`
resolved the system launcher directly.
- **Fix.** `gaia_runs_lemonade(base_url)` in `lemonade_launcher.py` is
the single decision. It is true when the embedded server is installed,
`LEMONADE_BASE_URL` is unset, and the URL is unset or is the one GAIA
resolves on its own. `ensure_ready`, the supervisor (now given the
daemon's `EmbeddedLemonadeOwner`), `launch_server`,
`_check_lemonade_installed`, `start_embedded_if_stopped` and
`describe_start_hint` all go through it. The embedded server binds a
random port, so `ensure_ready`, the Agent base and `launch_server`
re-resolve after starting it.
- **Not a start path.** `AgentSDK` construction never starts a server;
its first request fails with the provider's client hint.
- **Overlap.** This conflicts textually with amd#4618 in
`LemonadeClient._check_lemonade_installed`, where both add an "embedded
counts as installed" check. Either can merge first; on rebase keep this
PR's `gaia_runs_lemonade(self.base_url)` line and amd#4618's message
changes. It doesn't touch the functions changed by amd#4627, amd#4632 or
amd#4543.
</details>

## Test plan
- [x] `pytest tests/unit/test_gaia_lemonade_start_path.py` covers the
cold state: embedded installed and stopped, no system Lemonade. The
tests patch only the daemon, HTTP, `Popen` and the launcher resolver.
Each case asserts the daemon started GAIA's server, the system launcher
was never consulted, nothing was spawned, and the caller ended up on the
new port. Cases: CLI, Agent base, UI server, `initialize_lemonade`,
`create_lemonade_client`, the daemon supervisor, and failure paths.
- [x] Related suites pass: `test_lemonade_manager_autostart`,
`test_lemonade_supervisor`, `test_lemonade_launcher`,
`test_lemonade_service`, `test_daemon_lemonade`,
`test_daemon_lemonade_routes`
- [ ] On a machine with only `gaia init`'s Lemonade: `gaia lemonade
embedded stop`, then `gaia llm "hi"` answers instead of saying Lemonade
is not installed
- [ ] Same state, TUI: the model server comes up without a "could not
find one to start" error

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
@kovtcharov

Copy link
Copy Markdown
Contributor Author

This PR conflicts with #4655 (Qwen card sampling), which the release plan merges first; the resolution is mechanical and passes the combined tests on a local v0.25 candidate.

🔍 Technical details

Kalin Ovtcharov added 4 commits October 4, 2026 13:18
# Conflicts:
#	src/gaia/llm/providers/lemonade.py
Two slots without --kv-unified would split n_ctx between them, halving the
window the memory fit sized. The unified pool keeps both slots at the full
window and the KV memory at n_ctx tokens, which is what the fit charges.
… pool

Memory extraction runs on a background thread after the answer returns, so it
could be generating on the side slot while the user's next turn ran on the
conversation slot. Both slots are promised the whole window from one unified
KV pool; when the two active requests together outgrew it, llama.cpp failed
both with "Context size has been exceeded" instead of evicting one.

Requests to a local model now take a per-model lock inside the existing
model-slot lease, so one runs at a time. That matches what --parallel 1
already did at the server, and keeps the second slot's benefit: the
conversation's cache stays resident while the side request runs. Idle slots
are purged when room is needed, so a single active request always fits.

"Context size has been exceeded" and "failed to find free space in the KV
cache" are now classified as context overflow, and both typed classifiers
read the shared CONTEXT_OVERFLOW_PHRASES list.
# Conflicts:
#	src/gaia/llm/providers/lemonade.py
@kovtcharov

Copy link
Copy Markdown
Contributor Author

Side requests can overlap the conversation, so they're now kept from running at the same time. Without this, both requests could fail with "Context size has been exceeded" on the shared KV pool.

  • Memory extraction runs on a background thread after the answer returns, so it can still be generating on the side slot when the user's next turn starts.
  • Requests to a local model now run one at a time per process. That matches what --parallel 1 already did at the server, and keeps this PR's gain: the conversation's cache stays resident while the side request runs.
  • "Context size has been exceeded" and "failed to find free space in the KV cache" are now classified as context overflow, not a generic server error.

Error classification is LLM-affecting: CI should re-run error_recovery, context_retention and memory.

🔍 Technical details
  • With --kv-unified, llama.cpp promises every slot the full n_ctx from one buffer. When active requests outgrow it, update_slots sends the error to every processing slot and clears them. Only idle slots are purged to make room (try_clear_idle_slots), so one active request always fits.
  • The lock is a per-model RLock taken inside _model_slot_lease, after the broker lease, so it covers chat_completions, the streaming path and loads. Across processes, the daemon's broker lease already serializes.
  • I chose this over reserving a side budget from the window. Reserving would need --kv-unified-per-slot, which older bundled llama.cpp builds may lack, plus client-side token estimates for the side prompt. It would also shrink the conversation window.
  • _classify_lemonade_response and classify_lemonade_exception now read the shared CONTEXT_OVERFLOW_PHRASES, so FLM's overflow wording is typed as overflow there too.
  • Tests: a side request waits for a conversation request and for an open stream, different models don't block each other, and both new 500 messages classify as overflow.

A model with a forced llama.cpp backend loads with save_options, so chat flags
sent with it would persist in Lemonade's config. Matches amd#4678, which applies
the same guard to its one-slot pin.
amd#4678 pinned llama.cpp chat loads to --parallel 1. The two-slot flags here
replace that pin in the same CHAT_LLAMACPP_ARGS constant and load hook, and
amd#4678's single-slot tests now expect the two-slot set.
kovtcharov added a commit to kovtcharov/gaia that referenced this pull request Oct 4, 2026
…ade (amd#4678)

On Lemonade older than v11.8.0, which GAIA still accepts (minimum
v10.2.0), two GAIA requests running at once could both fail with
"Context size has been exceeded". That happened when memory extraction
ran beside the next turn, or when two Agent UI sessions were active.
Those versions let llama-server pick several slots over one shared KV
pool and promised each slot the whole window
(lemonade-sdk/lemonade#3276). GAIA now asks for one slot explicitly,
which is what v11.8.0+ (including the pinned v2026.40.0) already does by
default, so current installs see no change.

Merge before amd#4543, which replaces this flag with its own two-slot set;
the overlap is one constant and the load hook.

## Test plan
- [ ] `python -m pytest tests/unit/test_lemonade_single_slot.py`: a
llama.cpp chat load sends `--parallel 1`, other loads keep their flags,
an unreadable catalog still loads, and a 401 still fails.
- [ ] `python -m pytest tests/unit/test_broker_wiring.py
tests/unit/test_lemonade_model_loading.py
tests/unit/test_embedder_cpu_backend.py
tests/unit/test_llamacpp_backend.py`
- [ ] On a Lemonade older than v11.8.0, load a GGUF chat model through
GAIA and check the backend log reads `n_slots = 1`.

<details>
<summary>🔍 Technical details</summary>

- Applies only when the caller passed `ctx_size` and no `llamacpp_args`,
and the catalog says the recipe is `llamacpp`. Embedders keep their own
batch flags, and FLM/NPU models are untouched.
- Sending `llamacpp_args` replaces any args a user saved in Lemonade for
that model, for GAIA's loads.
- No prompt or tool change, so no eval category needs a re-run.
</details>

Co-authored-by: Kalin Ovtcharov <[email protected]>
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Oct 4, 2026
Merged via the queue into amd:main with commit 7f1e0aa Oct 4, 2026
@kovtcharov-amd
kovtcharov-amd deleted the kalin/local-chat-two-slots branch October 4, 2026 21:56
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Oct 4, 2026
…d#4687)

On Qwen3.6-35B-A3B (the local default wherever a GPU holds it), every
memory extraction after a turn reasoned until its 4096-token cap and
wrote no answer — so memory learned nothing, and each call held the GPU
for 2–3 minutes after the user's turn had ended. The agent abandons the
call at 60s but Lemonade keeps generating, so calls pile up: on the
v0.25 RC a `/model` switch waited ~12 minutes for six of them to drain.
Memory's short JSON side calls (extraction, consolidation,
reconciliation, skill distillation) now turn thinking off for local
models that have a thinking switch; the main turn is unchanged.

**Eval required before merge** — this changes what Qwen3.6 is asked to
do for memory extraction (an LLM-affecting path). A `gaia eval agent`
run on the `gaia_memory` category is pending.

<details>
<summary>🔍 Technical details</summary>

- RC evidence: `lemond.log` shows six non-streaming requests at
`out=4096` (prompts 404–1142 tokens), each fired ~100 ms after a turn's
`Streaming completed`; the same call on Gemma produces 179–215 tokens.
The TUI's agent log is ERROR-only in user mode, which is why the
"extraction abandoned" WARNING never appeared.
- Root cause: `ModelRequirement.thinking=True` for Qwen3.6 makes
`chat_completions` send `enable_thinking: true` on every request unless
the caller overrides it, and no memory side call did. Consolidation
(1024) and reconciliation (256) had the same flaw with even smaller
budgets.
- New `no_thinking_kwargs(model)` in `lemonade_client.py` mirrors the
auto-title helper's gate: it returns `{}` for cloud models and for
models without a registered switch.
- An extraction that still ends on `finish_reason=length` with no text
now logs an ERROR naming the model.
- Rebases cleanly onto amd#4543: its `id_slot=SIDE_SLOT` sits on different
lines of the same call.
</details>

## Test plan
- [x] `pytest tests/unit/test_lemonade_cloud_models.py
tests/unit/test_memory_mixin.py
tests/unit/test_skill_synthesis_incremental.py
tests/unit/test_skill_synthesis.py`: 489 passed
- [x] The new call-site tests fail on unfixed `main` (5 fail on the
Qwen3.6 path; the Gemma and cloud "send nothing" cases pass either way)
- [x] Wire test: a side call to Qwen3.6 reaches Lemonade with
`enable_thinking: false` and the card's non-thinking sampling, streaming
and non-streaming
- [x] `python util/lint.py --black --isort`
- [ ] `gaia eval agent --category gaia_memory` on Qwen3.6-35B-A3B
(scores the flagship)
- [ ] On a Qwen3.6 TUI session, `grep "out=4096" lemond.log` stays empty
across several turns, and a `/model` switch loads at once

Co-authored-by: Kalin Ovtcharov <[email protected]>
kovtcharov added a commit to kovtcharov/gaia that referenced this pull request Oct 5, 2026
On a cloud model (DeepSeek on Fireworks), every background memory
request failed with HTTP 400, so GAIA never learned anything from a
conversation on Fireworks. Background memory requests (extraction and
the others) pin themselves to a llama.cpp slot to keep the chat's cache
warm, a local-only hint added in amd#4543. The cloud path passed it
straight to Fireworks, which rejects it ("Extra inputs are not
permitted, field: 'id_slot'"). The user sees nothing except an agent-log
error that wrongly blames the provider connection. Now the cloud branch
drops `id_slot` along with the other llama.cpp-only fields it already
strips.

Found validating the v0.25 candidate in the TUI on DeepSeek via
Fireworks; reproduced with a direct request (with `id_slot` → 400,
without → 200).

## Test plan
- [x] `pytest tests/unit/test_lemonade_cloud_models.py
tests/unit/test_lemonade_chat_slots.py` (113 passed)
- [x] The new assertion fails on `main` for both cloud providers
(fireworks, amd) and passes here
- [x] `python util/lint.py --black --isort`
- [ ] TUI on a Fireworks model: "My favourite fruit is mango." → no
`HTTP 400` in the agent log, and the fact is extracted to memory
@kovtcharov-amd kovtcharov-amd mentioned this pull request Oct 6, 2026
5 of 10 tasks
grtninja pushed a commit to grtninja/gaia that referenced this pull request Oct 6, 2026
# GAIA v0.25.0 Release Notes

## Breaking Changes

- **`gaia chat` runs the flagship GAIA agent**, the same agent as the
TUI and Agent UI, instead of the retired ChatAgent. `gaia chat -q "…"`
queries it once. (PR [amd#4520](amd#4520))
- **`gaia talk` transcribes and speaks through Lemonade** — it uses
Lemonade's Whisper and `kokoro-v1`, and stops with the reason if
Lemonade is down. The `[audio]` extra is gone; `pip install
amd-gaia[audio]` only warns. (PR
[amd#4665](amd#4665))
- **The Agent UI runs only the GAIA agent** — the Agent Hub home, agent
picker, and custom-agent export/import are removed from the UI. The CLI
and eval harness can still run other agents. (PR
[amd#4509](amd#4509))
- **The retired nomic embedder is removed** — memory saved with it is
re-embedded on first start. (PR
[amd#4489](amd#4489))
- **Indexed documents are re-indexed once** — the document cache is now
keyed on chunking settings, so the first query after upgrading rebuilds
it. (PR [amd#4624](amd#4624))
- **A skill that asks for more than its tier allows no longer loads** —
the permission ceiling is checked at every load, so a skill already on
disk that exceeds it is refused with the reason. (PR
[amd#4849](amd#4849))

## What's New

- **A larger local model where the GPU holds it** — `gaia init` picks
Qwen3.6-35B-A3B on a 64 GB+ Strix Halo or a 32 GB GPU and keeps
Gemma-4-E4B elsewhere, with each context window sized to available
memory. Qwen3.8 Flash Next is opt-in on 128 GB Strix Halo. (PRs
[amd#4479](amd#4479),
[amd#4670](amd#4670),
[amd#4671](amd#4671),
[amd#4658](amd#4658),
[amd#4655](amd#4655))
- **The Agent UI opens straight to a chat and sets itself up** — a fresh
install runs the same setup steps as the TUI in the window, with
provider, key and model settings, permission modes, and revocable
"always allow" grants. (PR
[amd#4509](amd#4509))
- **A much smaller install** — PyTorch, transformers and accelerate are
gone from the core, `[ui]` and `[talk]` installs; the desktop app's
Python environment drops from ~0.9 GB to ~0.1 GB on Windows. (PRs
[amd#4666](amd#4666),
[amd#4621](amd#4621),
[amd#4665](amd#4665))
- **One Windows installer for the desktop app and the terminal**, with a
GAIA Windows Terminal profile. (PRs
[amd#4720](amd#4720),
[amd#4707](amd#4707))
- **A "no" holds** — a declined action isn't retried through another
tool; the agent asks again with the exact command. The TUI gains
Shift+Tab permission modes. (PRs
[amd#4460](amd#4460),
[amd#4461](amd#4461))
- **Answers are checked against what the tools actually did** — the
agent looks at files you name before answering about them, and a short
plain-English note appears only when work isn't confirmed. (PRs
[amd#4532](amd#4532),
[amd#4501](amd#4501),
[amd#4508](amd#4508))
- **One shell session** — commands share a persistent shell, risky ones
ask instead of being refused, and "full access" is one setting
everywhere. (PR [amd#4408](amd#4408))
- **Memory surfaces what's relevant to each request, with its age**,
keeps what fixed a failure as a lesson for that workspace, and extracts
after the answer instead of before it. (PRs
[amd#4061](amd#4061),
[amd#4066](amd#4066),
[amd#4406](amd#4406))
- **`gaia.log` stays bounded** — it rotates at 10 MB with three backups
(`GAIA_LOG_MAX_MB`, `GAIA_LOG_BACKUPS`). (PRs
[amd#4668](amd#4668),
[amd#4760](amd#4760))
- **Child processes get a trimmed environment** — shell, MCP and skill
children no longer inherit GAIA's internal credentials; `GAIA_NO_DOTENV`
skips loading `.env`. (PRs
[amd#4635](amd#4635),
[amd#4659](amd#4659))
- **Every file tool checks the allowed-folders rule**, and paths inside
an inline shell script are checked one by one. (PRs
[amd#4656](amd#4656),
[amd#4758](amd#4758))

## Bug Fixes

A selection of the user-visible fixes; the full list is in the changelog
below.

- **Local Qwen models no longer loop on repeated tool calls** — they run
with their model card's sampling instead of near-greedy settings. (PR
[amd#4655](amd#4655))
- **Qwen3.6 runs on a Strix Halo with an older AMD driver** — it used to
crash on its first token, so `gaia init` failed; GAIA now turns off the
Vulkan path that crashes on those drivers only, and newer drivers keep
the faster path. (PR [amd#4674](amd#4674))
- **A long PDF no longer hangs or times out while indexing** — big
documents index in the background, and PDFs that only carry
owner-password restrictions now index. (PRs
[amd#4754](amd#4754),
[amd#4679](amd#4679),
[amd#4734](amd#4734))
- **Document answers cite the right document and page**, and every chunk
is embedded whole instead of its first 1,200 characters. (PRs
[amd#4688](amd#4688),
[amd#4723](amd#4723))
- **`gaia init` fails when model verification fails**, shows downloads
live, and no longer hangs while Lemonade hashes a large model. (PRs
[amd#4620](amd#4620),
[amd#4564](amd#4564),
[amd#4673](amd#4673))
- **`gaia init` adds a profile's extras without reinstalling GAIA**,
which failed on Windows while `gaia.exe` was running. (PR
[amd#4672](amd#4672))
- **Every SDK and CLI entry point starts GAIA's own Lemonade**, and
every call goes to the resolved URL with its API key. (PRs
[amd#4657](amd#4657),
[amd#4627](amd#4627))
- **Local chat stays cached across turns** — the system prompt is fixed
and side requests no longer evict the conversation. (PRs
[amd#4698](amd#4698),
[amd#4543](amd#4543))
- **A cloud model selection never preloads a local model**, and cloud
models no longer get llama.cpp-only fields. (PRs
[amd#4757](amd#4757),
[amd#4709](amd#4709))
- **The Agent UI stops claiming "100% local" while chat goes to a cloud
model**, and the chat header names the session's real model. (PRs
[amd#4711](amd#4711),
[amd#4550](amd#4550))
- **Enter can't approve a permission prompt**, and prompts wait 10
minutes before timing out. (PRs
[amd#4700](amd#4700),
[amd#4699](amd#4699))
- **Stopping a run keeps the turn and its steps visible.** (PR
[amd#4743](amd#4743))
- **A file edit keeps the file's line endings** — a one-line edit on
Windows used to rewrite every line ending, so a small change showed up
as the whole file changed. (PR
[amd#4864](amd#4864))
- **A broken agent install is reported as broken, not as missing** — the
error names both package versions and the real import error, and
suggests a reinstall that works. (PR
[amd#4588](amd#4588))
- **A meeting or document summary is never cut off mid-sentence** — a
thinking model used to spend the summary's output budget reasoning, so a
long meeting lost its second half. (PR
[amd#4827](amd#4827))
- **"What can you do?" gets an answer** instead of an attempt to
generate an image of the question. (PR
[amd#4809](amd#4809))
- **Writes and approved edits can't reach credential folders**
(`~/.ssh`, `~/.aws`, `~/.kube` and others), and shell option values and
script arguments get the same path check as plain paths. (PRs
[amd#4848](amd#4848),
[amd#4847](amd#4847))
- **`gaia connectors connect google --grant-agent installed:gaia`
works** — it used to fail with no sign-in link for the shipped agent; it
now asks for read-only Gmail and grants exactly that. (PR
[amd#4859](amd#4859))
- **A "no" to creating a folder also covers writing into it** — GAIA no
longer asks again to create the same folder a different way. (PR
[amd#4857](amd#4857))
- **`gaia skill import` runs the same checks as a hub install** — https
only, the audit, the permission ceiling, and an explicit opt-in for
skills that ship code. (PR
[amd#4849](amd#4849))
- **Memory off and private chats apply to scheduled and background runs
too.** (PRs [amd#4842](amd#4842),
[amd#4821](amd#4821))
- **Memory stops false apologies and reusing deleted values**, saves
"remember this" requests, and skips loading the embedder when memory is
off. (PRs [amd#4708](amd#4708),
[amd#4756](amd#4756))
- **A reply cut off by the token limit is continued** instead of ending
mid-sentence, and a tool call cut off at the output cap is retried
shorter. (PRs [amd#4054](amd#4054),
[amd#4556](amd#4556))
- **The TUI remembers the chosen model** across restarts and
agent-process restarts. (PRs
[amd#4497](amd#4497),
[amd#4710](amd#4710))
- **`gaia uninstall --purge` removes installer binaries, PATH edits and
daemon state.** (PR [amd#4413](amd#4413))

## Contributors

Thanks to the community members who contributed to this release:

- [@itomek](https://github.com/itomek) — the flagship's browser and tool
picker, one shell session, memory extraction off the answer path, stale
tool-result eviction, the TUI's sourced Fireworks rankings, and
`--purge` cleanup (PRs [amd#4407](amd#4407),
[amd#4408](amd#4408),
[amd#4406](amd#4406),
[amd#4465](amd#4465),
[amd#4414](amd#4414),
[amd#4413](amd#4413))
- [@mikemikimike](https://github.com/mikemikimike) — chained shell
command timeouts, bundled skills in frozen builds, and sidecar cleanup
reporting (PRs [amd#4463](amd#4463),
[amd#4467](amd#4467),
[amd#4419](amd#4419))
- [@Hashim1999164](https://github.com/Hashim1999164) — honoring
`GAIA_HOME` for cache, chat and index paths (PR
[amd#4381](amd#4381))
- [@krtadev](https://github.com/krtadev) — `~` expansion in file and
document tool paths (PR [amd#4576](amd#4576))
- [@aksh8b](https://github.com/aksh8b) — telling a broken agent install
apart from a missing one, with a reinstall hint that works (PR
[amd#4588](amd#4588))
- [@Dev-next-gen](https://github.com/Dev-next-gen) — numeric prerelease
ordering in the hub (PR [amd#4517](amd#4517))
- [@vianmangal](https://github.com/vianmangal) — recording denied tool
calls as unsuccessful in memory (PR
[amd#4412](amd#4412))
- [@GaetanVDB07](https://github.com/GaetanVDB07) — links to upstream
credential setup guides for connectors (PR
[amd#4669](amd#4669))
- [@rradjabi](https://github.com/rradjabi) — moving self-hosted CI jobs
to the xsj-dispatch runner pool (PR
[amd#4534](amd#4534))




## Also in this PR

- **Hub floors raised to core 0.25.0** — the chat agent imports the
allowed-folders check that only 0.25.0 ships (amd#4656), so
`gaia-agent-chat` goes to 0.2.0 with `amd-gaia>=0.25.0`, and the
flagship requires `amd-gaia>=0.25.0` and `gaia-agent-chat>=0.2.0`.
- **Two follow-ups held back until that floor could rise** —
`~/.gaia/logs/gaia-agent.log` now rotates like `gaia.log` (amd#4668), and
the chat agent's Python runners and Windows notification start their
children without GAIA's internal credentials (amd#4659).

The full changelog (300 commits) is in `docs/releases/v0.25.0.mdx`.

## Test plan

- [x] `util/validate_release_notes.py docs/releases/v0.25.0.mdx --tag
v0.25.0` passes; narrative is 590 words (cap 600)
- [x] `util/check_component_core_api.py --release-version 0.25.0` passes
- [x] `pytest tests/unit/test_docs_json_release.py
tests/unit/test_check_component_core_api.py
hub/agents/chat/python/tests/test_chat_dependency_floor.py
hub/agents/chat/python/tests/test_dependency_floor.py
hub/agents/gaia/python/tests/test_gen_binaries_lock.py` (72 passed)
- [x] `pytest hub/agents/gaia/python/tests/test_stdio.py` (91 passed,
incl. the new rotation test); `pytest
tests/unit/test_execute_python_file_cwd.py
tests/unit/test_run_python_tool.py` (42 passed)
- [ ] `mintlify validate` (docs CI job) — timed out locally, relying on
CI
- [x] Full flagship eval on main 9ce6598
(https://github.com/amd/gaia/actions/runs/37436249503): 181/308
scenarios pass vs 100/183 for the same categories in the baseline, 39
FAIL→PASS, 13 PASS→FAIL (two fixed in amd#4878, held until after rc1);
retrieval lane still finishing at merge time
- [ ] CI green

## Release checklist

- [ ] Publish `gaia-agent-chat` 0.2.0 only after core 0.25.0 is on PyPI
— it fails at import on an older core
- [ ] Build Installers on the merged SHA (pre-tag verification) before
pushing `v0.25.0`
- [ ] terminal-hub 0.25.0 published before the flagship npm release
consumes `binaries.lock.json`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents llm LLM backend changes performance Performance-critical changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants