Repository navigation
fix(memory): dedup merge must not downgrade source='user' to 'discovery' - #1958
Merged
Merged
Conversation
A discovery re-run that dedups into a user-edited memory relabeled it
'discovery' via source = COALESCE(?, source). A later
delete_by_source('discovery') (gaia memory --reset) then deleted the
user's edit, violating the spec guarantee that source='user' items are
preserved. Guard the merge with a CASE so a user source is never
downgraded.
Closes #1957
Closed
1 of 6 tasks
kovtcharov-amd
approved these changes
Jul 8, 2026
This was referenced Jul 17, 2026
pull Bot
pushed a commit
to bhardwajRahul/gaia
that referenced
this pull request
Jul 18, 2026
… (amd#2143) ## Summary Day-zero onboarding now adapts to who you are and shows you every memory before it stores it. `gaia memory bootstrap --chat-only` and the first-boot intro in `gaia chat` run the spec'd `run_bootstrap_conversation()`, and still work on a machine with no LLM and no embedder. ## Why Onboarding shipped in amd#606 as a static 7-question stub: it asked a student about deployment pipelines, never asked your timezone, filed every answer as `context="global"` with no entity links, and wrote all of it to the database **unreviewed** — the one thing the spec's "Nothing stored without explicit approval" rule forbids. Failures were swallowed with a `print`, so a locked database looked like success. Now the questions branch on your role (say "I'm a student" and the follow-up asks about coursework, not deployment), your tools get linked to the app you named (`entity="app:vscode"`) and scoped to `work`, and nothing reaches the database until you approve it item by item — with a loud, actionable error if a write genuinely fails. ## Linked issue Closes amd#1955 ## Changes - **The conversation engine is a pure core** (`agents/base/bootstrap.py`) over an injected `MemoryStore` + injected IO callables, mirroring the existing `discovery.py` + CLI-driver split. This is load-bearing, not stylistic: `init_memory()` degrades to `_memory_store = None` on three live paths (Lemonade not installed, cloud backend, `GAIA_MEMORY_DISABLED=1`), so a naive `self.memory_store` call would break `--chat-only` for exactly the new users onboarding targets. `MemoryMixin.run_bootstrap_conversation()` is the spec'd entry point; the CLI passes `on_stored=None` (no embedding), agents pass a hook and get embeddings inline. Same rows either way — the CLI's are backfilled at next agent start. - **Adaptivity is rule-based, not LLM-driven.** The spec's own example is keyword-shaped, and an LLM branch would re-introduce a Lemonade dependency into a flow that today has none. An optional `classify_fn`-style seam (`questions=` / public `build_entries` / `next_question_id`) is left for a future upgrade and for a step-wise UI wizard. - **Fail-loudly throughout.** The core catches only `BootstrapCancelled`; store/embed failures `raise RuntimeError(...) from e` naming what failed, what to do, and the DB path — replacing the swallow at the old `cli.py:5859`. Categories are validated against `VALID_CATEGORIES` in our code, because `MemoryStore.store()` does **not** validate (only `seed_bulk` does), so a bad category would be stored and then never recalled. - **Two first-boot guards, both bug-driven.** The review gate lets a user answer everything and approve nothing → no `profile` row → the intro would re-offer forever; an `onboarding_completed_at` marker (via the existing `memory_settings.json` mechanism) closes that. Declining with "no" now also counts as an answer and is recorded. Onboarding failure no longer costs you the chat session. - **Spec aligned to code where they disagreed** (see Deviations) — plus the memory spec's schema section, stale at v2 since amd#1794, updated to v3. ## Deviations from the plan / spec — all flagged | # | Spec / plan said | Shipped | Why | |---|---|---|---| | 1 | Onboarding stores `category="fact"` for identity (spec :1334-1351) | **`category="profile"`**; spec updated |⚠️ **Needs a maintainer call.** `profile` is a real *privileged* category: it renders into its own "User profile:" prompt section (`limit=15`, always-global) and drives first-boot detection. Renaming would demote identity out of that section, re-fire the intro forever, and let a chat turn forge identity. Reversal is a one-line category-map edit if you disagree. | | 2 | Flow lives "in `memory.py`" (:1361) | Core in new `bootstrap.py`; **the spec'd entry point still lives on `MemoryMixin`** | `memory.py` is 2600+ lines; the no-LLM constraint forces the pure-core split. Substance met, file placement differs. | | 3 | Use the existing `remember()` tool (:1361) | `MemoryStore.store(source="user")` directly | `remember` writes `source="tool"`, which the spec's *own* reset-safety rule (:1322/:1484) forbids for onboarding. Also keeps the LLM tool surface out of the diff. | | 4 | `remember()` implies an immediate embed | CLI: no embed (**unchanged**); mixin: embeds via `on_stored` | Preserves the cold-start path. Identical rows. | | 5 | Timezone → `category="fact"` (:1350) | `profile` @ `global` | Consistency with #1. | | 6 | "Show before store" written under *discovery* (:1320) | Batch review added to the chat flow | The issue's explicit ask. | | 7 | tools → 2 entries, `fact`@`work` only | **3 entries** — adds a `profile`@`global` mirror | Found in review and verified: `set_memory_context()` has **zero** non-test callers, and `get_by_category_contexts` selects *only* global rows when the active context is `global`. Work-only rows would never reach the system prompt — a day-one regression vs. today. The `work` rows keep the spec's scoping + entity link; the mirror keeps the stack visible. | | 8 | first-boot hook **unchanged** | Marker + `RuntimeError` guard + "~3 minutes" | The review gate broke the plan's own "fires once and only once" invariant. | **Known trade-off:** `_get_context_items` returns active-context + global, and the default context is `global`, so the `work`-scoped stack rows surface only in the `work` context. That's what the spec (:1355) and the AC demand; the global mirror (#7) is the mitigation. **Deliberately out of scope:** the two inlined `[Y/n/q]` review loops in `_bootstrap_discover` / `_bootstrap_infer` are not refactored into a shared helper — that would regress-risk those paths for no AC gain. Note that discovery's gate still treats an unrecognized answer as *approve*, which now disagrees with the chat gate in the same command; worth a follow-up. ## amd#1955 Acceptance Criteria — Proof All evidence below is from real runs on this branch (details + raw output in `GAIA-1955-verification.md`). | AC | Proof | |---|---| | **#1 — Adaptive questions** | Cold run answering "I'm a student" asked *"What are you studying, and how do you like to study?"*; the engineering/deployment question was never asked. Tests: `test_student_role_branches_to_coursework_not_engineering`, `..._engineer_role_branches_to_engineering_workflow`, `..._unmatched_role_branches_to_the_generic_follow_up`, `..._role_keywords_match_on_word_boundaries` ("I build things" must not route to the *designer* branch via "ui" in "build"). | | **#2 — Category/context conformance** | Cold-DB `gaia memory status`: `fact: 2, preference: 1, profile: 9` · `global: 10, work: 2` · `user: 12` · avg confidence `0.80`. Direct sqlite: `('Primary stack: …', 'app:vscode')`, `('Uses VS Code as primary IDE', 'app:vscode')`, both `fact`/`work`. | | **Entity linking** (spec :1355-1358) | The tools answer emits the stack fact **and** a dedicated IDE fact, both carrying `entity="app:vscode"`. | | **Timezone** (spec :1350) | Asked and stored: `Timezone: America/Los_Angeles` (`profile`/`global`). | | **Context suggestion** (spec :1343) | ≥2 use-case keywords → `Uses GAIA across these contexts: work, personal, learning`. | | **Show before store** (spec :1320/:1504) | 12 items listed with `[Y/n/q]` before any write. Declining leaves the row out of the DB; `q` stops the review and reports what went unreviewed; only `Y`/Enter stores — `"no"`, `"nope"` or a typo is re-asked, never taken as approval. | | **Reset safety** (spec :1322/:1484) | Every stored row is `source="user"` (`sources: ['user']`), protected by amd#1958's `CASE WHEN source = 'user'` dedup guard. | | **First-boot invariant** | Run 1 of `gaia chat` on a cold DB offered the intro and stored 12 rows (`profile@global=9`); run 2 went straight to interactive mode, intro not offered. | | **No-LLM / no-embedder contract** | `--chat-only` stored 11 rows with **0 embedding BLOBs** both with the embedder unreachable (`LEMONADE_BASE_URL=http://127.0.0.1:9`) *and* with Lemonade genuinely up on `:13305` — proving the CLI path never reaches for an embedder. | ## Test plan - [x] `python -m pytest tests/unit/test_memory_bootstrap.py -q` → **46 passed**. Needs no Lemonade and no mocked LLM by design; asserts stored-row *shape* in a real sqlite DB, not "the mock was called". (The `test_memory_` filename prefix is load-bearing — `tests/unit/conftest.py:29` keys on it to clear `GAIA_MEMORY_DISABLED`, so a file named `test_bootstrap.py` would pass vacuously in CI.) - [x] `python -m pytest tests/unit/test_memory_mixin.py tests/unit/test_memory_store.py tests/unit/test_memory_discovery.py -q` → **580 passed** — proves `remember`, the store, and discovery are untouched. - [x] `python -m pytest tests/integration/test_memory_integration.py -q` → **74 passed** (was `1 failed` on `main`: `test_fresh_install_gets_v2_schema` asserted schema v2 while fresh installs have stamped **v3** since amd#1794 — the assertion was never updated. Verified pre-existing on a pristine worktree at `ec2cb5ae`). - [x] `python util/lint.py --all` → `[SUCCESS] ALL QUALITY CHECKS PASSED!` - [x] **Cold state** (the maintainer's explicit ask on amd#1955): from an empty memory DB, `gaia memory bootstrap --chat-only`. Answer "I'm a student" → coursework follow-up fires. Answer "Python, TypeScript, VS Code, git" → review list shows a `work` fact with `entity=app:vscode`. Then `gaia memory status` → `profile` + `preference` + `fact`, all `source=user`. - [x] **No-embedder contract:** with `lemonade-server` down, `gaia memory bootstrap --chat-only` still completes and stores. Any embedder error here means the mixin coupling leaked into the CLI path. - [x] **First-boot:** from a cleared DB, `gaia chat` offers the intro; complete it; `gaia chat` again → not offered. ### Eval `gaia eval agent --category memory` on this branch vs. `main`, same machine, memory enabled, one eval process at a time (6-scenario subset; the full category is ~3h/side). **No regression:** pass rate **83% both sides**, avg **9.25 (branch) vs 9.0 (main)**. <details> <summary>Scenario detail + the one flagged regression (a web-search flake)</summary> | Scenario | main | branch | |---|---|---| | memory_conflict_resolution | PASS 9.7 | PASS 9.8 | | memory_cross_session_persistence | PASS 8.9 | PASS 9.8 | | memory_multi_fact_accumulation | PASS 9.9 | PASS 9.9 | | memory_preference_application | PASS 9.7 | FAIL 7.0 → **PASS 8.3 on re-run** | | memory_store_and_recall | PASS 9.9 | PASS 9.9 | | memory_stress_retrieval_under_noise | FAIL 8.3 | FAIL 8.0 (**also fails on `main`** — pre-existing) | `memory_preference_application` failed only on **turn 3**, where the agent chose `search_web` for a general-knowledge question, the search errored (`TAVILY_API_KEY` is unset on this machine), and it gave up. Turns 1–2 — the actual memory behaviour — passed. Re-running the identical scenario against identical branch code: **PASS 8.3**. This change touches no tool, no tool schema, and no system prompt, so it has no mechanism to affect `search_web`. There is **no committed `scorecard_memory.json` baseline**, so this is an A/B against `main`, not a baseline comparison. The `main` side was served from a detached worktree at `ec2cb5ae` (verified: `bootstrap.py` and `run_bootstrap_conversation` absent). **Honest framing:** none of CLAUDE.md's enumerated eval triggers strictly fire — no system-prompt, tool-registration, error-classification, model-default, or tool-call-parsing changes. `memory.py` is in the diff and onboarding's rows feed `_build_stable_memory_prompt`, so this was run as a regression guard. </details> <details> <summary>Two environment findings from the eval work (neither is a bug in this change) — worth follow-ups</summary> 1. **`memory_enabled` defaults to `false`** (beta flag in the UI DB under `HOME`), so a clean/isolated `HOME` yields a memory-*disabled* agent — every `remember` returns *"Memory is paused — this is a private session."* My first A/B scored cleanly and symmetrically while measuring an agent that could not remember anything. The runner's preflight checks `GAIA_MEMORY_ADMIN` but never checks memory is actually on; it should fail loudly when a `memory`-category scenario runs against `memory_enabled=false`. 2. **`OMP: Error #15`** on macOS once memory is enabled (faiss and torch each link their own `libomp.dylib`) crashes the backend; `KMP_DUPLICATE_LIB_OK=TRUE` works around it. Means memory evals can't run on a Mac without that env var. </details> ## Checklist - [x] I have linked a GitHub issue above (`Closes amd#1955`). - [x] I have described **why** this change is being made, not just what changed. - [x] I have run linting and tests locally (`python util/lint.py --all`, `pytest tests/unit/`). - [x] I have updated documentation if user-visible behavior changed — spec, SDK reference, user guide, and CLI reference updated together; no `docs.json` entry needed (`guides/memory` is already registered, no new page). --------- Co-authored-by: Alexey Tyurin <>
pull Bot
pushed a commit
to bhardwajRahul/gaia
that referenced
this pull request
Aug 17, 2026
Release notes had grown into long blocks of prose with a marketing-toned paragraph on top. They now generate as short bullets grouped by section, with a word cap on the narrative part. Nothing informational is lost — every PR link, contributor credit, and changelog entry is preserved; the prose around them is cut. Two generators write `docs/releases/<tag>.mdx` and they had drifted apart. The `gaia-release` skill told the model GAIA's notes "read dry" and to make them "engaging"; the `release-notes` job in `claude.yml` asked for "comprehensive" notes with an `## Overview` paragraph and emoji headings. Fixing one alone would have been overwritten by the other on the next tag, so both now share one spec. Closes amd#2961 ## What it looks like now Regenerated from the last two releases — same facts, same PR numbers, new template. Narrative words (the capped part, excluding bug-fix/contributor/changelog lists): | Release | Published | Regenerated | Cap | |---|---|---|---| | v0.22.0 (minor) | 1705 | **538** | 600 | | v0.23.0 (minor) | 1119 | **280** | 600 | <details> <summary>Example 1 — v0.23.0 regenerated</summary> ```markdown --- title: "v0.23.0" description: "Install and run agents from the terminal, add capabilities as skills, and connect a Microsoft account without a secret." --- # GAIA v0.23.0 Release Notes Agents are now installable from the terminal, and the confirmation gate that pauses an agent before a consequential action works everywhere, not just in the Agent UI. ## Breaking Changes - **`GAIA_MICROSOFT_TENANT` is gone** — the Microsoft connector split into Personal and Work/School, each with its own tenant. Drop the variable and pick the matching connector. (PR [amd#2729](amd#2729)) ## What's New - **Install and run agents from the terminal** — `gaia hub list`, `gaia hub install <agent> --trust`, `gaia hub uninstall <agent>`. `--trust` is required for an unverified agent. (PRs [amd#2484](amd#2484), [amd#2530](amd#2530), [amd#2708](amd#2708)) - **Every agent asks before it acts** — the confirmation gate for sending mail, writing files, and running commands now fires from the terminal, the local API, and MCP tool calls, not only the Agent UI. Set `GAIA_AUTO_APPROVE_TOOLS=1` to opt out. (PRs [amd#2475](amd#2475), [amd#2544](amd#2544), [amd#2846](amd#2846), [amd#2854](amd#2854)) - **Safer by default** — the MCP bridge binds to localhost and enforces `--auth-token`; the local API refuses credentialed cross-origin requests from non-allow-listed sites; MCP servers launch without a shell; agents cannot write to `~/.gaia` or pass crafted SQL to the database agent. (PRs [amd#2246](amd#2246), [amd#2238](amd#2238), [amd#2344](amd#2344), [amd#2844](amd#2844), [amd#2847](amd#2847), [amd#2860](amd#2860)) - **Add capabilities as skills** — `gaia skill create|import|list|info` gives an agent a new capability from a folder and a manifest. Skills are signed with trust tiers, audited before publish, and opt-in. (PRs [amd#2669](amd#2669), [amd#2692](amd#2692), [amd#2702](amd#2702), [amd#2693](amd#2693)) - **Connect a Microsoft account without a secret** — Personal and Work/School are separate connectors with device-code sign-in. (PRs [amd#2718](amd#2718), [amd#2364](amd#2364)) - **Lemonade Server 11.5.0.** ## Bug Fixes - **Triage paginates large inboxes and reports truncation** (PR [amd#2646](amd#2646)) — mail past a hidden limit is no longer dropped without saying so. - **Thread messages come back sorted and numbered** (PR [amd#2570](amd#2570)) — "reply to 3" hits the message shown at position 3. - **The inbox pre-scan reports uncertainty as uncertainty** (PR [amd#2587](amd#2587)). - **An email conversation survives its turns** (PR [amd#2837](amd#2837)) — a follow-up keeps session context. - **A bare reconnect keeps existing grants** (PR [amd#2733](amd#2733)). - **Restore from Trash anytime** (PR [amd#2542](amd#2542)) — no time window on undo. - **Sender priority no longer overrides content classification** (PR [amd#2774](amd#2774)). - **The agent survives an OpenMP double-init** (PR [amd#2508](amd#2508)). - **Large tool results truncate to valid JSON** (PR [amd#2645](amd#2645)). - **A missing model surfaces as a real 404** (PR [amd#2245](amd#2245)). - **GPU is detected on all platforms and `default_device` is honoured** (PR [amd#2244](amd#2244)). - **A sidecar that is alive but not serving is detected** (PR [amd#2707](amd#2707)). - **The model-slot lease is held across inference** (PR [amd#2394](amd#2394)) — a second agent can't evict the model mid-generation. - **A browser that never launched is surfaced** (PR [amd#2507](amd#2507)). - **Stop aborts in-flight streaming** (PR [amd#2166](amd#2166)). ## Known Issues - **The email agent is beta and CLI-first** — treat its output as a draft to review. - **A full inbox triage can time out on larger mailboxes.** - **Email autonomy is experimental** and not wired up in the packaged sidecar. ## Contributors - [@handle](https://github.com/handle) — <contribution> (PR [#NNN](https://github.com/amd/gaia/pull/NNN)) <!-- generated from the commit log; v0.23.0's list is unchanged from the published notes --> ## Full Changelog **N commits** since v0.22.0: - `<sha>` — <subject> Full Changelog: [v0.22.0...v0.23.0](amd/gaia@v0.22.0...v0.23.0) ``` </details> <details> <summary>Example 2 — v0.22.0 regenerated (the largest recent release)</summary> ```markdown --- title: "v0.22.0" description: "The email agent tracks follow-ups and action items, drafts in your voice, and runs as its own process. Plus a cron scheduler and Word document support in RAG." --- # GAIA v0.22.0 Release Notes A large release built around the email agent, which now tracks what you're waiting on instead of forgetting it after triage. ## Breaking Changes - **Triage returns a reply scaffold, not an empty draft** — `POST /v1/email/triage` and `/triage/batch` now return a `DraftScaffold` without `body`. Code reading `result.draft.body` gets a missing key instead of `""`; use `POST /v1/email/draft` for composed prose. (PR [amd#1984](amd#1984)) - **RoutingAgent and DocumentQAAgent moved to standalone packages** — install `gaia-agent-routing` and `gaia-agent-docqa`. The old imports fail; there is no deprecation shim. (PR [amd#1455](amd#1455)) ## What's New - **An inbox agent that keeps track** — `gaia email` scans Sent folders across every connected mailbox and flags threads still waiting on a reply past a window you set (default 3 days). Detection only; it never nudges anyone for you. (PRs [amd#1922](amd#1922), [amd#1917](amd#1917), [amd#1919](amd#1919), [amd#1918](amd#1918)) - **Drafts in your own voice** — the agent derives greeting, sign-off, length, and formality from your Sent history and composes against that. Only the derived characteristics are stored, never old mail content. (PR [amd#1925](amd#1925)) - **Attachments work end to end** — triage surfaces each attachment's name, type, and size, and drafting and sending accept real attachments as Gmail multipart MIME or Outlook Graph attachments. (PRs [amd#1921](amd#1921), [amd#1883](amd#1883)) - **Email runs as its own process in the Agent UI (beta)** — install it from the Agent Hub panel and the UI talks to it over HTTP, instead of loading the email stack into the UI process. (PRs [amd#1884](amd#1884), [amd#1910](amd#1910), [amd#2100](amd#2100), [amd#2101](amd#2101), [amd#2105](amd#2105)) - **Run prompts on a cron from the terminal** — `gaia schedule add --name digest --cron "0 9 * * *" --prompt "summarize my inbox" --sink stdout`, then `gaia schedule daemon`. Schedules live in a hand-editable `~/.gaia/schedules.toml`; sinks are `stdout`, `file:<path>`, `notification`, or `telegram`. (PR [amd#1371](amd#1371)) - **Agents learn from work they repeat** — after enough successes on the same shape of goal, an agent distills the tool sequence into a reusable procedure and recalls it next time. Runs inside the existing memory pass; nothing to install. (PR [amd#1794](amd#1794)) - **Pick your model once** — `gaia config set default_model <id>` persists across `gaia chat`, `gaia llm`, and `gaia prompt`. An explicit `--model` still wins for a one-off. (PR [amd#1863](amd#1863)) - **RAG reads Word documents** — `.docx` files index like PDF and PPTX, including table cells, nested tables, content controls, hyperlinks, and textboxes, so filled-in form values get indexed. (PR [amd#1866](amd#1866)) - **A new default embedder** — the previous default cannot be loaded by current llama.cpp builds, which broke indexing, code search, and memory embedding on an up-to-date Lemonade. The default is now EmbeddingGemma 300M at the same 768 dimensions. (PRs [amd#1952](amd#1952), [amd#1761](amd#1761), [amd#1748](amd#1748)) - **The Agent Hub shows what an agent is worth** — an agent's page now carries its eval scorecard with a score badge and a code-derived capability matrix. (PRs [amd#1985](amd#1985), [amd#2020](amd#2020), [amd#2066](amd#2066)) - **Lemonade Server 10.10.0** — adds an audio-generation endpoint, lets Windows reuse system ROCm, and inhibits suspend during inference. Two upstream breaking changes are Linux-specific. (PR [amd#1969](amd#1969)) ## Bug Fixes - **`gaia init` said a working Lemonade wasn't installed** (PR [amd#1940](amd#1940)) — modern Lemonade (10.7+) dropped the `lemonade-server` CLI that GAIA probed for. - **Installing the email agent from the Hub failed on every platform** (PR [amd#2086](amd#2086)). - **Bulk triage broke on any real inbox** (PR [amd#2088](amd#2088)) — 60 emails overflowed the 16K context window; the result envelope is now condensed. - **RAG silently indexed nothing** (PR [amd#1979](amd#1979)) — a failed `sentence-transformers` import made every indexing call a no-op. - **Email bodies were truncated at 4,000 characters with no override** (PR [amd#2036](amd#2036)) — MFA codes and precise replies lost content past the cutoff. - **Long threads overflowed the model's context** (PR [amd#2076](amd#2076)). - **A disabled device was treated as usable** (PR [amd#2081](amd#2081)) — a device reporting `available: false`, such as an unpowered NPU, was misread as ready. - **A newly connected mailbox was skipped** (PR [amd#1808](amd#1808)) — mailboxes connected mid-session were not picked up. - **JSON with a `}` inside a string was dropped** (PR [amd#1824](amd#1824)). - **Outlook users were told to reconnect Google** (PR [amd#1757](amd#1757)) — `AGENT_NOT_GRANTED` named the wrong provider. - **The Agent UI hard-crashed on a recoverable GPU crash** (PR [amd#1799](amd#1799)) — it now falls back to software rendering. - **A user-edited memory could be silently downgraded and then wiped** (PR [amd#1958](amd#1958)). - **The builder agent ignored an agent name you had already given** (PR [amd#1981](amd#1981)). - **The landing and hub pages scrolled sideways on phones** (PR [amd#1959](amd#1959)). ## Known Issues - **Inbox pre-scan needs a single mailbox for now** — with both Gmail and Outlook connected, an Agent UI pre-scan errors. Disconnect one in Settings → Connectors; triage itself still spans every mailbox. ([amd#2127](amd#2127)) - **Spam detection under-flags over the REST API** — `/v1/email/triage` uses a narrow sender check rather than the model's reading. The agent's own inbox scanning is unaffected. ([amd#2124](amd#2124)) - **The email agent is beta** — treat its output as a draft to review. It never sends without your confirmation. ## Contributors - [@alexey-tyurin](https://github.com/alexey-tyurin) — skill auto-synthesis / procedural memory (PR [amd#1794](amd#1794)) - [@TravisHaa](https://github.com/TravisHaa) — the `gaia schedule` CLI and cron-based dispatch (PR [amd#1371](amd#1371)) - [@Rohithmatham12](https://github.com/Rohithmatham12) — refresh resolved email backends before multi-mailbox triage (PR [amd#1808](amd#1808)) - [@Osamaali313](https://github.com/Osamaali313) — fix `extract_json_from_text` dropping JSON containing `}` (PR [amd#1824](amd#1824)) - [@eeee2345](https://github.com/eeee2345) — offline model-endpoint guard-proxy integration guide (PR [amd#1809](amd#1809)) - [@somo9909](https://github.com/somo9909) — prerequisites section for the memory guide (PR [amd#1665](amd#1665)) ## Full Changelog **N commits** since v0.21.2: - `<sha>` — <subject> Full Changelog: [v0.21.2...v0.22.0](amd/gaia@v0.21.2...v0.22.0) ``` </details> <details> <summary>What changed in the templates</summary> - The narrative overview paragraph and the `**Why upgrade:**` block are gone — the latter restated `What's New` verbatim. - `What's New` entries are bullets, not `###` prose blocks. - Tone guidance is no longer restated in the skill; it points at CLAUDE.md § How You Communicate. - The skill's embedded example now shows the old prose block as **bad** and the bullet form as **good**. - Emoji removed from the CI prompt (it asked for 🚀 / 🎯 / 🐛 headings against the skill's own no-emoji rule). - Both generators now emit the same sections in the same order, so the file's shape no longer depends on which one ran. - The cap excludes `Bug Fixes` / `Known Issues` / `Contributors` / `Full Changelog`. Those are reference lists sized by how many fixes shipped — capping them would hide work. This was caught by regenerating v0.22.0, which overflowed a whole-file cap purely on its 14 bug-fix bullets. **Follow-up, not in this PR:** the cap lives in prompt text, so it is advisory. Making it a hard check in `util/validate_release_notes.py` would enforce it in CI. </details> ## Test plan - [ ] `python util/validate_release_notes.py <regenerated sample> --tag v0.23.0` exits 0 — passes unmodified, no validator changes in this PR - [ ] `awk '/^## (Bug Fixes|Known Issues|Contributors|Full Changelog)/{exit} {print}' <file> | wc -w` is under 350 (patch) / 600 (minor-major) - [ ] `.github/workflows/claude.yml` parses as valid YAML and its release-notes prompt contains no emoji - [ ] `.claude/skills/gaia-release/SKILL.md` is under 500 lines (498) - [ ] Both generators list the same sections in the same order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A user could edit a memory, then lose it silently. When memory discovery re-ran and its output was near-identical to a user-edited item, the dedup merge relabeled that item's
sourcefromusertodiscovery. A latergaia memory --reset— which deletes discovery-sourced items — then wiped the user's edit. After this fix, a merge never downgrades asource='user'item, so user-edited memories survive both discovery re-runs and--reset, matching the spec guarantee that user-edited memories are preserved.Closes #1957
Test plan
python -m pytest tests/unit/test_memory_store.py -xpassespython util/lint.py --allpasses (pre-existing failures ingaia.schedule.daemon/ import-validation are unrelated)source='user'item, run a discovery pass that dedups into it, thengaia memory --reset; confirm the user item is still present withsource='user'🔍 Technical details
Root cause: the dedup UPDATE in
MemoryStore.store()usedsource = COALESCE(?, source)(src/gaia/agents/base/memory_store.py:827).sourcedefaults to"tool"and is neverNULL, soCOALESCEalways took the incoming value — a discovery pass (source='discovery') merging into asource='user'item overwrote'user'with'discovery'.gaia memory --resetthen callsdelete_by_source("discovery")(src/gaia/cli.py:6308) and deleted the relabeled user item, violating the spec's "new discoveries don't overwrite user-edited memories" guarantee (AC #8).Fix: guard the merge with a SQL
CASEso asource='user'row is never downgraded:All other merge semantics (content replace,
MAX(confidence), embedding invalidation) are unchanged.Tests added (
tests/unit/test_memory_store.py, classTestDeduplication):test_dedup_never_downgrades_user_source— a discovery merge into a user item keepssource='user'.test_user_item_survives_reset_after_discovery_rerun— the end-to-end regression: re-run →delete_by_source('discovery')leaves the user item intact.Verification:
pytest tests/unit/test_memory_store.py→ 313 passed. Broadertests/unit/failures are all pre-existing and unrelated (missingfastapiextra; an_embedding_modelfixture issue intest_embedding_cache.pythat also fails onmain).Out of scope: AC #7 (short-content items dropping below the 0.80 Szymkiewicz–Simpson dedup threshold) is intentionally not addressed here. Lowering that threshold or special-casing short content risks over-merging genuinely distinct facts (e.g.
browser is Chromevsbrowser is Firefox), which needs eval-backed tuning rather than a targeted data-loss fix. This PR fixes only the HIGH-priority live data-loss path.