-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix: resolve secrets from local sources when hub lookup fails #8892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: resolve secrets from local sources when hub lookup fails #8892
Conversation
Fixes issue where ANTHROPIC_API_KEY and other secrets were not found even when available in process.env or .env files. Changes: - Improved CLIPlatformClient.resolveFQSNs() to check local sources (process.env and .env files) as fallback when API returns not found - Fixed secret type for process.env secrets to use ProcessEnv instead of LocalEnv for consistency with LocalPlatformClient - Added proper error handling to continue checking local sources even when API call fails - Added bounds checking for API results array This ensures secrets are resolved from local environment variables and .env files when not configured in the hub, preventing the 'We couldn't find a secret with the name' error. Fixes continuedev#8890
|
Keep this PR in a mergeable state → Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
|
I have read the CLA Document and I hereby sign the CLA 0 out of 2 committers have signed the CLA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 1 file
|
Let me know if you'd like any changes or additional tests. |
|
Reviewed the changes - this is an internal bug fix that improves secret resolution fallback behavior. No documentation updates needed as this restores expected functionality rather than introducing new features. The existing docs already cover environment variable usage in the onboarding flow. |
Add tests covering: - Fallback to local sources when Hub API returns not found - Fallback to local sources when Hub API call fails - Proper handling of API results with fewer elements than requested - Correct SecretType.ProcessEnv usage for process.env secrets - Empty string handling for environment variables - Edge cases with null/undefined API results Co-authored-by: nate <[email protected]> Generated with Continue (https://continue.dev)
|
Added comprehensive test coverage for the secret resolution changes in Test Coverage:
The tests verify the core fix: secrets now properly fallback to local sources when Hub lookup fails, preventing false "secret not found" errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aadityagawai we already support falling back to env secret loading for the CLI, could you clarify what this PR changes?
See existing findSecretInProcessEnv
|
Closing this for now since stale, @Aadityagawai feel free to reopen! |
Fixes #8890
Problem
The error "We couldn't find a secret with the name 'ANTHROPIC_API_KEY'" appeared even when the secret was available in
process.envor.envfiles. The client failed as soon as the Hub lookup returned "not found", without checking any local sources.Solution
CLIPlatformClient.resolveFQSNs()to fallback to local sources (process.env and .env files) when Hub lookup fails.ProcessEnvinstead ofLocalEnv.Testing
.envfiles when they don't exist in the Hub.Notes
This improves developer workflows and prevents false "secret not found" errors when running Continue locally.
Summary by cubic
Resolve secrets from local sources when Hub lookup fails. Prevents false “secret not found” errors (e.g., ANTHROPIC_API_KEY) when the secret exists in process.env or .env.
Written for commit 12e4884. Summary will update automatically on new commits.