Skip to content

fix(lk): say which env credentials --user-auth ignores - #1074

Merged
Topherhindman merged 1 commit into
mainfrom
fix/lk-user-auth-env-keys-note
Oct 23, 2026
Merged

Topherhindman merged 1 commit into
mainfrom
fix/lk-user-auth-env-keys-note

Conversation

@Topherhindman

@Topherhindman Topherhindman commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

LIVEKIT_* credentials in the environment don't switch lk's auth mode, so with --user-auth a command acting through the session silently left a set LIVEKIT_URL, LIVEKIT_API_KEY or LIVEKIT_API_SECRET unused. lk now names the ones it's ignoring, once, after the "Using user" line on stderr: Ignoring LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET from environment (--user-auth uses your session).

Agent runs (lk agent dev, lk agent start, the debugger's --audio) are the exception. resolveCredentials hands environment credentials to the agent even under --user-auth, so those runs don't get the note.

Something to look at separately: when only some of those env vars are set, resolveCredentials pairs the shell's API key with the session project's URL, which may belong to a different project. It counts env-sourced values as explicit (explicitCredentials reads IsSet). This PR doesn't change that.

Testing:

  • TestAnnounceUserNamesIgnoredEnvCredentials checks the note for all three variables, for one, for none, and that agent runs don't get it.
  • env-keys-with-user-auth.txtar drops its known-bug skip and matches the full line.
  • The rest of cmd/lk passes.

@Topherhindman
Topherhindman force-pushed the auth-tests/lk-auth-scripts branch from 81c5844 to 7d625e4 Compare October 23, 2026 17:11
@Topherhindman
Topherhindman force-pushed the fix/lk-user-auth-env-keys-note branch from 7ad81a8 to 1e205a2 Compare October 23, 2026 17:11
@Topherhindman
Topherhindman force-pushed the auth-tests/lk-auth-scripts branch from 7d625e4 to e07a424 Compare October 23, 2026 17:53
@Topherhindman
Topherhindman force-pushed the fix/lk-user-auth-env-keys-note branch from 1e205a2 to d8697c9 Compare October 23, 2026 17:53
Base automatically changed from auth-tests/lk-auth-scripts to main October 23, 2026 19:24
LIVEKIT_* credentials in the environment don't switch lk's auth mode,
so with --user-auth a command acting through the session silently left
a set LIVEKIT_URL, LIVEKIT_API_KEY or LIVEKIT_API_SECRET unused. lk now
names the ones it's ignoring, once, after the "Using user" line on
stderr.

Agent runs are the exception: resolveCredentials hands environment
credentials to the agent even under --user-auth, so they don't get the
note.
@Topherhindman
Topherhindman force-pushed the fix/lk-user-auth-env-keys-note branch from d8697c9 to e29b920 Compare October 23, 2026 19:39
@Topherhindman
Topherhindman merged commit ad6cd13 into main Oct 23, 2026
25 checks passed
@Topherhindman
Topherhindman deleted the fix/lk-user-auth-env-keys-note branch October 23, 2026 20:25
Comment thread cmd/lk/user_auth_test.go
// TestAnnounceUserNamesIgnoredEnvCredentials checks the note announceUser adds
// for LIVEKIT_* credentials in the environment that --user-auth leaves unused,
// and that commands handing them to an agent don't get it.
func TestAnnounceUserNamesIgnoredEnvCredentials(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary because we also have an e2e test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants