fix: env-gather autodetect sees as_needed secrets (#1447) - #1452
Closed
ptone wants to merge 2 commits into
Closed
Conversation
…edKeys (#1447) When a harness has default_type: oauth-token (e.g. antigravity) and GEMINI_API_KEY is stored as an as_needed hub secret, autodetect could not see the key — it was filtered from ResolvedSecrets before the broker ran, so autodetect fell back to oauth-token (no env requirements), the hub's pass-2 was never asked for the key, and the agent started without credentials. Fix: add AvailableAsNeededKeys to the create-agent request. The hub populates it with the target key names of as_needed env-type secrets that were filtered out of ResolvedSecrets. The broker's autodetect includes these keys when probing for env-var-based auth types, closing the chicken-and-egg gap. Changes: - Add AvailableAsNeededKeys field to CreateAgentRequest (broker) and RemoteCreateAgentRequest (hub) - Extend resolveSecrets() to return filtered as_needed key names as a second return value - Populate req.AvailableAsNeededKeys in buildCreateRequest - Include AvailableAsNeededKeys in broker's resolvedEnvKeys for env-var autodetect - Add regression tests for both the fix and the pre-fix fallback
Owner
Author
Code Review: APPROVE — Risk LOW(Self-approval blocked by GitHub; posting as comment.) Targeted, well-structured fix for the P0 chicken-and-egg bug (#1447). The change is narrow, correct, backward-compatible, and well-tested. FindingsNo Critical or Required findings. Nit: What I verified
Gates run
|
Address Gemini review feedback on PR GoogleCloudPlatform#1483: our new test functions should use the canonical `projectPath` JSON key, not the legacy `grovePath`.
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.
Summary
Fixes #1447 — P0 bug that breaks all antigravity agents on single-node when
GEMINI_API_KEYis anas_neededhub secret.AvailableAsNeededKeysfield toCreateAgentRequest(broker) andRemoteCreateAgentRequest(hub) — carries the target key names ofas_neededenv-type secrets that the hub filtered out ofResolvedSecretsresolveSecrets()to return the filtered as_needed key names alongside the resolved secretsreq.AvailableAsNeededKeysinbuildCreateRequestso the broker receives the deferred keysAvailableAsNeededKeysin the broker'sresolvedEnvKeysset during env-var autodetect, closing the chicken-and-egg gap where autodetect only saw already-resolved keysRoot cause
When a harness has
default_type: oauth-tokenandGEMINI_API_KEYis stored asas_needed:resolveSecrets()correctly filters outas_neededenv-type secretsresolvedEnvKeys— butGEMINI_API_KEYis in neitherResolvedEnvnorResolvedSecretsdefault_type(oauth-token), which has no env requirementsTest plan
go build ./...passesgo vet ./...passesgofmt -lproduces no output for changed filesgo test ./pkg/runtimebroker/...passes (all tests including 2 new regression tests)go test ./pkg/hub -run 'TestResolveSecrets|TestBuildEnvGather'passes (all resolve/gather tests)TestEnvGather_AvailableAsNeededKeys_AutodetectAPIKeyverifies autodetect selects api-key auth when GEMINI_API_KEY is in AvailableAsNeededKeysTestEnvGather_NoAvailableAsNeededKeys_FallsBackToDefaultverifies pre-fix fallback behavior (no AvailableAsNeededKeys → oauth-token default)TestResolveSecrets_HubScope_AsNeeded_Filteredextended to verify asNeededKeys return value