Repository navigation
fix(connectors): derive the flagship's mail scopes for --grant-agent - #4533
Closed
github-actions[bot] wants to merge 1 commit into
Closed
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
…installed:gaia `gaia connectors connect google --grant-agent installed:gaia` exited 5 because the flagship's sidecar spec declared no connector requirements, and a binary install has no importable gaia_agent to read them from. The spec now carries the flagship's mailbox requirement (gmail.readonly / Mail.ReadWrite) for scope derivation only; forward_providers stays empty, so the daemon still forwards no tokens to the flagship. Tests pin the spec to DECLARED_SCOPES and to gaia_agent.connectors.MAILBOX_REQUIREMENTS. Closes #4531
5 tasks
2 of 4 tasks
Collaborator
|
Superseded by #4859 (same fix, rebased onto current main, with the CLI test running from the frozen-binary state). |
kovtcharov-amd
pushed a commit
to aksh8b/gaia
that referenced
this pull request
Oct 6, 2026
…installed:gaia (amd#4859) `gaia connectors connect google --grant-agent installed:gaia` — the documented way to connect a mailbox to the flagship — failed with exit 5 and no sign-in link for anyone running the shipped flagship. The flagship ships as a frozen binary, so its declared mail requirement can't be imported, and the daemon's own record of the flagship listed none. That record now carries the same read-only requirement, so the command prints the sign-in link, asks Google for `gmail.readonly` only, and grants exactly that. No tokens are forwarded to the flagship. Supersedes amd#4533 (same fix, rebased onto current main). Its command-line test passed without the fix on any machine that has the flagship wheel installed, so it now runs from the frozen-binary state. Closes amd#4531 ## Test plan - [x] `pytest tests/unit/connectors/test_grant_agent_scope_derivation.py` — 18 passed; without the fix 3 fail, one with the exact exit-5 message from the issue - [x] `pytest tests/unit/connectors` — 907 passed - [ ] From a cold connector state (move `~/.gaia/connectors` aside) with the flagship binary installed and a Google OAuth client configured: the command prints a sign-in URL and the consent screen asks only for read-only Gmail - [ ] After consent, `gaia connectors grants list google` shows `installed:gaia` with `gmail.readonly`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Connecting a mailbox to the flagship agent with
gaia connectors connect google --grant-agent installed:gaiafailed with exit 5 and no sign-in link. The shipped flagship is a frozen binary, so the CLI couldn't read its mail requirement, and the daemon's copy of the flagship's details never listed one. Now the command prints the sign-in link, asks Google for read-only Gmail access (gmail.readonly) and nothing else, and grants that access toinstalled:gaia. The daemon still sends no OAuth tokens to the flagship.Closes #4531
Test plan
python -m pytest tests/unit/connectors/test_grant_agent_scope_derivation.py -rspasses (the new CLI test fails onmainwith the exact exit-5 error from the issue)python util/lint.py --all— black, isort and flake8 pass; the one pylint error is already onmain, in files this PR doesn't touch~/.gaia/connectorsaside) with the flagship binary installed and a Google OAuth client configured:gaia connectors connect google --grant-agent installed:gaiaprints a sign-in URL, and the consent screen asks only for read-only Gmail accessgaia connectors grants list googleshowsinstalled:gaia: https://www.googleapis.com/auth/gmail.readonlygaia connectors connect google --scopes https://www.googleapis.com/auth/gmail.readonlystill works as before🔍 Technical details
register_installed_sidecarsregisters a binary-installed agent usingAgentSidecarSpec.required_connections. The"gaia"spec left that field empty, soresolve_declared_scopesraisedNoDeclaredScopesError.GaiaAgent.REQUIRED_CONNECTORSis only read when thegaia_agentwheel can be imported, and the shipped frozen binary doesn't provide it.src/gaia/daemon/sidecars/spec.pyadds_GAIA_REQUIRED_CONNECTIONS, written out as literals the same way_EMAIL_REQUIRED_CONNECTIONSis, so core never imports the hub wheel. It matchesgaia_agent.connectors.MAILBOX_REQUIREMENTS: Googlegmail.readonly, MicrosoftMail.ReadWrite, and the samereasonstrings.forward_providersstays empty, soforward.pystill refuses to send any token to the flagship. A test checks this.tests/unit/connectors/test_grant_agent_scope_derivation.py:DECLARED_SCOPES. This runs everywhere.MAILBOX_REQUIREMENTS. This is skipped whengaia_agentisn't importable; it passed locally with the hub source onPYTHONPATH.AgentRegistryandregister_installed_sidecarswithlist_installedfaked to report the flagship binary. It assertsgrant_agents == {"installed:gaia": [gmail.readonly]}.tests/unit/run: 17,376 passed. The 32 failures and 8 collection errors are all environmental on this runner (missingcvss,responses,dateutil,sherpa_onnx,fitz,matplotlib, or a read-only site-packages / step-summary file). None touch connectors or sidecars.