Skip to content

Voice agent: connect() can clobber a delegate-driven disconnect #8

Description

@tangxiya-star

Deferred from review of #6. Tracking only.

VoiceAgentSession.swift:79-90connect() forces phase = .connected after its await room.connect(...) / setMicrophone(...) block, regardless of what the RoomDelegate did in between.

Scenario: room.connect() resolves, then the link drops; didUpdateConnectionState(.disconnected) runs and sets phase = .idle / agentState = .offline. But connect() then proceeds and sets phase = .connected, isMicEnabled = true. UI shows "Connected · mic on" for a dead room, and send() will believe it's connected and silently drop observations.

Related lower-severity nits from the same review:

  • toggleMicrophone flips isMicEnabled based on the room call alone, with no connected-guard — can show "mic on" when disconnected.
  • backend /connection-details returns participantName = the random identity (inspector-xxxx), not the "Inspector" display name the token carries. Cosmetic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfollow-upKnown issue, deferred from reviewvoice-agentLiveKit voice inspection agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions