Skip to content

Sometimes Jim disconnects after my response to his first sentence (Hi, I'm Jim...) #194

Description

@ChenYuHsuan0719

Observed behavior

Description

After starting an interactive interview session, Jim (Gemini AI) successfully delivers its first utterance. However, as soon as the candidate attempts to reply, the session crashes with a disconnect error.

There is also a mismatch between the frontend and backend states: the frontend UI remains open and stuck on the error, but the backend terminal logs show that the LiveKit room was (RoomClosed) after Gemini threw an internal error (code=1011).

Steps to Reproduce

  1. Launch codetrial and start an interactive interview session.
  2. Wait for Jim to complete its initial opening statement.
  3. Begin speaking to reply to Jim.
  4. Observe that the session drops with a disconnect error on the UI.
  5. Notice that the frontend UI stays open, but the terminal logs show RoomClosed and code=1011.
  6. Click "End Interview" to manually exit.

Actual Behavior

The Gemini session drops with code=1011 as soon as the candidate responds. The backend forcefully closes the LiveKit room (RoomClosed), preventing report generation, but the frontend UI does not close.

Possible Solutions

  1. Prevent the backend from dropping the room: Right now, when Gemini encounters an error, the backend closes the interview room immediately. It might be better to catch this error and try to reconnect Jim automatically.
  2. Fix the UI synchronization: If the backend must close the room due to an error, the frontend UI should detect this RoomClosed event and show a proper "Session Ended/Failed" screen, instead of just leaving the user stuck in the interview view.

Expected behavior

  1. If a fatal error occurs, the frontend UI should handle the disconnect and notify the user that the room has been closed, rather than getting stuck.

Reproduction

  1. Launch codetrial and start an interactive interview session.
  2. Wait for Jim to complete its initial opening statement.
  3. Begin speaking to reply to Jim.
  4. Observe that the session drops with a disconnect error on the UI.
  5. Notice that the frontend UI stays open, but the terminal logs show RoomClosed and code=1011.
  6. Click "End Interview" to manually exit.

CodeTrial version

Pre-built Windows Release (codetrial-x86_64-pc-windows-msvc)

Environment

  • OS: Windows 11 Home (25H2)
  • Browser: Google Chrome 154.0.8037.92
  • LiveKit Server: Cloud / Managed LiveKit

Sanitized evidence

NODE_ENV is not production: the page's CSP allows loopback origins and a plaintext ws:// LiveKit URL is accepted. Set NODE_ENV=production to deploy.
SESSION_SECRET is unset: signing session cookies with the built-in "codetrial-local-session", which is published in this repository and lets anyone forge a session.
provider pooling: 1 provider(s) over 1 project(s): primary=wss://<REDACTED_STUDENT_ID>-interview-hw1-<REDACTED_HASH>.livekit.cloud
codetrial: open [http://127.0.0.1:3000](http://127.0.0.1:3000) in your browser
livekit quota: all 1 project(s) can take connections
codetrial dispatch room=interview-273xkt7z
joined room=interview-273xkt7z identity=interviewer-interview-273xkt7z
waiting for candidate in room=interview-273xkt7z
starting interview: room=interview-273xkt7z problem=kth-smallest-element-in-a-bst duration=45min
timing: room and Gemini session ready 0.89s after the candidate joined
timing: Gemini cut its own turn, 4.7s of it unplayed; candidate audio so far: (nothing transcribed)

# [Event: Gemini API session crashes during candidate's response]
Gemini closed the session: code=1011 reason=Internal error encountered.
Gemini session resumed; the interview continues where it left off

# [Event: Backend drops candidate and closes the room]
candidate left room=interview-273xkt7z; waiting for a return
disconnected from room=interview-273xkt7z: RoomClosed

# [Event: Stream terminates prematurely without producing a report]
LiveKit event stream ended for room=interview-273xkt7z; ending with no report, because the room closed before the interview did

### Public data confirmation

- [x] I removed credentials, session tokens, candidate recordings, and personal interview content from this public report.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions