A bot that repeats its menu forever
The menu asks the customer to choose 1 or 2. If they type “2, please.”, the bot shows the same menu again. We examine the loop in Lean and TLA+.
To ask about an appointment, a customer enters their ID number and picks a menu option. The bot only recognises the digits 1 and 2 on their own. A customer who adds a few words to ask for an agent can keep replying without reaching anyone or triggering an error.
Bot: To get started, enter your ID number.
Customer: •••• 1234
Bot: Choose an option. 1. View my appointment 2. Speak to an agent
Customer: 2, please.
Bot: I didn't recognise your reply. Choose an option. 1. View my appointment 2. Speak to an agent
Customer: 2. Speak to an agent.
Bot: I didn't recognise your reply. Choose an option. 1. View my appointment 2. Speak to an agent
Loop detected. The bot only accepts a bare 1 or 2. Adding text makes it repeat the menu.
Example conversation after the fix
Customer: 2, please.
Bot: I'll pass your request to someone on our team.
The bot leaves the menu. In this example it tells the customer it will pass the request to an agent.
The rule
Can a customer keep replying and still be stuck in the menu? The property menu ~> done requires the bot to eventually leave the menu each time it enters.
What Lean shows
In SupportBot.lean, a function computes the next state from the current state, the input and the version of the bot. Lean checks three properties. Both versions require a valid ID to move from identification to the menu. In the original, an unrecognised reply sends the bot back to the menu. In the corrected version, any reply at the menu leads to done.
Show the code SupportBot.lean
SupportBot.lean
What TLC shows
SupportBot.tla makes a weak fairness assumption. If the bot stays at the menu waiting for a reply, it eventually receives one. With Fixed = FALSE, TLC finds a run in which the customer keeps replying without leaving the menu. That run violates MenuProgress. With Fixed = TRUE, the property holds in the model.
Show the code SupportBot.tla, SupportBot.cfg, SupportBotBug.cfg
SupportBot.tla
SupportBot.cfg
SupportBotBug.cfg
Limits
- A bot that said goodbye and closed the menu would satisfy this property too. To verify that a request reaches the right agent, the model would need to represent its destination and receipt.
- It checks the conversation design, not the language model or the parser that reads the reply. If the parser drops a reply, the model does not see it.