Repository navigation
fix(cli): apply connect credentials to the agent server - #7929
Merged
longcw merged 1 commit intoOct 19, 2026
Merged
Conversation
The connect command parsed --url/--api-key/--api-secret but only used them for the room API, so simulate_job built the job token and join URL from server construction-time/env values. With no env credentials the simulated job raised 'api_key and api_secret must be set'; with different env credentials the agent joined the env deployment instead of the room created via the flags. Apply the CLI values via server.update_options() before running the server, mirroring _run_worker (start/dev).
longcw
approved these changes
Oct 19, 2026
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.
fix(cli): apply connect credentials to the agent server
What breaks
The legacy
connectcommand parses--url/--api-key/--api-secretbut uses them only to talk to the room API (api.LiveKitAPI(url, api_key, api_secret)). Unlikestart/dev, which apply CLI values viaserver.update_options(...),connectnever updates theAgentServer— soserver.simulate_jobbuilds the job's connection from construction-time/env values. With noLIVEKIT_URL/LIVEKIT_API_KEY/LIVEKIT_API_SECRETin the environment (or with different env credentials), the simulated job carries empty/wrong credentials and the agent cannot join the room.Fix
In
connect, before server startup, build a kwargs dict from truthyurl/api_key/api_secretand callserver.update_options(**kwargs)— mirroring_run_worker(cli.py).simulate_jobthen mints its token/join URL from the same credentials used for the room API, and skipped flags still fall back to env values.Tests
tests/test_cli_connect_options.pydrives the command through the existing_build_cli(server)/CliRunnerpattern with fakedLiveKitAPI,server.runandsimulate_job, asserting the server's_ws_url/_api_key/_api_secretare the CLI values atsimulate_jobtime.assert [('', '', '')] == [('ws://flag-host:7880', 'cli-key', 'cli-secret')](the job connection was built before applying the flags).