Skip to content

fix(mcp): make keyring a true optional dependency in _resolve_keyring_refs - #1028

Merged
kovtcharov-amd merged 2 commits into
mainfrom
kalin/fix-keyring-optional-import
May 11, 2026
Merged

kovtcharov-amd merged 2 commits into
mainfrom
kalin/fix-keyring-optional-import

Conversation

@kovtcharov

Copy link
Copy Markdown
Contributor

Why this matters

Before: `tests/unit/mcp/client/test_mcp_client.py::test_from_config_accepts_env` fails at import on any dev environment without the optional `keyring` package, even though that test only passes plain string env vars and never exercises the `$keyring` path. The unconditional `import keyring` at the top of `_resolve_keyring_refs` made keyring a hard dependency in practice for every config-driven MCP server load.

After: imports for `keyring`, `ConnectorsError`, and `SERVICE_NAME` are deferred to the branch that actually needs them. Plain-env callers stay zero-dep on keyring; the security invariants and error handling for real `$keyring` references are unchanged.

Caught while reviewing #1026 — pre-existing issue, not introduced by that PR.

Test plan

  • `pytest tests/unit/mcp/client/ -v` — 25/25 pass (previously 24 pass + 1 fail)
  • `python util/lint.py --black --isort` — clean

_resolve_keyring_refs imported keyring (an optional dependency) at the
top of the function regardless of whether the env actually contained
any $keyring references. On dev environments without keyring installed
this caused tests/unit/mcp/client/test_mcp_client.py::TestMCPClient::
test_from_config_accepts_env to fail at collection with
ModuleNotFoundError, even though the test only passes plain string
env vars and never triggers the keyring path.

Move the keyring + connectors imports inside the loop branch that
actually needs them, so plain-env callers stay zero-dep on keyring
while $keyring callers get the same behaviour as before.
@github-actions github-actions Bot added the mcp MCP integration changes label May 10, 2026
@kovtcharov-amd
kovtcharov-amd requested a review from itomek May 11, 2026 20:00
@kovtcharov-amd
kovtcharov-amd enabled auto-merge May 11, 2026 20:01
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue May 11, 2026
Merged via the queue into main with commit 6444b8d May 11, 2026
31 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the kalin/fix-keyring-optional-import branch May 11, 2026 20:27
@itomek itomek mentioned this pull request May 14, 2026
5 of 6 tasks
pull Bot pushed a commit to bhardwajRahul/gaia that referenced this pull request May 15, 2026
## Why this matters

v0.18.0 ships agent memory v2 (hybrid-search second brain with LLM
extraction and observability dashboard), ChatAgent split into three
composable agents (Chat/FileIO/DocumentQA), parallel tool calls, and a
Telegram adapter scaffold — plus fixes the RAG-on-PDF timeout with Gemma
4 that broke document Q&A since v0.17.6 and adds CI gates that enforce
RAG quality baselines on every future PR.

Full notes: `docs/releases/v0.18.0.mdx`.

## What's New

- **Agent memory v2** ([amd#606](amd#606)) —
Hybrid semantic + keyword search, LLM extraction, observability
dashboard via SSE streaming
([amd#1032](amd#1032)). Per-user isolation
enforced; extraction runs async so it doesn't add latency.
- **ChatAgent split** ([amd#979](amd#979)) —
`ChatAgent`, `FileIOAgent`, and `DocumentQAAgent` replace the monolithic
class; each composable via `tools=`. Backward-compatible shim preserved.
- **Parallel tool calls** ([amd#946](amd#946))
— Multiple `tool_calls` from a single LLM turn are executed
concurrently, cutting round-trips for multi-tool workflows.
- **Telegram adapter scaffold, Phase 0**
([amd#951](amd#951)) — `gaia telegram
start|stop|status`, per-user session isolation, `[telegram]` extras.
Phase 1 (message handling + allowed-users gate) tracked in
[amd#889](amd#889).
- **Connectors: per-MCP toggle + single-writer enforcement**
([amd#1018](amd#1018),
[amd#998](amd#998)) — Disable individual MCP
servers without removing them; concurrent writes serialised with
actionable errors on contention.
- **File navigation, web browsing, and write security**
([amd#495](amd#495)) — `FileSearchToolsMixin`,
web browsing tool, and scratchpad mixin in `KNOWN_TOOLS`; write tools
check `allowed_paths` before dispatch.
- **Email UI and policy alerts**
([amd#995](amd#995),
[amd#1039](amd#1039),
[amd#952](amd#952)) — Pre-scan triage card,
in-chat Connect, policy alert cards, and durable receipts for
confirmation-gated actions.

## Bug Fixes

- **RAG-on-PDF timeouts on Gemma 4**
([amd#1034](amd#1034), closes
[amd#1030](amd#1030)) — Prompt-size budget
check added at composition time; CI gates enforce it on every PR
([amd#1040](amd#1040)).
- **Envelope-level parse failure crashed SD recovery**
([amd#1047](amd#1047), closes
[amd#1023](amd#1023)) — Falls through to a
clean recovery path with step-1 context preserved.
- **Windows-path tool args corrupted**
([amd#1027](amd#1027)) — Backslash
normalisation now happens after argument parsing.
- **Blender `send_command` hung**
([amd#1026](amd#1026), closes
[amd#1022](amd#1022)) — Read timeout applied
to persistent-connection servers.
- **`gaia chat init` in post-install banner**
([amd#1029](amd#1029), closes
[amd#1024](amd#1024)) — Replaced with the
correct `gaia init`.
- **Keyring treated as required**
([amd#1028](amd#1028)) — Import guarded;
optional on systems without `keyring`.
- **electron-builder URLs stale**
([amd#953](amd#953)) — Three doc/installer
files updated to current download paths.

## Tooling & Docs

- **RAG eval CI gates** ([amd#1040](amd#1040),
closes [amd#1033](amd#1033)) — RAG quality
baselines + prompt-size budget enforced on every PR.
- **Fork-PR authors now receive Claude review**
([amd#932](amd#932)) —
`allowed_non_write_users: "*"` with prompt-injection mitigations
documented.
- **Eval runs mandated before merging**
([amd#1036](amd#1036)) — `CLAUDE.md` requires
`gaia eval agent` for LLM-affecting changes.
- **GAIA website** ([amd#369](amd#369)) —
[amd-gaia.ai](https://amd-gaia.ai) live.
- **Custom agent guide reorganised**
([amd#997](amd#997)), Lemonade PPA docs
([amd#801](amd#801)), broken Lemonade CLI URL
fixed ([amd#996](amd#996)), WhatsApp adapter
evaluation spec ([amd#950](amd#950)).

## Release checklist

- [x] `util/validate_release_notes.py docs/releases/v0.18.0.mdx --tag
v0.18.0` passes
- [x] `src/gaia/version.py` → `0.18.0`
- [x] `src/gaia/apps/webui/package.json` → `0.18.0`
- [x] Navbar label in `docs/docs.json` → `v0.18.0 · Lemonade 10.2.0`
- [x] All 28 commits in range (v0.17.6..HEAD) are represented in the
notes
- [ ] Review from @kovtcharov-amd addressed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mcp MCP integration changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants