Repository navigation
fix(lk): agent runs with --dev and a full key set are an error - #1090
Open
Topherhindman wants to merge 1 commit into
Open
Topherhindman wants to merge 1 commit into
Topherhindman wants to merge 1 commit into
Conversation
resolveCredentials skips the project lookup when the URL, API key and secret are all given, from flags or LIVEKIT_* env vars. That lookup is where #1084 made --dev with an API key or secret an error, so `lk agent dev --dev` and `lk agent start --dev` in a shell with all three set quietly ran the agent against the env's server with the env's key, instead of the dev server. With only some of them set, they already failed. resolveCredentials now checks --dev against the key and secret before it decides whether to look anything up, and returns the same error, e.g. "--dev can't be combined with API key credentials; unset LIVEKIT_API_KEY and LIVEKIT_API_SECRET or drop --dev". The debugger's --audio run goes through it too. --dev alone, or with --url, is unchanged.
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.
Fixes DEVX-902
#1084 made
--devwith an API key or secret an error, but the check is in project resolution.lk agent devandlk agent startskip project resolution when the URL, API key and secret are all given, from flags or fromLIVEKIT_URL,LIVEKIT_API_KEYandLIVEKIT_API_SECRET. So in a shell with all three set,--devwas ignored and the agent got the env's server and key:With only some of them set, the agent commands already failed with #1084's error. Now they fail with a full set too:
It says "remove --api-key and --api-secret" when the values come from the flags. The debugger's
--audiorun uses the same code, so it gets the fix too.--devalone, or with--url, is unchanged, and so is a full set of credentials without--dev.Tests:
TestResolveCredentials_DevWithCredentialsIsAnError: a full set from env, a full set from flags, and an env key alone all fail with the message. The first two fail on main.TestResolveCredentials_DevAlone:--devand--dev --urlstill give the agentdevkeyandsecret.agent-dev-with-env-credentials.txtar):lk agent dev --devandlk agent start --devwith all three env vars, andlk agent start --devwith all three flags, fail with the message and send no request. It fails on main.go build ./...,go vet ./...andgo test ./...pass.