Skip to content

Gate the dev-channel flag on the installed agents SDK version#901

Merged
davidzhao merged 5 commits into
dz/fix-node-devfrom
jl/dev-channel-flag-gate
Jul 10, 2026
Merged

Gate the dev-channel flag on the installed agents SDK version#901
davidzhao merged 5 commits into
dz/fix-node-devfrom
jl/dev-channel-flag-gate

Conversation

@u9g

@u9g u9g commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Stacked on #900's branch (dz/fix-node-dev). Three commits, best reviewed in order:

  1. remove dead nil checks on devSrvdevSrv is now created unconditionally, so the nil guards in acceptSession/Run were dead (plus an em-dash comment normalization).
  2. move interpreter-based SDK version resolution to pkg/agentfs — pure relocation, no behavior change: the Python/Node binary finders and installed-version probes move out of cmd/lk as exported functions with agentfs.ResolveInstalledSDKVersion as the shared entry point.
  3. pick the dev-channel flag from the installed SDK version — the fix this enables. An SDK must not be handed a flag it predates: Node's commander CLI hard-errors on unknown options, so every released @livekit/agents (≤ 1.5.0) dies at startup when passed --cli-addr (reproduced: error: unknown option '--cli-addr', exit 1, on every start and reload). The installed version is resolved via the project's own runtime (accurate for pnpm/workspace symlinks and loose constraints) and the flag chosen from it:
runtime SDK new enough otherwise
Python --cli-addr (≥ 1.6.6) legacy --reload-addr
Node --cli-addr (≥ 1.5.1) no flag (dev works, minus the dev channel)

Undetermined versions always take the safe branch. The cutover constants (1.6.6 / 1.5.1) are placeholders for the first releases that actually ship --cli-addr support — bump them when those land.

Verified end-to-end: agent-starter-node on released 1.4.11 (hard-failed before) now starts cleanly with no flag; agent-starter-python on 1.6.0 still gets --reload-addr and runs. Unit tests cover the flag choice matrix.

u9g added 5 commits July 9, 2026 20:10
Also normalizes an em dash in a nearby comment.
Pure relocation, no behavior change: the Python/Node binary finders and
installed-version probes (plus the embedded node_resolve_version.js)
move from cmd/lk into pkg/agentfs as exported functions, with
agentfs.ResolveInstalledSDKVersion as the shared entry point, so
callers outside the startup checks can reuse the resolver.
An SDK must not be handed a flag it predates: Node's CLI hard-fails on
unknown options, so every released @livekit/agents (<= 1.5.0) dies at
startup when passed --cli-addr. Resolve the installed agents version
via the project's own runtime and choose accordingly — --cli-addr when
positively at/above the first supporting release (1.6.6 Python, 1.5.1
Node, placeholders until those releases exist), otherwise the legacy
--reload-addr for Python and no flag at all for Node. Undetermined
versions always take the safe branch.
On Windows CI runners the first node.exe spawn can take several seconds
(Defender scans the binary on first exec), which blows the SDK version
probe's 5s timeout inside startAgent — the test then fails with
'@livekit/agents not found' at exactly 5.04s before the crash-signal
behavior under test ever runs (same flake seen on main). Spawn a
throwaway Node process first to absorb the cold start.
@davidzhao davidzhao merged commit fc28243 into dz/fix-node-dev Jul 10, 2026
9 checks passed
@davidzhao davidzhao deleted the jl/dev-channel-flag-gate branch July 10, 2026 11:54
davidzhao added a commit that referenced this pull request Jul 10, 2026
* fix `lk agent dev` with Agents-JS

JS agents will also support the OnServerStart protocol

* Gate the dev-channel flag on the installed agents SDK version (#901)

* remove dead nil checks on devSrv, now created unconditionally

Also normalizes an em dash in a nearby comment.

* move interpreter-based SDK version resolution to pkg/agentfs

Pure relocation, no behavior change: the Python/Node binary finders and
installed-version probes (plus the embedded node_resolve_version.js)
move from cmd/lk into pkg/agentfs as exported functions, with
agentfs.ResolveInstalledSDKVersion as the shared entry point, so
callers outside the startup checks can reuse the resolver.

* pick the dev-channel flag from the installed SDK version

An SDK must not be handed a flag it predates: Node's CLI hard-fails on
unknown options, so every released @livekit/agents (<= 1.5.0) dies at
startup when passed --cli-addr. Resolve the installed agents version
via the project's own runtime and choose accordingly — --cli-addr when
positively at/above the first supporting release (1.6.6 Python, 1.5.1
Node, placeholders until those releases exist), otherwise the legacy
--reload-addr for Python and no flag at all for Node. Undetermined
versions always take the safe branch.

* remove agent_watcher_test.go

* pre-warm node in TestAgentProcessFailSignal to avoid probe timeout

On Windows CI runners the first node.exe spawn can take several seconds
(Defender scans the binary on first exec), which blows the SDK version
probe's 5s timeout inside startAgent — the test then fails with
'@livekit/agents not found' at exactly 5.04s before the crash-signal
behavior under test ever runs (same flake seen on main). Spawn a
throwaway Node process first to absorb the cold start.

---------

Co-authored-by: u9g <jason.lernerman@livekit.io>
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