Add hotel receptionist scenario example#1877
Conversation
|
| const room = | ||
| ctx.userData.db | ||
| .availableRooms(checkIn, checkOut, guests) | ||
| .find((candidate) => candidate.type === wantedType) ?? currentRoom; |
There was a problem hiding this comment.
🟡 start_booking_modification fallback bypasses conflict check, silently creating double-bookings
The availableRooms call at line 649 does not exclude the booking being modified from its overlap check (examples/src/hotel_receptionist/hotel_receptionist.ts:437-449). Since the booking is still confirmed with its original dates, the booking's own room always appears unavailable due to self-conflict. The ?? currentRoom fallback on line 650 then assigns the current room without verifying the new dates don't conflict with other bookings on that room.
For example, with the seed data, room 301 has both Holt (day -2 to +1) and Tanaka (day 0 to +3). If Holt's booking is modified to extend through day +4, availableRooms won't find room 301 (both self-conflict and Tanaka's booking conflict), but ?? currentRoom assigns it anyway — creating/worsening a double-booking that lookup_booking (line 592-599) would flag as a conflict.
Prompt for agents
The start_booking_modification tool at line 647-650 uses `availableRooms(checkIn, checkOut, guests).find(...) ?? currentRoom` to pick a room. The availableRooms method (line 437-449) checks ALL confirmed bookings for overlap, including the booking being modified itself. This means the booking's own room is always excluded due to self-conflict, and the ?? currentRoom fallback silently assigns the current room even when the new dates conflict with OTHER confirmed bookings on that room.
To fix this, the availableRooms method should accept an optional bookingCodeToExclude parameter (or the booking's code/reference) so the booking being modified is excluded from the overlap check. This way, the current room would appear available when appropriate, AND if other bookings conflict with the new dates, the room would correctly appear unavailable. The ?? currentRoom fallback should either be removed or replaced with an explicit error when no room is available.
Relevant code: HotelDb.availableRooms (line 437-449), start_booking_modification execute (line 636-658).
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Testing
Ported from livekit/agents#6186
Original PR description
This PR:
Next: