Skip to content

fix(simulate): offer lk cloud auth when no project is linked - #1045

Open
u9g wants to merge 2 commits into
mainfrom
jason/simulate-auth-prompt
Open

u9g wants to merge 2 commits into
mainfrom
jason/simulate-auth-prompt

Conversation

@u9g

@u9g u9g commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Problem

On a fresh install with no project linked, lk agent simulate text (the dashboard's getting-started command) exits 1 with only:

api-key is required

Nothing tells the user to run lk cloud auth. This failure happens on the client before any request reaches the server, so server-side telemetry never records it. Other agent commands like lk agent create and lk agent deploy instead offer to authenticate.

The cause: loadSimulateProject resolved credentials with loadProjectDetails, which has no fallback when nothing resolves. The other agent commands go through requireProject, which does.

Fix

loadSimulateProject now resolves through requireProject. Affected commands: simulate text, audio, view and export.

Situation Before After
Terminal, no project linked api-key is required "No local projects found. Authenticate one?" prompt, which runs the lk cloud auth flow and continues with the new project
Non-interactive (CI, piped), no project api-key is required no projects configured; run 'lk cloud auth' in an interactive terminal or set --project
Several projects linked, none default api-key is required Project picker

Anything that already resolved still resolves the same way: --project, env/flag credentials, livekit.toml, and the default project. --experimental-auth is still rejected, by the same experimentalAuthGate.

Verification

  • go test ./cmd/lk/ passes.
  • Ran in agent-starter-python with an empty HOME, comparing main with this branch:
    • TTY: main prints api-key is required. This branch shows the authenticate prompt, and Enter starts the lk cloud auth device flow.
    • Non-TTY: this branch prints the lk cloud auth / --project message.
    • LIVEKIT_URL/LIVEKIT_API_KEY/LIVEKIT_API_SECRET env: unchanged. It prints "Using url, api-key, api-secret from environment" and starts the agent with no prompt.

`lk agent simulate text|audio|view|export` resolved credentials with
loadProjectDetails, so a fresh install got a bare "api-key is required".
Resolve through requireProject like the other agent commands: a terminal
prompts to authenticate, and a non-interactive run says to run
`lk cloud auth` or set --project.
@u9g

u9g commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

On a fresh install with no linked project: main prints a bare api-key is required, this branch prompts to authenticate with lk cloud auth, and a non-interactive run says to run lk cloud auth or set --project.

sim-auth-prompt.mp4

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.

1 participant