Skip to content

ci(test): run the hub-wheel suites and fail on unlisted file skips - #4353

Merged
kovtcharov-amd merged 29 commits into
amd:mainfrom
kovtcharov:claude/hub-wheel-skip-guard
Sep 28, 2026
Merged

kovtcharov-amd merged 29 commits into
amd:mainfrom
kovtcharov:claude/hub-wheel-skip-guard

Conversation

@kovtcharov

Copy link
Copy Markdown
Contributor

About 300 unit tests never ran in CI. Their files skip as a whole when a hub wheel (gaia_agent_chat, gaia_agent, gaia_agent_email) or an optional extra is missing. The unit lane lacks them, but it still names the files, so the lane check counted them as covered. With this PR, each file runs in a lane that installs what it needs, and a lane fails when a file skips as a whole without an allowlist entry saying which lane runs it.

Stacked on #4344. Merge #4343 and #4344 first.

  • The new guard runs inside each lane, right after install. It collects the job's own pytest commands in that lane's environment, so it sees what the lane actually runs. It reports the skipping file by name. This matters because a file that imports a skipping helper is otherwise blamed on the helper's line: test_chat_inline_web_ssrf.py was hidden that way.
  • Two moved files needed repairs to pass together. test_chat_fix_contracts.py picked up file tools leaked from earlier tests. test_chat_system_prompt_budget.py evicted the chat agent module at collection, so other files' patches stopped hitting it.
  • Two files stay allowlisted with no lane, for an owner to decide. test_profilespec_characterization.py has 11 golden rows that drifted, and its docstring says golden updates need sign-off. test_tool_loader_token_budget.py has 4 token and tool-count pins that are stale, and even re-pinned, one ratio is over budget.

Overlaps: #4350 is also stacked on #4344 and edits the offline-integration list and the allowlist, so expect a small conflict there. #4038, #3721, #3669, #3812 and #3072 touch other parts of test_unit.yml and test_gaia_agent.yml.

Test plan

  • Before: python util/check_module_skips.py --workflow test_unit.yml --job unit-tests with no module_skips entries reports 80 files skipping wholesale and exits 1
  • After: the guard exits 0 for all 7 guarded jobs, each run in a clean py3.12 venv built from that job's install step
  • python util/check_test_lane_coverage.py and python util/lint.py --test-lanes pass (31 module-skip entries verified)
  • New tests: pytest tests/unit/test_check_module_skips.py tests/unit/test_check_test_lane_coverage.py passes 64. They include a real --collect-only over a temp repo
  • Chat-lane files in the chat env: 421 passed. Before the two test repairs, 2 failed when run together
  • Flagship-lane files in the gaia env: 59 passed. test_mcp2_server.py plus the MCP transcript tests in the MCP env: 27 passed
  • Email unit lane's full command plus test_synthetic_mbox.py: 4980 passed
  • The 4 newly unskipped files in the unit job (docx, pptx, reportlab, slack): 60 passed. Full tests/unit/ in that env: 14509 passed, 23 failed. The failures are in 3 files (uninstall, CLI smoke, Lemonade ASR) that also fail when run alone. They come from this Mac's setup: GAIA_HOME isolated and gaia not on PATH. This PR changes no code those files exercise
  • actionlint is clean on the 6 edited workflows. black, isort, and pylint --errors-only are clean on the changed Python
  • Watch the MCP lane's Windows leg run test_mcp2_server.py and the guard. They were only run on macOS locally

Fixes #4206

Kalin Ovtcharov added 3 commits September 25, 2026 00:40
Nine test files no CI lane runs had been failing silently against APIs and
contracts that changed underneath them. This brings them back to green
against current main so the next change can put them in a lane.

- test_sdk.py: assert the SDK surface that exists today (process_query via
  Agent.chat, the tool registry instead of the never-public execute_tool,
  openai_server's module-level app, Agent.STATE_* class constants, current
  RAGSDK/AudioClient/KokoroTTS methods, LLMClient as an ABC); drop the
  xfail DatabaseMixin block (it ships as gaia.database.mixin) and the
  placeholder docs-exist check.
- test_multi_caller_equivalence.py: send the X-Gaia-UI header on mutating
  calls and read /api/connectors' "connectors" shape.
- test_memory_integration.py: fresh installs are schema v4.
- test_memory_api_integration.py: consolidation is 503 until a chat session
  registers a consolidator, and runs it once one has.
- test_documents_router.py: two fixtures indexed for real and needed Lemonade.
- test_tui_control_e2e.py: give the pty a size and a TERM like a terminal.
- test_ui_email_scope_consent.py: the agent now declares microsoft_work too;
  drop three tests of the in-process /v1/email mount the UI no longer has.
- test_lemonade_embedded_lifecycle.py: llamacpp:cpu has no macOS build.
- test_email_mcp_stdio_parity.py: docstring said no Lemonade; triage uses it.
- test_vlm_integration.py: deleted. A script that returned booleans instead
  of asserting, so it could not fail, and it called a removed constructor arg.

Refs amd#4205
…blocking

43 test files ran in no CI lane, so they looked green on every PR whether
they worked or not, and nothing stopped the count from growing. Now every
test file is either run by a lane or listed with the reason CI can't run it,
and lint fails the moment a new file is neither.

- test_unit.yml gains an offline-integration job for the 23 files that need
  no Lemonade, live account or AMD hardware (with Go for the TUI e2e and the
  [mcp] extra for the SDK and MCP-server tests).
- test_email_agent_unit.yml runs test_ui_email_scope_consent.py.
- util/test_lane_allowlist.yml lists the 18 that need a live Lemonade
  Server, a real Gmail account, a self-hosted model runner, npm-fetched MCP
  servers, or are hand-run scripts, each with its reason.
- util/lint.py runs check_test_lane_coverage.py as a blocking check
  (--test-lanes, and part of --all); lint.yml re-runs when the allowlist
  changes.

Fixes amd#4205
About 300 tests sat in files that skip wholesale in the unit lane, because
they importorskip a hub wheel or an optional extra that lane never installs.
The lane still named them, so they counted as covered while nothing ran
them. Now each one runs in a lane that has what it needs, and a lane fails
when a file skips wholesale without an allowlist entry naming where it runs.

- util/check_module_skips.py collects a job's own pytest commands with
  --collect-only, in the lane's own env, and fails on a whole-file skip not
  listed under module_skips in util/test_lane_allowlist.yml, or on one
  listed as run by this very lane. It runs after the install step in
  test_unit.yml (both jobs) and the chat, gaia, email, email-unit and MCP
  lanes. It records the skipping module, not the line that raised, so a
  file that imports a skipping helper is reported under its own name.
- check_test_lane_coverage.py keeps module_skips honest: each runs_in
  workflow must exist, name the path, and run the guard.
- test_chat_agent.yml runs 9 chat-wheel files plus 7 with per-test chat
  skips; test_gaia_agent.yml runs 4 flagship-wheel files;
  test_email_agent_unit.yml runs test_synthetic_mbox.py;
  test_agent_mcp_server.yml runs test_mcp2_server.py. The unit job installs
  python-docx, python-pptx, reportlab and slack-sdk, so 4 more files run
  there.
- test_chat_fix_contracts.py: clear the global tool registry, so a file
  tool leaked from an earlier test no longer adds a scratch-dir root.
- test_chat_system_prompt_budget.py: evict only modules it imported under
  its dependency stubs. Evicting gaia_agent_chat.agent unconditionally
  orphaned the ChatAgent class other test modules held, so their patches
  missed.
- Two files stay allowlisted with no lane: their goldens and token pins
  have drifted, and fixing them needs an owner's call.

Fixes amd#4206
@github-actions github-actions Bot added documentation Documentation changes devops DevOps/infrastructure changes tests Test changes labels Sep 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Approve with suggestions

This closes a real blind spot: ~300 unit tests were being counted as "covered" by CI while silently skipping as a whole because the lane never installed the wheel they need. The new guard runs inside each lane, after install, and fails when a file skips with nothing in the allowlist saying which lane actually runs it. The design is sound, the failure messages are actionable, and the new guard has genuine tests behind it — including a real collection run over a temp repo rather than a stub.

Two things worth fixing before or just after merge:

  • The new TUI end-to-end test won't run when the TUI changes. It only lives in the Offline Integration job, and that workflow isn't triggered by changes under the Go TUI directory — so a TUI-only PR gets a green board without ever running the test that drives the TUI. That's the same "looks green, never ran" shape this PR exists to fix, one level up. Adding the TUI directory to the workflow's path filters closes it.
  • Two known-broken suites are now permanently allowlisted with no tracking issue. Both entries say fixing them needs an owner's decision, which is fair, but nothing in the repo now drives that decision — the allowlist comment header used to warn against exactly this. A referenced issue number in each entry would keep the debt visible.

Neither blocks merge; both are one-line follow-ups.

Real-world evidence

No evidence-bundle.md was produced for this PR. The change touches CI workflows, tests, tooling and docs — none of the surfaces (Agent UI, MCP, gaia CLI, REST) that call for a screenshot or a live request — so that's expected, and the verdict rests on static review plus the checks below, which I ran in this checkout:

$ python util/check_test_lane_coverage.py
[OK] 851 test file(s) across 7 root(s) are all named by a lane or allowlisted
     (78 workflow file(s) scanned, 18 allowlisted, 31 module-skip entr(ies) verified).

$ python util/lint.py --test-lanes
| Test Lane Coverage             | [OK] PASS  | -         |
[SUCCESS] ALL QUALITY CHECKS PASSED!

$ python util/check_module_skips.py --workflow test_unit.yml --job nope
[!] test_unit.yml/nope: test_unit.yml: no job `nope`
    (jobs: offline-integration, unit-tests, unit-tests-macos, unit-tests-windows)

The new lint flag and the allowlist consistency check both pass here, and the guard's argument validation fails loudly as designed. The in-lane behaviour of the guard itself (a real --collect-only in an environment with the hub wheels installed) can't be exercised on this runner — the PR's test plan reports those runs, and CI on this PR is the thing that confirms them.

🔍 Technical details

Issues

🟡 The TUI e2e test is gated on the wrong paths (.github/workflows/test_unit.yml:15-36, :39-61)

tests/integration/test_tui_control_e2e.py is named only by the new offline-integration job (test_unit.yml:325), and test_unit.yml has no workflow_call consumer, so its paths: filters are the only trigger. Those filters cover src/**, tests/**, util/check_*, installer/tui/** and docs — but not tui/**. A PR that only edits Go under tui/ will not run the test that builds and drives the TUI. check_test_lane_coverage.py can't see this, because "named by a lane" says nothing about whether the lane is triggered.

      - 'installer/tui/**'
      # tests/integration/test_tui_control_e2e.py builds and drives the real
      # Go TUI, so a TUI-only change must run the offline-integration job.
      - 'tui/**'

(apply to both the push: and pull_request: blocks)

🟡 Known-broken suites allowlisted without a tracking issue (util/test_lane_allowlist.yml:118-134, and :44, :45)

The two module_skips groups with no runs_in both open "Broken, and fixing it needs an owner's decision" and describe concrete drift (11/17 golden rows, 4 stale token pins with one ratio over budget). Same for tests/mcp/test_mcp_cli_to_agent_workflow.py, whose reason says it "still asserts the pre-#977 gaia mcp add config flow, which fails today". The reasons are honest and well-written, but there's no issue reference, so nothing schedules the owner decision and the entries will read the same in a year. The file's own header warns that filling the allowlist wholesale risks "recording that debt as a decision". Suggest appending (#NNNN) to each of these reasons once issues are filed.

Nits

🟢 The runs_in guard check is workflow-granular, not job-granular (util/check_test_lane_coverage.py:524-527)

module_skip_errors sets guarded from any run: block in the whole workflow, and lane_paths_in_script likewise aggregates across jobs. So an entry whose file is only run by a job that doesn't invoke the guard (say unit-tests-macos) still passes, while the guard itself is invoked per --job. Fine for today's allowlist; worth narrowing to the job that names the path, or noting the limitation in the docstring alongside the existing "scope and limits" list.

🟢 test_chat_system_prompt_budget.py is now order-dependent in the other direction (tests/unit/test_chat_system_prompt_budget.py:59, :79)

Keeping gaia_agent_chat.agent in sys.modules when it was already imported is the right call for the whole-lane run, but it means this file's assertions now run against the real-dependency module or the stub-bound one depending on collection order — running the file alone and running it in the lane exercise different objects. Worth a one-line comment saying that's accepted, so nobody "fixes" it back.

🟢 Two SDK tests now assert the same two things (tests/test_sdk.py:59, :696)

test_agent_with_mocked_llm and test_agent_process_query_interface both end in isinstance(result, dict) + send_messages.called. The former previously aimed at the tool-dispatch round trip (its old mock returned a {"tool": ...} payload); that path is now uncovered. Repairing it to actually run was the right move — consider having one of them stub a tool call so the class's stated purpose survives.

🟢 The guard's collection doesn't reproduce the step's env: (util/check_module_skips.py:105)

collect_skips inherits the process environment but the lane's pytest steps set GAIA_MEMORY_DISABLED: "1" (and others) at step level. Nothing in the tree collection-skips on those today, so this is latent, not a bug — but the module docstring's "Scope and limits" note would be a good home for it.

🟢 Skip-count mismatch between the docstring and the PR (util/check_module_skips.py:9)

The docstring says "#4206 found ~214 tests that no lane had actually run"; the PR description says "About 300 unit tests". One of the two numbers is stale.

Strengths

  • The guard tests the thing that's hard to test. tests/unit/test_check_module_skips.py runs a real pytest --collect-only over an ephemeral repo instead of stubbing the subprocess — including the test_chat_inline_web_ssrf case where an importer of a skipping helper was being blamed on the helper's line. That's exactly the "mocks prove we called it, not that the call is valid" trap CLAUDE.md calls out, avoided deliberately.
  • Fail-loudly throughout. Unparseable YAML, an unknown job, a job with no pytest command, an unresolvable test path, a missing plugin report and a non-(0,5) pytest exit all raise with context rather than degrading to a pass. _OK_EXIT_CODES = (0, 5) is correctly narrow — a bad path still exits 4 and fails.
  • The two closed loops are the good part of the design. The in-lane guard catches a skip; check_test_lane_coverage keeps the allowlist honest by requiring each runs_in workflow to exist, name the path, and run the guard. Neither half can be satisfied by a stale entry alone.
  • The allowlist reasons are genuinely useful prose — each one names what's missing (a hub wheel, an extra, a live server, a real account) rather than just asserting the exclusion.

kovtcharov added a commit to kovtcharov/gaia that referenced this pull request Sep 25, 2026
…3707)

Typing during an answer was starved and Enter mid-turn could not
actually send, so a correction to a five-minute task ("actually, only
the unread ones") arrived after the work it was meant to redirect. The
composer now stays responsive while text streams, and Enter hands the
message to the turn *already running* — the agent folds it in at its
next step boundary and answers it alongside what it was doing. Nothing
is interrupted and no second turn starts.

Three independent causes, all fixed here:

- **Typing was starved, not blocked.** Every streamed token rebuilt the
whole transcript, and Bubble Tea runs `Update` on one goroutine — so
that work and your keystrokes shared a queue. Tokens now coalesce onto
the repaint tick that already runs ten times a second.
- **Enter only parked the message locally** until the turn ended. It now
POSTs to the running turn via a new route (contract **2.15**), which the
daemon relays as-is.
- **A one-step turn accepted the message and threw it away.** The queue
was drained only at the top of each agent-loop iteration, so a turn that
formed its answer in a single step — the commonest shape — had nothing
left to pick up what you typed during it. The route had already returned
`delivered: true` and the transcript already showed it. The loop now
looks again once the answer is formed and takes one more step when
something arrived.

Delivery is never assumed: the transcript line appears only once the
sidecar has the message, a refusal says why and puts the text back, and
a peer below 2.15 keeps today's queue and is named along with the
command to update it.

Two notes for the reviewer:

- The text is **labelled as arriving mid-task** before it reaches the
model. Unlabelled, a user message landing in the middle of a tool
sequence is indistinguishable from a new request and the model abandons
the work already done.
- Type-ahead beside the **tool-permission modal** was considered and
deliberately left out. Its answers are the single letters `y`/`n`/`a`,
so letting prose through would let "check the c**a**lendar too" approve
a destructive tool call. Doing it safely needs a focus model on a
documented security control — its own PR.

## Test plan

- [x] `cd tui && go vet ./... && go test ./... -race -count=1` — passes,
including the `tui/test` integration package
- [x] `pytest tests/unit/agents/ hub/agents/gaia/python/tests/ -q` —
1887 passed, 53 skipped
- [x] `python util/lint.py --black --isort`
- [x] Live against a real model (Gemma-4-E4B on a Strix Halo GPU,
sidecar built from this branch): `POST /v1/gaia/query/{run_id}/followup`
mid-stream returns `200 {"delivered":true}`, the stream shows `Picked up
your follow-up: …`, the turn takes a second step, and the answer obeys
the correction. Same run on the pre-fix commit never picks it up and
ignores the correction — see the evidence comment below.
- [x] Live: a follow-up for a run that is not in flight is a loud `404`
naming what to do instead, not a quiet accept
- [ ] Live in the TUI: type through the streaming answer (keystrokes
keep up), press Enter, and confirm the row reads `⏎ sends to the running
turn` — the route path above is verified end-to-end; the keystroke path
is still covered only by `tui/internal/ui/chat` tests
- [ ] Live against a pre-2.15 sidecar: Enter still queues, and the
notice names the version floor and `gaia hub uninstall/install gaia`

> `Unit Tests (Windows smoke)` is red here and on unrelated open PRs
(amd#4359, amd#4353) — a pre-existing `main` failure in a Windows symlink
test, not this branch.

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: Ovtcharov <[email protected]>
Co-authored-by: Tomasz Iniewicz <[email protected]>
Main moved a long way under this branch. Conflict resolutions:

- test_unit.yml / test_lane_allowlist.yml: main fixed
  tests/mcp/test_mcp_cli_to_agent_workflow.py and test_mcp_sdk_integration.py
  and now runs them in offline-integration, so their allowlist entries are
  dropped and main's run-list wins. This branch's module_skips section and
  its in-lane guard step are kept -- they are the point of the PR.
- util/lint.py, docs/reference/dev.mdx: main's new --tool-descriptions check
  kept alongside this branch's module_skips documentation.
- tests/integration/test_tui_control_e2e.py: main's CLICOLOR_FORCE fix, which
  is what this branch's CI run was failing on.
- tests/integration/test_memory_integration.py: main's schema bump 4 -> 5.

Also closes the two review findings:

- tui/** added to both path-filter blocks of test_unit.yml. The offline
  integration job owns the TUI end-to-end test, but the workflow was not
  triggered by changes under tui/ -- a TUI-only PR went green without ever
  running the test that drives the TUI. That is the same "looks green, never
  ran" shape this PR exists to fix, one level up.
- The two no-lane allowlist groups now reference amd#4390 and amd#4391, so the
  owner decisions they are waiting on are actually tracked.

One extra fix the guard itself demanded: tests/integration/test_files_search_budget.py
(added by amd#4354) is run by no lane, which fails check_test_lane_coverage.py on
main today. This PR makes that check blocking, so the file is wired into
offline-integration beside test_files_router.py, which shares its dependencies.
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Resynced with main and closed both review findings. The two CI failures on the last run were fixed by main, not by anything here — and the guard caught one genuine new gap while I was at it.

Both of your points are done: the TUI test now runs when the TUI changes, and the two parked suites have tracking issues (#4390, #4391) so the owner decisions they're waiting on are actually scheduled rather than frozen in a comment.

The gap the guard found

tests/integration/test_files_search_budget.py, added by #4354, is run by no lane — check_test_lane_coverage.py fails on main today because of it. This PR makes that check blocking, so it had to be resolved here: it's wired into offline-integration beside test_files_router.py, which shares its dependencies. Exactly the class of miss the PR exists to stop, caught by the PR's own tooling on its first real contact with main.

🔍 Technical details

Previous CI failures — both fixed on main, not by me

  • test_tui_control_e2e.py::test_keys_and_screen_round_trip — "ansi format stripped the escapes". Main's fix sets CLICOLOR_FORCE=1 and clears NO_COLOR/CLICOLOR, because termenv calls any environment with CI set "not a TTY" and drops lipgloss to the Ascii profile. Came in with the merge.
  • test_memory_api_integration.py::test_list_knowledge_time_params_accepted — assert 422 == 200. Also resolved by main.
  • The Windows smoke failure was test_toctou.py::test_safe_open_rejects_symlinked_directory_escape. Main carries that fix (squashed into fix(lemonade): find GAIA's own server everywhere, not the default port #4309, which is why the commits don't appear by SHA), so it clears on resync.

Merge resolutions

Main moved a long way under this branch — 7 conflicted files.

  • test_unit.yml + test_lane_allowlist.yml — the one that needed judgement rather than a side. Main fixed tests/mcp/test_mcp_cli_to_agent_workflow.py and test_mcp_sdk_integration.py and now runs them in offline-integration, while this branch still allowlisted them as broken. Took main: both allowlist entries dropped, both files kept in the run list. This branch's module_skips section and its in-lane guard step are kept — those are the PR.
  • test_email_agent_unit.yml — kept this branch's tests/unit/test_synthetic_mbox.py in the run list and its summary line, because the allowlist pins that lane as the one that runs it. Dropping it would have made the allowlist self-contradictory.
  • util/lint.py (4 hunks) + docs/reference/dev.mdx — main's new --tool-descriptions check kept alongside this branch's module_skips documentation. Independent additions.
  • test_tui_control_e2e.py — main's CLICOLOR_FORCE fix.
  • test_memory_integration.py — main's schema bump 4 → 5.

Findings

🟡 TUI e2e gated on the wrong paths — tui/** added to both the push: and pull_request: path filters, with the reason inline. Verified through the parsed YAML, not just the text.

🟡 No-lane allowlist entries had no tracking issue — filed #4390 (ProfileSpec goldens: 11/17 failing, and the file's own docstring says a golden update needs sign-off) and #4391 (doc profile at 38 tools / 6498 tokens against pins of 37 / 5128, with the worst-case loaded set over its 65% ratio even of the new total, so re-pinning alone wouldn't pass). Both reasons now end Tracked in #NNNN.

Verification

$ python util/check_test_lane_coverage.py
[OK] 918 test file(s) across 7 root(s) are all named by a lane or allowlisted
     (79 workflow file(s) scanned, 18 allowlisted, 31 module-skip entr(ies) verified).

$ python util/lint.py --test-lanes
| Test Lane Coverage             | [OK] PASS  | -         |
[SUCCESS] ALL QUALITY CHECKS PASSED!

pytest tests/unit/test_check_module_skips.py tests/unit/test_check_test_lane_coverage.py → 64 passed. actionlint clean on both edited workflows; all three YAML files parse; every touched Python file AST-parses. python util/lint.py --black --isort clean. No conflict markers in the tree.

I also ran the guard itself against the unit lane. It reports one file — tests/unit/messaging/test_slack_sdk_contract.py — but that is my box, not the lane: slack-sdk isn't installed here, and test_unit.yml:128 installs it. The guard is meant to run inside the lane's own environment, so this is the expected local-vs-lane difference rather than a finding.

Still open

The last test-plan box — watching the MCP lane's Windows leg run test_mcp2_server.py and the guard — can only be checked off by a CI run on this PR. Worth a look at the board before merging.

kovtcharov and others added 2 commits September 26, 2026 07:29
…kend (amd#4345)

The Agent UI's TypeScript API types are written by hand, and nothing
checked them against what the backend actually sends. Five had already
drifted: settings were missing the agent mode, system status was missing
the active profile, schedules were missing their parsed config, and
three fields were typed as never-null although the backend sends null.
Now CI fails and names the field whenever a hand-written type and the
backend disagree, and those five types are fixed. Nothing changes for
users; no UI code read the missing fields yet.

This is the type-generation half of amd#4246. It also covers amd#3327's
"snapshot the schema" and "check the TS types agree" items, but not its
route `response_model` and conformance-test items.

## Test plan

- [x] `python -m pytest tests/unit/chat/ui/test_export_openapi.py
tests/unit/chat/ui/test_models.py tests/unit/chat/ui/test_server.py
tests/unit/test_webui_agent_info_contract.py -q`: 170 passed
- [x] `python -m gaia.ui.export_openapi --check` exits 0, also from
another working directory with different env
- [x] `cd src/gaia/apps/webui && npx tsc --noEmit`: clean. With `main`'s
`types/index.ts` restored it fails five times, naming `agent_mode`,
`active_profile`, `schedule_config`, `mail_provider`, `extension`
- [x] `cd src/gaia/apps/webui && npm test`: 400 passed. Deleting one
line from `api.gen.ts` fails the new generation test and `node
scripts/gen-api-types.mjs --check`
- [x] `npm run build` succeeds
- [x] black, isort, pylint clean on the new Python files
- [ ] CI: the Agent UI Vitest job's new Type-check step passes

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

**The pipeline:** `python -m gaia.ui.export_openapi` writes
`src/types/api.schemas.json` from `create_app(":memory:").openapi()`,
then `npm run gen:api-types` writes `src/types/api.gen.ts`. Each step
has a stale check: a pytest test for the JSON and a Vitest test for the
TS. `src/types/apiContract.ts` then compares 18 hand-written wire types
with their generated counterparts at compile time. It flags backend
fields missing from TS, TS fields never sent, and kind mismatches
(string/number/boolean/null/array/object). It also has a self-test so it
can't pass vacuously. `tsc` runs in the PyPI build on every PR, and now
in the Agent UI Vitest job too.

**Why not openapi-typescript:** it has a peer dependency on
`typescript@^5` and uses the TS 5 compiler API. The Agent UI is on
TypeScript 7, the native port, which has no JS API, so npm refuses the
install. Its 6.x line has no TS dependency but pulls a vulnerable
`undici`. `[email protected]` is pinned exact and adds no
new `npm audit` findings (still 6, all pre-existing). The lockfile was
written with npm 11 to keep its `libc` fields.

**Only the component schemas are snapshotted, not the full OpenAPI
doc.** Route docstring edits don't cause regenerations, since the types
don't depend on them.

**AgentInfo's 14 "TS-only" fields aren't drift.** They're Hub catalog
fields from `merge_with_registry`, and
`tests/unit/test_webui_agent_info_contract.py` (amd#3846) already checks
each one against its emitter. The contract allowlists exactly those 14.

**Not covered:** camelCase view models (`Message`, `AgentStep`,
`CommandOutput`), and TS types whose routes have no `response_model`
(tunnel, MCP, connectors). The latter are amd#3327's remaining work.

**Things to know:**
- CI installs unpinned `fastapi`/`pydantic`, as the email agent's
`export_openapi --check` already does. The committed snapshot matches
the current latest (fastapi 0.141.1, pydantic 2.13.5), but a future
release that changes schema output would need a regenerate.
- A dependabot bump of `json-schema-to-typescript` or its `prettier`
dependency may need `npm run gen:api-types` run on its PR.

**Overlap:**
- amd#4325 removes `SystemStatus.device_supported` from the backend and TS.
Whichever of the two PRs merges second must rerun the two regenerate
commands. The fixture edits touch separate hunks.
- Other open PRs that edit pydantic models in `src/gaia/ui/` need the
same regenerate after this lands.
- amd#4186 and amd#4340 don't touch these files.
</details>

Part of amd#4246

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
The guard failed on its own first CI run, on files this branch had never
seen. Main added test_registry.py, test_inference_location.py,
test_skill_tools_same_turn.py and test_tool_admission_order.py, which all
importorskip("gaia_agent_chat"), plus test_mcp_bridge_protocol.py which
needs mcp.types. The unit lane installs neither, so all five skip
wholesale there while check_test_lane_coverage.py still counted them as
covered -- exactly the hole this PR exists to close.

They are now listed under module_skips against the lane that installs
what they need, and that lane actually runs them: the three unnamed chat
files are added to test_chat_agent.yml's run list and both of its path
filters, and test_mcp_bridge_protocol.py to test_agent_mcp_server.yml's.
test_registry.py was already run by the chat lane and only needed the
allowlist entry.

Worth noting for anyone reproducing: none of this reproduces on a dev box
with the chat wheel and [mcp] installed -- the files do not skip there, so
the guard is green locally and red in the lane. check_test_lane_coverage.py
is the check that catches it either way, and it now verifies 36 module-skip
entries.
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Follow-up: the guard failed on its own first CI run — and it was right. Fixed and pushed.

Main added five test files that skip wholesale in the unit lane: four that need the chat wheel (test_registry.py, test_inference_location.py, test_skill_tools_same_turn.py, test_tool_admission_order.py) and one that needs mcp.types (test_mcp_bridge_protocol.py). The unit lane installs neither, so none of their tests were running while the coverage check still counted them as covered. That is precisely the hole this PR exists to close, so the guard catching it on contact with main is the system working.

One thing worth knowing for anyone reproducing this: it does not reproduce on a dev box. With the chat wheel and [mcp] installed locally, those files don't skip, so the guard is green on a laptop and red in the lane. check_test_lane_coverage.py is the half that catches it either way.

🔍 Technical details

The failing step was Check no test file skips wholesale in test_unit.yml/unit-tests (job 108360537848 — the only failed step on that run).

Each file is now in module_skips against the lane that installs what it needs, and that lane actually runs it — both halves, or check_test_lane_coverage.py rejects the entry as stale:

  • tests/unit/test_inference_location.py, test_skill_tools_same_turn.py, test_tool_admission_order.py → added to test_chat_agent.yml's pytest run list and both of its path-filter blocks.
  • tests/unit/agents/test_registry.py → already run by the chat lane, so it only needed the allowlist entry.
  • tests/unit/test_mcp_bridge_protocol.py → added to test_agent_mcp_server.yml's run list.

The checker proved that for me on the first attempt, which is a good sign for the design — an initial pass that only added allowlist entries came back with:

[!] 2 `module_skips` entr(ies) in test_lane_allowlist.yml are stale. Fix the entry or the lane:
    - tests/unit/test_skill_tools_same_turn.py: `test_chat_agent.yml` does not run it
    - tests/unit/test_tool_admission_order.py: `test_chat_agent.yml` does not run it

After wiring:

$ python util/check_test_lane_coverage.py
[OK] 918 test file(s) across 7 root(s) are all named by a lane or allowlisted
     (79 workflow file(s) scanned, 18 allowlisted, 36 module-skip entr(ies) verified).

actionlint clean on all four edited workflows; all parse as YAML. pytest tests/unit/test_check_module_skips.py tests/unit/test_check_test_lane_coverage.py → 64 passed. python util/lint.py --black --isort clean.

The unit-lane guard now reports only tests/unit/messaging/test_slack_sdk_contract.py, which is my box rather than the lane — slack-sdk isn't installed here and test_unit.yml:128 installs it.

kovtcharov-amd and others added 12 commits September 26, 2026 00:45
Main's Code Quality (Lint) job has been red since 2e0b6ab: two stale
sys re-imports in gaia.ui.server, an f-string with no interpolation in
gaia.ui.utils, and tests/integration/test_files_search_budget.py running
under no CI lane (test_lane_allowlist.yml only exempts files that
genuinely can't run in CI; this one is fully offline).
… homepage (amd#4382)

## Summary

The homepage stopped its argument at "here's how to install it" —
nothing on the page showed a visitor that the project has real traction
or ships often. This adds a stats row (GitHub stars/forks, release
downloads, release count, npm downloads) and a release stream with
relative-date badges ("Today" / "N days ago"), both placed directly
under the install button.

Numbers are fetched live at build time and labeled honestly: "GitHub
release downloads", not a bare "downloads" — the site's own install
button actually downloads from a Cloudflare R2 bucket with zero tracking
today, so a number implying "everyone who's ever installed GAIA" would
overclaim. The real all-source download/traffic dashboard is scoped
separately in `docs/plans/website-admin-dashboard.md` rather than folded
into this PR.

## Test plan

- [ ] `cd website && npm test` — 109 tests pass, including 17 new tests
in `src/data/github.test.ts`
- [ ] `cd website && HUB_CATALOG_URL=https://hub.amd-gaia.ai npm run
build` — type-checks and builds clean
- [ ] `cd website && HUB_CATALOG_URL=https://hub.amd-gaia.ai npm run
dev`, visit `/`, confirm the stats row and release stream render under
the install button in both light and dark theme
`docs/reference/eval.mdx` spent ~1,400 lines walking through `gaia
generate`, `groundtruth`, `batch-experiment`, `visualize`, and
`create-template` — every one removed from the CLI in v0.18 — before the
eval commands that actually exist. A reader following the page from the
top hits a dead command in the Quick Start, and the deprecation banner
asked them to read past all of it to reach the parts that still work.

The page now leads with the three live commands (`gaia eval sessions`,
`gaia eval agent`, `gaia eval tasks`) and keeps only the sections
describing running code: session replay, the agent eval benchmark
pointer, and the flagship task gate. Deleted content is in git history.

Overlaps open PR amd#3812 ("docs(core): retire legacy plans and refresh
harness and TUI docs"), which only swaps `lemonade-server serve` → `gaia
init` on this page and doesn't touch the legacy sections this PR
removes.

## Test plan
- [x] `python util/check_doc_links.py --internal-only` — 1012/1012 OK
- [x] `pytest tests/unit/test_doc_code_validation.py
tests/unit/test_check_doc_links.py -q` — 58 passed
- [x] Verified live subcommands against `gaia eval` subparsers in
`src/gaia/cli.py` (`agent`, `benchmark`, `sessions`, `code`, `tasks`)

Fixes amd#4247

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
`gaia talk` heard itself: the microphone stayed live while it spoke, so
its own voice came back as the next request. It also accepted `--model`,
`--max-tokens`, `--use-claude`, `--use-chatgpt`, `--claude-model`,
`--base-url` and `--stats`, then ran without them. Now capture pauses
for the whole of playback and every flag reaches the component that uses
it.

Outside voice, an Agent UI chat turn could hang forever on an `input()`
prompt printed to the server's own terminal — a server-side console now
never prompts, while the CLI still does — and `import gaia` crashed in
any process without a resolvable home directory. Also fixes the wrong
port in `.env.example` and a length mismatch that could misalign RAG
chunks with their embeddings.

Fixes amd#124

## Test plan

- [ ] `python -m pytest tests/unit/test_audio_recorder_sd.py
tests/unit/test_cli_talk_flags.py
tests/unit/test_logger_home_unresolvable.py
tests/unit/test_rag_encode_alignment.py tests/unit/test_talk_config.py
tests/unit/test_talk_playback_mute.py
tests/unit/test_ui_no_stdin_prompts.py` — 63 passed; the two of these
files that exist on `main` pass 16/16 there
- [ ] `python -m pytest hub/agents/chat/python/tests` — 14 passed in
1.70s
- [ ] The `ChatAgent` wiring test fails if the validator's
`interactive_check` hook is removed — checked by removing it
- [ ] `gaia talk --help` lists every flag, and `gaia talk --use-chatgpt`
refuses and exits 1
- [ ] `import gaia` in a subprocess with the home-directory variables
removed succeeds
- [ ] With a real microphone and speaker: talk over playback and confirm
it is not transcribed (not run on the author's machine)
- [ ] Agent UI started from a terminal: a turn that needs a path outside
the allowlist is denied without prompting the server's stdin (not run
end to end)

---------

Co-authored-by: Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
…md#4186)

The website, the Agent UI, and the terminal each carried their own
palette, so GAIA's copper appeared as three near-but-unequal golds and
the same assistant looked like three products. All three now implement
one set of colour roles from one set of literals, and each surface has a
test that fails when a component writes a hex inline instead of asking
for a role. `docs/spec/gaia-design-language.mdx` is the source of truth
for what the roles are, what contrast each owes the reader, and why the
light copper is not a darkening of the dark one.

Implements milestone 0 of the redesign plan in amd#3803, plus the theming
half of milestone 5. The shell simplification (milestone 2) stacks on
top of this in a follow-up.

## What it looks like

The welcome headline used to keep a cursor blinking at a sentence
nothing was writing to — the first thing every new user saw. The chat
transcript had the same defect. Both now go quiet the moment the text
stops.

| Before | After |
| --- | --- |
| ![Welcome headline with a cursor still blinking after the subtitle
finished](https://raw.githubusercontent.com/amd/gaia/7aeb753343094ff46dfaf4fa7140336b558dbad3/evidence/02_agentui_light.png)
| ![Same headline, settled, no
cursor](https://raw.githubusercontent.com/amd/gaia/kalin/ui-design-language-evidence/evidence/02_agentui_light.png)
|
| ![Chat answer ending in a blinking cursor after the turn
completed](https://raw.githubusercontent.com/amd/gaia/kalin/ui-design-language-evidence/evidence/03a_chat_light_before.png)
| ![Same answer, settled, no
cursor](https://raw.githubusercontent.com/amd/gaia/kalin/ui-design-language-evidence/evidence/03_chat_light.png)
|

Dark mode on the same palette — copper is the only accent; green and
amber appear solely as status, never decoration:

![Agent UI welcome screen in dark
mode](https://raw.githubusercontent.com/amd/gaia/kalin/ui-design-language-evidence/evidence/01_agentui_dark.png)

![Dark chat transcript with tool-call
results](https://raw.githubusercontent.com/amd/gaia/kalin/ui-design-language-evidence/evidence/04_chat_dark.png)

The agent-picker grid under the headline is the surface milestone 2
removes — the shell is being rebuilt around the flagship agent, not a
hub of them.

## The other threads

- **The website now offers both downloads.** It advertised the desktop
app only, so the terminal build — which ships six platform targets to
the desktop's three — was invisible to anyone who did not already know
it existed. Both are presented side by side, and asymmetric platform
coverage raises an actionable error instead of rendering an empty card.
- **Three controls had no visible keyboard focus at all**, light-theme
status badges read below 4.5:1, and picking an agent then clicking a
welcome chip quietly opened a session on a different one. All three
shipped green because the guards meant to catch them each matched
exactly one spelling of the mistake.

## Two design calls worth a second opinion

Both change what users see, so please push back if you disagree rather
than let them ride in:

- **Tools in the activity list no longer have their own colours.**
Green, amber, red, and blue carry status meaning, so they are not
available for decoration — keeping the per-tool table meant a green tool
badge sitting directly beside a red failure icon in the same row. Tools
are now told apart by their icon.
- **The animated starfield and constellation backgrounds on the website
are gone.** The design language rules out decorative motion; nothing
else referenced them.
- **Inline code keeps the accent in the terminal renderer.** A code span
is a different kind of token rather than a louder one, and the accent is
what makes it findable — but a paragraph with six `` `flags` `` in it
does speckle, so it is worth a second read.

## What catches the next regression

Guards, each written because a real defect got past the previous one:
token contrast per surface in both themes, no colour literal outside the
token file, and call-site pairing — the fg/bg pair a component actually
ships is measured, not just the pairing the tokens intended. That last
one matters most: token-level assertions rated a hover state fine that
shipped at 4.15:1.

**Two of these guards were green while broken**, and neither was found
by reading them. A focus-ring regex backtracked to zero width, so
`outline: none` counted as "paints an outline"; an Electron assertion
matched a type annotation instead of the default it was pinning. Every
guard here is now mutation-proven — the mistake it exists to reject is
re-injected and observed to fail it. That is the argument for the
mutation step, not a footnote to it.

## Known non-conformance

`--accent` on `--bg-active` reads 4.15:1 against a 4.5 floor, and is
excluded deliberately. The copper is pinned across all three surfaces,
and lightening the active surface enough to clear the floor pushes it
past `--bg-hover`, inverting the depth ramp. It needs a cross-surface
accent decision, which is larger than this PR.

## Test plan

- [x] `cd src/gaia/apps/webui && npx vitest run` — 637 pass, 59 files
- [x] `cd src/gaia/apps/webui && npx tsc --noEmit` — clean
- [x] `cd src/gaia/apps/webui && npm run build` — clean
- [x] `cd tests/electron && npx jest test_electron_chat_app.js` — 196
pass
- [x] `cd website && npx vitest run` — 213 pass
- [x] `cd website && npx astro check` — 0 errors, 0 warnings
- [x] `cd website && HUB_CATALOG_URL=https://hub.amd-gaia.ai npm run
build` — completes (needs network; the build has no fixture fallback by
design. Behind a TLS-inspecting proxy add
`NODE_OPTIONS=--use-system-ca`.)
- [x] `cd tui && go vet ./... && go test -count=1 ./internal/ui/...` —
clean, all packages pass
- [x] `python util/check_doc_links.py` — 2496 links, 0 broken
- [x] Toggle light/dark in the Agent UI and on the website; confirm code
panels stay dark in both and the `>` prompt, focus ring, and primary
button are the only coloured things on screen
- [x] Tab through the file browser, activity filters, and update chip in
both themes; every control shows a ring

`Test Agent SDK on Windows (Lemonade Integration)` is red here for
amd#4281, a self-hosted-runner bug unrelated to this PR — a leftover state
file points the tests at a dead port. It fails the same way on unrelated
branches and is fixed by amd#4284.

---------

Co-authored-by: f <f@f>
GAIA needed you to run `lemonade-server serve` before anything worked —
a command Lemonade removed in 10.7, so on any current install it fails
with "command not found" and the user is left with no path forward. Now
the daemon starts the local model server itself, supervises it as a
child, and reaps it on shutdown. Launch the TUI, or run `gaia chat` /
`gaia llm`, on a machine with nothing running: it comes up working, with
nothing typed.

The daemon owning the process is what makes "one server per machine"
real rather than a race that usually works. Front-ends ask over the
authenticated loopback channel they already use (`POST
/daemon/v1/lemonade/start`, host API 1.2); nothing else spawns a server.
A server the daemon did *not* start — one launched from the tray — is
attached to and left running, including when the daemon stops.

Failures stay loud: not installed, port held by something else, the
server died on launch, the daemon unreachable — each names what failed,
what to do, and where to look. Nothing degrades quietly to "no LLM".

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

- `LemonadeSupervisor` (`src/gaia/llm/lemonade_supervisor.py`) probes,
starts the server in its own process group, polls `/health`, and
tree-kills on shutdown — tree-kill because Lemonade spawns
`llama-server` children, and an orphan still holds the port and the GPU
memory the next start needs. No new locking scheme: the daemon is
already single-instance, so its in-process lock is the whole story.
- `ensure_lemonade_running` (`src/gaia/llm/lemonade_service.py`) is the
one verb. Inside the daemon it uses the supervisor directly; everywhere
else it start-or-attaches the daemon and asks.
- Launch resolution is unchanged and untouched: everything goes through
`resolve_lemonade()` / `build_start_command()` and treats
`StartSpec(argv, env)` as opaque. The embeddable `lemond ./ --port N`
form (PR amd#3117) takes a working directory and port the others do not, so
nothing here inspects or rebuilds argv — bundled-lemond support arrives
behind the same seam for free.
- `LemonadeClient.health_check` gained an optional `timeout`. The client
default (900s) is right for generation and catastrophic for a liveness
probe: a socket that accepts and never answers would block one for 15
minutes.
- The stale-command sweep covers runtime messages (`readiness.py`, the
email sidecar's `/init` and `/query`, the playground), hub agent docs,
and ~45 doc-site pages. `--ctx-size` went with it — GAIA pins the window
per device profile, so telling a user to set one is wrong advice that
looks like it works.

Not in scope, worth a follow-up: `gaia init` still starts a server
directly (`installer/init_command.py`), so it can leave an unsupervised
one the daemon will attach to and never reap.
</details>

## Test plan

- [x] Cold start, nothing running: `gaia daemon stop && taskkill /F /IM
LemonadeServer.exe && rm ~/.gaia/host/instance.json`, then `gaia llm
"..."` — answers, having started the daemon and the server itself.
- [x] Cold start through the TUI's readiness gate: `gaia-tui run email
--query "..."` from a stopped server — answers; daemon log shows
`lemonade: starting supervised server` then `lemonade_routes.start`.
- [x] Go client against a live daemon: cold 9.8s, warm 26ms (one probe).
- [x] `gaia daemon stop` reaps the server it started; a tray-launched
server survives it (`/daemon/v1/lemonade/status` reports `supervised:
false`).
- [x] Daemon boot alone does not start a server — it is on demand.
- [x] `python -m pytest tests/unit/test_lemonade_{supervisor,service}.py
tests/unit/test_daemon_lemonade_routes.py
tests/unit/test_lemonade_manager_autostart.py` — 40 new tests pass.
- [x] `cd tui && go test ./...` — 3 failures, all reproduced on a
stashed tree (`TestKeysDriveTheRightActions`,
`TestHubCatalogLoadSurvivesTheChatView`,
`TestASubprocessAgentIsNotGated`).
- [x] Wider Python suites match their pre-existing baseline exactly (40
failures, all reproduced with the branch stashed — Windows path
assumptions and the unit-test socket guard blocking `TestClient`).
- [ ] Reviewer: `grep -rn "lemonade-server serve" docs/ src/ hub/`
returns only comments explaining why the command is dead.

---------

Co-authored-by: Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
…ormed reply (amd#4031)

When the model sent a malformed tool call, GAIA could end the turn with
"I had trouble formatting my tool call. Could you rephrase…" without
retrying once. The give-up counted every failed tool call toward its
limit of three, including refused commands and failing or timed-out test
runs. In a benchmark run the agent had tracked down a hanging test,
three commands had failed along the way, and its first malformed reply
threw the whole answer away. Malformed replies now have their own budget
of three; ordinary debugging no longer spends it.

## Test plan
- [ ] `python -m pytest tests/unit/agents/test_parse_error_recovery.py`
passes. On main, `test_a_malformed_reply_after_failing_tools_is_retried`
fails: the loop stops after 4 model calls instead of retrying.
- [ ] Three malformed replies still end the turn with the friendly
message (`test_three_malformed_replies_still_give_up`, and the existing
`test_three_consecutive_parse_errors_give_up_gracefully`).

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

`_process_query_impl` keeps `error_count` for everything else it feeds,
and adds `parse_failures`. It is incremented only where a reply fails to
parse (the tool-call path and the plan path), and those are the two
give-up thresholds that now read it. Per turn, same threshold of 3.
</details>

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
…checks (amd#4387)

A JavaScript, Go or Rust project's test run was invisible to the agent's
verification record: `npm test`, `go test ./...` and `cargo test` were
recognised as checks, but their output was only ever read for a pytest
or unittest summary. A failing run behind a pipe (`npm test | tail`)
passed on exit code alone, a passing run still drew the "verify your
change" reminder, and the flagship eval's judge could not count it as a
verified test run. One runner table now knows each runner's own summary
line, and the verification footer, the answer seam, and the eval
consumer all read through it; pytest and unittest behave exactly as
before.

## Test plan

- [ ] `python -m pytest tests/unit/agents/test_unsupported_test_claim.py
tests/unit/agents/test_answer_quality_checks.py
tests/unit/agents/test_verification_scope.py
tests/unit/eval/test_flagship_tasks.py -q` — per-runner pass/fail cases
for pytest, unittest, jest, vitest, mocha, `go test`, `cargo test`; a
piped failure fails; a coloured vitest summary reads; `[no tests to
run]` and `--collect-only` do not count
- [ ] `python -m pytest tests/unit/agents tests/unit/eval -q` (2346
passed locally)
- [ ] `python util/lint.py --black --isort --pylint`

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

- `checks.py`: `_RUNNERS` table (label, summary regex, ran regex,
`per_target`); `runner_summary` picks the summary printed last across
runners, ANSI-stripped; for `go test` / `cargo test` any failing package
or target line decides the run. `_REPORTED_FAILURE_RE` gains `N
failing`, `^FAIL`, `test result: FAILED`.
- `verification.py`: `summary_reports_failure` and
`has_test_run_summary` now go through `runner_summary` instead of a
duplicated pytest/unittest pair of regexes (removed).
- `flagship_tasks.py`: `_test_run_passed` uses the shared table;
`tests_verified` accepts any test-kind check label instead of only
`"pytest"`.
- `docs/sdk/core/agent-system.mdx`: the fallback-classification sentence
names the runners.
</details>

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
…#3335)

Asking GAIA to triage GitHub issues on a machine without the GitHub CLI
used to end the conversation: the agent told you to install `gh` and run
`gh auth login`, and you went and did it by hand. It now offers to do
both itself — it installs the CLI with your machine's package manager
after showing you the exact command, then starts the browser sign-in and
hands you the one-time code to enter. You approve every step; nothing is
installed or signed in silently.

Three tools (`check_cli_setup`, `install_cli`, `sign_in_cli`) driven by
data on the binary policy, so a second CLI is a table entry rather than
new code. Two details worth a reviewer's attention:

- **`check_cli_setup` reports five states, not "works / doesn't".** The
one that matters is `env_token`: `gh` authenticated from `$GH_TOKEN`
works fine and *refuses* to store a credential while that variable is
set, so reporting it as "logged out" would send you to run a command
`gh` rejects. Signing in is offered only where signing in is the fix.
- **Sign-in waits on the CLI's own exit, not on a second approval
prompt.** That observes GitHub actually completing the grant instead of
you reporting that it did, and it avoids stranding a polling `gh`
process behind a confirmation that either expires in a minute or blocks
forever.

This also narrows the `gh auth` grant: `gh auth token` was already
refused as a credential surface, but `gh auth status --show-token`
prints the same token and ran at the tier that asks nobody.

Scopes requested are `repo` and `read:org` — what the triage skill's
command table can actually reach. GAIA never reads, logs, or stores the
token or the one-time code.

## Test plan

- [ ] `python -m pytest tests/unit/test_binary_setup.py
tests/unit/test_cli_setup_tools.py -q` — 114 tests: all five detection
states, the approval gate, command-echo verification, secret scrubbing,
and child-process reaping.
- [ ] `python -m pytest tests/unit/test_skill_binary_grants.py
tests/unit/test_shell_guardrails.py tests/unit/test_starter_skills.py
-q` — no regression in the existing grant/shell policy (453 passed
locally).
- [ ] Confirm the approval gate cannot be bypassed:
`install_cli`/`sign_in_cli` are in `TOOLS_REQUIRING_CONFIRMATION`,
`grant_scope` returns `None` for both (no "always"), and a loaded skill
grant exempts only read-only `run_shell_command`.
- [ ] Ask the agent "is the GitHub CLI installed and signed in?" — it
should call `check_cli_setup` and report the state without offering a
sign-in when the credential comes from `$GH_TOKEN`.
- [ ] On a machine with `gh` logged out (`GH_CONFIG_DIR` set to an empty
directory, `GH_TOKEN` unset), ask it to sign in — it should show a
one-time code and `https://github.com/login/device`, then confirm the
scopes afterwards.
- [ ] `gh auth status --show-token` is refused; `gh auth status` and `gh
pr view 1 --template x` still run.

### Verified locally

All four reachable detection states were exercised against a real `gh`
2.90.0 (isolated `GH_CONFIG_DIR`, so no developer session was touched),
and the device flow was driven end to end — real code captured, real
child killed on cancel, verified dead by PID. Tool selection was checked
against a live Gemma-4-E4B: "capital of France" takes no tool, "list the
files" still picks `list_files`, and the GitHub question picks
`check_cli_setup`.

**Not verified, needs a reviewer's machine:** a real `winget`/`brew`
install (nothing was installed on the test box), a completed browser
sign-in (needs a human at a browser), and `insufficient_scopes` (needs a
deliberately under-scoped token).

**The eval still needs a run on a quiet machine before merge.** `gaia
eval agent --category tool_selection` could not be completed here — two
attempts stalled in the scenario driver with zero turns recorded:
scenarios that take 180-240s in the committed baseline ran past 1600s,
and a retry against a healthy Lemonade sat 22 minutes on the first
scenario without emitting a turn. `claude -p` answers normally on its
own, so this looks like load on the box rather than anything in this
change, but that is unproven. The three live queries above are
supporting evidence, not a substitute.

---------

Co-authored-by: Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
amd#4021)

When the agent loaded a skill partway through a turn, the skill's
instructions reached the prompt but its tools didn't reach the tool list
until the next turn. After loading github-triage, whose recipe is "run
every GitHub command through `run_shell_command`", the agent had no
shell tool. It ran `gh` through `run_python` instead, in all 3 benchmark
tasks that loaded the skill (9 calls). For a user, that means an
approval prompt for every GitHub read, where the skill's grant needs
none. Loading a skill now makes its tools callable on the very next
step.

## Test plan
- [ ] `python -m pytest tests/unit/test_skill_tools_same_turn.py`
passes. On main the two reproducing tests fail.
- [ ] Agents without a per-turn tool subset are unchanged
(`test_no_tool_subset_stays_no_tool_subset`).
- [ ] A required tool the agent doesn't have is not added
(`test_a_required_tool_this_agent_lacks_is_not_invented`).

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

`Agent.load_skill` now adds the skill's `tools_required` and its own
namespaced tools to an active `_active_tool_filter`. It goes through
`_apply_tool_filter`, the same path the `load_tools` escape hatch uses
mid-turn, so both render paths pick it up on the next model call. This
covers a fresh load and a reload of an already-loaded skill. amd#3903
admits active skills' `tools_required` at the next turn's selection.
This PR covers the turn the skill was loaded in, and the two compose.
The helper is module-level because five test stubs borrow
`Agent.load_skill` onto plain classes.
</details>

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
…4035)

An agent that finished a task and then re-ran the same check a few times
used to have its answer thrown away: the user got "I stopped after
calling `run_python` 3 times in a row without making progress, so I
can't confirm the task is finished" on runs where the code had been
changed, documented, and pytest had passed — the verification line on
that same answer said "verified — pytest ran and passed". A judge scored
one of those tasks 3.00 against Claude Code's 4.75, the largest quality
gap left in the suite. The agent now answers from the work it actually
did; repeats that failed or were refused still report the failure,
because there the failure is what the user needs to hear.

Stacked on amd#4028 and amd#3908, merged in that order (main → amd#4028 → amd#3908 →
this), so the diff here includes both until they land. Together the
guard corrects once in place of the repeated call and only ends the turn
on the next identical call — that closing turn is what this PR changes.

## Test plan

- [ ] `python -m pytest tests/unit/agents/test_loop_break_answer.py
tests/unit/agents/test_loop_guard_correction.py
tests/unit/agents/test_step_cap_final_answer.py
tests/unit/agents/test_loop_break_truthful.py -q` — closing answer on
both tool paths after the correction round, error/refused repeats
unchanged, failure and cancel handling
- [ ] `python -m pytest tests/unit/agents -q` (1056 passed locally on
the merged tree)
- [ ] `gaia eval agent --category tool_selection` shows no regression
against the committed baseline — not run here

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

- The step-limit closing call was generalised to
`_closing_answer(messages, conversation, instruction, step)`; the
step-limit and loop-guard paths differ only in the instruction they
pass. Both loop-guard call sites (native fan-out and legacy
embedded-JSON) go through `_answer_after_repeated_calls`, which returns
`(answer, steps_taken)` and `(None, …)` when the user pressed Stop.
- Merge resolution at both call sites: `if current_call not in
loop_corrected_calls: … continue` first, then
`print_repeated_tool_warning()` followed by
`_answer_after_repeated_calls(...)` with `consecutive_count - 2` — the
calls that actually ran, the same number `_build_loop_break_summary`
reports.
- The gate is `_repeats_carry_a_failure`: an errored or `status:
"denied"` last result keeps `_build_loop_break_summary`, so amd#3908's
rate-limited / not-permitted / dead-service wording is untouched.
`_build_loop_break_summary` now calls that predicate instead of
repeating the condition.
- The guard stops mid-fan-out, which leaves an assistant tool-call turn
with no result for the call it stopped — Anthropic and other spec-strict
providers reject that outright. `_unanswered_tool_call_messages` answers
every dangling id with "Not run — the turn stopped before this call"
before the closing request goes out, and a test asserts the outgoing
message list accounts for every id (the correction message answers its
own id, so only the stopping call needs sealing).
- On failure the behaviour mirrors the step-limit path: warn, and return
the existing notice with one line saying why the summary couldn't be
written. A reply that asks for a tool instead of answering counts as a
failure.
- The extra call counts as a step and its stats land in `conversation`,
so tokens are aggregated as usual. The verification-scope line is still
appended once, post-loop.
- Both call sites pass `recent_results` (from `previous_outputs`), never
`step_results`, which error recovery clears before every retry — a
legacy-path test fails if that is swapped back.
- amd#3908's own `test_repeat_after_the_correction_ends_the_turn` needed no
change: its repeats return an error, which stays on the summary branch.
</details>

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Ovtcharov <[email protected]>
Co-authored-by: probe <probe@local>
Co-authored-by: Kalin Ovtcharov <[email protected]>
The agent repeats its mistakes across sessions and never learns which
approach worked, and the benchmark numbers that would catch a regression
are produced by hand on a developer machine, so a 20% cost increase or a
dropped task goes unnoticed until someone reruns the suite weeks later.
These two plans say how to close both gaps: an outcome-record →
attributed-lesson → plan-time-recall loop grounded on the memory and
verification code that ships today (`memory.py`, `verification.py`), and
a nightly CI matrix over the `everyday`, TheRock and Jan suites on one
open model with a two-consecutive-nights regression rule that files a
`bug` issue for the existing auto-fix path. Both are proposals; nothing
here changes runtime behaviour.

- [Adaptive memory](docs/plans/adaptive-memory.mdx) — cites the
extraction ops, `reconcile_memory`, `consolidate_old_sessions`,
`update_memory`/`forget`, the self-healing error store and the per-turn
verification record; names what is view-only today (TUI `/memory`, CLI
`status`/`bootstrap`), and ends with a seed → avoid → unlearn benchmark
series and a four-phase rollout.
- [Nightly benchmarks](docs/plans/nightly-benchmarks.mdx) — a reusable
`bench_suite.yml` + `nightly_benchmarks.yml` matrix on the harness in
amd#4335, per-cell metering, a nightly budget cap that skips loudly, a
rolling min–max band over seven nights, and the Jan tier's disk /
`file://` clone / APFS baseline lessons.

### Test plan

- [x] `python util/check_doc_links.py --internal-only` — 1036 links, 0
broken (both new pages scanned)
- [x] Both pages registered in `docs/docs.json` (Ecosystem →
`plans/adaptive-memory`, Infrastructure → `plans/nightly-benchmarks`);
`docs.json` parses
- [x] Every `file:line` citation checked against `main` at 81d972f;
every amd#4335 symbol checked against `gh pr diff 4335`
- [ ] Mintlify preview of the two pages (no local `mintlify` here)

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Ovtcharov <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: f <f@f>
Co-authored-by: probe <probe@local>
kovtcharov-amd and others added 10 commits September 28, 2026 10:23
400 was tight enough that a carefully-tuned, eval-validated docstring
(read_tool_output, amd#4379) tripped the CI gate at 469 chars. Raising the
ceiling avoids forcing a rewrite of text that was tuned against real
model behavior — the two named allowances (run_shell_command,
remember_skill_lesson) still exist for cases that need to go further.
A memory the model filed under "work" or "personal" was saved and never
shown again. The `remember` tool offered a `context` label, and `gaia
memory bootstrap` writes "work" rows. But a default session reads only
"global" rows, and nothing in GAIA switches to another context. In a
learning benchmark the user stated two standing rules, and the model
saved them with `context='work'`. Sessions 2–4 ran on the same store,
never saw the rules, and all three failed to follow them.

A default session now shows memories from every context, and that also
fixes rows already on disk. An agent that picked its own context, such
as email, keeps it plus "global". The model can no longer choose a
label: `remember` and `update_memory` store under the agent's active
context. I dropped the parameter rather than validating it. Validation
would mean either rejecting the call, which wastes a turn, or quietly
relabelling it, which is a silent substitution. The model can't know the
agent's scoping anyway.

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

- The same "global means unscoped" rule applies to the reminder list in
the per-turn context and to extraction's duplicate search. `recall`
already searches every context unless the model filters.
- Sensitive rows stay out as before.
- A model that still passes `context=` gets the loop's structured
"unexpected argument" error and can retry without it.
- Docs updated: the memory guide's context section, which showed the
model storing into "personal" by chat, and the SDK page's filter
description and tool card. Also updated the bootstrap docstring that
described the old global-only read.
- The per-request retrieval in amd#4061 gets the same rule in a follow-up
commit on that branch.
</details>

## Test plan
- [x] `pytest tests/unit/test_memory_context_visibility.py`: 6 new tests
on a real on-disk store. A "work" preference saved in one session is in
the next session's system prompt, and a "personal" reminder reaches the
next turn (both fail on main). Sensitive rows stay out. Email scoping
holds. `remember` stores under the active context, and neither tool
accepts `context`
- [x] `pytest tests/unit -k "memory or bootstrap"`: 1108 passed. Two
existing tests updated because they encoded the old global-only read and
the model-chosen label
- [x] `python util/lint.py --black --isort` on changed files
- [ ] `gaia eval agent` on the memory categories vs the committed
baseline (memory tool schema changed)

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
amd#3791)

GAIA refused its `coding` skill whenever the `pytest` executable was not
on the global PATH. That is the usual state for a Python project, where
pytest lives in a virtualenv. In a benchmark run where models could see
and load skills, 42 of 48 attempts to load `coding` were refused, so
models lost the skill's guidance on the very tasks it was written for.

A missing command now refuses a skill only when nothing can stand in for
it. pytest can: the skill loads, and `load_skill` tells the model to run
the suite through `execute_python_file` with `pytest.main`. `gh` cannot,
so a missing `gh` still refuses `github-triage`.

The refusal also appears to derail models. Every one of 12 benchmark
runs that ended in "I had trouble formatting my tool call" had a refused
`coding` load earlier in the turn; the build before skills became
visible had none. It is an association, not a measured cause: a re-run
of those cells with this fix will show whether they recover.

Closes amd#3790

## Test plan

- [x] `pytest tests/unit/test_skill_binary_grants.py`: a missing pytest
resolves without refusing and is reported as unavailable; an installed
one is never reported; missing `gh` still refuses.
- [x] `pytest hub/agents/gaia/python/tests/test_skill_library_tools.py`:
`load_skill` on a pytest-declaring skill with pytest off PATH succeeds,
returns `unavailable_commands: ["pytest"]` with the substitute in
`warning`, and grants nothing.
- [x] `pytest tests/unit/test_skill_binary_grants.py
hub/agents/gaia/python/tests/test_skill_library_tools.py
tests/unit/test_starter_skills.py tests/unit/test_skills_manager.py`:
523 pass.
- [x] Live, the real flagship loading the real `coding` skill with
pytest absent from PATH. `main` fails with "Skill 'coding' needs the
'pytest' command, which is not on PATH…". This branch loads it with the
warning "'pytest' is not on PATH, so this skill's `pytest` steps cannot
run as written. Run the suite with execute_python_file…".
- [ ] `gaia eval agent`: it changes what the model is told on skill
load. It can't run on this machine (no `claude` CLI for the judge).

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
Co-authored-by: Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
…amd#4066)

**Stacked on amd#4058.** The first four commits are that PR. Review the
last two here.

The agent rediscovered the same project quirk every session. When a call
failed and the agent worked around it (say `pytest` fails with "test
clock not configured", it reads the doc, reruns with `env
TOYBOX_CLOCK=frozen` and it passes), memory stored the error and then
deleted it on the success. Nothing recorded what fixed it, so the next
session started from scratch.

Now that fail-then-fix sequence in one turn becomes a lesson, built only
from the two calls: the failing call and its error, the call that
worked, and what changed ("added `env TOYBOX_CLOCK=frozen`"). It belongs
to the workspace it happened in, and the next session there sees it in
its memory prompt with the date learned. It gains confidence each
session the fix works again and is dropped when the fix itself fails.
Other folders never see it.

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

- The pairing key is amd#4058's operation key: the tool plus the program it
runs (past `env`, `VAR=value` and `python -m`) or the path. The failing
and working calls must have different arguments, so a plain retry that
happens to pass teaches nothing. Refusals (`executed: False`) never
count, either as the failure or as a failed fix. There's no matching on
error wording.
- Scope: stored as `category="note"`, `domain="lesson"`, in the memory
context `workspace:<most specific allowed path>`. That context keeps
lessons out of every other workspace's prompt and retrieval, including
amd#4061's per-request recall. So lessons are shown in their own
stable-prompt section (top 3 by confidence), not through relevance
search, which would also hide them whenever the request is worded
differently from the lesson.
- Within a session, later turns get the new lessons in the per-turn
context, since the stable prompt is frozen. Within a turn there was a
real loss path: overflow recovery stubs every tool result except the
latest, which drops the failure a fix answered. The recovery now
restates this turn's lessons on the last user message. The cache is
already lost at that moment, so this costs nothing extra.
- A lesson whose text looks like a credential isn't stored.
</details>

## Test plan
- [x] `pytest tests/unit/test_memory_heal_lessons.py`: 14 tests on a
real on-disk store, over several sessions sharing one DB. All 7 positive
tests fail on the pre-change source. Covers the exact lesson text and
row shape, no lesson for a same-call retry / a refused failure / a
different program / a failure and fix in different turns, a path tool's
changed argument, the next session's prompt in the same workspace but
not another, the rest of the session, confirm once per session (0.5 →
0.6), drop when the fix fails, keep when the fix is refused, and
overflow recovery keeping the lesson (idempotent)
- [x] `pytest tests/unit -k "memory or overflow or shrink"`: 1155
passed. The 1 failure, `test_tool_loader_token_budget`, also fails on
main
- [x] black + isort on changed files
- [ ] `gaia eval agent` on the memory categories vs the committed
baseline (memory prompt content changed)

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
…ding on it (amd#4054)

All three TheRock benchmark runs that GAIA failed ended the same way:
the DeepSeek model used up its 8,192-token output budget, and GAIA took
the cut-off reply as its final answer at about step 30 of 150. Two of
those replies were unfinished reasoning handed back as text ("The fix:
add `trigger_test_label_only: True` to gfx90a's linux entry…"). The
third was a tool call cut off partway through its arguments. GAIA never
knew the reply had been cut off, because the provider threw away the
reason the reply ended. Now it keeps that reason. A cut-off reply goes
back to the model with "your reply was cut off, continue", before GAIA
tries to read it as an answer or a tool call. After two cut-offs in one
turn, the turn ends with an honest "I could not finish" message instead
of the half-written text.

- **Why this is a structural check:** it acts on `finish_reason=length`,
which comes from the provider, not on the wording. A complete answer, an
honest "I couldn't finish" and a normal chat reply all end normally, so
none of them can trigger it.
- **Why the existing plan guard didn't fire:** it only reads the last
sentence of a short reply. These replies were 38–39K characters and
ended mid-thought. It still had its whole re-prompt budget left.
- **Worth a follow-up, not changed here:** the 8,192 output cap is
hard-coded in the base `Agent`. It was sized for a 32K local context,
and for a cloud reasoning model the thinking counts against it.

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

- `LLMClient.get_last_finish_reason()` is added. It defaults to `None`
and `LemonadeProvider` implements it for streaming and non-streaming
calls. `AgentResponse.finish_reason` carries it to the loop.
- The check runs right after the reply arrives, before
`_parse_llm_response`. Native tool-call envelopes keep their existing
truncation error.
- The Claude, OpenAI and LiteLLM providers don't report the finish
reason yet, so they behave as before.
</details>

## Test plan

- [x] `pytest tests/unit/agents/test_cut_off_reply_guard.py`. Replays
the final reply of each of the three failed runs, and each one is
continued and the work goes on. Repeated cut-offs and a cut-off on the
last step end with the honest failure message. A complete answer, an
honest "could not finish" and a chat reply all end the turn untouched.
The finish reason reaches the loop from the provider and the SDK. The
loop tests failed against `main`.
- [x] `pytest tests/unit/agents tests/unit/chat
tests/unit/test_claude_provider.py
tests/unit/test_streaming_tool_calls.py
tests/unit/test_tool_call_priority.py`
- [ ] `gaia eval agent --category tool_selection`

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
…sitory (amd#4376)

Replicates amd#4076 (kovtcharov/gaia fork, push access blocked) onto a
branch this session can push to. No content changes beyond conflict
resolution against current main.

The flagship worked real repositories without a shell. The tool loader
showed `run_shell_command` only when a request sounded like a shell
request, and coding requests usually don't ("skip gfx90a tests on PRs
unless labeled"). On four TheRock CI-fix tasks it never got the shell,
and 181 of its 276 tool calls were `run_python` wrapping a single `grep`
or `sed`. Claude Code took about 20 shell calls per task; GAIA took
65–96 calls. Now, when the session's project is a code repository, the
shell is offered on every turn. Outside a repository nothing changes,
and the shell still asks for approval as before.

**Why not just make the shell always-on everywhere:** its schema is
about 160 tokens on every call, and most flagship sessions (documents,
email, chat) have no use for a shell. Tying it to the workspace spends
those tokens only where they pay off. It's decided once, when the agent
is built, so the prompt prefix stays cache-stable from turn 1.

## Review status carried over

The original review raised four findings. Three were fixed on the branch
and I verified each is present in this replication:

- The project map no longer names a shell the turn didn't offer —
`_shell_tool_offered()` reads `_active_tool_filter` and falls back to
the registry.
- The non-deterministic "no project root" test was split into a
stubbed-root case and an explicit-root case.
- The npm changelog now names `GAIA_PROJECT_ROOT` /
`GaiaAgentConfig(project_root=...)` instead of implying the shell turns
itself on in any repository.

The fourth — **the agent eval — is still outstanding and remains a
pre-merge gate for a maintainer.** See the note below for how far I got.

## Test plan

- [x] `python -m pytest
hub/agents/gaia/python/tests/test_shell_in_code_repos.py
tests/unit/test_project_map.py -q` — 91 passed
- [x] `python -m pytest hub/agents/gaia/python/tests/ -q` — 507 passed,
0 failed
- [x] `python -m pytest tests/unit/ -k "tool_loader or full_tool_bundles
or dynamic_tool or project_map"` — 191 passed, 2 failed; both failures
(`test_harness_runs_and_pins_baseline`,
`test_token_baseline_when_tiktoken_available`) reproduce identically on
a clean `main` checkout
- [x] `python util/lint.py --black --isort` clean
- [ ] `gaia eval agent --category tool_selection` — **could not run
here**, see below

> [!IMPORTANT]
> **The agent eval still needs to run on maintainer hardware, and this
is a tool-schema change, so it is required before merge.**
>
> I did attempt it rather than skipping it. Lemonade and the Claude
judge both work on this machine, and a scenario completes end-to-end
(`known_path_read` PASS 9.8/10). But the eval only runs against *this*
checkout if `PYTHONPATH` is pinned to it — otherwise the installed
`gaia` resolves to an unrelated worktree and measures the wrong code.
With the path correctly pinned, every scenario returns `INFRA_ERROR`
because the eval's MCP bridge cannot start:
`src/gaia/mcp/servers/agent_ui_mcp.py:282` does `from mcp.server import
MCPServer`, but the installed `mcp` package exports `Server`, not
`MCPServer`. That file is untouched by this PR and the same import is on
current `main`, so the eval is blocked by a pre-existing
incompatibility, not by this change.

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
…uest (amd#4055)

GAIA threw away almost everything a reasoning model wrote. On one
DeepSeek call, 91% of the output tokens were reasoning and the visible
answer was 18 characters. So at every step of a tool-calling job, the
model had to re-derive its plan from scratch, and a plan that existed
only in its reasoning never reached the next step. When a reply had no
visible text, GAIA did something worse: it handed the private reasoning
to the user as the answer. Now reasoning is kept as its own field. It is
recorded in the transcript, sent back to the model on each step of the
same request (the provider's own guidance for thinking models that use
tools), and never shown as the answer.

- **Earlier requests:** reasoning from past user requests is kept but
not sent again by default, so long conversations don't keep growing.
`resend_reasoning_across_requests=True` turns that on. The owner may
want it on.
- **Checked with a real call:** one request through the Lemonade gateway
to `fireworks.deepseek-v4p1-flash`, in a tool-call loop, sent back an
assistant turn carrying `reasoning_content`. It was accepted and the
model answered coherently. The prompt grew by 27 tokens for 117
characters of reasoning, which shows the reasoning reaches the model
rather than being dropped.
- **Cost:** each step's prompt grows by roughly that step's reasoning.
On the TheRock benchmark, replies averaged about 1,000 tokens, mostly
reasoning, so a 30-step job carries on the order of 30K extra prompt
tokens by the end. Most of that is a cached prefix.

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

- `LLMClient.get_last_reasoning()` and `accepts_reasoning_history` are
added, and `LemonadeProvider` implements both. The SDK attaches
`reasoning_content` to assistant history only for a provider that
accepts it, so OpenAI and LiteLLM never receive the field, and Claude's
message translation already drops unknown keys.
- Inline `<think>` blocks go into the same field as `reasoning_content`,
including an unclosed block (a reply cut off mid-thought) and a lone
`</think>` (the chat template opened the block in the prompt).
- The Claude provider doesn't turn on extended thinking. It does drop
any `thinking` blocks it gets back, so it would have the same gap if
thinking were enabled. That provider is not changed here.
- Callers that rebuild `conversation_history` from the UI database
(`ui/_chat_helpers.py`, `ui/agent_loop.py`) store only the answer text,
so the setting has no effect in the Agent UI until they store reasoning
too.
- amd#4054 (continue a cut-off reply) pairs with this change. With both
merged, a reply cut off while the model is still thinking is continued
with its reasoning intact. Neither PR depends on the other.
</details>

## Test plan

- [x] `pytest tests/unit/agents/test_model_reasoning_kept.py`. Reasoning
from `reasoning_content` and from inline `<think>` blocks is stored and
kept out of the answer. Within a request, the next call carries the
previous step's reasoning. Across requests it is not resent by default
and is resent with the setting on. Ten of these tests failed before the
change.
- [x] `pytest tests/unit/agents tests/unit/chat
tests/unit/test_claude_provider.py
tests/unit/test_streaming_tool_calls.py
tests/unit/test_tool_call_priority.py`
- [x] One real tool-call round trip through the Lemonade gateway with
`reasoning_content` sent back (see above)
- [ ] `gaia eval agent --category tool_selection`
- [ ] `gaia eval agent --category rag_quality`

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
…ge (amd#4061)

Memory held useful lessons that the model almost never saw. The memory
section of the system prompt is fixed at session start and picks facts
by confidence alone, whatever the user is asking. Everything else only
surfaced if the model called `recall`, and it did so 4 times in a
2,121-task benchmark sweep. Surfaced memories also had no dates, so a
lesson learned months ago under different permissions looked as current
as one confirmed yesterday.

Each turn now adds the three stored memories most relevant to the
request to the per-turn context, which is prepended to the user message.
The cached system prompt doesn't change. A memory has to clear a
similarity floor, so an unrelated nearest match isn't shown. It must
also be in this context or global and not sensitive, credentials are
masked, and anything the system prompt already shows is skipped. Every
memory the model sees without calling `recall` now carries a short
"(learned 2026-06-03, last confirmed 2026-09-20)". The dates are
absolute, so the fixed prompt stays stable, and the per-turn context
already carries the current time.

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

- Uses a vector-only FAISS search with an absolute cosine floor
(`TURN_RECALL_MIN_SIMILARITY = 0.5`), not `_hybrid_search`. RRF gives no
absolute floor, and hybrid search bumps confidence on every hit, which
would inflate anything shown passively.
- About the floor: it is set from memory-to-memory similarity in the
sweep stores (nomic-embed-text-v2). Unrelated pairs have a median around
0.34 and same-topic pairs sit above 0.8. It hasn't been measured on
query-to-memory pairs, and the eval below is where it gets checked.
- Cost: one embedding call before each turn when the index isn't empty.
Extraction already embeds the same text after the turn, so that later
call now hits the embedding cache. If embedding fails, the turn still
gets its time and reminders, and a warning is logged.
- "Last confirmed" is `updated_at`, which moves when the same memory is
stored again or updated.
</details>

## Test plan
- [x] `pytest tests/unit/test_memory_turn_recall.py`: 13 new tests on a
real SQLite store and FAISS index. The 6 positive ones fail on main.
Covers the exact injected line with its age, the top-3 cap, dedup
against the stable prompt, no confidence or use-count bump, context
scope (a default session reads every context, the same rule as amd#4062; a
scoped one reads its own), excluded rows (sensitive, reminder, below
floor), credential masking, embedder failure, stable-prompt ages, and
that the memory arrives on the user message while the system prompt
stays byte-identical
- [x] `pytest tests/unit -k memory`: 1101 passed. Hub chat/gaia memory
tests: 22 passed
- [x] `python util/lint.py --black --isort`
- [ ] `gaia eval agent` on the memory categories vs the committed
baseline (memory prompt content changed)

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
When a tool result is too large for the model, GAIA used to keep its
first and last few thousand characters and drop the middle, so the agent
often went back for what it could not see. Now an over-budget result
arrives as the parts that fit plus a numbered index of everything left
out, split where the document splits: functions and methods, headings,
JSON records, a search's files, failing test sections, diff hunks.
`read_tool_output(artifact, entry=n)` returns one part verbatim, so
nothing is lost and the model can see exactly what it is missing. The
split is deterministic, with no summarising model in the tool path.
Budgets are unchanged: the index applies only above the existing device
threshold.

Measured on the TheRock benchmark (4 real ROCm build-system bugs,
GLM-5.3 Flash and DeepSeek V4.1 Flash), the judged quality of fixes rose
on the two tasks where the old cut had hidden the relevant code (3.00 →
4.00 and 3.75), and stayed level elsewhere. Tokens and cost did not
fall: a tighter cloud budget was tried and reverted, because the model
walks an index of a file it needs whole, one part per round trip. This
PR is the "nothing lost" mechanism, not a cost saving.

## Test plan

- [x] `pytest tests/unit/agents` — 1578 passed, 50 skipped on main,
including ~90 chunk-index tests: every chunker tiles its text exactly,
every index entry reads back verbatim by number, inputs of 100 KB, 1 MB
and a single 50K-char line page correctly, a property test over 30 seeds
of mixed text, `check_result` kept verbatim, local NPU/GPU and remote
budgets pinned, a `read_tool_output` page is never re-condensed
- [x] black, isort, flake8, pylint clean on changed files
- [x] Offline replay of recorded transcripts through the real handler:
`python util/bench_chunk_index_sim.py 'runs.*/*/*/_transcript.json'`
(needs local transcripts)
- [x] Live: TheRock tasks on GLM-5.3 Flash (4 tasks, 2 runs) and
DeepSeek V4.1 Flash (1 task), judged; outcome and quality as described
above
- [ ] NPU eval: a non-string result between 20K and 30K chars now
reaches the model whole on NPU instead of being cut to 20K unarchived at
the message backstop

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
Co-authored-by: Kalin Ovtcharov <[email protected]>
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 28, 2026
Merged via the queue into amd:main with commit 4bc33c9 Sep 28, 2026
25 of 31 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the claude/hub-wheel-skip-guard branch September 28, 2026 19:04
@github-actions github-actions Bot added dependencies Dependency updates talk Talk agent changes chat Chat SDK changes llm LLM backend changes audio Audio (ASR/TTS) changes cli CLI changes eval Evaluation framework changes electron Electron app changes security Security-sensitive changes performance Performance-critical changes website GAIA website (amd-gaia.ai) agents agent::email Email agent changes tui Go terminal UI (gaia-tui) daemon Daemon supervisor / sidecar control plane sidecar Agent sidecar contract / harness labels Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent::email Email agent changes agents audio Audio (ASR/TTS) changes chat Chat SDK changes cli CLI changes daemon Daemon supervisor / sidecar control plane dependencies Dependency updates devops DevOps/infrastructure changes documentation Documentation changes electron Electron app changes eval Evaluation framework changes llm LLM backend changes performance Performance-critical changes security Security-sensitive changes sidecar Agent sidecar contract / harness talk Talk agent changes tests Test changes tui Go terminal UI (gaia-tui) website GAIA website (amd-gaia.ai)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: ~214 tests skip in every CI lane because hub wheels aren't installed

2 participants