Skip to content

Conversation

@NTJ3
Copy link

@NTJ3 NTJ3 commented Jan 27, 2026

Summary by CodeRabbit

  • New Features

    • Sessions now expose a configurable options property that can be updated at runtime.
    • Added a new session option to control whether the microphone is enabled by default (defaults to enabled).
  • Behavior Change

    • Microphone will only be auto-enabled on startup when the session's default-microphone option is true; updating options triggers immediate state updates.

✏️ Tip: You can customize this high-level summary in your review settings.

@CLAassistant
Copy link

CLAassistant commented Jan 27, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link

coderabbitai bot commented Jan 27, 2026

Caution

Review failed

The head commit changed during the review from 6645c2f to 0b48a72.

📝 Walkthrough

Walkthrough

Adds defaultMicrophoneEnabled to SessionOptions (default: true) and exposes Session.options (getter/setter). Session startup now enables the local microphone only when options.defaultMicrophoneEnabled is true; the setter normalizes incoming values and calls notifyListeners().

Changes

Cohort / File(s) Summary
Session & Options
lib/src/agent/session.dart, lib/src/agent/session_options.dart
Added defaultMicrophoneEnabled to SessionOptions (default true) and propagated through constructor and copyWith. Introduced public Session.options getter/setter that normalizes input, updates _options, and calls notifyListeners(). Startup flow now conditions local microphone enablement on options.defaultMicrophoneEnabled. _options field position adjusted relative to new accessors.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I hopped in with code and a tiny delight,
I toggled the mic to be wrong or be right,
A rabbit's small switch in a session of sound,
Now silence or chatter where choices are found. 🎙️✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a microphone control option to SessionOptions with a new defaultMicrophoneEnabled property.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/src/agent/session.dart (1)

209-224: defaultMicrophoneEnabled=false is bypassed when preConnectAudio=true (privacy risk).

Lines 209-224: with the default preConnectAudio=true, a user setting defaultMicrophoneEnabled=false still activates the mic during pre-connect. This defeats the intent and can surprise users.

✅ Suggested fix (gate pre-connect by defaultMicrophoneEnabled)
-      if (_options.preConnectAudio) {
+      final bool shouldPreConnectAudio =
+          _options.preConnectAudio && _options.defaultMicrophoneEnabled;
+
+      if (shouldPreConnectAudio) {
         dispatchesAgent = await room.withPreConnectAudio(
           () async {
             _setConnectionState(ConnectionState.connecting);
             _agent.connecting(buffering: true);
             return connect();
           },
           timeout: timeout,
         );
       } else {
         _setConnectionState(ConnectionState.connecting);
         _agent.connecting(buffering: false);
         dispatchesAgent = await connect();
-        if (_options.defaultMicrophoneEnabled) {
+        if (_options.defaultMicrophoneEnabled) {
           await room.localParticipant?.setMicrophoneEnabled(true);
         }
       }
🤖 Fix all issues with AI agents
In `@lib/src/agent/session.dart`:
- Around line 151-158: The options setter currently allows assigning any
SessionOptions which can diverge from the Session.room (which is final); modify
set options(SessionOptions value) to enforce that value.room matches the
instance's room (Session.room) — either by clamping value.room to this.room
before assigning to _options or by rejecting the assignment (throw/return) when
they differ; ensure you update the setter for options and use the existing
symbols (_options, SessionOptions, Session.room, notifyListeners) so the
session's room cannot become inconsistent with its options.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e421d4 and 728b9c5.

⛔ Files ignored due to path filters (1)
  • pubspec.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • lib/src/agent/session.dart
  • lib/src/agent/session_options.dart
🔇 Additional comments (1)
lib/src/agent/session_options.dart (1)

33-59: LGTM — option is wired through constructor and copyWith.

The new default and propagation look consistent.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

NTJ3 and others added 5 commits January 28, 2026 00:40
@NTJ3 NTJ3 force-pushed the nitin/control-mic branch from 514dc14 to 6645c2f Compare January 27, 2026 19:37
@NTJ3 NTJ3 closed this Jan 27, 2026
@NTJ3
Copy link
Author

NTJ3 commented Jan 27, 2026

Draft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants