Skip to content

implement CLI serverInfo protocol#2015

Open
davidzhao wants to merge 2 commits into
mainfrom
dz/cli-serverinfo
Open

implement CLI serverInfo protocol#2015
davidzhao wants to merge 2 commits into
mainfrom
dz/cli-serverinfo

Conversation

@davidzhao

Copy link
Copy Markdown
Member

allows the agent to exchange data with lk CLI in dev mode lk agent dev <agent.js>

@davidzhao davidzhao requested a review from a team as a code owner July 9, 2026 22:35
@changeset-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: dcf8eef

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-anthropic Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-cerebras Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-did Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-fishaudio Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-hedra Patch
@livekit/agents-plugin-hume Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-liveavatar Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-minimax Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-mistralai Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-perplexity Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-runway Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-soniox Patch
@livekit/agents-plugin-tavus Patch
@livekit/agents-plugins-test Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

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.

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread agents/src/cli_client.ts
logger.warn('invalid --cli-addr, skipping dev channel');
return;
}
const host = this.#cliAddr.slice(0, sep);

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.

🟡 IPv6 addresses with brackets fail to connect because brackets are not stripped before passing to the socket library

The extracted host retains square brackets (host = this.#cliAddr.slice(0, sep) at agents/src/cli_client.ts:41) when the CLI address uses the standard bracketed IPv6 format (e.g. [::1]:8080), so the connection silently fails because Node's net module does not accept bracketed hosts.

Impact: When the driving lk CLI listens on an IPv6 address, the agent silently fails to report its server info to the dev channel.

Bracket-stripping omission in IPv6 host parsing

The code at agents/src/cli_client.ts:34-42 splits on the last colon to separate host and port, which correctly identifies the port separator for bracketed IPv6 like [::1]:8080. However, the resulting host value is [::1] (with brackets). Node.js's net.createConnection({ host, port }) passes the host to DNS lookup, which does not strip brackets — it expects a raw IP address or hostname.

The fix would be to strip leading [ and trailing ] from the host after slicing:

let host = this.#cliAddr.slice(0, sep);
if (host.startsWith('[') && host.endsWith(']')) {
  host = host.slice(1, -1);
}

The Go CLI (which sets --cli-addr) uses Go's net.Listen which formats IPv6 addresses with brackets (e.g. [::]:12345), making this a realistic scenario on dual-stack systems.

Suggested change
const host = this.#cliAddr.slice(0, sep);
let host = this.#cliAddr.slice(0, sep);
if (host.startsWith('[') && host.endsWith(']')) {
host = host.slice(1, -1);
}
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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