Skip to content

Merge upstream main (livekit-ffi 0.16.0) into the RootApp fork (hw.12) - #1

Merged
JesseDietrichson merged 42 commits into
rootapp/mainfrom
rootapp/sync-upstream-2026-11-26
Nov 26, 2026
Merged

JesseDietrichson merged 42 commits into
rootapp/mainfrom
rootapp/sync-upstream-2026-11-26

Conversation

@JesseDietrichson

Copy link
Copy Markdown

Brings rootapp/main up to upstream main through livekit-ffi 0.16.0: 39 commits since the last sync at ab3711a (5 November).

  • libwebrtc stays webrtc-a545de4.
  • The FFI proto is unchanged, so the desktop's generated C# doesn't need regenerating.

Upstream highlights

Conflicts

Nine files. In each, the fork's behaviour is kept and upstream's goes on top; the merge commit f5d21d7 has the details.

  • Start bitrate: still set through SetBitrate (BitratePreferences). Upstream's x-google-start-bitrate munging is not taken.
  • Opus NACK: goes on single-PC offers, including the initial offer, after the stereo munging (munge_single_pc_offer), and on dual-PC answers after the fork's stereo munging.
  • FFI video: a tightly packed decoder I420 buffer still backs the handle without a copy (shared_i420_info). Every other frame converts into upstream's reused FrameBuffers, and the I420 pool stays.
  • Joining both sides:
    • create_sender_for_pc calls the fork's sender setup.
    • prepare_publish carries the fork's stereo and DTX flags.
    • The track constructors combine the fork's API with upstream's with_runtime.
    • Stream-state handling sits next to upstream's deferred publication events.
    • The log sink keeps its settable level and uses upstream's level mapping.

Verification

  • The RootApp FFI workflow built all six RIDs on this branch, and the debug-file check passed: run 45885592323.
  • A first run caught one test-module brace the merge dropped; 659179c fixes it.
  • Calls haven't been tested yet. That happens in the desktop app with hw.12.

After merging, rootapp-ffi/v0.16.0-hw.12 gets tagged from rootapp/main, and ROOTAPP-BUILD.md has an hw.12 entry.

🤖 Generated with Claude Code

pblazej and others added 30 commits November 6, 2026 13:55
## Summary

- Compile LiveKitFFI independently in Swift 5, matching SPM and allowing
Swift 6 hosts without inheriting their language mode.
- This fixes FFI pod metadata; separate Swift SDK CocoaPods Swift 6
issues remain outside this PR.

## Code changes

- Add `spec.swift_versions = ['5.0']` to the release podspec template.
- Add an FFI patch changeset so Knope prepares 0.13.5 and synchronizes
all nine versioned files; manifests remain at 0.13.4 until release
preparation.
- Verified real Tera output, CocoaPods parsing, Ruby syntax, formatting,
changeset coverage, version/base consistency, and the Knope dry run.
Consumer builds were not rerun.

---------

Co-authored-by: omnigent <noreply@omnigent.ai>
Part of CLTCU-19. First of three; the others are the dropped-frame
counter and video buffer reuse.

The libwebrtc log sink discarded the severity argument and logged
everything at `Debug`:

```rust
new_log_sink(|msg, _| { log::debug!(target: "libwebrtc", "{}", msg); })
```

So **every libwebrtc warning and error has been filtered out by default
in every SDK**. That is how a customer hitting a decoder-side problem
sends us logs with nothing in them — we were attributing the silence to
stdout-vs-stderr, and the messages were never getting out at all.

Severity is mapped through now:

| libwebrtc | `log` | why |
|---|---|---|
| `LS_ERROR` | `Error` | made visible |
| `LS_WARNING` | `Warn` | made visible |
| `LS_INFO` | `Debug` | unchanged in practice |
| `LS_VERBOSE` | `Trace` | unchanged in practice |

Verbose and info deliberately move *down* rather than to their nominal
levels: libwebrtc emits both very heavily and the sink is installed at
`LS_VERBOSE`, so promoting info would flood anyone who displays it. Only
the two levels that matter change behaviour.

Three tests pin the mapping, including that the noisy levels stay below
`Info`. `cargo test -p libwebrtc`: 30 pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…vider (livekit#1517)

### Summary
Fixes livekit#1280.

In KeyProvider, passing an out-of-range key index (< 0 or >=
key_ring_size) previously caused the native WebRTC frame cryptor layer
to trigger an assertion crash (SIGABRT). Furthermore, setting
key_ring_size > 255 silently failed to allocate key rings in libwebrtc.

### Changes
1. **Bounds Checking:**
- In native WebRTC (webrtc-sys/include/livekit/frame_cryptor.h): Track
key_ring_size_ in KeyProvider. Guard set_shared_key, atchet_shared_key,
get_shared_key, set_key, atchet_key, and get_key to verify index >= 0 &&
index < key_ring_size_. If out of bounds, return alse or an empty vector
gracefully instead of asserting.
- In libwebrtc/src/native/frame_cryptor.rs: Added bounds check guards
for key operations.
- In livekit/src/room/e2ee/key_provider.rs: Updated set_shared_key and
set_key to return �ool indicating whether the key was successfully set,
and only update latest_key_index when the index was within bounds.
2. **Key Ring Size Clamping & Constants:**
- Clamped options.key_ring_size to 1..=MAX_KEY_RING_SIZE (255) in both
webrtc-sys and libwebrtc.
- Exposed DEFAULT_KEY_RING_SIZE = 16 and MAX_KEY_RING_SIZE = 255 in
libwebrtc::frame_cryptor and livekit::room::e2ee.
- Added key_ring_size() getter across layers to query the active ring
capacity.
3. **Tests & Changeset:**
- Added unit tests in webrtc-sys, libwebrtc, and livekit covering
out-of-bounds rejection, clamping, and default options.
   - Added knope changeset in .changeset/key_provider_bounds_check.md.
livekit#1480)

## Summary

How batches leave the device and where they go. The core classifies
every answer itself; the backend contract, row by row with its tests, is
in livekit#1484.

## Changes

- `TelemetryTransport`: moves encoded batches and returns status,
headers and body
- `NetTransport` over `livekit-net` (feature `net`)
- Destinations: the ingest URL derived from a Room's server URL (LiveKit
Cloud only, parsed with WHATWG rules)
- Credentials: the token's unverified grant and expiry, keyed by project
and session
- `LK_TELEMETRY_ENDPOINT` points uploads at a local collector
- `SPEC.md`: *Destination and credentials*
- A server URL that is not on LiveKit Cloud gets a routing key of its
own (scheme, host and port), so it never revives or silences a Cloud
project's token
- A Cloud host must be a DNS host name, and every routing key is a valid
file name on every platform, because it ends each cached batch's id
- The core alone reads the Cloud "disabled" answer, matched on the whole
body; `ExportError` has no `Disabled` variant
- The native `livekit-net` client no longer follows a redirect that
changes the scheme, so `Authorization` never reaches a plaintext URL
- In the crate's first stage: a record carries each attribute key once
(the last value wins) and one `otel.event.name`, and report counts
saturate instead of wrapping

<details><summary><b>Verification</b></summary>

At `3e68d917`, from a clean checkout (CI's test workflow also runs on
this PR because it targets `main`; there is no clippy job in CI):

- `cargo fmt --check`
- `cargo clippy -p livekit-telemetry --all-targets -- -D warnings`, also
with `--all-features` and as a `cargo hack --feature-powerset --depth 2`
run
- `cargo test -p livekit-telemetry`: 56 unit, 0 doc
- `cargo test -p livekit-net --features native`, and its `cargo hack
--feature-powerset --depth 2` clippy run
- `RUSTDOCFLAGS="-D warnings" cargo doc -p livekit-telemetry --no-deps`
reports only the unresolved link to `Telemetry::stats` in `stats.rs`,
which `main` (`6473ec17`) has too; livekit#1483 adds the item

</details>

### Migration: `TransportError::ResponseTooLarge`

The new variant breaks Rust code that matches `TransportError`
exhaustively, and Swift `switch` or Kotlin `when` statements over the
generated `TransportError`. Add a case for it.

The livekit-net 0.2 types reach other public APIs, so these crates
receive a pre-1.0 minor-version increase (the `major` changeset label):

- `livekit-signaling`: `From<TransportError>` for `SignalError`.
Signaling maps the new variant to `SignalError::Connection`.
- `livekit-token-source`: `TokenSourceError::Transport`.
- `livekit-telemetry`: `From<HttpResponse>` for `ExportResponse`, with
the `net` feature.
- `livekit`: `From<RoomSdkOptions>` for the signaling
`SignalSdkOptions`.
- `livekit-capture`: returns `livekit` types such as
`TrackPublishOptions`.

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: omnigent <noreply@omnigent.ai>
Co-authored-by: Codex <codex@openai.com>
## Summary

The write-ahead cache between the exporter and the transport.

## Changes

- `BatchCache` with `MemoryCache` and `FileCache` (`storage_dir`)
- A batch is committed once its file is fsynced and renamed and the
directory fsynced
- Bounded by size and count, every eviction reported
- A 413 split is replaced in one transaction
- `SpillCache`: keeps a batch the disk refused in memory, and takes no
write after the opt-out
- Test-only fault hooks that fail or crash every write, fsync, rename,
delete and publish
- `FileCache` keeps the newest batch, as `MemoryCache` does, so a batch
larger than the cap still gets its upload attempt
- An eviction whose directory sync fails still counts the batch once its
file is gone
- `remove` and `clear` treat a directory that the OS purged as empty, so
an opt-out succeeds; `clear` also deletes a stray `.tmp` and reports a
delete that fails
- A push holds the process-wide directory lock while it writes, so a
second cache on the same directory never sweeps away its `.tmp`
- A rebinding `replace` with more than one member is rejected before
anything is written

<details><summary><b>Verification</b></summary>

At `1371f6c6`, from a clean checkout (CI's test workflow runs only for
PRs into `main`, so these were run locally; there is no clippy job in
CI):

- `cargo fmt --check`
- `cargo clippy -p livekit-telemetry --all-targets -- -D warnings`, also
with `--all-features` and as a `cargo hack --feature-powerset --depth 2`
run
- `cargo test -p livekit-telemetry`: 77 unit, 0 doc
- `RUSTDOCFLAGS="-D warnings" cargo doc -p livekit-telemetry --no-deps`
reports only the unresolved link to `Telemetry::stats` in `stats.rs`,
which `main` (`6473ec17`) has too; livekit#1483 adds the item

</details>

---------

Co-authored-by: omnigent <noreply@omnigent.ai>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
## Summary

What the host reports and what the core does with it. The device
contract, row by row with its tests, is in livekit#1485.

## Changes

- `DeviceState` (thermal, power, memory, battery, network, lifecycle):
the `lk.device.*.changed` events, a cadence factor of up to 4×, and soft
and hard upload holds
- `DeviceEvent`: audio route changes, interruptions and capture failures
- RTC stats: one raw `getStats()` report per track or peer connection
mapped to samples, simulcast layers folded into one series, windowed on
device into `lk.rtc.stats.sample`
- `SPEC.md`: the cadence policy
- Inbound RTT comes from the candidate pair the transport selected,
never from a stale pair listed first
- A reading without the CPU limitation counter keeps the previous
baseline, so it no longer looks like CPU pressure
- Each poll is read as a whole: every field takes the largest value its
streams report, whatever their order, and a NaN or infinite number
counts as no reading
- Only a layered outbound track turns its bytes and packets into a
running total of stream growth; any other track, inbound included,
passes its counters through as reported
- A track keeps its layer and CPU state through a close that follows a
split
- `clear` counts a first poll that has not opened its window yet as one
purged record
- `SPEC.md` names the battery attributes the code sends (pinned by a
test), and the `lk.rtc.stats.sample` contract moves to this stage

<details><summary><b>Verification</b></summary>

At `4c3e79da`, from a clean checkout (CI's test workflow runs only for
PRs into `main`, so these were run locally; there is no clippy job in
CI):

- `cargo fmt --check`
- `cargo clippy -p livekit-telemetry --all-targets -- -D warnings`, also
with `--all-features` and as a `cargo hack --feature-powerset --depth 2`
run
- `cargo test -p livekit-telemetry`: 110 unit, 0 doc
- `RUSTDOCFLAGS="-D warnings" cargo doc -p livekit-telemetry --no-deps`
reports only the unresolved link to `Telemetry::stats` in `stats.rs`,
which `main` (`6473ec17`) has too; livekit#1483 adds the item

</details>

---------

Co-authored-by: omnigent <noreply@omnigent.ai>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
There is a community dotnet SDK which passes "dotnet" as SDK name:
https://github.com/pabloFuente/livekit-server-sdk-dotnet/blob/main/LivekitRtc/Internal/FfiClient.cs#L59

I added the field to the proto already:
https://github.com/livekit/protocol/blob/main/protobufs/livekit_models.proto#L644

