Repository navigation
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
@googlebot I signed it! |
LegaSage
force-pushed
the
pr/credential-resolution
branch
2 times, most recently
from
September 11, 2026 19:24
0fdf19e to
4af83a6
Compare
An `.env` with `GOOGLE_API_KEY=` / `GEMINI_API_KEY=` (names present, values
empty) made `Settings.GOOGLE_API_KEY` a falsy `SecretStr("")` instead of None:
the placeholder sanitizer was guarded by `if val and ...`, which short-circuits
on the empty secret it is meant to drop. The Google provider check then raised
"Planner requires GOOGLE_API_KEY in .env", which reads as "the variable is
missing" even though the line is right there in the file — the wrong debugging
path.
- settings.fallback_api_keys: normalize on `is not None`, so empty/placeholder
credentials always become None.
- llm.validate_provider: every missing-credential error now names the dotenv
file that was actually loaded, lists the accepted aliases (GEMINI_API_KEY /
GCP_API_KEY for Google), and distinguishes <unset> from <present but
empty/placeholder>. No key material is ever included.
- tests/unit/config/test_credential_resolution.py pins all of it.
`load_dotenv` skips any variable already present in the process environment, blank included. The ARTEMIS daemon was started while `.env` still had `GEMINI_API_KEY=` / `GOOGLE_API_KEY=` empty, so it exported the blanks and every child runner it spawned inherited them — filling in `.env` afterwards changed nothing until the whole daemon was restarted, and the failure looked like "the key is not in .env". Blank carries no information, so drop blank credential vars from os.environ before the dotenv load and let the file win; a non-blank inherited value still takes precedence. Verified live: an ARTEMIS task that failed at the planner credential check ran past it on the same unrestarted daemon after this change.
LegaSage
force-pushed
the
pr/credential-resolution
branch
from
September 11, 2026 19:28
4af83a6 to
58dabd5
Compare
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.
Problem
.env.exampleshipsGOOGLE_API_KEY=andGEMINI_API_KEY=as blank lines. When a user leaves a value empty (or edits.envwhile the daemon is already running), the planner fails with:which says the variable is missing when it is present and empty. Three things stack up:
fallback_api_keyssanitizes placeholders underif val and is_placeholder_key(val). Pydantic'sSecretStr("")is falsy, so an empty secret skips the check and survives as a non-NoneemptySecretStr; theGEMINI_API_KEYalias never applies.validate_providerraises a bare message that cannot distinguish "unset" from "present but empty/placeholder".load_dotenvnever overrides a variable already in the environment, blank included. A daemon started with blank vars exports the blanks to every runner it spawns, so a corrected.envstays invisible until the whole daemon restarts.Fix
None, so the existing alias chain (GEMINI_API_KEY→GOOGLE_API_KEY→GCP_API_KEY) works.<unset>vs<present but empty/placeholder>. Key material is never printed.Tests
tests/unit/config/test_credential_resolution.py(7 tests). The core assertion fails onmain:Settings(_env_file=None)withGOOGLE_API_KEY=""yields aSecretStronmainandNonewith this change.Found while running ARTEMIS from an MCP server whose
.envhad both key lines present and empty; the next task ran past the credential gate on the same, un-restarted daemon after this change.