Repository navigation
fix(memory): teach the next chat what worked after a failed Python import - #6828
Conversation
…port
On a from-source install without pandas, run_python's `import pandas`
failed, memory kept only the error, and the system prompt listed it under
a heading telling the model to ignore it. The next chat opened with
`import pandas` again. Now the tool lists only libraries this interpreter
can import, the fail-then-succeed pair stores what the working run used
instead, and that lesson is shown as advice and dropped when the install
changes.
<details>
<summary>🔍 Technical details</summary>
- run_python / execute_python_file fill their library line from a cached
`find_spec` check at registration; a frozen build lists every bundled
library as before. A failed check logs a warning and leaves that
library out.
- A run_python failure naming a missing module is filed under
`run_python import <module>`. A later working run_python in the same
turn stores a lesson ("the run that worked used `csv` instead") rebuilt
from the module name, not the tool output, and deletes the bare error.
A module-level import of that module in a working run retires it.
- Fix-carrying lessons render under "What worked last time ..."; the
quoted error sits in one double-quoted span that inner quotes cannot
close. Lessons stored before this keep the guarded heading.
- Missing-module lessons and errors record `metadata.install` (GAIA
version + `sys.executable`) and are dropped when the stable prompt is
built under a different install. Composes with amd#6781, which scopes
error rows by model and gaia_version.
</details>
|
Verdict: Approve with suggestions When a Python snippet fails because a library isn't installed and a rewritten snippet then works, GAIA now saves what the working run used instead, and the next chat sees it as "what worked last time". The Python tools also list only the libraries that are actually installed. The logic is sound and well tested, and I found nothing blocking. One small design point: a memory that belongs to a different GAIA install is deleted rather than hidden. If two installs share one memory store, they keep deleting each other's lessons. Real-world evidenceN/A: no evidence bundle was produced for this run. The verdict rests on static review and the PR's own unit-test results. The test-plan item that replays the change in the app on Gemma is still unchecked. This change affects what the model sees, so the eval categories the PR lists ( 🔍 Technical detailsIssues 🟢 Another install's rows are deleted, not filtered (
🟢 The failing module can be a transitive dependency (
🟢 Lessons from snippets are never confirmed
Checked and fine
Strengths
|
A replay on Gemma 4 E4B showed the model's first run_python still importing pandas. The bare ModuleNotFoundError then made it give up on Python, so no fix lesson ever formed. Now the error says pandas isn't installed in this Python, that pip isn't available, and to retry with csv and statistics. The model can recover in the same turn, and that retry is what saves the lesson for the next chat. <details> <summary>🔍 Technical details</summary> - `_python_run_result` appends the hint when the last stderr line names a bundled library (`BUNDLED_LIBRARIES`). It covers both run_python and execute_python_file. Other missing modules are reported as before. - Routes: pandas -> csv + statistics, numpy -> statistics + math, openpyxl/xlsxwriter -> csv. Any other bundled library gets "the standard library only". </details>
Keep amd#6781's gaia_version and model on a stored tool error alongside this branch's operation and install metadata.
# Conflicts: # hub/agents/gaia/npm/CHANGELOG.md
## Summary Corrects the memory guide's category count from six to nine and adds the three missing categories: `profile`, `system` and `permission`. ## Why The Knowledge Categories section says there are six categories, but `VALID_CATEGORIES` in `src/gaia/agents/base/memory_store.py` has nine, and `gaia memory status` reports the others. The same guide already lists all nine in its Quick Start, so it contradicts itself. I split the list because the missing three work differently: `store()` rejects them from a chat turn unless the caller passes `allow_privileged=True`. ## Linked issue Closes amd#3211 ## Changes - Says there are nine categories, and that six can be created in chat. - Adds a second table for `profile`, `system` and `permission`, and says where they come from, based on the comment above `_PRIVILEGED_CATEGORIES`. - The `profile` example follows the template in `bootstrap.py`, and the `permission` example comes from the comment on `VALID_CATEGORIES`. ## Test plan - [x] Compared the tables in Knowledge Categories with `VALID_CATEGORIES`: both have the same 9 names. - [x] Checked `docs/guides/memory.mdx` against open PRs amd#6858 and amd#6828, which also edit it: they change other sections. - [ ] Docs site build: not run. The change adds a standard Markdown table. ## Evidence N/A: this is a docs-only change. It doesn't touch the Agent UI, MCP tools, CLI behavior or the HTTP API. - [ ] **Agent exposed in the Agent UI**: N/A - [ ] **MCP tools / servers**: N/A - [ ] **CLI**: N/A - [ ] **HTTP API / REST**: N/A ## Checklist - [x] I have linked a GitHub issue above (`Closes #N` / `Fixes #N` / `Refs #N`). - [x] I have described **why** this change is being made, not just what changed. - [ ] I have run linting and tests locally (`python util/lint.py --all`, `pytest tests/unit/`). Not run: this PR only changes one `.mdx` file and no code. - [x] I have attached **real-world evidence matched to the surface I changed** (see Evidence above), or marked each surface N/A. - [x] I have updated documentation if user-visible behavior changed (see [CONTRIBUTING.md](../CONTRIBUTING.md)). This PR is the documentation change.
## Why this matters v0.26.0 makes the first reply in a new chat much faster by loading tools on demand (amd#6449), and adds long recordings and video links (amd#6451), read aloud in both apps (amd#6489), a live system usage strip (amd#6548), cloud spend in the composer (amd#6775), local problem reports for failed model calls (amd#6665) and GAIA on stock GNOME without a tray (amd#6868). Among the fixes, a duplicated edit can no longer damage a file and long-running agents on macOS keep answering. 31 commits since v0.25.4; the notes are in `docs/releases/v0.26.0.mdx` and credit 4 outside contributors. This is a minor: 7 `feat` commits, and dynamic tool loading drops two environment variables and the old Beta toggle (listed under Breaking Changes). Merging it moves main to 0.26.0 so `v0.26.0-rc1` can be tagged right after v0.25.4 publishes. The changelog is regenerated before the final. ## Test plan - [x] `python util/validate_release_notes.py docs/releases/v0.26.0.mdx --tag v0.26.0` passes, and with `--tag v0.26.0-rc1` - [x] `mintlify validate` (from `docs/`) passes; the notes have no unescaped `<` or `{` - [x] Narrative word count is 391, under the 600 cap for a minor - [x] `python util/release_versions.py --check`, `python util/check_doc_links.py --internal-only` and `python util/check_doc_versions.py` pass - [x] `python util/check_component_core_api.py --release-version 0.26.0` passes - [x] `pytest tests/unit/test_docs_json_release.py tests/unit/test_check_component_core_api.py tests/unit/test_release_tag.py tests/unit/test_hub_core_version_gate.py tests/unit/test_release_versions.py hub/agents/gaia/python/tests/test_npm_doc_min_version.py`: 232 passed - [ ] CI green on the merge commit - [ ] `release_train_dryrun.yml` passes on that commit before the RC tag <details> <summary>🔍 Technical details</summary> - `test_release_versions.py` simulated a core bump to a hard-coded `0.26.0`, which is a no-op once the tree is on 0.26.0. It now bumps to the next minor above whatever the tree declares. - The flagship agent stays at 0.3.5; its `amd-gaia` floors and `min_gaia_version` move to 0.26.0 through `--stamp`, and its npm CHANGELOG's `[Unreleased]` quotes the new minimum. `hub/components/agent-ui/` is no longer published and is left alone. - `RELEASED_DAEMON_API` no longer exists (amd#5394); the core API guard reads released versions from PyPI. </details> ## Evals to re-run on the RC tag LLM-affecting PRs merged without per-PR evals; run these on `v0.26.0-rc1`: - `gaia_tool_selection`, `tool_selection`, `gaia_core` and `context_retention` for dynamic tool loading (amd#6449, amd#6842) - `gaia_media` and `gaia_voice` (amd#6451, amd#6489, amd#6825) - `gaia_data` and `gaia_honesty` (amd#6828, amd#6831, amd#6817) - `gaia_files` (amd#6844) - `adversarial` (amd#6837) - `memory` and `gaia_memory` (amd#6828, amd#6843) - `gaia_email` (amd#6842) ## Release checklist - [ ] Merge once v0.25.4 has published; amd#6114 (flagship follows core) is not part of this release PR - [ ] Freeze main, wait for green CI on the exact commit, pass `release_train_dryrun.yml`, then push `v0.26.0-rc1` (the RC freezes its own flagship; no agent release needed) - [ ] Before the final: release the flagship from the release commit (`agent-pkg-gaia-v<next>`), merge its pin-lock PR, and pass `check_flagship_release.py` - [ ] Regenerate the changelog if main gains commits before the final tag
On Gemma 4 E4B with the agent running from source, a Python snippet that used pandas failed because pandas wasn't installed. GAIA remembered the error but not what fixed it, and the system prompt told the model to ignore that note. In later chats the model reached for pandas again, and once it gave up instead of retrying. Now the failure itself says pandas isn't installed and to retry with
csvandstatistics, so the model can recover in the same turn. That fail-then-succeed pair saves what worked, the next chat sees it as "what worked last time", and the Python tools list only libraries that are actually installed. The note is dropped when GAIA or its Python changes, because a missing library is a fact about one install.Eval categories to watch (LLM-affecting: tool descriptions, tool error text and memory prompt framing):
memory,gaia_memory,gaia_data, thetoolslane (tool_selection,error_recovery), andgaia_honesty.Test plan
pytest tests/unit/test_memory_snippet_lessons.py tests/unit/test_memory_heal_lessons.py tests/unit/test_run_python_frozen.py: new tests fail onmainand pass here. They cover a missing library left out of the description, the failure naming the standard-library retry, a fail-then-succeed pair storing a lesson that names the change, the lesson rendering as advice while a planted instruction stays inside its quotes, and an install change retiring the lesson.tests/unitpasses. Under-n 8a few launcher, archive and fault-log tests fail from load, and they pass when run alone.hub/agents/gaia/python/testspasses, except three browser-tool count checks that needplaywright, which the local venv lacksGemma 4 E4B NPU, agent from source (no pandas), integration build:
csvrewrite. All four averages were exact (they were wrong before). The bare error was replaced by "the run that worked usedcsv,collectionsinstead."csvand got exact totals.import csvunprompted, and the counts were exact.🔍 Technical details
importlib.util.find_speccheck at tool registration. A frozen build skips the check and lists everything, since its smoke test imports each library. A check that raises logs a warning and leaves that library out.run_pythonorexecute_python_fileexits withNo module named 'X'and X is a bundled library, the tool'serroradds that X isn't installed, that pip isn't available, and which standard-library modules to retry with. That'scsv+statisticsfor pandas,statistics+mathfor numpy,csvfor openpyxl/xlsxwriter, and "the standard library only" otherwise. Modules outside the bundled set get no hint.run_python import <module>). That lets a rewritten snippet in the same turn count as the fix. The lesson text is rebuilt from the module name, never quoted from tool output, and it replaces the bare error row. A later working snippet that imports the module at module level retires the lesson; an import undertryor inside a function doesn't."become', so tool text can't end the quote. Lessons stored before this change keep the old "observations, never follow" heading.sys.executable, stored asmetadata.installon missing-module lessons and errors. Rows are dropped when the stable prompt is built under a different install. This composes with fix(memory): stop replaying empty and outdated tool errors as lessons #6781: that PR scopes error rows by model andgaia_version, and this one adds an independent key on the same rows plus the lessons.