I missed that we need some glue code in Rust for the v1 connection. This
PR adds it.
…m closes (livekit#1671)

A backport of the livekit/client-sdk-js#2251 change made to the js copy
of the rpc v2 code.

## Summary

When the local room closes, `RpcClientManager::fail_all_pending()`
failed every in-flight `perform_rpc` with `RecipientDisconnected`
(1503). That code means the *remote* participant left, so callers
couldn't tell "they left" apart from "I left".

This adds a new built-in `RpcErrorCode::ConnectionClosed` (1506,
"Connection closed") and uses it for the local room-close path. This
matches the corresponding JS SDK's update. `RecipientDisconnected` still
covers the remote participant leaving, including the 2s grace period
from livekit#1520.

## Testing
A duplicate of the test added to the web PR was also added to this PR in
the aims of keeping the test suites as close to identitcal as possible.

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…`main`, comments addressed) (livekit#1654)

Rebases livekit#1435 against `main`
and addresses reviewer comments.
See original PR for more context.

---------

Co-authored-by: LautaroPetaccio <lausuper@gmail.com>
…ivekit#1591)

Emit `Reconnecting` before tearing down remote participants on a full
reconnect. Beforehand the order was the other way around, making it
impossible to understand if a participant left on their own right before
the reconnect or because of the reconnect.

This is needed in preparation for the session API, but to me this also
makes sense in isolation.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
> [!IMPORTANT]
> Merging this pull request will create these releases

# livekit-protocol 0.8.3 (2026-11-13)
## Fixes

- Scope agent database access to a thread or a database:
`AgentThreadGrants` gains `sql`, and the new `agentDatabase` claim
(`AgentDatabaseGrants`) grants `read`, `write` and `delete` on listed
databases plus project-wide `create` and `list`.
`AgentGrants::database_admin` is removed, and `DatabaseClient` signs
each call with only the grant it needs. A thread's database id is its
thread id, so `Thread::database_id` is gone.
# livekit-common 0.1.7 (2026-11-13)
## Fixes

- Scope agent database access to a thread or a database:
`AgentThreadGrants` gains `sql`, and the new `agentDatabase` claim
(`AgentDatabaseGrants`) grants `read`, `write` and `delete` on listed
databases plus project-wide `create` and `list`.
`AgentGrants::database_admin` is removed, and `DatabaseClient` signs
each call with only the grant it needs. A thread's database id is its
thread id, so `Thread::database_id` is gone.
# livekit-api 0.10.2 (2026-11-13)
## Fixes

- Scope agent database access to a thread or a database:
`AgentThreadGrants` gains `sql`, and the new `agentDatabase` claim
(`AgentDatabaseGrants`) grants `read`, `write` and `delete` on listed
databases plus project-wide `create` and `list`.
`AgentGrants::database_admin` is removed, and `DatabaseClient` signs
each call with only the grant it needs. A thread's database id is its
thread id, so `Thread::database_id` is gone.
- Add an opt-in decoded HTTP response limit, used by telemetry export,
that reports an oversized response as the new
`TransportError::ResponseTooLarge` variant. Code that matches
`TransportError` exhaustively, in Rust or in the generated Swift and
Kotlin bindings, needs a case for it.
- Report the .NET SDK as `ClientInfo.SDK.DOTNET` in the join request.
The `dotnet` SDK name fell through to `UNKNOWN` on the single peer
connection path. - livekit#1669 (@MaxHeimbrock)
# livekit-wakeword 0.2.0 (2026-11-13)
## Breaking Changes

### Support LiveKit WakeWord v2 streaming models

`WakeWordModel` now runs v2 models: one stateful streaming `.onnx` file
per wake word,
exported by `livekit-wakeword train`, stepped every 80 ms of 16 kHz
audio. The API
matches the Python and Swift clients:

- `predict` takes PCM chunks of any size as they arrive and returns each
model's
highest score among the 80 ms steps the call completed (`0.0` if none).
State
  carries over between calls; there is no longer a 2 s window to buffer.
- `predict_clip` scores a whole clip from a fresh state.
- `reset` forgets all audio heard so far, e.g. after a detection.
- `unload_model` and `model_names` manage loaded models.
- `WakeWordModel::with_session_options` takes a `SessionOptions` (graph
optimization
level, intra/inter-op threads, sequential execution, thread spinning and
session
config entries), matching the Python client's `sess_options`. It applies
to every
  model, including ones a later `load_model` call adds.

`SessionOptions::default()` requests `GraphOptimizationLevel::Level3`.
On the
`ort-tract` backend, used on every target except aarch64 Windows, tract
optimizes the
graph only when a level is requested: the hey livekit model takes 2.0 ms
per 80 ms step
with optimization and 380 ms without, which is slower than real time.

On the native ONNX Runtime backend, `mlas.disable_kleidiai` defaults to
`"1"` unless
`config_entries` sets it, as in the Python client. This avoids wrong
results from
ONNX Runtime 1.27's KleidiAI kernels on arm64.

## Breaking changes

- v1 classifier models are not supported. `load_model` returns
  `WakeWordError::NotStreamingModel` for them; retrain the phrase with
  `livekit-wakeword train`.
- The bundled mel spectrogram and embedding models are removed, along
with the
`MEL_BINS`, `EMBEDDING_WINDOW`, `EMBEDDING_STRIDE`, `EMBEDDING_DIM` and
  `MIN_EMBEDDINGS` constants. `FRAME_SAMPLES` (1280) is new.
- `WakeWordError` gains `NotStreamingModel` and `ModelOutputMissing`.
# livekit-token 0.4.1 (2026-11-13)
## Fixes

- Scope agent database access to a thread or a database:
`AgentThreadGrants` gains `sql`, and the new `agentDatabase` claim
(`AgentDatabaseGrants`) grants `read`, `write` and `delete` on listed
databases plus project-wide `create` and `list`.
`AgentGrants::database_admin` is removed, and `DatabaseClient` signs
each call with only the grant it needs. A thread's database id is its
thread id, so `Thread::database_id` is gone.
# livekit 0.11.0 (2026-11-13)
## Breaking Changes

- Add an opt-in decoded HTTP response limit, used by telemetry export,
that reports an oversized response as the new
`TransportError::ResponseTooLarge` variant. Code that matches
`TransportError` exhaustively, in Rust or in the generated Swift and
Kotlin bindings, needs a case for it.
- When the local room closes, in-flight `perform_rpc` calls now fail
with `RpcErrorCode::ConnectionClosed` (1506) instead of
`RecipientDisconnected` (1503), which remains reserved for remote
participant departures.

## Fixes

- Scope agent database access to a thread or a database:
`AgentThreadGrants` gains `sql`, and the new `agentDatabase` claim
(`AgentDatabaseGrants`) grants `read`, `write` and `delete` on listed
databases plus project-wide `create` and `list`.
`AgentGrants::database_admin` is removed, and `DatabaseClient` signs
each call with only the grant it needs. A thread's database id is its
thread id, so `Thread::database_id` is gone.
- Fix remote participant and track leaks when closing a room, including
encrypted tracks, cancelled closure, and participant updates racing with
teardown.
- Handle out-of-range key indices gracefully in `KeyProvider` and clamp
`key_ring_size` to valid bounds.
- Log libwebrtc messages at their own severity instead of reporting
every one as debug, so its warnings and errors are no longer filtered
out by default in every SDK.
- On a full reconnect, `Room` now reports `Reconnecting` (and the
`ConnectionStateChanged` that precedes it) before removing remote
participants, so the `ParticipantDisconnected` events of a full
reconnect arrive after `Reconnecting` rather than before it and can be
told apart from participants actually leaving. livekit#1591 (@MaxHeimbrock)
- Report the .NET SDK as `ClientInfo.SDK.DOTNET` in the join request.
The `dotnet` SDK name fell through to `UNKNOWN` on the single peer
connection path. - livekit#1669 (@MaxHeimbrock)
# livekit-telemetry 0.2.0 (2026-11-13)
## Breaking Changes

- Add an opt-in decoded HTTP response limit, used by telemetry export,
that reports an oversized response as the new
`TransportError::ResponseTooLarge` variant. Code that matches
`TransportError` exhaustively, in Rust or in the generated Swift and
Kotlin bindings, needs a case for it.

## Features

- Add the write-ahead batch cache (`BatchCache`, `MemoryCache`,
`FileCache`) that holds encoded batches in memory or on disk until they
upload.
- Add device state and device events (`DeviceState`, `DeviceEvent`) and
RTC stats samples (`RtcStatsSample`, `RtcStat`) with their on-device
windowing.
- Bound telemetry collector responses to 65,536 decoded bytes and retain
batches with Retry-After on overflow. Document in `SPEC.md` that the
exporter, not the transport, enforces the per-attempt export timeout and
the 24-hour cap on server-directed pauses.
- Rename the public `RtcStatsSample.track_sid` field and constructor
parameter to `track_id`; callers and generated bindings must migrate to
the new name while keeping the same LiveKit track identifier values.
- Add the `TelemetryTransport` seam, a `net` HTTP transport over
`livekit-net`, and LiveKit Cloud destination routing from a Room's
server URL and token.

## Fixes

- Serialize cache writes and clears across process instances and reject
replacements whose parent is already missing without resurrecting
evicted batches.
- Compact unowned recomputable dead destinations while preserving
all-dead routing, disabled projects and remembered consent.
- Speed up deduplication of large telemetry attribute lists while
preserving last-value precedence and attribute order.
# livekit-capture 0.2.0 (2026-11-13)
## Breaking Changes

- Add an opt-in decoded HTTP response limit, used by telemetry export,
that reports an oversized response as the new
`TransportError::ResponseTooLarge` variant. Code that matches
`TransportError` exhaustively, in Rust or in the generated Swift and
Kotlin bindings, needs a case for it.

## Fixes

- Scope agent database access to a thread or a database:
`AgentThreadGrants` gains `sql`, and the new `agentDatabase` claim
(`AgentDatabaseGrants`) grants `read`, `write` and `delete` on listed
databases plus project-wide `create` and `list`.
`AgentGrants::database_admin` is removed, and `DatabaseClient` signs
each call with only the grant it needs. A thread's database id is its
thread id, so `Thread::database_id` is gone.
- Fix remote participant and track leaks when closing a room, including
encrypted tracks, cancelled closure, and participant updates racing with
teardown.
- Handle out-of-range key indices gracefully in `KeyProvider` and clamp
`key_ring_size` to valid bounds.
- Log libwebrtc messages at their own severity instead of reporting
every one as debug, so its warnings and errors are no longer filtered
out by default in every SDK.
- On a full reconnect, `Room` now reports `Reconnecting` (and the
`ConnectionStateChanged` that precedes it) before removing remote
participants, so the `ParticipantDisconnected` events of a full
reconnect arrive after `Reconnecting` rather than before it and can be
told apart from participants actually leaving. livekit#1591 (@MaxHeimbrock)
- When the local room closes, in-flight `perform_rpc` calls now fail
with `RpcErrorCode::ConnectionClosed` (1506) instead of
`RecipientDisconnected` (1503), which remains reserved for remote
participant departures.
- Report the .NET SDK as `ClientInfo.SDK.DOTNET` in the join request.
The `dotnet` SDK name fell through to `UNKNOWN` on the single peer
connection path. - livekit#1669 (@MaxHeimbrock)
# livekit-rpc 0.3.0 (2026-11-13)
## Breaking Changes

- When the local room closes, in-flight `perform_rpc` calls now fail
with `RpcErrorCode::ConnectionClosed` (1506) instead of
`RecipientDisconnected` (1503), which remains reserved for remote
participant departures.

## Fixes

- Scope agent database access to a thread or a database:
`AgentThreadGrants` gains `sql`, and the new `agentDatabase` claim
(`AgentDatabaseGrants`) grants `read`, `write` and `delete` on listed
databases plus project-wide `create` and `list`.
`AgentGrants::database_admin` is removed, and `DatabaseClient` signs
each call with only the grant it needs. A thread's database id is its
thread id, so `Thread::database_id` is gone.
# livekit-net 0.2.0 (2026-11-13)
## Breaking Changes

- Add an opt-in decoded HTTP response limit, used by telemetry export,
that reports an oversized response as the new
`TransportError::ResponseTooLarge` variant. Code that matches
`TransportError` exhaustively, in Rust or in the generated Swift and
Kotlin bindings, needs a case for it.

## Fixes

- The native HTTP client no longer follows a redirect from `https` to a
plaintext scheme, so an `Authorization` header never reaches a plaintext
URL on the same host and port. An `http` to `https` upgrade is still
followed.
# livekit-ffi 0.14.0 (2026-11-13)
## Breaking Changes

- Add an opt-in decoded HTTP response limit, used by telemetry export,
that reports an oversized response as the new
`TransportError::ResponseTooLarge` variant. Code that matches
`TransportError` exhaustively, in Rust or in the generated Swift and
Kotlin bindings, needs a case for it.

## Fixes

- Scope agent database access to a thread or a database:
`AgentThreadGrants` gains `sql`, and the new `agentDatabase` claim
(`AgentDatabaseGrants`) grants `read`, `write` and `delete` on listed
databases plus project-wide `create` and `list`.
`AgentGrants::database_admin` is removed, and `DatabaseClient` signs
each call with only the grant it needs. A thread's database id is its
thread id, so `Thread::database_id` is gone.
- Fix remote participant and track leaks when closing a room, including
encrypted tracks, cancelled closure, and participant updates racing with
teardown.
- Compile the LiveKitFFI CocoaPod in Swift 5 mode, matching SPM and
allowing Swift 6 hosts without inheriting their language mode.
- Handle out-of-range key indices gracefully in `KeyProvider` and clamp
`key_ring_size` to valid bounds.
- Log libwebrtc messages at their own severity instead of reporting
every one as debug, so its warnings and errors are no longer filtered
out by default in every SDK.
- On a full reconnect, `Room` now reports `Reconnecting` (and the
`ConnectionStateChanged` that precedes it) before removing remote
participants, so the `ParticipantDisconnected` events of a full
reconnect arrive after `Reconnecting` rather than before it and can be
told apart from participants actually leaving. livekit#1591 (@MaxHeimbrock)
- When the local room closes, in-flight `perform_rpc` calls now fail
with `RpcErrorCode::ConnectionClosed` (1506) instead of
`RecipientDisconnected` (1503), which remains reserved for remote
participant departures.
- Report the .NET SDK as `ClientInfo.SDK.DOTNET` in the join request.
The `dotnet` SDK name fell through to `UNKNOWN` on the single peer
connection path. - livekit#1669 (@MaxHeimbrock)
# livekit-signaling 0.2.0 (2026-11-13)
## Breaking Changes

- Add an opt-in decoded HTTP response limit, used by telemetry export,
that reports an oversized response as the new
`TransportError::ResponseTooLarge` variant. Code that matches
`TransportError` exhaustively, in Rust or in the generated Swift and
Kotlin bindings, needs a case for it.

## Fixes

- Scope agent database access to a thread or a database:
`AgentThreadGrants` gains `sql`, and the new `agentDatabase` claim
(`AgentDatabaseGrants`) grants `read`, `write` and `delete` on listed
databases plus project-wide `create` and `list`.
`AgentGrants::database_admin` is removed, and `DatabaseClient` signs
each call with only the grant it needs. A thread's database id is its
thread id, so `Thread::database_id` is gone.
- Report the .NET SDK as `ClientInfo.SDK.DOTNET` in the join request.
The `dotnet` SDK name fell through to `UNKNOWN` on the single peer
connection path. - livekit#1669 (@MaxHeimbrock)
# livekit-token-source 0.2.0 (2026-11-13)
## Breaking Changes

- Add an opt-in decoded HTTP response limit, used by telemetry export,
that reports an oversized response as the new
`TransportError::ResponseTooLarge` variant. Code that matches
`TransportError` exhaustively, in Rust or in the generated Swift and
Kotlin bindings, needs a case for it.
# webrtc-sys 0.3.54 (2026-11-13)
## Fixes

- Handle out-of-range key indices gracefully in `KeyProvider` and clamp
`key_ring_size` to valid bounds.
# livekit-datatrack 0.2.5 (2026-11-13)
## Fixes

- Scope agent database access to a thread or a database:
`AgentThreadGrants` gains `sql`, and the new `agentDatabase` claim
(`AgentDatabaseGrants`) grants `read`, `write` and `delete` on listed
databases plus project-wide `create` and `list`.
`AgentGrants::database_admin` is removed, and `DatabaseClient` signs
each call with only the grant it needs. A thread's database id is its
thread id, so `Thread::database_id` is gone.
# libwebrtc 0.4.1 (2026-11-13)
## Fixes

- Handle out-of-range key indices gracefully in `KeyProvider` and clamp
`key_ring_size` to valid bounds.
- Log libwebrtc messages at their own severity instead of reporting
every one as debug, so its warnings and errors are no longer filtered
out by default in every SDK.
# livekit-data-stream 0.2.1 (2026-11-13)
## Fixes

- Scope agent database access to a thread or a database:
`AgentThreadGrants` gains `sql`, and the new `agentDatabase` claim
(`AgentDatabaseGrants`) grants `read`, `write` and `delete` on listed
databases plus project-wide `create` and `list`.
`AgentGrants::database_admin` is removed, and `DatabaseClient` signs
each call with only the grant it needs. A thread's database id is its
thread id, so `Thread::database_id` is gone.

Co-authored-by: knope-bot[bot] <152252888+knope-bot[bot]@users.noreply.github.com>
The ObjC categories in _libwebrtc.a_ (e.g. `NSString (StdString)`)
export no symbols, so the linker drops them and macOS/iOS binaries abort
at startup:
```
+[NSString stringForStdString:]: unrecognized selector sent to class
```

The usual fix, `-ObjC` (currently documented in the README as required
for consumers), can't be applied at the crate level since Cargo doesn't
propagate link args to dependent crates. Instead, merge all `obj/sdk`
objects into one archive member when assembling _libwebrtc.a_, so the
categories load together with the referenced SDK symbols and consumers
need no flag as of the next prebuilt release.

After this merges,
[_livekit-examples/rust-dev-client_](https://github.com/livekit-examples/rust-dev-client)
should be updated to remove the workaround.
…kit#1679)

Agents 2.0 needs a reusable HTTP client, the shared thread-persistence
schema, exact task states, and durable function-call metadata. This PR
supplies the SDK side and supersedes livekit#1652.

Changes:

- Add `LiveKitApi::with_api_key_and_client`. Every service and failover
region discovery reuse the supplied TLS/proxy configuration and
connection pool; discovery keeps its short timeout.
- Expose `agent::DEFAULT_PARTITION_KEY` and pin the consolidated
partition-keyed v1 schema from livekit/protocol#1885.
- Preserve all seven typed task states, optional task-name presence, and
exact status filters.
- Restore `FunctionCall.extra` on protobuf tag 7, with JSON text per
value for approvals, resumable tool/delegation state, provider metadata,
and application receipts. Legacy tag 6 remains reserved.
- Regenerate protocol/serde bindings, normalize trailing whitespace in
generated serde output, and include patch changesets for affected
packages and dependents.

Dependency and compatibility:

The protocol submodule pins protocol-main commit
`ef439e910d5c14f591de70a29899c62415ec8e84`, which landed
livekit/protocol#1885 (including #1924). Its tree is identical to the
tested protocol PR head. The temporary integration snapshot is no longer
needed.

The SQL schema changes in place at version 1 and requires coordinated
platform/framework consumers. Task JSON RUNNING becomes WORKING.
Metadata uses a fresh wire number; older Python exporters that copy
fields by name still need their corrected serializer. The companion
agents-v2 working tree now pins SDK commit
`09e0a8e4334cf53529b521381aaf07f1e880a212`; its status adapters, SQLite
record and newer protocol adapters were updated locally. Those v2 edits
are outside this SDK PR.

Validation:

- Protocol Go tests and protocol CI pass, including metadata JSON/binary
round trips, legacy tag isolation, and the repository's protojson import
policy.
- SDK protocol tests pass (2 tests), and the API crate check passes with
services/rustls features. The API regression suite previously passed 32
tests; external mock-server cases return early locally when its server
is unavailable, while loopback tests execute locally.
- In v2, the Python extension/FFmpeg build and all-target Rust workspace
check pass. The full Rust workspace suite and Python binding contracts
pass, including 113 embedded Python binding tests.
- Hermetic Python host/plugin/smoke suites: 2,900 passed, 63 skipped, 66
expected xfails.
- Rust formatting, Clippy policies, architecture checks and
generated-code checks pass. Python formatting, lint, strict mypy and
pyright pass (pyright reports 2 existing warnings).
- The final pin now points to the protocol-main merge commit. Its tree
is identical to the tested protocol PR revision; no generated Rust
source changed in this final update.

The tests used an isolated Cargo target. A disk-space linker failure was
resolved by removing this session's temporary build caches; the binding
suite then passed. Live voice E2E was not run: no LiveKit project
credentials or local livekit-server are configured. No wheel release or
live-room behavior is claimed.
…atures` Cargo.toml table (livekit#1633)

In livekit#1631, I updated the livekit-ffi ci builds to pass an explicit `--lib
--crate-type <crate type>`, to enable LTO when building livekit-ffi
(which results in a hundred of kb drop in binary size).

@ladvoc made the point in a [review
comment](livekit#1631 (comment))
that it would be nice to be able to encapsulate this in the same
`platform-features` toml table we are using for feature configuration,
which I think makes a ton of sense.

So, I have done this - now `ffi_features.py` returns `--lib --crate-type
<crate type>` if `crate-type` is set in the table, and the larger ci
build infrastructure (which it wasn't looking like used
`ffi_features.py`? I think that was an oversight...) was ported over to
use this script as its source of truth for features and the crate type.
)

Moves the protocol submodule to livekit/protocol c6a16489
(livekit/protocol#1983): AgentDB.Wire.Error is {code, name,
description}; Hello carries client_version; if_tip, capabilities,
max_frame and deadline_ms are removed.
…kit#1483)

## Summary

The pipeline: the synchronous handle, one scope per Room, typed spans,
and the exporter actor. The README becomes the crate docs (its usage
example is a doc test) and `SPEC.md` is complete.

## Changes

- `Telemetry`: the synchronous handle — flood guard, flush / shutdown /
purge, stats
- `Scope`: one Room — server URL and token, attributes, RTC stats, the
`lk.subscribe` lifecycle
- Typed `Span`s
- `Exporter`: the actor that encodes, caches and uploads under the
upload policy
- README as crate docs; `SPEC.md` complete
- Ending the last open `lk.connect` or `lk.reconnect` wakes the
exporter, so a batch held while connecting goes out at once
- The span registry holds sessions weakly, so a Room dropped without
`disconnected` is freed and no longer counts as in a call
- Plain log records have a flood guard of their own, and `disconnected`
reports once per connection
- Checkpoints and attributes a span drops past its caps are counted in
the exported span
- A session waits on at most 256 tracks of each kind, and the exporter's
clock retires a published track that never sends
- The config is normalized once, with a 1 s floor for the periods and
the timeout; `Telemetry::shutdown_bound` names the longest wait of
`shutdown`
- A second shutdown returns only once the exporter stopped, and a
request starts only under the opt-out's admission barrier
- The first flush no longer subtracts from the monotonic clock, which
panicked on Windows right after boot
- A purge reports the result of its last attempt, so a retry that
deletes everything reports success
- A soft hold that ends while the cache is empty no longer silences the
escape warning of the next hold

## Why this stage is larger

The largest stage, at about 4.7k lines: `Telemetry ⇄ Shared ⇄ Exporter`
and `Scope ⇄ Span ⇄ Telemetry` are one dependency cycle, so they land
together. Their tests follow in livekit#1484, together with the backend
contract.

## Temporary

`#[expect(dead_code)]` on `Telemetry::weak_commands`, which serves
`global` (livekit#1485).

<details><summary><b>Verification</b></summary>

At `58f3a6e5`, from a clean checkout (CI's test workflow runs only for
PRs into `main`, so these were run locally; there is no clippy job in
CI):

- `cargo fmt --check`
- `cargo clippy -p livekit-telemetry --all-targets -- -D warnings`, also
with `--all-features` and as a `cargo hack --feature-powerset --depth 2`
run
- `cargo test -p livekit-telemetry`: 146 unit, 2 doc
- `RUSTDOCFLAGS="-D warnings" cargo doc -p livekit-telemetry --no-deps`

</details>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: omnigent <noreply@omnigent.ai>
Co-authored-by: Codex <codex@openai.com>
…#1484)

## Summary

Tests for livekit#1483: the pipeline end to end, and the backend contract one
test per row. Every link below points at the stage that adds the test.

## Changes

- `telemetry.rs`: the pipeline end to end through a scripted transport
- `backend_tests.rs`: the backend contract, one test per row, including
a mock collector over the real `livekit-net` HTTP stack
- The one `telemetry.rs` test that needs `global` arrives with it in
livekit#1485
- The exporter's jitter draw can be scripted in tests, so the backoff
tests check every retry against its envelope: a fixed delay or a wait
without jitter fails them
- The throttle tests answer with a real 429 and `Retry-After`, so they
go through the core's own classifier
- The connect-hold test pins the 60 s cap (nothing at 59 s, one batch at
61 s), and every test wait that can hang is bounded
- The write-ahead test checks that the batch is on disk when the request
arrives
- One test compares the two device transitions: a foreground change
waits for the tick, a move to the background flushes at once

<details><summary><b>Backend contract</b>: every status code and
condition → behaviour → test (29 rows)</summary>

A Room hands over its server URL and token; only a parsed
`*.livekit.cloud` host over TLS gets
`https://<host>/observability/client/{logs,traces}/otlp/v0` with
`Authorization: Bearer <token>`. Every collector answer is classified by
the core; behaviour marked **custom** is not prescribed by the
[OTLP/HTTP
spec](https://opentelemetry.io/docs/specs/otlp/#otlphttp-response).

| Condition | Behaviour | Test | Why |
|---|---|---|---|
| Server URL | parsed (WHATWG); token only for a TLS scheme, a domain
under `.livekit.cloud` with its own label, default port, no userinfo;
endpoint built from that host alone; anything else collects nothing |
[`look_alike_server_urls_never_get_the_token`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/destination.rs#L604)<br>[`only_livekit_cloud_hosts_get_an_ingest_url`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/destination.rs#L576)<br>[`the_ingest_url_and_token_come_from_the_room`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L78)<br>[`self_hosted_servers_get_nothing_and_nothing_is_kept`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L105)
| **custom** — self-hosted servers have no ingest (CLT-3335);
credentials only to the authorized origin |
| Token handed over again | same pair: no-op (a reconnect retries a
404'd ingest); new token: uploads resume at once |
[`handing_over_the_same_token_again_is_free`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L92)<br>[`a_reconnect_with_the_same_token_retries_a_404`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L633)<br>[`an_expired_token_holds_uploads_until_a_fresh_one_arrives`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L131)
| RFC 6750 bearer; **custom** refresh contract |
| Token expired or missing | never sent; batches wait (hard hold). A
past, negative, fractional-past or non-numeric `exp` is expired; only a
missing one means no known expiry; a far-future one is clamped to a year
|
[`an_expired_token_holds_uploads_until_a_fresh_one_arrives`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L131)<br>[`untrusted_expiry_claims_fail_closed`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/destination.rs#L913)<br>[`uploads_wait_for_a_destination`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1875)<br>[`hard_holds_have_no_escape_hatch`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L505)
| **custom** — untrusted claims fail closed |
| First token lacks the observability grant | nothing collected for that
project |
[`a_room_without_the_observability_grant_sends_nothing`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L120)<br>[`a_token_without_the_grant_is_not_consent`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/destination.rs#L636)
| **custom** — the grant is the customer's consent |
| Refresh drops the grant (today's SFU) | keep the granted token until
it expires, then wait |
[`a_refresh_that_drops_the_grant_keeps_uploading_with_the_granted_token`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L151)<br>[`a_refresh_that_drops_the_grant_keeps_the_granted_token_until_it_expires`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/destination.rs#L646)
| **custom** — bridge until OCD-3387 |
| Ownership | each record (and each RTC window, at open) captures
(project, session); credentials keyed by it; the answer is attributed to
the project the request went to; a Room switching projects takes nothing
along; an unconnected Room never borrows another Room's project; a
Room's records from before it connected, cached ones included, are bound
on disk to that Room's first project by the exporter pass its connect
wakes (at once if the exporter is idle, otherwise once the export pass
then running finishes; no single-request bound), so they replay after a
restart; a crash once a batch's bound copy is journaled rolls forward to
it. A Room that never connects before the process ends — or a process
killed after the connect but before that batch's bound copy is journaled
— leaves the batch unowned: held until the 24 h expiry, then counted
`expired` |
[`answers_to_pre_connect_batches_are_attributed_to_their_own_project`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L764)<br>[`pre_connect_records_replay_after_a_restart`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L811)<br>[`a_crash_while_binding_still_replays_to_the_rooms_project`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L859)<br>[`a_room_switching_projects_takes_nothing_along`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L560)<br>[`an_unconnected_room_never_borrows_another_rooms_project`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L593)<br>[`two_rooms_on_two_projects_never_share_a_token_or_a_destination`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L163)<br>[`ownership_survives_a_room_changing_projects`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/destination.rs#L697)<br>[`rooms_never_borrow_each_others_tokens`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/destination.rs#L673)
| **custom** — never borrow a credential (RFC 6750 §5.2) |
| Credential lifecycle | a refusal is recorded by credential identity,
shared by every slot (Room, project copy, process route, restart), until
the token expires; a session's credentials stay while it is alive (one
per project it used) or cached batches need them — pre-connect batches
included; project copies only while needed |
[`refusals_stick_and_credentials_follow_live_rooms`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/destination.rs#L716)<br>[`a_gone_rooms_pre_connect_backlog_keeps_its_credential`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L784)
| **custom** |
| Restart with cached data, no token | wait for a token of the same
project (≤ 24 h); tokens never persisted |
[`a_restart_with_cached_data_and_no_token_waits_for_the_same_project`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L523)
| **custom** |
| 2xx | batch removed |
[`batches_events_into_one_otlp_request`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1398)
| OTLP specifies 200 for success; accepting every 2xx is **custom** |
| 2xx + `partial_success` | rejected records counted, never retried |
[`partial_success_counts_the_refused_records_and_never_retries`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L202)<br>[`success_and_partial_success`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/transport.rs#L401)
| OTLP: MUST NOT retry partial success |
| 400, 3xx, other 4xx | dropped, counted `rejected`; a delay hint
changes nothing |
[`a_bad_request_drops_the_batch`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L231)<br>[`client_errors`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/transport.rs#L419)<br>[`delay_hints_never_make_a_final_status_retryable`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/transport.rs#L463)
| OTLP: not retryable |
| 413 | halves replace the batch in a journaled cache transaction (on
disk stays on disk), retried at once down to one record, each against
the pass budget; a lone oversized record dropped (`oversized`) |
[`payload_too_large_splits_down_to_single_records`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L455)<br>`a_split_never_moves_a_batch_off_the_disk`
(added in
livekit#1485)<br>[`a_split_crashed_at_every_step_loses_and_duplicates_nothing`](https://github.com/livekit/rust-sdks/blob/1371f6c69159d663092ed2834a385a9a20749c27/livekit-telemetry/src/cache.rs#L1102)
| **custom** — OTLP only says don't retry as-is; RFC 9110 §15.5.14
_(test lands in livekit#1485)_ |
| 401/403 "data recording is disabled by owner" | project silent for the
process, its cache purged |
[`disabled_project_goes_silent_and_purges_its_cache`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L245)<br>[`disabled_by_owner`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/transport.rs#L438)
| **custom** — exact phrase match, no machine code yet |
| Other 401/403 | kept; that token never sent again; wait for the next |
[`unauthorized_holds_the_batch_until_a_new_token`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L266)<br>[`repeated_unauthorized_answers_wait_for_renewal_without_loss`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L473)<br>[`a_refused_token_is_never_sent_again`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/destination.rs#L660)
| **custom** — RFC 9110 §15.5.2 |
| 404 | project silent until its next token or a reconnect; cache purged
|
[`not_found_on_the_derived_endpoint_goes_silent`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L283)<br>[`not_found_recovers_with_the_next_token_disabled_does_not`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/destination.rs#L756)<br>[`a_reconnect_with_the_same_token_retries_a_404`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L633)
| **custom** (CLT-3335), scoped to the origin |
| 429 | that destination pauses for `Retry-After`, else `RetryInfo`,
else 60 s; collection continues |
[`throttling_honors_retry_after_then_retry_info_then_a_minute`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L294)<br>[`a_real_http_collector_throttles_and_recovers`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L418)
| OTLP: retryable, honor `Retry-After`; RFC 6585 §4; 60 s default
**custom** |
| 503 with a delay | that destination pauses for it |
[`throttling_honors_retry_after_then_retry_info_then_a_minute`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L294)
| OTLP: retryable; RFC 9110 §10.2.3 |
| 502 / 503 / 504 | backoff 1 s → 60 s, full jitter; exhaustion pauses,
never deletes (24 h retention) |
[`a_failing_server_never_costs_a_batch`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L346)<br>[`server_errors`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/transport.rs#L571)
| OTLP: retryable with exponential backoff; the constants and retention
are **custom** |
| 500 + `RetryInfo` | retried after the named delay (a header alone does
not count) |
[`a_retryable_500_waits_for_its_retry_info`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L322)<br>[`delay_hints_never_make_a_final_status_retryable`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/transport.rs#L463)
| **custom** — Cloud sends retryable 500s |
| Other 5xx | dropped, counted `rejected` |
[`other_server_errors_drop_the_batch`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L334)
| OTLP: MUST NOT retry |
| `Retry-After` / `RetryInfo` values | seconds or HTTP-date; garbage
ignored, negative → now, oversized saturates; clamped to 24 h; shutdown
never cuts it short |
[`untrusted_time_values_are_bounded`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/transport.rs#L498)<br>[`retry_after_http_dates`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/transport.rs#L554)<br>[`shutdown_never_cuts_a_server_delay_short`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L494)
| RFC 9110 §10.2.3; the clamp is **custom** |
| One project failing | only that destination pauses; evictions count as
`throttled` only for the paused destination |
[`a_failing_project_does_not_pause_the_others`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L614)
| **custom** |
| Timeout | backoff; counted apart |
[`timeouts_are_counted_apart_from_failures`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1798)
| OTLP: retryable |
| Connection, DNS, TLS failure | backoff 1 s → 60 s full jitter; never a
capability decision |
[`no_answer_backs_off_exponentially_with_full_jitter`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L362)<br>[`backoff_doubles_with_full_jitter_up_to_a_minute`](https://github.com/livekit/rust-sdks/blob/58f3a6e5d8c389d6cf1f8c85734c16dcda3ae059/livekit-telemetry/src/exporter.rs#L1876)
| OTLP: retry with backoff |
| Foreign transport throws an undeclared exception | a retryable
failure, not a panic (the Rust conversion hook is tested; no generated
Swift/Kotlin transport test) |
[`an_undeclared_foreign_exception_is_a_retryable_failure`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/transport.rs#L590)
| **custom** policy on the UniFFI callback contract |
| Invalid request (transport-side) | dropped |
[`an_invalid_request_is_dropped`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L394)
| **custom** — treated as permanent |
| Redirect | a returned 3xx drops the batch; the livekit-net client
strips `Authorization` when the host or port changes (a scheme-only
change on the same explicit port is not tested) |
[`redirects_to_another_host_or_port_never_carry_the_token`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L712)<br>[`client_errors`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/transport.rs#L419)
| RFC 9110 §15.4; **custom** |
| Request shape | protobuf, gzip, `Priority: u=7`; ≤ 512 records and ≤ 1
MiB **encoded**, session attributes and the self-report included; the
self-report is added at most once per pass and never takes the place of
real records, even at a batch size of 1; a single record over the limit
dropped (`oversized`) |
`a_failing_self_report_never_starves_real_records` (added in
livekit#1485)<br>[`requests_are_gzipped_and_low_priority`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1629)<br>`encoded_requests_stay_under_the_byte_limit_for_both_signals`
(added in
livekit#1485)<br>`final_limits_hold_after_decoration_and_caller_strings_are_bounded`
(added in livekit#1485) | OTLP/HTTP binary + gzip; RFC 9218; the limits and the
priority are **custom** _(test lands in livekit#1485)_ |
| Local collector | `LK_TELEMETRY_ENDPOINT`: everything there, no Cloud
rules, no token |
[`the_override_reaches_a_local_collector_without_cloud_rules`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L403)<br>[`the_override_takes_everything_without_a_token`](https://github.com/livekit/rust-sdks/blob/3e68d917447e6e4f93d6312a0a39eb0fd0c8a869/livekit-telemetry/src/destination.rs#L769)
| **custom**, test-only, no platform API |

</details>

<details><summary><b>Verification</b></summary>

At `42a5dd17`, from a clean checkout (CI's test workflow runs only for
PRs into `main`, so these were run locally; there is no clippy job in
CI):

- `cargo fmt --check`
- `cargo clippy -p livekit-telemetry --all-targets -- -D warnings`, also
with `--all-features` and as a `cargo hack --feature-powerset --depth 2`
run
- `cargo test -p livekit-telemetry`: 216 unit, 2 doc
- `RUSTDOCFLAGS="-D warnings" cargo doc -p livekit-telemetry --no-deps`

</details>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: omnigent <noreply@omnigent.ai>
)

## Summary

`global`, the process-wide pipeline, and the opt-out. From here livekit#1396
adds only `global::uninstall` and a `Severity` conversion to
`livekit-telemetry`, besides the README and `SPEC.md`. Every link below
points at the stage that adds the test (the UniFFI ones at livekit#1396).

## Changes

- `global`: one pipeline per process, installed once and reachable from
anywhere, with the platform's instruments started on it
- `global::disable`: the opt-out, in effect before it returns
- `device_tests.rs`: the device contract, one test per row
- The last temporary `dead_code` expectation removed
- A repeated `global::disable` resolves only once the cache is deleted,
also while the first call is still purging
- `install` and `uninstall` stop the outgoing instruments while their
pipeline is still installed, so a last record from `stop` reaches it
- The opt-out cancels and awaits every live generation's exporter,
running or draining, and no request starts once it returned
- The opt-out erases the storage directory of every generation, live or
gone, and keeps it on record until it is known to hold nothing; a
directory it cannot read is logged and makes the opt-out report the
erase incomplete
- A configure refused after the opt-out erases its storage directory
too, and a `with_cache` pipeline never records the `storage_dir` it
ignores
- The device tests build on Windows again

<details><summary><b>Device contract</b>: every failure scenario →
behaviour → max lost → why → test (32 rows)</summary>

What can go wrong on a device, and the most it can cost. OTel specifies
no client persistence or device policy, so **every row is custom**.
**U** = records not yet committed (≤ one flush interval, ≤ 2 048 queued)
+ open spans (≤ 256) + open RTC windows; **B** = one batch (≤ 512
records); **E** = records evicted or expired, always counted. **N** =
records committed to the cache and not yet sent (≤ 4 MiB compressed, ≤
512 batches, ≤ 24 h old). A batch is committed when the cache's `push`
returns (file `fsync`ed, renamed, directory `fsync`ed on Unix); crash
points are driven deterministically by test-only fault hooks around
every write, fsync, rename, delete and publish.

**Max lost:** **0** = nothing; **0 until limits** = nothing until the
cache's bounds (4 MiB, 512 files, 24 h) evict, then **E**; **U**, **B**,
**E**, **N** as defined above. Every row is **custom** (no OTel spec
covers client persistence or device policy); *Why* names the platform
behaviour, spec or reason behind the row.

| Scenario | Behaviour | Max lost | Why | Test |
|---|---|---|---|---|
| App to background | RTC windows close, everything committed and the
whole cache flushed at once, whatever is left of the interval's
allowance | 0 once committed | iOS suspends a backgrounded app within
seconds (background execution limits); Android may freeze or kill a
cached process |
[`background_transition_flushes_while_foreground_waits_for_the_tick`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L2108)<br>[`entering_the_background_flushes_even_with_the_allowance_spent`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1429)
|
| Killed / crashed (no callback) | nothing waits for a termination
callback; committed batches replay next launch | **U** | neither OS
guarantees a termination callback (memory-pressure kills, crashes,
force-quit) |
[`a_crash_loses_only_what_was_not_yet_cached`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L88)<br>[`batch_is_written_before_upload_and_replayed_on_next_start`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1490)<br>[`pre_connect_records_replay_after_a_restart`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L811)
|
| Killed after an answer, before the delete | the batch is sent again at
the next launch | 0 lost; that batch duplicated | an answer and a file
delete cannot be atomic: at-least-once over at-most-once |
[`a_crash_between_the_answer_and_the_delete_resends_the_batch_once`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L998)
|
| Killed while a request is out | the batch is sent again at the next
launch | 0 lost; ≤ 1 batch duplicated | a request whose answer never
arrived may have been ingested: at-least-once |
[`a_batch_in_flight_at_a_crash_is_sent_again_once`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L109)
|
| Killed mid-write | `.tmp` + `fsync` + rename; a torn `.tmp` removed at
open | the uncommitted batch | POSIX `rename(2)` is atomic; `fsync(2)`
first, so a crash never exposes a torn file |
[`a_write_killed_half_way_leaves_no_partial_batch`](https://github.com/livekit/rust-sdks/blob/1371f6c69159d663092ed2834a385a9a20749c27/livekit-telemetry/src/cache.rs#L1269)<br>[`file_cache_evicts_oldest_beyond_max_bytes_and_drops_stray_tmp`](https://github.com/livekit/rust-sdks/blob/1371f6c69159d663092ed2834a385a9a20749c27/livekit-telemetry/src/cache.rs#L1037)
|
| Killed at any step of a split (413) | journaled; finished or rolled
back at open, before any eviction, at the byte and at the file-count
limit; a failure after the commit point is a success (halves published
by the next listing); a reconfigure's second cache on the directory
never breaks a split in progress (one process-wide split lock); binding
a pre-connect batch to its project is the same journaled replace, rolled
forward at open once its bound copy is journaled (only that copy names
the project) | 0 lost, 0 duplicated | RFC 9110 §15.5.14: the body must
shrink; journaling keeps the replace as crash-safe as a push |
[`a_split_crashed_at_every_step_loses_and_duplicates_nothing`](https://github.com/livekit/rust-sdks/blob/1371f6c69159d663092ed2834a385a9a20749c27/livekit-telemetry/src/cache.rs#L1102)<br>[`a_split_failing_after_its_commit_point_is_kept_and_purgeable`](https://github.com/livekit/rust-sdks/blob/1371f6c69159d663092ed2834a385a9a20749c27/livekit-telemetry/src/cache.rs#L1154)<br>[`a_second_cache_on_the_directory_never_breaks_a_split_in_progress`](https://github.com/livekit/rust-sdks/blob/1371f6c69159d663092ed2834a385a9a20749c27/livekit-telemetry/src/cache.rs#L1211)<br>[`a_stuck_journal_is_retried_after_a_write_not_every_listing`](https://github.com/livekit/rust-sdks/blob/1371f6c69159d663092ed2834a385a9a20749c27/livekit-telemetry/src/cache.rs#L1245)<br>[`a_crash_while_binding_still_replays_to_the_rooms_project`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L859)
|
| Corrupt / truncated cache file | full gzip + CRC check before sending;
dropped, counted `corrupt` | that batch (≤ **B**) | storage can truncate
or damage files; the gzip CRC-32 (RFC 1952) detects it before upload |
[`corrupt_and_stray_cache_files_are_dropped_and_counted`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L181)
|
| File there but unreadable (file protection, permissions) | kept,
retried later; not corrupt | 0 | iOS Data Protection makes files
unreadable while the device is locked: not corruption |
[`an_inaccessible_batch_is_kept_not_counted_corrupt`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L653)
|
| Delete fails after acceptance | pending deletion: not sent again this
launch (never rebound to a new id either), deleted when possible | 0
lost; each such batch sent once more after a restart | a delete that did
not happen must not look like one that did; no resend within the launch
|
[`a_failed_delete_after_acceptance_is_not_sent_again`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L630)<br>[`an_accepted_batch_awaiting_its_delete_is_not_rebound_and_resent`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L913)
|
| Disk full, directory gone, fsync fails | never claimed committed: the
file is removed and the batch kept in memory (bounded by
`max_cache_bytes`, oldest evicted and counted), still uploaded;
`cache.write_errors`; a split that cannot commit keeps the parent |
spill evictions (**E**) while alive; the spill on a crash | `ENOSPC` is
ordinary on phones, iOS may purge Caches while the app runs, a failed
`fsync(2)` leaves durability unknown |
[`a_full_disk_keeps_batches_in_memory_and_says_so`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L142)<br>[`a_failed_directory_sync_keeps_the_batch_in_memory_not_half_on_disk`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1029)<br>[`durability_failures_are_errors_not_silent_successes`](https://github.com/livekit/rust-sdks/blob/1371f6c69159d663092ed2834a385a9a20749c27/livekit-telemetry/src/cache.rs#L1296)
|
| Several processes sharing one storage dir | not supported: each
platform passes its own per-app dir; there is no cross-process lock (the
split lock is per process) | not tested; ≤ **B** per split in progress,
uncounted (another process's recovery can delete its journal); each
cached batch may be sent once per process | app sandboxes give each app
its own container, and an app's extensions must be given a directory of
their own | not tested |
| Cache full (4 MiB / 512 files) | oldest evicted, counted (`throttled`
during a server pause) | **E** | a bounded on-device footprint; the OS
may purge cache directories anyway |
[`cache_eviction_is_counted_as_a_drop`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1782)<br>[`file_cache_caps_the_number_of_batches`](https://github.com/livekit/rust-sdks/blob/1371f6c69159d663092ed2834a385a9a20749c27/livekit-telemetry/src/cache.rs#L1059)<br>[`a_hold_longer_than_the_cache_reports_what_it_cost`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1540)
|
| 24 h age | expired at start and while running | **E** | stale
telemetry loses its value; bounds how long a user's data stays on the
device |
[`batches_older_than_a_day_are_dropped_and_counted_at_start`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L208)<br>[`batches_expire_while_the_app_runs`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L390)
|
| Clock jump | this launch's batches need the monotonic clock to agree |
0 | users and networks change the wall clock; the monotonic clock cannot
jump |
[`a_clock_jump_does_not_expire_a_fresh_backlog`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L374)
|
| Offline | hard hold: nothing attempted, no failure counted; checked
before every request, also mid-pass; the soft cap is not scheduled
meanwhile | 0 until limits | attempts while offline only cost battery
and radio; the OS reports reachability |
[`device_holds_record_without_attempting`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L224)<br>[`a_device_change_during_a_pass_stops_its_remaining_requests`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L825)<br>[`a_soft_hold_turning_hard_does_not_spin`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L846)
|
| Low Data Mode, battery ≤ 10 % unplugged | soft hold; one batch per 60
s on its own clock | 0 until limits | the user asked for less traffic
(Low Data Mode, Data Saver); a nearly empty battery |
[`device_holds_record_without_attempting`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L224)<br>[`the_soft_hold_cap_is_scheduled_and_splits_count_against_it`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L553)
|
| Thermal, memory, low power, background, CPU-limited encoder | cadence
×2 … ×4; relief brings the pending tick forward at once; an unknown
thermal / low-power reading is neutral and makes no change event | 0 |
the OS asks apps to do less under thermal, memory and power pressure;
WebRTC reports a CPU-limited encoder |
[`device_state_emits_change_events_and_stretches_cadence`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1594)<br>[`cpu_limitation_counter_drives_cadence_pressure`](https://github.com/livekit/rust-sdks/blob/4c3e79da7c2628472629035e2a10aac8b2afdc90/livekit-telemetry/src/rtc.rs#L968)<br>[`relief_brings_the_pending_tick_forward`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1457)<br>[`unknown_thermal_and_low_power_are_silent_and_neutral`](https://github.com/livekit/rust-sdks/blob/4c3e79da7c2628472629035e2a10aac8b2afdc90/livekit-telemetry/src/device.rs#L535)
|
| Connect / reconnect | soft hold | 0 | signaling and ICE/DTLS own the
uplink while a call is set up: telemetry never competes with media |
[`uploads_hold_while_connecting_but_never_beyond_the_cap`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1641)<br>[`typed_spans_hold_uploads_while_connecting_and_export_when_ended`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1029)
|
| A slow collector | the exporter stays responsive (deadlines, commands)
while a request is out | 0 | an actor blocked on I/O would miss its
deadlines and commands |
[`deadlines_are_served_while_a_request_is_out`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L493)
|
| Shutdown | drains within `export_timeout_ms`, then cancels the request
on the wire and stops; the rest stays committed; the device state pushed
at install always ships by `flush` + `shutdown` | 0 committed | an SDK
must never hold up the app's teardown; bounded by `export_timeout_ms` |
[`the_initial_device_state_always_ships_by_flush_and_shutdown`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1211)<br>[`shutdown_during_a_slow_backlog_is_bounded_and_joins_the_exporter`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L533)<br>[`shutdown_drains_every_finished_span_batch`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L2147)<br>[`shutdown_leaves_a_session_summary`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1764)
|
| Queue overflow, event flood | drop-oldest (2 048), 300 events / 10
min; counted | exactly the dropped | bounded memory, like the OTel batch
processor's `maxQueueSize`; drop-oldest keeps the freshest context |
[`in_memory_bounds_count_every_drop`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L310)<br>[`queue_overflow_is_counted_by_reason`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1465)<br>[`flood_guard_caps_events_but_not_stats_windows`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1921)
|
| Notification storm (subscribes, device changes, tokens) | wake-ups
only re-evaluate; a new batch only at the tick, the queue threshold or
backgrounding; exactly one request allowance per interval while a Room
is in a call | 0 | the collector's per-project quota is shared by the
fleet: wake-ups must not multiply requests |
[`notifications_within_an_interval_never_exceed_one_allowance`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1365)
|
| Backlog with no call | not metered: once no Room is in a call (none
connected, or all disconnected) each pass sends the whole cache | 0 | no
media to protect: drain while the app is running |
[`the_allowance_applies_only_while_a_room_is_in_a_call`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1445)
|
| The core's own warnings and errors | copied by the log forwarder
(`livekit*` targets, never `livekit_telemetry*`) wherever the platform
calls `log_forward_bootstrap` (Swift's default `OSLogger` with `ffi:
true` does), whatever level it passes — that level filters only the
console forwarding; platforms must not feed forwarded Rust entries to
`telemetry_log`; any compact JWT (three base64url segments decoding to
JSON, whatever the header's encoding, also inside punctuation such as
`(...<jwt>)`) masked as `<jwt>`, bearer and `token` credential values
(`token=`, `"token": "…"`, quoted or spaced) as `<redacted>`; console
entry unchanged | — | the core's own failures are otherwise invisible;
Rust allows one global logger per process |
`only_the_cores_own_warnings_and_errors_are_copied` (added in
livekit#1396)<br>`the_platforms_level_filters_the_console_not_the_telemetry_copy`
(added in livekit#1396)<br>`tokens_in_copied_records_are_masked` (added in
livekit#1396)<br>`the_console_entry_is_what_it_always_was` (added in livekit#1396)
_(lands in livekit#1396)_ |
| Server-requested delay across a restart | a `Retry-After` /
`RetryInfo` pause is held in memory only: after a relaunch each project
gets one request (once its token is handed over) before a new 429/503
pauses it again | 0 lost (the throttled batch stays cached); ≤ 1 early
request per project per relaunch; not tested | RFC 9110 §10.2.3 and RFC
6585 §4 ask the client to wait; one probe per relaunch is the cost of
not persisting the deadline | not tested |
| Retries exhausted | pause, never delete | 0 until limits | OTLP/HTTP:
retryable failures are retried with backoff; giving up would lose data
silently |
[`a_failing_server_never_costs_a_batch`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/backend_tests.rs#L346)
|
| Opt-out (also mid-upload, racing a capture or a configure) | in effect
when `telemetry_disable()` returns (no scope, no capture), the purge
then runs on the core's runtime (a repeated opt-out joins the one
already running); `telemetry_is_disabled()` is `true` process-wide
before the call returns, so a platform with per-isolate state checks it
before each `getStats` or submit; lifecycle serialized with instruments;
every generation revoked under the locks that commit data, its exporter
cancelled and awaited (draining ones too), queue/spans/windows/cache
purged; then the `storage_dir` of every generation, live or gone,
erased, so an earlier launch's batches are deleted even when this launch
could not open that directory and cached in memory; a later configure is
refused: it clears its own cache, erases its `storage_dir` (also one it
could not open) and starts no exporter, and a directory that stays
unreadable waits for the next configure; a `with_cache` pipeline's cache
is purged while the pipeline lives, the caller owns it afterwards, and
the `storage_dir` that pipeline ignores is never touched; only actual
deletions counted; a purge whose retry deletes everything reports
success; incomplete deletes logged, and the opt-out reports them | **N +
U** by design; ≤ **B** per generation already on the wire or handed to a
pull-queue host | withdrawing consent must take effect at once and erase
unsent data (GDPR Art. 7(3), Art. 17) |
[`the_opt_out_is_in_effect_before_its_purge_runs`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1248)<br>[`an_opt_out_counts_the_halves_of_an_unpublished_split`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1473)<br>[`opting_out_stops_collection_and_purges_everything`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L249)<br>[`opting_out_during_an_upload_resurrects_nothing`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L336)<br>[`a_capture_racing_the_opt_out_leaves_nothing_behind`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1273)<br>[`an_instrument_never_starts_after_the_opt_out_stopped_it`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1072)<br>[`the_opt_out_cancels_a_draining_generation_before_returning`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1162)<br>`the_opt_out_withdraws_a_replaced_generations_pulled_request`
(added in livekit#1396)<br>`a_repeated_opt_out_waits_for_the_first_purge`
(added in
livekit#1396)<br>[`after_the_opt_out_nothing_is_captured`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L581)<br>[`an_incomplete_purge_is_reported`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L678)<br>[`purges_count_only_actual_deletions_once`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1051)<br>[`the_opt_out_deletes_an_earlier_launchs_batches_after_a_fallback_start`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1734)<br>[`a_refused_configure_deletes_an_earlier_launchs_batches`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1765)<br>[`the_opt_out_leaves_the_storage_dir_of_a_caller_provided_cache`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1693)<br>[`the_opt_out_keeps_an_unreadable_gone_disk_until_it_is_erased`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1658)<br>[`a_purge_whose_retry_deletes_everything_reports_success`](https://github.com/livekit/rust-sdks/blob/58f3a6e5d8c389d6cf1f8c85734c16dcda3ae059/livekit-telemetry/src/exporter.rs#L1724)<br>[`clearing_an_unreadable_directory_fails`](https://github.com/livekit/rust-sdks/blob/1371f6c69159d663092ed2834a385a9a20749c27/livekit-telemetry/src/cache.rs#L1320)<br>[`the_process_pipeline_no_ops_until_installed`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/telemetry.rs#L1038)
_(lands in livekit#1396)_ |
| Dart host stops serving the pull queue | ≤ 1 request queued; a request
nobody polls for times out as usual; requests the exporter gave up on,
or pulled after the opt-out, are never served, by `next()` or
`try_next()`; unknown ids ignored | 0 served stale | Dart FFI callbacks
are bound to their isolate: Rust must never call into, or wake, a dead
one | `try_next_serves_without_waiting_and_never_a_stale_request` (added
in livekit#1396)<br>`a_suspended_host_is_never_served_stale_requests` (added in
livekit#1396)<br>`a_cancelled_request_is_never_served` (added in
livekit#1396)<br>`finishing_discards_what_is_queued` (added in livekit#1396) _(lands
in livekit#1396)_ |
| Invalid app input | rejected, never truncated; counted `invalid` |
exactly the rejected | a truncated id collides; attribute limits as in
the OTel attribute-limits spec |
[`custom_data_is_room_scoped_validated_and_snapshotted`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L411)
|
| Correlation attributes or project change mid-window | windows capture
owner + attributes at open; a change closes them first, under the lock
readings record under | 0 | a window describes one owner and one set of
attributes; emitted records are immutable |
[`rtc_windows_carry_the_attributes_of_their_readings`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L786)<br>[`a_window_closed_before_a_change_keeps_its_snapshot_whenever_it_is_queued`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L933)<br>[`a_project_change_splits_the_rtc_windows_by_project`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L959)
|
| Subscribe never gets media | `timed_out` on the core's clock, whoever
looks first, kept through disconnect | 0 | no first media is the failure
to measure: nothing else reports it |
[`the_subscribe_span_is_owned_by_the_core`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1063)<br>[`late_first_media_is_timed_out_whoever_looks_first`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L509)<br>[`a_subscribe_past_its_deadline_stays_timed_out_through_disconnect`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L276)
|
| Long-lived process | spans hold the pipeline weakly; per-track state
retired; span state ≤ 128 steps / attributes; retained caller strings
bounded (an oversized span name is kept only as `invalid`, detached
spans included) | 0 | apps run for days across many Rooms and tracks:
nothing may grow without bound |
[`a_pending_subscribe_never_keeps_the_pipeline_alive`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L602)<br>[`per_track_state_is_retired_with_the_track`](https://github.com/livekit/rust-sdks/blob/4c3e79da7c2628472629035e2a10aac8b2afdc90/livekit-telemetry/src/rtc.rs#L1232)<br>[`the_same_track_in_two_sessions_never_merges`](https://github.com/livekit/rust-sdks/blob/4c3e79da7c2628472629035e2a10aac8b2afdc90/livekit-telemetry/src/rtc.rs#L1209)<br>[`retained_span_state_is_bounded`](https://github.com/livekit/rust-sdks/blob/58f3a6e5d8c389d6cf1f8c85734c16dcda3ae059/livekit-telemetry/src/trace.rs#L656)<br>[`final_limits_hold_after_decoration_and_caller_strings_are_bounded`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L876)
|

Uninstall or an OS cache purge is beyond the SDK's reach (**N + U**).
Defaults, polling (fast after a subscribe or a publish) and explicit
flush (drains without the per-pass budget, within holds and pauses):
[`defaults_export_and_window_once_a_minute`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L69)<br>[`the_core_paces_stats_polling`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L458)<br>[`publishing_polls_fast_until_the_first_outbound_reading`](https://github.com/livekit/rust-sdks/blob/5e17e859e1163d441e19de32d0ab375faa6b4274/livekit-telemetry/src/device_tests.rs#L1324)<br>[`device_holds_uploads_and_a_backlog_replays_within_the_budget`](https://github.com/livekit/rust-sdks/blob/42a5dd17a7926f8470bd3da21b9e140b7d4176f8/livekit-telemetry/src/telemetry.rs#L1680).

</details>

<details><summary><b>Verification</b></summary>

At `5e17e859`, from a clean checkout (CI's test workflow runs only for
PRs into `main`, so these were run locally; there is no clippy job in
CI):

- `cargo fmt --check`
- `cargo clippy -p livekit-telemetry --all-targets -- -D warnings`, also
with `--all-features` and as a `cargo hack --feature-powerset --depth 2`
run
- `cargo test -p livekit-telemetry`: 275 unit, 2 doc
- `RUSTDOCFLAGS="-D warnings" cargo doc -p livekit-telemetry --no-deps`

</details>

---------

Co-authored-by: omnigent <noreply@omnigent.ai>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Adds a sentence on use cases with a link to the live demos to the Agents
info block, and adds the Robotics row to the ecosystem footer.
This PR refactors the GitHub workflows to match
[`client-sdk-cpp`](https://github.com/livekit/client-sdk-cpp/tree/main/.github/workflows),
which has been in place for a few months with a number of benefits.

## Overview

This set of changes improves developer experience and CI times for _PR
builds_. It is not intended to replace one-shot workflows like releases.
I originally implemented this in the C++ SDK and have been very happy
with it, and am hoping to get it here as well.

Here are the key points:

- A top-level `ci.yml` is defined with a few roles:
- All relevant workflows are now built into this workflow as jobs
(builds, tests, API checks, etc.)
- `detect_changes`: Only run certain workflows when relevant paths
change. For example, a `.md` change should not require a full rebuild
and test of the entire repository
- `"ci"` job: A single CI success metric that bubbles up all aggregate
workflows
- This aggregate approach allows for a single view of the workflow
logically, and any GitHub output is now viewable in a single page. See
here:
https://github.com/livekit/rust-sdks/actions/runs/42303392343?pr=1399

## Workflows included in the CI aggregate

- `builds.yml` — Builds the Rust workspace across the supported target
matrix.
- `tests.yml` — Runs workspace, transport, core-module, and RPC tests.
- `feature-combinations-curated.yml` — Checks supported Cargo feature
combinations across target platforms.
- `format.yml` — Verifies Rust formatting.
- `test-api.yml` — Tests `livekit-api` and `livekit-signaling`
configurations.
- `license-check.yml` — Validates source-file license headers.
- `changeset-check.yml` — Validates PR changeset coverage and release
requirements.
- `uniffi-dart-test.yml` — Builds the UniFFI Dart package and runs its
tests.

## Workflows outside the CI aggregate

- `gen-node-proto.yml` — Regenerates and commits Node protobuf bindings
for relevant PR changes.
- `gen-protocol.yaml` — Regenerates and commits protocol output for
relevant PR changes.
- `release.yml` — Publishes crates and initiates Node releases after a
release PR merges or on manual dispatch.
- `ffi-builds.yml` — Builds the FFI artifact matrix after merges or
manual dispatch and can publish a GitHub release.
- `webrtc-builds.yml` — Builds and publishes WebRTC artifacts for
release tags or manual dispatch.
- `uniffi-packages.yml` — Publishes Swift and Android UniFFI packages
for FFI release tags or manual dispatch.
- `uniffi-dart-publish.yml` — Builds Dart cdylibs and publishes the Dart
package for FFI release tags or manual dispatch.
- `node-builds.yml` — Reusable/manual Node native build and npm
publication workflow.
- `uniffi-swift.yml` — Reusable Swift XCFramework build and publication
workflow.
- `uniffi-android.yml` — Reusable Android AAR build and publication
workflow.
- `uniffi-cdylib.yml` — Reusable Dart cdylib build and release-upload
workflow.

---------
## Summary

`livekit-telemetry` — the shared client-telemetry core — and its UniFFI
surface for the Swift, Kotlin and Dart SDKs. Wire spec (events,
attributes, cadence, upload policy):
[`livekit-telemetry/SPEC.md`](https://github.com/livekit/rust-sdks/blob/a2558a40ff1a2eb9a88067da1fe655e3ad3de753/livekit-telemetry/SPEC.md).

livekit#1566 stacks on this PR: it takes every telemetry name from the protocol
registry.

## Changes

- `livekit-ffi/src/core_modules/telemetry.rs`: configure and
configure-pulled, scopes, spans, stats, the app API, the opt-out, device
state
- `log_forward.rs`: the core's own warnings and errors copied into
telemetry
- Dart tests
- The `telemetry_ping` example and the README's local testing guide
- One lifecycle task carries out configure, shutdown and the opt-out's
purge one at a time, in the order they were sent; `telemetry_configure`
waits until its pipeline is installed
- A replacing exporter starts only once the one before it stopped
(drained within its bound, or cancelled and joined), so two exporters
never replay a shared cache at once
- `telemetry_shutdown` returns once every exporter queued before it
stopped, and a shutdown that resumes late never ends a newer lifecycle
- The pull queue never hands out or keeps a request once `finish`
returned, and a pulled configure refused after the opt-out finishes its
queue
- Platform log lines passed to `telemetry_log` or `TelemetryScope.log`
get the same credential masking as the core's own copied lines

<details><summary><b>What a platform calls, and when</b></summary>

| When | Call |
|---|---|
| SDK init | `telemetry_configure(config, transport, instruments)` —
storage and tuning only; Dart: `telemetry_configure_pulled(config, [])`
+ `queue.try_next()` |
| Room created | `telemetry_scope()` |
| Connect, **and every token refresh** | `scope.set_server(url, token)`
— cheap, idempotent |
| Room lifecycle | `scope.start(SpanName, parent)` → `step` /
`set_track` / `end`; `subscribe_started` / `subscribed` (tracks already
in the room at join: `subscribe_started` at connect, so `lk.subscribe`
measures from join; a lone `subscribed` still opens the span as a
fallback) / `subscribe_failed`; `track_ended(sid)`; `set_room`;
`disconnected(reason)` |
| Stats | every `scope.stats_poll_interval_ms()`:
`scope.record_peer_stats(report, {trackId → sid}, ts)` per peer
connection |
| OS signals | `telemetry_set_device_state` (thermal `Unknown` / low
power `None` without a source), `telemetry_device_event`,
`telemetry_log` |
| App API (the only public surface) | `scope.emit_custom(name, {k: v})`,
`scope.set_attribute(key, value?)`, `telemetry_disable()` — synchronous,
in effect when it returns (TODO on platforms: token discussion);
`telemetry_is_disabled()` reads that opt-out process-wide (every thread
and Dart isolate), for platforms to check right before each `getStats`
or submit |

No endpoint, header or sink exists in any client-language API. Local
end-to-end tests set `LK_TELEMETRY_ENDPOINT` (read by the core; see the
README).

</details>

<details><summary><b>Local testing</b> against a local OpenTelemetry
backend (LGTM)</summary>

Everything can be tried against a local OpenTelemetry backend (LGTM) in
a couple of minutes; no LiveKit server is needed for the Rust example.

```sh
# 1. Local OTel backend (OTLP/HTTP on :4318, UI on :3000)
docker run -d --name lk-lgtm -p 3000:3000 -p 4318:4318 grafana/otel-lgtm

# 2. Record a small session (lk.connect with its checkpoints, lk.publish, lk.subscribe ended by
#    first media, a custom event) and export it to the local backend; it prints the trace id
LK_TELEMETRY_ENDPOINT=http://localhost:4318 cargo run -p telemetry_ping

# 3. Optional: the same through the Dart bindings (pull queue)
(cd livekit-ffi && cargo make dart-package) && cd livekit-ffi/packages/dart && dart pub get \
  && LK_TELEMETRY_ENDPOINT=http://localhost:4318 dart test test/live_collector_test.dart

# 4. Optional: the file cache — stop the backend, run step 2 with LK_TELEMETRY_DIR=/tmp/lk-telemetry,
#    start the backend again and run once more to watch the cached batches replay
```

Then open http://localhost:3000 → Explore: **Loki**
`{service_name="telemetry_ping"}` for the log records
(`otel.event.name`: `custom.ping`, `lk.rtc.stats.sample`,
`lk.telemetry.report`), **Tempo** with the printed trace id for the
spans (`lk.connect`, `lk.publish`, `lk.subscribe`). Platform e2e tests
set `LK_TELEMETRY_ENDPOINT` the same way (with `livekit-server --dev`
for a real Room).

</details>

<details><summary><b>Verification</b></summary>

At `a2558a40`, from a clean checkout:

- `cargo fmt --check`
- `cargo clippy -p livekit-telemetry --all-targets -- -D warnings`, also
with `--all-features` and as a `cargo hack --feature-powerset --depth 2`
run
- `cargo test -p livekit-telemetry`: 275 unit, 2 doc
- `RUSTDOCFLAGS="-D warnings" cargo doc -p livekit-telemetry --no-deps`
- `cargo test -p livekit-ffi --no-default-features --features
core-modules`: 34
- `cargo clippy -p livekit-ffi --no-default-features --features
core-modules --all-targets`: only the 7 warnings that `main`
(`6473ec17`) has
- `cargo clippy -p telemetry_ping --all-targets -- -D warnings`
- Kotlin: `cargo make --profile release android-package` in
`livekit-ffi` generates the bindings and `assembleRelease` succeeds, and
a fresh `./gradlew compileReleaseKotlin --rerun-tasks` passes.
`android-check-size` fails: the arm64 library is 2,298,256 bytes against
a limit of 1,769,472 bytes (`main`: 1,593,408 bytes)
- Dart: `cargo make dart-package`, `dart pub get`, `dart test`: 7 pass,
1 skip. The skipped live collector test passes against a local collector

Stages 2–7 pass the same `livekit-telemetry` gates on their own tips
(see each PR).

</details>

### Generated API: `TelemetryReconnectReason`

`livekit-ffi` core-modules now exports `livekit-telemetry` next to the
signaling module, and both declare an enum named `ReconnectReason`.
UniFFI rejects two exported types with one name, so the telemetry enum
is exported to Swift, Kotlin, Python and Dart as
`TelemetryReconnectReason` (ba09132).
The Rust name, the variants and the `telemetry_reconnect_reason`
function are unchanged. The released signaling `ReconnectReason` is
unchanged.

Consumers that name the telemetry enum must rename it. In Kotlin,
`uniffi.livekit_telemetry.ReconnectReason` becomes
`uniffi.livekit_telemetry.TelemetryReconnectReason`.

The package tasks now fail when native compilation or a bindings
generator fails
([cfc2c1f](livekit@cfc2c1f),
[c6234ed](livekit@c6234ed)).
This prevents a failed build from appearing successful by reusing stale
native output or compiling no generated Kotlin.

The Android size budget is rebaselined for the combined signaling and
telemetry library (e33167a). The
release arm64-v8a library measures 2493056 bytes. The new limit is
2752512 bytes, which is the measured size plus 10% headroom rounded up
to 64 KiB, as before. The Swift budget is rebaselined the same way
(aea874b): the release ios-arm64
framework measures 2483344 bytes, and the new limit is 2752512 bytes.

---------

Co-authored-by: omnigent <noreply@omnigent.ai>
Lets a client publish tracks as part of joining a room instead of after
`connect` returns. In single peer connection mode, the tracks'
`AddTrackRequest`s and media sections travel with the join request and
the initial publisher offer, so the separate track request and the SDP
negotiation that would follow are no longer needed.

## API

```rust
let mut options = RoomOptions::default();
options.publish_tracks = vec![
    InitialTrack::new(LocalTrack::Audio(mic), TrackPublishOptions::default()),
    InitialTrack::new(LocalTrack::Video(camera), camera_options),
];
let (room, events) = Room::connect(&url, &token, options).await?;
// Both tracks are published once `connect` returns.
```

- `RoomOptions::publish_tracks: Vec<InitialTrack>`. `InitialTrack` is
`#[non_exhaustive]` with `InitialTrack::new`, and also converts from a
`(LocalTrack, TrackPublishOptions)` tuple.
- `livekit-signaling`: `SignalClient::connect` now takes an
`InitialPublish` (the offer plus the track requests) instead of a bare
publisher offer. This is a breaking change for that crate.
- `RtcEngine::connect` keeps its signature. The room uses a new
crate-internal `connect_with_tracks`.

## Behaviour

- **Fallbacks:** tracks that can't be sent with the join are published
normally before `connect` returns, so `publish_tracks` works in every
configuration and only the round-trip saving differs:
  - dual peer connection mode
- a server without the v1 signalling path (v1 returns 404 and the client
falls back to v0)
  - a failure to build the initial offer
- end-to-end encryption, because a join-time sender could send media
before its frame cryptor is attached (the cryptor needs the participant
identity from the join response)
- **Failure:** if a join-time track fails to publish, the room is closed
and `connect` returns the error.
- **Reconnect:** join-time tracks are not sent again on a full
reconnect. The room republishes its local tracks as it does for any
other publish.

## Implementation notes

- **Shared publish code:** `publish_track` is split into
`prepare_publish` (builds the request and encodings), `configure_sender`
(degradation preference and sender frame transformer, applied when the
transceiver is created, before any negotiation) and
`LocalParticipant::complete_publish` (registers the publication and
emits `LocalTrackPublished`). Join-time tracks go through the same steps
as `publish_track`.
- **Initial offer:** the initial offer gets the same SDP munging as
later offers, including the `x-google-start-bitrate` hint for join-time
video. The hint is marked as used only once the server's answer applies
that offer.
- **Early publisher transport:** the publisher transport is created
before joining. It is either used as is (offer sent and the v1 path
accepted) or closed and replaced, with the tracks detached from its
transceivers.
- **Lifecycle:** join-time tracks are taken out of the options before
the engine and room keep them, so nothing holds a track after it is
unpublished. A regression test covers this.

## Tests

New `livekit/tests/publish_with_join_test.rs`, run against
`livekit-server --dev`:
- publishing with the join in single and dual peer connection mode
- an encrypted room
- no duplicate publications after a full reconnect
- unpublishing a join-time track releases it (test-only
`LocalAudioTrack::drop_probe`)
- falling back when the server answers `/rtc/v1` with 404 (through a
local proxy)
- a refused track fails `connect`, leaves no participant behind and
doesn't leak the track

The existing unit tests and the `room`, `reconnection`,
`peer_connection_signaling`, `packet_trailer`, `video`, `audio`,
`data_channel_encryption` and `engine_lifecycle` e2e suites pass.

## Benchmark

Join with `publish_tracks` compared with `connect` followed by
`publish_track`, both in single peer connection mode, against
livekit-server 1.13.7 on the LAN. The tracks use synthetic audio and
video sources, each iteration uses a fresh room with a subscriber
already connected, and the two modes alternate. Times are p50 in ms from
when the publisher starts connecting, 30 iterations per mode.

**~105 ms RTT (network conditioner)**

| Tracks | Metric | `connect` + `publish_track` | `publish_tracks` |
Saved |
|---|---|---|---|---|
| audio | subscriber sees the track published | 755 | 633 | 122 |
| audio | subscriber's first audio frame | 885 | 766 | 119 |
| video | subscriber sees the track published | 926 | 634 | 292 |
| video | subscriber's first video frame | 1233 | 901 | 332 |
| audio + video | subscriber sees both tracks published | 1073 | 749 |
324 |
| audio + video | subscriber's first video frame | 1327 | 1008 | 319 |

**LAN, audio + video**

| Metric | `connect` + `publish_track` | `publish_tracks` |
|---|---|---|
| publisher has both tracks published | 103 | 51 |
| subscriber sees both tracks published | 199 | 71 |
| subscriber's first audio frame | 178 | 88 |
| subscriber's first video frame | 405 | 218 |

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
The generated Dart bindings leaked every byte or string payload that
crossed the boundary. Upstream fixed it in Uniffi-Dart/uniffi-dart#180
and Uniffi-Dart/uniffi-dart#182. Every published livekit_ffi so far is
generated from the 2026-08-31 pin and has the leak.

This moves `tools/bindgens` from 67547701 to 304bae06, upstream `main`
as of 2026-11-17. There is no newer tagged release, and the pin stays on
uniffi 0.31. The lockfile diff is the two uniffi-dart entries.

The public API of the generated package is unchanged. Also included from
upstream:

- Uniffi-Dart/uniffi-dart#172, a disposed Rust object or trait wrapper
cannot be reused
- Uniffi-Dart/uniffi-dart#179, no temporary RustBuffers in enum and
callback conversion
- Uniffi-Dart/uniffi-dart#173, a callback whose error cannot be encoded
still completes on the Rust side
- Uniffi-Dart/uniffi-dart#177, a negative or out-of-range Duration is
rejected with an error

`unawaited_return_in_try_block` and `dead_code` join the generated-code
ignores in `support/dart/analysis_options.yaml`.

### Checks

- `cargo make dart-package`, `dart analyze` clean, 5 of 5 package tests,
`dart pub publish --dry-run` 0 warnings.
- e2e-flutter on macOS against client-sdk-flutter `main` (a40ca98e),
data stream scenarios plus the Rust core load: 10 pass, 2 expected
failures, the same as with the published package.
- Memory, same e2e run, RSS growth:

| | published 0.13.4 | this branch |
|---|---|---|
| 30 x 8 MiB `sendBytes` round trips | +1006 MB | +254 and +623 MB in
two runs |
| 256 MiB `sendFile`, peak | +826 MB | +147 MB |

The round trip reading is noisy on this branch because it depends on
when garbage collection runs. Over 120 round trips it moves between +224
MB and +710 MB and falls back twice. The published package added about
300 MB every 10 round trips over the 30 it was measured for.
Part of CLTCU-19. Rebased onto `main` now that livekit#1643 is closed — this no
longer depends on it, and carries no proto change.

Converting a video frame allocated a fresh buffer the size of the frame
and freed it when the binding released the handle. At 1628x1920 I420
that is 4.5 MB per frame, so a 30 fps stream churned **134 MB/s** of
short-lived allocations that large.

Allocations that size bypass the allocator's free lists: the Windows
heap sends anything over ~512 KB straight to `VirtualAlloc` and
decommits it on free, so each frame faults in a fresh ~1150-page mapping
and gives it back. glibc avoids that by raising its mmap threshold as
large blocks are freed.

**Read this before reviewing: that mechanism is reasoned from allocator
behaviour, not measured on Windows.** The reduction in allocator traffic
is real either way, but whether it is what fixes the customer's loss is
not established. The one measurement we do have from the investigation
points elsewhere — a bounded-queue A/B showed 56 frames lost with the
default 1-frame queue and 0 with `queue_size_frames=0`, which argues the
queue depth is the lever rather than the allocation. That change is a
one-liner in the bindings and is not in any open PR.

So this is a defensible performance change on its own merits, and should
be judged as one — not as the fix for CLTCU-19.

## How it works

`cvt` writes into a buffer the caller owns, and each stream keeps a
small set to hand back.

A buffer may only be written while nothing else holds it, and `Arc` is
what knows: the FFI handle map holds a clone for as long as the binding
has the frame, so a strong count of 1 means the buffer came back.

```rust
fn acquire(&mut self) -> &mut Arc<Vec<u8>> {
    if let Some(i) = self.buffers.iter().position(|b| Arc::strong_count(b) == 1) {
        return &mut self.buffers[i];     // the binding released it
    }
    ...                                   // else add one, up to the cap
}
```

`Arc::get_mut` turns "is the binding done?" into a question the borrow
checker answers rather than one the code has to get right. That matters
because the failure mode is nasty: `send_event` returns long before the
binding reads the pixels — in Python the callback only parses the small
protobuf event and defers the copy to the event loop — so writing too
early **tears frames** rather than dropping them.

## Sizing

Nothing depends on the binding releasing promptly: when no buffer is
free the stream adds one, up to `MAX_FRAME_BUFFERS = 3`, past which it
allocates per frame exactly as before.

| Consumer | Buffers |
|---|---|
| C++ today (copying; handle disposed inside the callback) | 1 |
| Python today (copying) | 1 |
| Unity / any renderer (holds the frame it is uploading while the next
arrives) | 2 |
| sustained backlog | capped, falls back to per-frame |

The cap is small deliberately: the set never shrinks, so a burst would
otherwise pin its high-water mark for the life of the stream — 12 MB per
4K frame.

## This is not the end state

There is a `TODO(sxian)` on `to_video_buffer_info` spelling this out.
For a native-format request `cvt` only repacks the decoder's padded
strides into tight ones; we could hand out the decoder's buffer instead,
and `impl FfiHandle for BoxVideoBuffer` plus
`VideoBufferInfo.components` already make that possible. Doing so would
delete this pooling entirely, because libwebrtc's `VideoFrameBufferPool`
already pools and refcounts decoder buffers. It needs stride-aware
consumers first — the C++ SDK reads `components[].stride` today, Python
and Unity assume packed.

## Testing

`cargo test -p livekit-ffi`: 37 pass, including a released buffer being
handed out again, a buffer the binding still holds **never** being
handed out, a renderer settling at exactly two, growth stopping at the
cap with all outstanding buffers distinct, a mid-stream size change
(simulcast layer switch) reusing the allocation, and one test driving
the real `FFI_SERVER` handle map rather than a stand-in.

Verified end to end against the C++ SDK with a live `livekit-server` —
reading valid non-black luma across 20 consecutive frames, each reusing
a buffer a previous frame returned.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…t them (livekit#1691)

The polled outgoing data stream adapter in `core-modules` acknowledged a
send as soon as its packets were buffered. A `send_*` or `write` call
resolved before anything reached the transport, transport errors were
lost, and nothing slowed a producer down. Flutter is the one SDK on this
adapter. It shows as unbounded memory growth on a large `sendFile` and
as send errors that never reach the caller. Swift and Android pass their
own delegate, which already resolves a send once the packets are handed
to the data channel, and this brings Flutter to the same point.

`OutgoingPacketQueue.next_packets()` is replaced by `next_batch()`,
which returns an `OutgoingPacketBatch` record: the `packets`, moved out
without a copy, and an `ack` object with `complete()` and
`fail(reason)`. The send resolves when the host completes the ack. It
fails when the ack fails, is released without an outcome, or the queue
is closed. The manager already awaits each delegate call, so at most one
batch is pending.

The queue is split into two halves. The manager holds the sending half
and the host holds `OutgoingPacketQueue`, the receiving half. Releasing
the queue then drops a batch nobody pulled, which fails its send and
lets the forwarding task finish. The sending half also watches the token
its manager cancels on drop, so the task finishes when the manager goes
away, whatever the host still holds. `outgoing.rs` gains a constructor
that takes that token. Its forwarding task is unchanged, so hosts that
pass their own delegate are not affected.

This is a breaking change for hosts on the polled adapter, so the
changeset is `livekit-ffi: major`.

### Checks

- `cargo test -p livekit-ffi --no-default-features --features
core-modules` passes, 78 tests. New `polled_*` tests cover the wait, a
failed batch, a dropped batch, a closed queue, a queue released with an
unpulled batch, a manager dropped while the host keeps the queue or a
pulled batch, and 200 repeated sends that check every ack is released.
- e2e-flutter on macOS against a local server, client-sdk-flutter with
livekit/client-sdk-flutter#1295. Run together with the uniffi-dart pin
from livekit#1636. The table is from 37c5951, and the macOS run was repeated
on the current API with the same result:

| | published 0.13.4 | livekit#1636 only | livekit#1636 and this PR |
|---|---|---|---|
| 256 MiB `sendFile`, peak RSS growth | +826 MB | +147 MB | +45 MB |
| `sendText` then `disconnect()`, localhost | never arrives | never
arrives | arrives |
| other 10 data stream and core scenarios | pass | pass | pass |

The same scenarios pass on an iOS simulator and on an iPhone 17 Pro over
Wi-Fi, with one exception on the phone: `sendText` then `disconnect()`
is still not reliable there. A send now resolves when its packets are
handed to the data channel, and Flutter's `disconnect()` does not wait
for the channel to drain. The JS, Swift and Android SDKs send the Leave
without that wait too, so it is a gap of its own and not part of this
PR.
…oms close (livekit#1538)

## Summary

This leak was detected during C++ regression test work catching memory
leaks, see here:
https://github.com/livekit/client-sdk-cpp/actions/runs/43513539718#summary-132669981633

It happens intermittently, but in troubleshooting with GPT this issue
was identified.

Changes:

- Cancel in-flight fast-publish and debounced publisher negotiations
through the session close signal
- Ignore publisher negotiation requests after session closure
- Add an ownership regression test and release changeset

## Root cause

Publisher negotiation ran in detached Tokio tasks that strongly retained
`SessionInner`. During rapid video publish, unpublish, and disconnect
cycles, a task could remain waiting up to 10 seconds for an SDP answer
and then retry after the room had closed. The retained session kept its
peer connections, peer connection factory, media threads, and encoder
resources alive.

## Validation

- New focused ownership cancellation test passed
- In the C++ SDK, reproduced before the fix under `taskset -c 0,1`: run
6 gained 8 threads and 64.44 MiB
- After the fix, 12 consecutive 100-cycle constrained-CPU video runs
passed with thread count stable at 7

Fixes BOT-586
Simple compilation issue on test code, not exercised in CI properly due
to out of date prior branch. Fixed the compilation issue and adjusted
GitHub repo settings to require branches be up to date so other PRs
pre-CI refactor are tested correctly.
xianshijing-lk and others added 12 commits November 18, 2026 15:02
…t#1699)

## Summary

Fixes the intermittent Windows CI abort tracked in livekit#1681. It is a real
use-after-free in `webrtc-sys`, not a test problem, and it is not
specific to the test that surfaced it.

## Root cause

1. The prebuilt libwebrtc is built with Chromium's `no_exceptions`
config. On Windows (`use_custom_libcxx=false`) that config is just
`-D_HAS_EXCEPTIONS=0`, and the define lands in `webrtc.ninja`:

   ```
$ unzip -p webrtc-win-x64-release.zip win-x64-release/webrtc.ninja |
head -1 | grep -o '_HAS_EXCEPTIONS=.'
   _HAS_EXCEPTIONS=0
   ```

2. `webrtc_sys_build::webrtc_defines()` scrapes every `-D` out of that
file and `build.rs` applies them to our own translation units, so
`_HAS_EXCEPTIONS=0` applies to this crate's C++ as well.

3. Under `_HAS_EXCEPTIONS=0` the MSVC STL swaps in stub exception
classes whose `runtime_error(const std::string&)` constructor **stores
the pointer instead of copying the message** — microsoft/STL#2114.

4. Every error path in this crate throws with a temporary `std::string`:

   ```cpp
   throw std::runtime_error(serialize_error(to_error(result)));
   ```

The temporary dies at the end of the throw expression, so `what()`
dangles while the exception unwinds. cxx's `Fail::operator()` then calls
`strlen` on freed memory and passes the result to
`cxxbridge1$exception`, where Rust's debug `copy_nonoverlapping`
precondition check catches the garbage and aborts:

   ```
   thread '...' panicked at library\core\src\ptr\mod.rs:531:5:
unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that
both
pointer arguments are aligned and non-null and the specified memory
ranges do not overlap
      ...
3: <u8 as <[_]>::to_vec_in::ConvertVec>::to_vec::<alloc::alloc::Global>
      5: <alloc::borrow::Cow<str>>::into_owned
      6: cxxbridge1$exception
      7: rust::cxxbridge1::detail::Fail::operator()
   thread caused non-unwinding panic. aborting.
process didn't exit successfully: ... (exit code: 0xc0000409,
STATUS_STACK_BUFFER_OVERRUN)
   ```

It is intermittent because it depends on whether the freed block still
happens to hold the old bytes, and Windows-only because libstdc++ and
libc++ copy the message.

## Not just `set_bitrate`

The exceptions these tests trigger are expected — throwing is how a `->
Result<...>` bridge fn reports an error to Rust. Every such call was
affected, including production paths:

- `PeerConnection::set_bitrate` →
`libwebrtc::imp::peer_connection::tests::set_bitrate`
- `PeerConnection::remove_track` during room teardown →
`test_room_deleted_disconnects_without_reconnect`, which aborted on
`main` ([run
44139973215](https://github.com/livekit/rust-sdks/actions/runs/44139973215))

## Changes

- Add `livekit_ffi::BridgeException`, which owns its message by value,
so `what()` stays valid regardless of how the STL is configured.
- Convert all 17 throw sites across `peer_connection.cpp`,
`peer_connection_factory.cpp`, `rtp_sender.cpp`, `rtp_transceiver.cpp`,
`jsep.cpp` and `frame_cryptor.cpp`.
- Document the rule in `webrtc-sys/AGENTS.md` so it is not reintroduced.

Filtering `_HAS_EXCEPTIONS` out of the scraped defines was considered
and rejected: it would make this crate disagree with the prebuilt
libwebrtc about STL internals, trading a fixed bug for an ODR hazard
across far more code.

## Validation

`cargo build -p webrtc-sys`, `cargo test -p webrtc-sys` (11 passed) and
`cargo test -p libwebrtc --lib` (31 passed, including `set_bitrate`) are
green locally on macOS — but macOS never had the bug, so **the
meaningful check is the Windows CI job on this PR**.

The existing assertion in the `set_bitrate` test doubles as the
regression check: a dangling `what()` produces a garbled or truncated
message, which `err.message.contains("start_bitrate_bps <
min_bitrate_bps")` would catch.

## Related

There is a separate latent mismatch this PR does not touch: `cxx.cc` is
compiled by the `cxx` crate without our defines, so it sees
`_HAS_EXCEPTIONS=1` while our shims see `=0`, and `std::exception`'s
layout differs between them. That only matters if cxx itself throws
(non-UTF-8 data into `rust::String`, out-of-range `rust::Slice`), which
we do not hit today.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
> [!IMPORTANT]
> Merging this pull request will create these releases

# livekit-data-stream 0.3.0 (2026-11-18)
## Breaking Changes

- Add `semconv`, the telemetry names and enum values generated from the
protocol's Weaver registry, and move the protocol submodule to
`538dd3f0`, the merged registry. This is a breaking upgrade of the
generated Rust source, taken as a minor bump before 1.0 with no
compatibility alias: `DataTrackExtensionId::DteiParticipantSidLow` is
gone and value 1 is now `DteiE2ee` (JSON name `DTEI_E2EE`, so the old
name no longer parses), `media_source::Video` gains the `Videos`
variant, `media_source::Video`, `StreamOutput`, `UpdateStreamRequest`
and `MigrateJobRequest` lose `Eq` and `Hash`,
`simulation_run::job_metrics::Turn` loses `Copy`, and request messages
such as `UpdateStreamRequest` and `TransferSipParticipantRequest` gain
fields, so exhaustive matches and struct literals in downstream code
need `..Default::default()` or new arms. `livekit-common`,
`livekit-data-stream`, `livekit-datatrack`, `livekit-rpc`,
`livekit-token`, `livekit-signaling` and `livekit` expose protocol types
in their public API, and `livekit-capture` exposes `livekit` types, so
each takes the same break.

## Fixes

- AgentDB wire errors carry a numeric code with its name and
description, and Hello carries the client version.
- Update dependent SDK packages for the Agents 2.0 protocol and service
client changes.
# livekit 0.12.0 (2026-11-18)
## Breaking Changes

- Add `semconv`, the telemetry names and enum values generated from the
protocol's Weaver registry, and move the protocol submodule to
`538dd3f0`, the merged registry. This is a breaking upgrade of the
generated Rust source, taken as a minor bump before 1.0 with no
compatibility alias: `DataTrackExtensionId::DteiParticipantSidLow` is
gone and value 1 is now `DteiE2ee` (JSON name `DTEI_E2EE`, so the old
name no longer parses), `media_source::Video` gains the `Videos`
variant, `media_source::Video`, `StreamOutput`, `UpdateStreamRequest`
and `MigrateJobRequest` lose `Eq` and `Hash`,
`simulation_run::job_metrics::Turn` loses `Copy`, and request messages
such as `UpdateStreamRequest` and `TransferSipParticipantRequest` gain
fields, so exhaustive matches and struct literals in downstream code
need `..Default::default()` or new arms. `livekit-common`,
`livekit-data-stream`, `livekit-datatrack`, `livekit-rpc`,
`livekit-token`, `livekit-signaling` and `livekit` expose protocol types
in their public API, and `livekit-capture` exposes `livekit` types, so
each takes the same break.

## Features

- Add `RoomOptions::publish_tracks`, a list of tracks and their publish
options published while connecting and sent with the join request in
single peer connection mode to save the round trips of a separate
`AddTrackRequest` and SDP negotiation; `livekit-signaling`'s
`SignalClient::connect` now takes an `InitialPublish` instead of a bare
publisher offer, and `RtcEngine::connect` takes the tracks to publish
with the join. Local tracks now keep the WebRTC runtime that created
them alive, so tracks created before connecting stay usable in the room;
call `enable_zero_playout_delay` before creating local tracks, since it
fails once the runtime is active. Publishing a track now fails as soon
as the server refuses it instead of after the publish timeout, and a
track muted before or while it is published stays muted instead of being
re-enabled.

## Fixes

- AgentDB wire errors carry a numeric code with its name and
description, and Hello carries the client version.
- Update dependent SDK packages for the Agents 2.0 protocol and service
client changes.
- Cancel and join pending publisher negotiations when a room closes,
including the debounce wait, so negotiation tasks no longer retain peer
connection factories, media threads, and encoder resources after
teardown.
- Fix compilation of publisher negotiation lifecycle tests after the
track-publishing join API update.
- Fix Objective-C linking - livekit#1394 (@ladvoc)
- Mark data track unpublished after republish fail - livekit#1537 (@ladvoc)
- Fix a debug-build abort when a data channel receives an empty message.
- Fix an intermittent abort on Windows when a webrtc-sys call reports an
error to Rust. The prebuilt libwebrtc is compiled with
`_HAS_EXCEPTIONS=0`, and the build script copies that define onto this
crate, so MSVC's `std::runtime_error(const std::string&)` kept only a
pointer to the temporary message instead of copying it. `what()` then
dangled while the exception unwound and cxx read freed memory to build
the Rust `Err`. Error messages are now owned by the thrown exception.
# livekit-capture 0.3.0 (2026-11-18)
## Breaking Changes

- Add `semconv`, the telemetry names and enum values generated from the
protocol's Weaver registry, and move the protocol submodule to
`538dd3f0`, the merged registry. This is a breaking upgrade of the
generated Rust source, taken as a minor bump before 1.0 with no
compatibility alias: `DataTrackExtensionId::DteiParticipantSidLow` is
gone and value 1 is now `DteiE2ee` (JSON name `DTEI_E2EE`, so the old
name no longer parses), `media_source::Video` gains the `Videos`
variant, `media_source::Video`, `StreamOutput`, `UpdateStreamRequest`
and `MigrateJobRequest` lose `Eq` and `Hash`,
`simulation_run::job_metrics::Turn` loses `Copy`, and request messages
such as `UpdateStreamRequest` and `TransferSipParticipantRequest` gain
fields, so exhaustive matches and struct literals in downstream code
need `..Default::default()` or new arms. `livekit-common`,
`livekit-data-stream`, `livekit-datatrack`, `livekit-rpc`,
`livekit-token`, `livekit-signaling` and `livekit` expose protocol types
in their public API, and `livekit-capture` exposes `livekit` types, so
each takes the same break.

## Fixes

- AgentDB wire errors carry a numeric code with its name and
description, and Hello carries the client version.
- Update dependent SDK packages for the Agents 2.0 protocol and service
client changes.
- Cancel and join pending publisher negotiations when a room closes,
including the debounce wait, so negotiation tasks no longer retain peer
connection factories, media threads, and encoder resources after
teardown.
- Fix compilation of publisher negotiation lifecycle tests after the
track-publishing join API update.
- Mark data track unpublished after republish fail - livekit#1537 (@ladvoc)
- Add `RoomOptions::publish_tracks`, a list of tracks and their publish
options published while connecting and sent with the join request in
single peer connection mode to save the round trips of a separate
`AddTrackRequest` and SDP negotiation; `livekit-signaling`'s
`SignalClient::connect` now takes an `InitialPublish` instead of a bare
publisher offer, and `RtcEngine::connect` takes the tracks to publish
with the join. Local tracks now keep the WebRTC runtime that created
them alive, so tracks created before connecting stay usable in the room;
call `enable_zero_playout_delay` before creating local tracks, since it
fails once the runtime is active. Publishing a track now fails as soon
as the server refuses it instead of after the publish timeout, and a
track muted before or while it is published stays muted instead of being
re-enabled.
- Fix a debug-build abort when a data channel receives an empty message.
- Fix an intermittent abort on Windows when a webrtc-sys call reports an
error to Rust. The prebuilt libwebrtc is compiled with
`_HAS_EXCEPTIONS=0`, and the build script copies that define onto this
crate, so MSVC's `std::runtime_error(const std::string&)` kept only a
pointer to the temporary message instead of copying it. `what()` then
dangled while the exception unwound and cxx read freed memory to build
the Rust `Err`. Error messages are now owned by the thrown exception.
# livekit-token 0.5.0 (2026-11-18)
## Breaking Changes

- Add `semconv`, the telemetry names and enum values generated from the
protocol's Weaver registry, and move the protocol submodule to
`538dd3f0`, the merged registry. This is a breaking upgrade of the
generated Rust source, taken as a minor bump before 1.0 with no
compatibility alias: `DataTrackExtensionId::DteiParticipantSidLow` is
gone and value 1 is now `DteiE2ee` (JSON name `DTEI_E2EE`, so the old
name no longer parses), `media_source::Video` gains the `Videos`
variant, `media_source::Video`, `StreamOutput`, `UpdateStreamRequest`
and `MigrateJobRequest` lose `Eq` and `Hash`,
`simulation_run::job_metrics::Turn` loses `Copy`, and request messages
such as `UpdateStreamRequest` and `TransferSipParticipantRequest` gain
fields, so exhaustive matches and struct literals in downstream code
need `..Default::default()` or new arms. `livekit-common`,
`livekit-data-stream`, `livekit-datatrack`, `livekit-rpc`,
`livekit-token`, `livekit-signaling` and `livekit` expose protocol types
in their public API, and `livekit-capture` exposes `livekit` types, so
each takes the same break.

## Fixes

- AgentDB wire errors carry a numeric code with its name and
description, and Hello carries the client version.
- Update dependent SDK packages for the Agents 2.0 protocol and service
client changes.
# libwebrtc 0.4.2 (2026-11-18)
## Fixes

- Fix Objective-C linking - livekit#1394 (@ladvoc)
- Fix a debug-build abort when a data channel receives an empty message.
- Fix an intermittent abort on Windows when a webrtc-sys call reports an
error to Rust. The prebuilt libwebrtc is compiled with
`_HAS_EXCEPTIONS=0`, and the build script copies that define onto this
crate, so MSVC's `std::runtime_error(const std::string&)` kept only a
pointer to the temporary message instead of copying it. `what()` then
dangled while the exception unwound and cxx read freed memory to build
the Rust `Err`. Error messages are now owned by the thrown exception.
# livekit-datatrack 0.3.0 (2026-11-18)
## Breaking Changes

- Add `semconv`, the telemetry names and enum values generated from the
protocol's Weaver registry, and move the protocol submodule to
`538dd3f0`, the merged registry. This is a breaking upgrade of the
generated Rust source, taken as a minor bump before 1.0 with no
compatibility alias: `DataTrackExtensionId::DteiParticipantSidLow` is
gone and value 1 is now `DteiE2ee` (JSON name `DTEI_E2EE`, so the old
name no longer parses), `media_source::Video` gains the `Videos`
variant, `media_source::Video`, `StreamOutput`, `UpdateStreamRequest`
and `MigrateJobRequest` lose `Eq` and `Hash`,
`simulation_run::job_metrics::Turn` loses `Copy`, and request messages
such as `UpdateStreamRequest` and `TransferSipParticipantRequest` gain
fields, so exhaustive matches and struct literals in downstream code
need `..Default::default()` or new arms. `livekit-common`,
`livekit-data-stream`, `livekit-datatrack`, `livekit-rpc`,
`livekit-token`, `livekit-signaling` and `livekit` expose protocol types
in their public API, and `livekit-capture` exposes `livekit` types, so
each takes the same break.

## Fixes

- AgentDB wire errors carry a numeric code with its name and
description, and Hello carries the client version.
- Update dependent SDK packages for the Agents 2.0 protocol and service
client changes.
- Mark data track unpublished after republish fail - livekit#1537 (@ladvoc)
# livekit-ffi 0.15.0 (2026-11-18)
## Breaking Changes

- The polled outgoing data stream adapter resolves a send once the host
reports its batch as sent, and no longer when the packets are buffered.
`OutgoingPacketQueue.next_packets()` is replaced by `next_batch()`,
which returns the packets and an `ack` the host must `complete()` or
`fail(reason)`.

## Features

- Probe cargo-ndk through Cargo when packaging Android bindings so an
installed 4.x tool is recognized without an unnecessary reinstall.
- Add typed app event and correlation attribute methods to
TelemetryScope while preserving the existing string methods, core
validation and capture snapshots.
- Export the telemetry `ReconnectReason` to Swift, Kotlin, Python and
Dart as `TelemetryReconnectReason`, so it no longer collides with the
signaling `ReconnectReason`. Foreign code that names the telemetry enum
must rename `ReconnectReason` to `TelemetryReconnectReason`. The Rust
name, the variants and `telemetry_reconnect_reason` are unchanged.
- Rename the exported RTC sample field and stats report argument from
`track_sid` to `track_id`; Rust and foreign callers must migrate the
input name while continuing to pass the same LiveKit track identifier
values.
- Limit the FFI lifecycle to three admitted telemetry generations and
return AtCapacity before constructing a rejected replacement; pulled
configuration now returns a Result and callers must keep serving
previous queues when replacement fails.
- Expose the client telemetry core through the `core-modules` UniFFI
surface (`telemetry_configure`, `telemetry_configure_pulled`,
`telemetry_scope`, spans, stats and `telemetry_disable`);
`log_forward_bootstrap` now copies the core's own warnings and errors
into telemetry and keeps the Rust log level at `warn` or looser.

## Fixes

- AgentDB wire errors carry a numeric code with its name and
description, and Hello carries the client version.
- Update dependent SDK packages for the Agents 2.0 protocol and service
client changes.
- Bump uniffi-dart to 304bae06 so the generated Dart bindings no longer
leak byte and string payloads.
- Cancel and join pending publisher negotiations when a room closes,
including the debounce wait, so negotiation tasks no longer retain peer
connection factories, media threads, and encoder resources after
teardown.
- A `telemetry_configure` call with no transport after the opt-out is
now refused like any other configure (`Ok`, storage erased) instead of
failing with `NoTransport`, and the Android build pins `cargo-ndk` to
4.1.2.
- Fix compilation of publisher negotiation lifecycle tests after the
track-publishing join API update.
- Fix Objective-C linking - livekit#1394 (@ladvoc)
- Mark data track unpublished after republish fail - livekit#1537 (@ladvoc)
- Add `RoomOptions::publish_tracks`, a list of tracks and their publish
options published while connecting and sent with the join request in
single peer connection mode to save the round trips of a separate
`AddTrackRequest` and SDP negotiation; `livekit-signaling`'s
`SignalClient::connect` now takes an `InitialPublish` instead of a bare
publisher offer, and `RtcEngine::connect` takes the tracks to publish
with the join. Local tracks now keep the WebRTC runtime that created
them alive, so tracks created before connecting stay usable in the room;
call `enable_zero_playout_delay` before creating local tracks, since it
fails once the runtime is active. Publishing a track now fails as soon
as the server refuses it instead of after the publish timeout, and a
track muted before or while it is published stays muted instead of being
re-enabled.
- Reuse video frame conversion buffers across frames instead of
allocating and freeing a frame-sized block for every frame.
- Fix a debug-build abort when a data channel receives an empty message.
- Fix an intermittent abort on Windows when a webrtc-sys call reports an
error to Rust. The prebuilt libwebrtc is compiled with
`_HAS_EXCEPTIONS=0`, and the build script copies that define onto this
crate, so MSVC's `std::runtime_error(const std::string&)` kept only a
pointer to the temporary message instead of copying it. `what()` then
dangled while the exception unwound and cxx read freed memory to build
the Rust `Err`. Error messages are now owned by the thrown exception.
# webrtc-sys 0.3.55 (2026-11-18)
## Fixes

- Fix Objective-C linking - livekit#1394 (@ladvoc)
- Fix a debug-build abort when a data channel receives an empty message.
- Fix an intermittent abort on Windows when a webrtc-sys call reports an
error to Rust. The prebuilt libwebrtc is compiled with
`_HAS_EXCEPTIONS=0`, and the build script copies that define onto this
crate, so MSVC's `std::runtime_error(const std::string&)` kept only a
pointer to the temporary message instead of copying it. `what()` then
dangled while the exception unwound and cxx read freed memory to build
the Rust `Err`. Error messages are now owned by the thrown exception.
# livekit-common 0.2.0 (2026-11-18)
## Breaking Changes

- Add `semconv`, the telemetry names and enum values generated from the
protocol's Weaver registry, and move the protocol submodule to
`538dd3f0`, the merged registry. This is a breaking upgrade of the
generated Rust source, taken as a minor bump before 1.0 with no
compatibility alias: `DataTrackExtensionId::DteiParticipantSidLow` is
gone and value 1 is now `DteiE2ee` (JSON name `DTEI_E2EE`, so the old
name no longer parses), `media_source::Video` gains the `Videos`
variant, `media_source::Video`, `StreamOutput`, `UpdateStreamRequest`
and `MigrateJobRequest` lose `Eq` and `Hash`,
`simulation_run::job_metrics::Turn` loses `Copy`, and request messages
such as `UpdateStreamRequest` and `TransferSipParticipantRequest` gain
fields, so exhaustive matches and struct literals in downstream code
need `..Default::default()` or new arms. `livekit-common`,
`livekit-data-stream`, `livekit-datatrack`, `livekit-rpc`,
`livekit-token`, `livekit-signaling` and `livekit` expose protocol types
in their public API, and `livekit-capture` exposes `livekit` types, so
each takes the same break.

## Fixes

- AgentDB wire errors carry a numeric code with its name and
description, and Hello carries the client version.
- Update dependent SDK packages for the Agents 2.0 protocol and service
client changes.
# livekit-telemetry 0.3.0 (2026-11-18)
## Breaking Changes

- Take every telemetry name from the protocol registry
(`livekit_protocol::semconv`) and send its spelling: `lk.room_id`,
`lk.participant_id`, `lk.track_id`, `lk.pii.room_name`,
`lk.pii.participant_identity`, `lk.pii.remote_participant_identity`,
`lk.track_source` with the RTC FFI `TrackSource` names, and
`lk.disconnect_reason` with the protobuf `DisconnectReason` names.

## Features

- Rename the exported RTC sample field and stats report argument from
`track_sid` to `track_id`; Rust and foreign callers must migrate the
input name while continuing to pass the same LiveKit track identifier
values.
- Limit the FFI lifecycle to three admitted telemetry generations and
return AtCapacity before constructing a rejected replacement; pulled
configuration now returns a Result and callers must keep serving
previous queues when replacement fails.
- Add `global::log_with`, which builds a log record only while a
pipeline is installed, and free the instruments that `global::uninstall`
and `global::disable` remove outside the installed-pipeline lock, so an
instrument destructor can log.
- Test the telemetry pipeline end to end against the backend contract:
routing, tokens, collector answers, retries, holds and the write-ahead
cache.
- Add the telemetry pipeline: per-room scopes, typed spans, and an
exporter that caches and uploads OTLP batches under a device-aware
cadence and hold policy.
- Add `global`, a process-wide telemetry pipeline with platform
instruments and a synchronous opt-out that retries incomplete erasures.
- Convert a `log::Level` into a telemetry `Severity` with `From`, and
remove the process pipeline without draining it with
`global::uninstall`.
- Clarify exclusive ownership of the configured telemetry cache
directory and the conservative opt-out result when a final per-cache
clear fails.
- Recover cached batches with streaming splits above an 8 MiB threshold
for decoded input. Retain unsupported batches and remove stale metadata
after parent eviction.
- Rename telemetry stats report input arguments to `track_id` alongside
the breaking `RtcStatsSample` field migration while preserving track
values and existing report admission semantics.

## Fixes

- Clearing the telemetry disk cache now syncs the directory once for its
deletion sweep instead of once per batch, and still syncs it when a
deletion fails.
- Clearing the telemetry disk cache, as the opt-out does, now also
deletes stray files in the storage directory and reports an entry it
cannot delete, so the opt-out no longer reports success while a stray
file stays.
- A Room that connects while the exporter retires unused credentials
keeps its token, so its telemetry no longer waits forever without
uploading.
- Export the telemetry `ReconnectReason` to Swift, Kotlin, Python and
Dart as `TelemetryReconnectReason`, so it no longer collides with the
signaling `ReconnectReason`. Foreign code that names the telemetry enum
must rename `ReconnectReason` to `TelemetryReconnectReason`. The Rust
name, the variants and `telemetry_reconnect_reason` are unchanged.
- A telemetry pipeline that `install` refuses after the opt-out is now
cancelled, so its exporter stops by itself (the caller still joins the
task), and it stays known to later `disable` calls, which retry a failed
delete of its caller-provided cache; installing the installed pipeline
again no longer hands it back as the outgoing one.
- Clarify that a failed batch split can report an already evicted parent
without resurrecting records or counting the loss twice.
- Keep telemetry correlation consistent: a room identity change closes
the open RTC windows and applies all four fields together, scoped
records and spans no longer link to a span of another session, and
`max_cache_bytes` gets its documented one-byte floor.
- A telemetry shutdown now gives the records and spans that a retained
scope captures during its final drain further bounded encoding turns,
which start only before the original export deadline; a started turn may
finish after that deadline, and what is still queued when no further
turn may start is not cached.
# livekit-api 0.11.0 (2026-11-18)
## Breaking Changes

- Upgrade to the breaking `livekit-protocol` release that moves the
submodule to `538dd3f0`: `livekit-api`'s own method signatures are
unchanged and its two request literals fill the new
`UpdateStreamRequest` and `TransferSipParticipantRequest` fields with
defaults, but the protocol types it exposes publicly change with it (for
example `EgressOutput::Stream(proto::StreamOutput)` now carries
`destinations` and `StreamOutput` no longer derives `Eq` and `Hash`), so
callers that destructure or construct those payloads, or that pass
values from an older `livekit-protocol`, need to update.

## Features

- Add `RoomOptions::publish_tracks`, a list of tracks and their publish
options published while connecting and sent with the join request in
single peer connection mode to save the round trips of a separate
`AddTrackRequest` and SDP negotiation; `livekit-signaling`'s
`SignalClient::connect` now takes an `InitialPublish` instead of a bare
publisher offer, and `RtcEngine::connect` takes the tracks to publish
with the join. Local tracks now keep the WebRTC runtime that created
them alive, so tracks created before connecting stay usable in the room;
call `enable_zero_playout_delay` before creating local tracks, since it
fails once the runtime is active. Publishing a track now fails as soon
as the server refuses it instead of after the publish timeout, and a
track muted before or while it is published stays muted instead of being
re-enabled.

## Fixes

- Preserve all seven framework task states and absent versus empty task
names in thread listings, retaining typed status filters.
- AgentDB wire errors carry a numeric code with its name and
description, and Hello carries the client version.
- Allow LiveKitApi to reuse a caller-supplied HTTP client so services
share its TLS configuration and connection pool.
# livekit-signaling 0.3.0 (2026-11-18)
## Breaking Changes

- Add `semconv`, the telemetry names and enum values generated from the
protocol's Weaver registry, and move the protocol submodule to
`538dd3f0`, the merged registry. This is a breaking upgrade of the
generated Rust source, taken as a minor bump before 1.0 with no
compatibility alias: `DataTrackExtensionId::DteiParticipantSidLow` is
gone and value 1 is now `DteiE2ee` (JSON name `DTEI_E2EE`, so the old
name no longer parses), `media_source::Video` gains the `Videos`
variant, `media_source::Video`, `StreamOutput`, `UpdateStreamRequest`
and `MigrateJobRequest` lose `Eq` and `Hash`,
`simulation_run::job_metrics::Turn` loses `Copy`, and request messages
such as `UpdateStreamRequest` and `TransferSipParticipantRequest` gain
fields, so exhaustive matches and struct literals in downstream code
need `..Default::default()` or new arms. `livekit-common`,
`livekit-data-stream`, `livekit-datatrack`, `livekit-rpc`,
`livekit-token`, `livekit-signaling` and `livekit` expose protocol types
in their public API, and `livekit-capture` exposes `livekit` types, so
each takes the same break.

## Features

- Add `RoomOptions::publish_tracks`, a list of tracks and their publish
options published while connecting and sent with the join request in
single peer connection mode to save the round trips of a separate
`AddTrackRequest` and SDP negotiation; `livekit-signaling`'s
`SignalClient::connect` now takes an `InitialPublish` instead of a bare
publisher offer, and `RtcEngine::connect` takes the tracks to publish
with the join. Local tracks now keep the WebRTC runtime that created
them alive, so tracks created before connecting stay usable in the room;
call `enable_zero_playout_delay` before creating local tracks, since it
fails once the runtime is active. Publishing a track now fails as soon
as the server refuses it instead of after the publish timeout, and a
track muted before or while it is published stays muted instead of being
re-enabled.

## Fixes

- AgentDB wire errors carry a numeric code with its name and
description, and Hello carries the client version.
- Update dependent SDK packages for the Agents 2.0 protocol and service
client changes.
# livekit-protocol 0.9.0 (2026-11-18)
## Breaking Changes

- Add `semconv`, the telemetry names and enum values generated from the
protocol's Weaver registry, and move the protocol submodule to
`538dd3f0`, the merged registry. This is a breaking upgrade of the
generated Rust source, taken as a minor bump before 1.0 with no
compatibility alias: `DataTrackExtensionId::DteiParticipantSidLow` is
gone and value 1 is now `DteiE2ee` (JSON name `DTEI_E2EE`, so the old
name no longer parses), `media_source::Video` gains the `Videos`
variant, `media_source::Video`, `StreamOutput`, `UpdateStreamRequest`
and `MigrateJobRequest` lose `Eq` and `Hash`,
`simulation_run::job_metrics::Turn` loses `Copy`, and request messages
such as `UpdateStreamRequest` and `TransferSipParticipantRequest` gain
fields, so exhaustive matches and struct literals in downstream code
need `..Default::default()` or new arms. `livekit-common`,
`livekit-data-stream`, `livekit-datatrack`, `livekit-rpc`,
`livekit-token`, `livekit-signaling` and `livekit` expose protocol types
in their public API, and `livekit-capture` exposes `livekit` types, so
each takes the same break.

## Fixes

- Preserve all seven framework task states and absent versus empty task
names in thread listings, retaining typed status filters.
- AgentDB wire errors carry a numeric code with its name and
description, and Hello carries the client version.
- Restore durable function-call metadata on field 7 while leaving
incompatible legacy field 6 unused.
- Update the v1 thread schema to explicit partition keys, conversation
ordering and Unix millisecond timestamps, and expose
DEFAULT_PARTITION_KEY for framework default resolution.
# livekit-rpc 0.4.0 (2026-11-18)
## Breaking Changes

- Add `semconv`, the telemetry names and enum values generated from the
protocol's Weaver registry, and move the protocol submodule to
`538dd3f0`, the merged registry. This is a breaking upgrade of the
generated Rust source, taken as a minor bump before 1.0 with no
compatibility alias: `DataTrackExtensionId::DteiParticipantSidLow` is
gone and value 1 is now `DteiE2ee` (JSON name `DTEI_E2EE`, so the old
name no longer parses), `media_source::Video` gains the `Videos`
variant, `media_source::Video`, `StreamOutput`, `UpdateStreamRequest`
and `MigrateJobRequest` lose `Eq` and `Hash`,
`simulation_run::job_metrics::Turn` loses `Copy`, and request messages
such as `UpdateStreamRequest` and `TransferSipParticipantRequest` gain
fields, so exhaustive matches and struct literals in downstream code
need `..Default::default()` or new arms. `livekit-common`,
`livekit-data-stream`, `livekit-datatrack`, `livekit-rpc`,
`livekit-token`, `livekit-signaling` and `livekit` expose protocol types
in their public API, and `livekit-capture` exposes `livekit` types, so
each takes the same break.

## Fixes

- AgentDB wire errors carry a numeric code with its name and
description, and Hello carries the client version.
- Update dependent SDK packages for the Agents 2.0 protocol and service
client changes.

Co-authored-by: knope-bot[bot] <152252888+knope-bot[bot]@users.noreply.github.com>
Subscribed audio gets no NACK today, so lost packets are not
retransmitted. libwebrtc advertises only `transport-cc` feedback for
Opus. In single PC mode the client sends the offer, and the server
answer keeps only feedback that both sides offer. The server also takes
audio feedback only from the first audio section of the first offer. The
server wants NACK for tracks without RED (livekit/livekit#3889), but no
audio NACK is negotiated. Rust turns RED off for E2EE (livekit#706), so Rust
E2EE users get neither RED nor NACK. This ports
livekit/client-sdk-js#2270, which fixes livekit/client-sdk-js#2277.

## Change

- Single PC offers add `a=rtcp-fb:<pt> nack` for every Opus payload type
in every audio section, whatever its direction. This includes the
initial offer sent with the join, which is the one that counts. The
first audio section can be the client's own `sendonly` mic, so
`recvonly` sections alone are not enough. This matches the final commit
of livekit/client-sdk-js#2270. Dual PC publisher offers do not change.
- Existing plain NACK is not added twice. The `*` wildcard counts as
existing NACK. `nack pli` is a different feedback type and does not
count as NACK.
- The munge runs in `munge_offer`, so the initial offer gets it too. The
SDP sent with the join is the SDP set as the local description.
- Dual PC answers add Opus NACK to each audio section whose offer
section, matched by mid, has it. libwebrtc drops it from the answer
otherwise. client-sdk-js and client-sdk-swift already do this.
- If the munged SDP does not parse, the original SDP is used, as for the
existing stereo munge.

## Verified

- `cargo test -p livekit --lib`: 91 passed. The new tests cover these
cases:
- String tests: every Opus payload type in every audio direction gets
NACK, with LF and CRLF. Other codecs and video sections do not.
Existing, wildcard or tab-separated NACK is not added twice. The answer
mirrors the offer by mid.
- Tests with real libwebrtc peer connections: the initial offer has NACK
in all three directions. The stored offer is the one sent with the join,
and NACK stays after the answer is applied. Later offers have NACK in
single PC mode and none in dual PC mode. If the remote offer has NACK,
the dual PC answer has it, and otherwise not.
- With the munges disabled, 7 of the 8 NACK tests fail. The eighth
checks that an answer stays unchanged. With only the answer munge
disabled, the dual PC test fails, so libwebrtc does drop NACK from the
answer.
- New e2e test `v1_opus_nack_negotiates_initial_offer` against a local
`livekit-server --dev` (1.13.10): the initial offer and the server
answer both carry Opus NACK. It fails with the munge disabled.
`audio_test` also passes.
- `cargo fmt --all --check` passes. `cargo clippy -p livekit --no-deps`
has no new findings in the changed code.

The tests with real peer connections and the e2e test are adapted from
livekit#1695.

## Not done yet

- A test under packet loss that compares `nack_count` in the inbound
audio stats. Loss injection on macOS needs root, so it did not run. The
JS SDK test under 10% loss went from about 300 lost packets per 30 s to
0.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ivekit#1620)

## Overview
Today, there are two ways client sdks that implement data tracks (using
the rust implementation) consume the rust code:
- `core-modules` style: swift, android, and flutter all use the existing
data tracks uniffi interface which has existed for many months. This is
what used to be in `livekit-uniffi` prior to the [livekit-ffi /
livekit-uniffi merge](livekit#1438).
- `room-apis` style: node, python, c++, and unity all use the legacy C
ABI style FFI interface, squashing all their call semantics into request
/ response protobufs.

The focus of this pull request is to bring an interface very similar to
the current `core-modules` style to consumers using `livekit-ffi` via
the `room-apis` style.

## Summary of change

The primary implementation goal of this is to reuse as much code between
the two `livekit-ffi` "modes" as possible. Any "record" type structs
like `DataTrackInfo` should be used by both styles, as well as
`LocalDataTrack` and `RemoteDataTrack`. This means that all downstream
sdks which use rust can now use most of the same primitives!

Also, just like the [sox resampler
change](livekit#1421),
`LocalDataTrack` and `RemoteDataTrack` now can be created from a ffi
handle id, and similarly a uniffi object can have a ffi handle created
from it. This allows for a more flexible migration strategy, so it can
be done piecemeal if desired.

## Usage Example

Here's how previously you would subscribe to a remote data track in
python:
```python
# 1. The remote track: a handle owned by the Python side.
track_handle = FfiHandle(owned.handle.id)
print(owned.publisher_identity, owned.info.name)

# 2. Subscribe. The stream handle comes back right away; the subscription
#    itself is set up asynchronously, and a failure arrives as the stream's EOS.
req = proto_ffi.FfiRequest()
req.subscribe_data_track.track_handle = track_handle.handle
req.subscribe_data_track.options.buffer_size = 16
resp = FfiClient.instance.request(req)
stream_handle = FfiHandle(resp.subscribe_data_track.stream.handle.id)

# Frames arrive as FfiEvents, one per read request.
queue = FfiClient.instance.queue.subscribe(
    filter_fn=lambda e: (
        e.WhichOneof("message") == "data_track_stream_event"
        and e.data_track_stream_event.stream_handle == stream_handle.handle
    ),
)
try:
    for _ in range(5):
        read = proto_ffi.FfiRequest()
        read.data_track_stream_read.stream_handle = stream_handle.handle
        FfiClient.instance.request(read)

        event = (await queue.get()).data_track_stream_event
        if event.WhichOneof("detail") == "eos":
            if event.eos.HasField("error"):
                raise RuntimeError(event.eos.error.message)
            break

        frame = event.frame_received.frame
        ts = frame.user_timestamp if frame.HasField("user_t
        print(frame.payload, ts)
finally:
    # 3. Tear down. Dropping the stream handle unsubscribes; dropping the
    #    track handle releases the track.
    FfiClient.instance.queue.unsubscribe(queue)
    stream_handle.dispose()  # livekit_ffi_drop_handle
    track_handle.dispose()   # livekit_ffi_drop_handle
```

And, here's how it now works with the new uniffi based api - less
verbose, and matches almost 1:1 with how it works in swift / kotlin /
flutter today:
```python
# 1. Take up the C ABI handle as a uniffi object. The two sides now co-own the
#    track, so drop the C ABI handle to leave uniffi as the only owner.
track = livekit_ffi.RemoteDataTrack.from_ffi_handle_id(owned.handle.id)
FfiHandle(owned.handle.id).dispose()
print(track.publisher_identity(), track.info().name)

# 2. Subscribe. This awaits until the subscription is established, and a
#    failure raises here instead of arriving as an EOS event.
try:
    stream = await track.subscribe_with_options(
        livekit_ffi.DataTrackSubscribeOptions(buffer_size=16)
    )
except livekit_datatrack.DataTrackSubscribeError as e:
    print("subscribe failed:", e)
    return

for _ in range(5):
    frame = await stream.next()  # None once the subscription has ended
    if frame is None:
        break
    print(frame.payload, frame.user_timestamp)  # bytes, Optional[int]

# 3. Tear down. Releasing the last reference frees the Rust object: the
#    stream unsubscribes, then the track is released.
del stream
del track
```
Releases run on knope today. Its bot opens the release PR and creates
the tags and the GitHub releases, and `knope.toml` repeats three
versioned files for each of the 23 packages. The changeset check is a
230-line shell step with its own Python script. knope also ignores a
changeset entry for an unknown package without a warning: one changeset
named `livekit-uniffi`, a package that no longer exists.

This PR moves the release process to
[verwalter](https://github.com/livekit/verwalter). Tag names, version
numbers and changelogs continue without a gap.

## Change

- `verwalter.toml` replaces `knope.toml`. Tags stay
`{package}/v{version}`. `livekit-ffi` still versions the six Node
`package.json` files and is still released as a draft.
- `release-pr.yml` is new. Each push to `main` regenerates the
`release/main` PR.
- `release.yml` runs when that PR merges. It tags and creates the GitHub
releases. Then it runs `cargo publish --no-verify` for each released
crate, dependencies first. A failure blocks only the dependents of that
crate, and a second run skips the versions that crates.io has. If
`livekit-ffi` is not in the release, it does not call `node-builds.yml`.
- `release.yml` calls `ffi-builds.yml` as a job with the `livekit-ffi`
tag, so a failed FFI build makes the release run red. `ffi-builds.yml`
no longer looks for a draft release on each push to `main`: a push is a
build only.
- `ffi-builds.yml` dispatches the Dart workflow at the tag after the
release is public, because pub.dev accepts only a run on the tag, and
waits for the result. The wait is safe to repeat: it uses a publishing
Dart run in progress at the tag, accepts one that passed, and starts a
new one only if there is none or the newest failed. A dry run of the
Dart workflow never counts: the workflow names its runs, and only a run
named `Publish Dart package <tag>` is the publish. Then it calls
`uniffi-packages.yml` (Swift, Android) as a job. The order matters: the
Dart run attaches the `build-*.zip` host libraries, and
`client-sdk-android` downloads them for a version that it learns from
Maven.
- `verwalter.toml` lists the 12 files that the `livekit-ffi` release
must have (`release.required_assets`). `ffi-builds.yml` attaches the
files and makes the release public with `verwalter release --asset
--publish`. While a listed file is missing, that step fails and the
release stays a draft.
- `ffi-builds.yml` only fills and publishes a release that verwalter
created. It no longer creates a draft release or a tag: a `tag_name`
without a release fails. A run with a tag checks out that tag, and the
check of the tag against the version in `livekit-ffi/Cargo.toml` runs
before the upload.
- `ffi-builds.yml` allows one run for each tag. A release is complete if
`verwalter status --check` passes for it: the tag is on the remote, and
the release is public with the 12 files. For a complete release, a
second run builds nothing and publishes no package again.
- A run of `release.yml` by hand takes a `ref` input and passes it to
each checkout and to `node-builds.yml`. Without it, the run releases
from the head of the branch.
- `release.yml` ends with a job that asserts the end state. `verwalter
status --check` fails if a tag is not on the remote, a release is
missing or a draft, a required file is missing, or crates.io does not
have a version. A second step asks npm for the six Node packages. A step
that was skipped without an error ends there.
- `node-builds.yml` takes a `dist_tag` input. If it is empty, a
pre-release version publishes under `next`, else under `latest`.
- `changeset-check.yml` runs `verwalter check`. The check that each
crate exists on crates.io stays on the release PR.
- `changeset_detect.py` and its test are deleted. The changeset section
of `AGENTS.md` describes the new rules.

`uniffi-packages.yml` and `uniffi-dart-publish.yml` lose their tag-push
trigger. verwalter creates the `livekit-ffi` tag before the FFI build,
so that trigger can publish the packages before the build is green.
`ffi-builds.yml` starts both.

Different for contributors:

- A dependent crate needs no changeset entry. It gets a `patch` bump
automatically.
- verwalter applies the level as written. knope demoted `minor` to a
patch bump on `0.x`. With verwalter, `minor` on `0.2.0` gives `0.3.0`.
- A change in `webrtc-sys/build` needs a changeset entry for
`webrtc-sys-build` only. verwalter 0.31.0 counts a file in a nested
package for that package alone.
- Changelog headings become `## 0.14.1` with `### Patch Changes`,
without a date. Each entry gets the PR number and the author, so a
changeset summary must not repeat them.

## Failure case

For `livekit-ffi/v0.14.0`, the push run of `ffi-builds.yml` looked for
the draft release before the knope bot created it. The builds passed,
the upload was skipped, and the run was green. The release then had no
`ffi-*.zip` assets. That lookup is gone: a release run gets the tag from
`release.yml`, after verwalter created the draft.

A release run can fail after the tags exist. verwalter keeps no state:
it reads the tags, the releases and crates.io, and finishes what is
missing. Use "Re-run failed jobs" on the release run first: it keeps the
merge commit. A new run of `release.yml` by hand needs `ref` set to that
merge commit. verwalter 0.31.0 guards the case that `main` moved and
`ref` is empty: `publish` fails a crate whose files changed since its
tag, and `release --asset` refuses the upload. Both name `ref=<tag>` in
the error. They compare only the files of the package, so the `ref`
input stays necessary.

A second run for the same tag waits for the first one. It then finds the
release complete and does nothing.

## Verified

With verwalter 0.31.0, built from its tag. The workflows pin v0.31.0.

- `verwalter plan`: 23 packages, no pending changesets. The last knope
release is on `main`, and this branch has `main` merged.
- `verwalter status --check`: passes. Each package has its tag and its
public release, each crate is on crates.io, and `livekit-ffi` 0.15.0 has
the 12 required files.
- The same check with one more name in `release.required_assets`: it
fails and names the missing file.
- `verwalter release --package livekit-ffi --asset <dir> --publish
--dry-run`: it prints the upload to `livekit-ffi/v0.15.0` with
`--clobber`.
- The npm step of the last job: npm has the six Node packages at 0.15.0.
- `verwalter check --pr 1680 --dry-run` passed with 0.29.0, before the
merge of `main`.
- All workflow files parse as YAML, and each shell block of the release
workflows passes `bash -n`.
- The tag step of `ffi-builds.yml` against real releases: a tag without
a release, no tag on a branch, no tag on a tag ref, and a dry run.
- The wait step, with a stub for `gh`, in eight cases: a publishing run
that passed (no dispatch), one in progress with one failed request, no
run and then a failed one, a failed run and then a new one, five failed
requests, a dry run that passed (dispatch), a dry run in progress
(dispatch), and a dry run that is newer than a publishing run that
passed (no dispatch).

## For maintainers

- Remove the knope bot from this repository before the merge. If both
tools run, both open a release PR.
- Make sure that the `verwalter-release` GitHub App is installed on this
repository. `release.yml` accepts only a PR from
`verwalter-release[bot]`.

## Not done yet

- No workflow of this branch ran on GitHub, and `actionlint` did not
run. The first release PR after the merge is the first real test.
- Three cases need a test on a fork: one failed FFI build leg makes the
release run red, a run by hand with `ref` packages that commit, and two
runs for one tag do not upload twice.
- The branch `claude/release-build-first` is a follow-up that builds the
files before the tag exists. It passed the first and the third case on a
fork, with Linux targets only. It is not part of this PR.
- The `build-*.zip` files still arrive after the release is public. The
Dart package and `client-sdk-android` read them. Both are safe, because
pub.dev and Maven get the version only after the files exist.
- A failed Dart run blocks the Swift and Android packages. After such a
failure, dispatch `uniffi-packages.yml` with `tag_name` by hand once the
`build-*.zip` files are on the release.
- python-sdks sees the new `livekit-ffi` version at the merge of the
release PR, because `download_ffi.py` reads it from
`livekit-ffi/Cargo.toml`. The FFI assets are public only after the
build, so a python-sdks build in that window fails with a 404. knope had
the same window. Move the submodule in python-sdks only after the
release run is green.
- `download_ffi.py` drops a pre-release suffix from the version, so it
cannot download the assets of an rc release.
- No `pre-release.yml`. The UniFFI package workflows are not prepared
for an rc version.
- Crates at the repository root cannot be found by a glob, so
`verwalter.toml` lists all 23 directories. A new crate needs an entry
there.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
…ivekit#1735)

<!-- verwalter release -->
Merging this PR releases:

## livekit `0.12.0` → `0.12.1`

### Patch Changes

- Negotiate NACK for Opus. If RED is off, for example with E2EE, lost
audio packets are now retransmitted. -
[livekit#1683](livekit#1683)
([@lukasIO](https://github.com/lukasIO))

Changesets: `opus_nack.md`

## livekit-capture `0.3.0` → `0.3.1`

### Patch Changes

- Negotiate NACK for Opus. If RED is off, for example with E2EE, lost
audio packets are now retransmitted. -
[livekit#1683](livekit#1683)
([@lukasIO](https://github.com/lukasIO))
- Updated dependencies: livekit@0.12.1

Changesets: `opus_nack.md`

## livekit-ffi `0.15.0` → `0.16.0`

### Minor Changes

- Expose `LocalDataTrack`, `RemoteDataTrack` and `DataTrackStream` over
UniFFI in room-apis builds too, as the same objects core-modules
exports. - [livekit#1620](livekit#1620)
([@1egoman](https://github.com/1egoman))

### Patch Changes

- Negotiate NACK for Opus. If RED is off, for example with E2EE, lost
audio packets are now retransmitted. -
[livekit#1683](livekit#1683)
([@lukasIO](https://github.com/lukasIO))
- Updated dependencies: livekit@0.12.1, livekit-capture@0.3.1

Changesets: `data_tracks_shared_uniffi_objects.md`, `opus_nack.md`

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
## Summary
- Adds `TokenSourceFetchOptions::with_thread_id`. The id goes into
`room_config.agents[].thread_id` of the token request. This is a mirror
of livekit/client-sdk-js#2297.

## Why
Agents 2.0 (b2) reads the thread of a call from the dispatch's
`thread_id` field.

## Testing
- New unit tests for the request body: thread id with an agent name,
thread id alone, and no agent fields.
- `cargo test -p livekit-token-source` and `cargo clippy -p
livekit-token-source` pass.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
In a 0.x version an additive API change is a patch, in a 1.x version it
is minor.
Found by Devin on the Verwalter release PR:
livekit#1742 (comment)

Since the livekit-token-source crate is in version 0.2.0 right now, this
additive change should have only bumped to 0.2.1, so a patch instead of
minor.
The level of a changeset is the claim of its author. No step compares it
with the change of the public API. A PR can therefore release a breaking
change as a `patch`.

## Change

`verwalter check` has an API check, and this PR turns it on with `cargo
semver-checks`.

- `verwalter.toml` has a `[check].api` command, the script
`.github/scripts/api_check.sh`. For each crate that a PR changes and a
changeset covers, the tool compares the public API with the base of the
PR. If the changeset level is below what the change needs, the PR fails,
and the comment names the level to use. verwalter translates for a 0.x
version: a breaking change needs `minor`.
- The baseline is the base of the PR, not the last release tag. A
changeset makes a claim for its own PR. Against the tag, a breaking
change that is on `main` and not released would fail each later PR for
the same crate.
- The script checks the base out as a Git worktree with its submodules.
The `--baseline-rev` option of the tool copies no submodules, and
`yuv-sys` does not build without libyuv.
- `changeset-check.yml` fetches the history and the submodules, sets up
the Rust toolchain and installs `cargo-semver-checks`.
- The check uses the default features only. `livekit` and `livekit-api`
have TLS features that do not build together.
- `DOCS_RS=1` is set for the tool, so `webrtc-sys/build.rs` skips the
native build.
- `livekit-ffi` has no check. Its contract is the FFI protocol and the
UniFFI bindings, not its Rust API.

Limits to know:

- A PR with the `internal` label has no changeset, so it gets no API
check.
- An API behind a feature that is not a default feature is not checked.
- If the tool cannot build the documentation of a crate, it prints no
level, and the check passes. The output of the tool is in the summary of
the run.

## Verified

- The script with a stand-in for `cargo`, in three cases. A report of a
breaking change prints `major`. A clean report and a build failure print
nothing. Each case ends with exit code 0.
- The baseline worktree of the script: it is at the base commit and has
`yuv-sys/libyuv/include/libyuv.h`.
- A base branch that does not exist: the script fails, so the check
fails.
- verwalter 0.31.0 reads the new configuration, and `actionlint` passes
on `changeset-check.yml`.

## Not done yet

- The tool did not run on this repository. On macOS it stops on the
`rustflags` of `.cargo/config.toml`, which have a space for the macOS
targets. The Linux runner has no such flags.
- The first real test is a PR with a changeset. It shows the time that
the check adds. It also shows which crates build with `DOCS_RS=1`.
- A deliberate breaking change with a `patch` changeset is not tested.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Upstream since ab3711a: 39 commits, through livekit 0.12.1 / livekit-ffi 0.16.0
(6143a96). libwebrtc stays webrtc-a545de4. Among them: Opus NACK negotiated for
audio (livekit#1683); publishing tracks with the join request (livekit#1050); tracks keep the
runtime that created them (livekit#1050); video frame conversion buffers reused per
stream (livekit#1644); libwebrtc log lines at their own severity (livekit#1642); exceptions
thrown to Rust own their message (livekit#1699); empty data channel messages accepted
(livekit#1698); polled outgoing data stream batches acknowledged once sent (livekit#1691);
remote participants released when the room closes (livekit#1654); Reconnecting reported
before participants are removed on a full reconnect (livekit#1591); the publisher
negotiation cancel leak (livekit#1538); in-flight RPCs failed with CONNECTION_CLOSED
on close (livekit#1671); e2ee key index bounds checks (livekit#1517); the telemetry crates
(livekit#1480-livekit#1485, livekit#1396); releases moved to verwalter (livekit#1682). No FFI proto change.

Conflicts, resolved keeping the fork's behaviour and taking upstream's on top:
- peer_transport: the fork's start bitrate through SetBitrate stays
  (BitratePreferences); upstream's x-google-start-bitrate munging (MungedOffer,
  set_max_send_bitrate_bps and its test) is dropped. Upstream's Opus NACK goes on
  single PC offers, the initial offer included, through munge_single_pc_offer
  (stereo, then NACK), and on dual PC answers after the fork's stereo munging.
- rtc_session: upstream's create_sender_for_pc (join-time tracks) calling the
  fork's add_video_track, add_stereo_track and add_external_audio_track.
- local_participant: upstream's prepare_publish, with the fork's stereo flag and
  TfStereo/TfNoDtx audio features moved into it.
- local audio/video tracks: the fork's API (try_create_audio_track,
  create_device_audio_track(options), sender_params) built through upstream's
  with_runtime.
- room: the fork's stream-state handling next to upstream's deferred publication
  events.
- libwebrtc log sink: the fork's settable level with upstream's log_level map.
- FFI video: a packed decoder I420 buffer still backs the handle without a copy
  (shared_i420_info); every other frame converts into upstream's reused
  FrameBuffers. to_libwebrtc_buffer keeps the fork's I420 pool. The fork's
  colorcvt tests use the FrameBuffer signature.

Not compiled locally (no Rust toolchain on this machine); verify with the RootApp
FFI workflow before tagging.
The merge appended the fork's tests after upstream's last test, whose closing
brace was the shared one at the end of the module.
@JesseDietrichson
JesseDietrichson merged commit 2ae0229 into rootapp/main Nov 26, 2026
9 checks passed
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.