Skip to content

feat: Report bot leaving before joining - #959

Open
pylead wants to merge 1 commit into
mainfrom
fix/left_before_joining
Open

feat: Report bot leaving before joining#959
pylead wants to merge 1 commit into
mainfrom
fix/left_before_joining

Conversation

@pylead

@pylead pylead commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

A bot told to leave while it was still joining or waiting to be admitted looked exactly like a bot that joined and recorded the meeting (all four rows below are identical). Now it reports a failed join instead, with a new leave_requested_before_joining sub-type.

Before

Case state event_type event_sub_type Code
Told to leave while in the waiting room post_processingended left_meeting null LEAVING branch
Told to leave while still joining post_processingended left_meeting null same branch — LEAVE_REQUESTED is valid from JOINING
Told to leave after being admitted post_processingended left_meeting null same branch
Told to leave from a breakout room post_processingended left_meeting null same branch

After

Case state event_type event_sub_type Change
Told to leave while in the waiting room fatal_error could_not_join_meeting leave_requested_before_joining fixed
Told to leave while still joining fatal_error could_not_join_meeting leave_requested_before_joining fixed
Told to leave after being admitted post_processingended left_meeting null unchanged
Told to leave from a breakout room post_processingended left_meeting null unchanged

While the bot is in LEAVING, the last bot event is the leave request and its old_state is the state the bot was in when the leave was requested, so that's what the two cases are told apart by. LEAVING is now also a valid from state for COULD_NOT_JOIN.

The new sub-type is BotEventSubTypes value 32 and needs a migration because it goes into the valid_event_type_event_sub_type_combinations check constraint. It is deliberately not user_requested-specific: an auto-leave (e.g. max uptime exceeded) fired from the waiting room lands here too.

Billing and Slack alerts don't change — both key on event_type == FATAL_ERROR (charges, alerts), which this isn't.

Version bumped to 1.62.0 because this changes a state customers already depend on. New tests in bots/tests/test_leave_requested_before_joining.py cover the two fixed cases plus the last two rows as regression guards.

🤖 Generated with Claude Code

A bot told to leave while it was still joining or sitting in the waiting
room never actually joined the meeting, but it was reported the same way
as a bot that left a meeting it had been in:

  waiting_room -(leave_requested)-> leaving -(left_meeting)->
  post_processing -(post_processing_completed)-> ended

It now ends in fatal_error with a could_not_join_meeting event instead:

  waiting_room -(leave_requested)-> leaving
  -(could_not_join_meeting / leave_requested_before_joining)-> fatal_error

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@pylead
pylead marked this pull request as ready for review August 13, 2026 21:05
@pylead
pylead requested a review from a team as a code owner August 13, 2026 21:05
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.

3 participants