agents icon indicating copy to clipboard operation
agents copied to clipboard

GPTLiveModel: interrupting a turn while a tool is running leaves the call unanswered and the session stops replying

Open TANGBUDU opened this issue 1 month ago โ€ข 7 comments

Bug Description

With GPTLiveModel, if session.interrupt() is called while the voice model is still speaking its filler and a delegated tool call is running, that call never gets an output. On an interrupted turn, the realtime generation task only commits results of tools that already finished (code). For the tool that is still running, no FunctionCallOutput is produced, function_tools_executed is not emitted, and no response.item.create is sent. The call stays in _backend_open_calls, and from then on the session does not reply to the user at all.

#6785 made every call get exactly one output, but this case (a tool still running when the turn is interrupted) is still left without one.

Expected Behavior

The call is answered when the interrupted turn drops it (for example with an error output, as _interrupted_tool_output does for a handoff), so the conversation can continue.

Reproduction Steps

async def lookup_fee(product: str) -> str:
    await asyncio.sleep(8)
    return "The renewal fee is 1,480 yen."

model = openai.realtime.GPTLiveModel(responses_options={"model": "gpt-6-luna"})
session = AgentSession(llm=model)
await session.start(agent=Agent(instructions="Always call lookup_fee for prices.",
                                tools=[function_tool(lookup_fee)]))
# ask a price question; 0.5 s after the tool starts, while the filler is still playing:
session.interrupt(force=True)
# ~20 s later, ask another question

In voice tests:

  • interrupt during the filler while the tool runs: 4/4 runs never sent the tool output, and the second question got no reply (it was transcribed, but no server events came for ~35 s until close)
  • interrupt after the filler (agent thinking): 3/3 normal
  • interrupt a reply that has no tool call: 3/3 normal
  • same as the first case, then send a FunctionCallOutput for the open call 3 s later: 3/3 recovered and the second question was answered

Operating System

Windows 11

Models Used

GPT-Live (gpt-live-1) with a Responses backend (gpt-6-luna)

Package Versions

livekit==1.1.18
livekit-agents==1.8.3
livekit-plugins-openai==1.8.3
python==3.13

The code path above is unchanged in 1.8.5.

Additional Context

Our app calls session.interrupt(force=True) from error recovery and before a SIP transfer, so this can leave a phone call silent. Sending an output for the open call ourselves after the interrupt works around it.

TANGBUDU avatar Oct 09 '26 01:10 TANGBUDU

Narrowed this down: it happens only when the tool is still running more than 5 s after the interrupt.

SpeechHandle._cancel() gives the speech INTERRUPTION_TIMEOUT (5 s) to finish, then cancels its tasks (code). The realtime generation task is still in cancel_and_wait(exe_task) waiting for the tool at that point, so the code after it that commits the tool results never runs. The tool itself still finishes; only its output is lost.

In voice tests with the same setup:

  • 3 s tool: the output was sent and the next question was answered (4/4)
  • 8 s tool: the output was dropped and the session stopped replying (4/4)

TANGBUDU avatar Oct 09 '26 01:10 TANGBUDU

I'd like to take this one if that's alright.

From the report (and the follow-up): on interrupt, the realtime generation path only commits outputs for tools that already finished. If a tool is still running past INTERRUPTION_TIMEOUT, cancel_and_wait tears down the generation task before commit runs, so no FunctionCallOutput is produced, the call stays in _backend_open_calls, and the session stops replying.

Proposed fix: on the interrupt path, emit an error FunctionCallOutput for any in-flight tool calls (same idea as _interrupted_tool_output for handoff), so every call still gets exactly one output and the conversation can continue. I'll add a regression test for interrupt-while-tool-running (including the >5s case).

Could you assign me? I'll open a PR shortly.

Li-john1021 avatar Oct 09 '26 04:10 Li-john1021

Thanks for offering to work on this! I'm the issue reporter, not a maintainer, so I can't assign it. Feel free to open a PR referencing this issue. The maintainers can review the proposed fix. It would be great to cover the >5s interruption case and ensure each tool call gets exactly one output.

TANGBUDU avatar Oct 09 '26 06:10 TANGBUDU

GPTLiveModel does not support session.interrupt(). Only the caller's voice can interrupt GPT-Live. The call stops our local playout, but the model is not told and keeps speaking, and the rest of that utterance is dropped without being played.

Second, when a turn is interrupted, the framework does not discard a tool that is still running. The interrupted branch cancels the tool loop, and the loop then waits for the running tool to finish. After that, its output is sent to the backend as response.item.create. So in your repro, the output should go out about 8 s after the tool starts, not never. Something must stop the turn before that point.

Could you run the repro with LK_OPENAI_DEBUG=1 and the livekit.agents logger at DEBUG, and attach the log from the interrupt to the second question? LK_OPENAI_DEBUG=1 logs every gpt-live client event and gpt-live server event, so it shows whether response.item.create for the open call goes out and what the server sends after it.

longcw avatar Oct 10 '26 02:10 longcw

Thanks @longcw โ€” that clarification helps.

I don't have an OpenAI GPT Live / Realtime account here, so I can't attach the LK_OPENAI_DEBUG=1 WebSocket log you asked for yet. I did reproduce the tool-output path on current main with the framework's FakeRealtimeModel (same interrupt + realtime tool loop the PR tests use):

  • Tool sleeps 1s (< INTERRUPTION_TIMEOUT): after interrupt there is a FunctionCallOutput, and it is synced into the realtime chat_ctx (what would become response.item.create on GPT Live).
  • Tool sleeps 8s (> 5s): DEBUG shows waiting for function call to finish before fully cancelling, then ~5s later speech not done in time after interruption, cancelling the speech arbitrarily. After playout: 0 tool outputs. The tool still finishes later, but nothing is committed / synced.

So your point that the interrupt path waits for the running tool is right โ€” and the reporter's timeout case is also real: once SpeechHandle cancels the generation at 5s, the commit / update_chat_ctx path never runs, so GPT Live never gets an item for that open call. FakeRealtime doesn't track _backend_open_calls, so the "session never answers the next turn" symptom is GPT-Live-specific; the permanent missing output on main is already reproducible without it.

Happy to re-run with LK_OPENAI_DEBUG=1 if someone can share a GPT Live-capable key / environment. PR #7700 is aimed at closing that past-timeout hole (plus a follow-up for late real results). Feedback welcome on whether that matches what you see in production logs.

Li-john1021 avatar Oct 10 '26 04:10 Li-john1021

Thanks @longcw. Here's the log with LK_OPENAI_DEBUG=1 and livekit.agents at DEBUG, from the first question through the second one (current main, OpenAI direct, gpt-live-1 with a gpt-6-luna backend). Timestamps are seconds from the start of the run, and lines starting with repro: are markers from the script.

The tool starts at 6.98 and the interrupt comes at 7.58 while the filler is playing. The tool loop waits for the tool, but at 12.58 SpeechHandle hits INTERRUPTION_TIMEOUT and cancels the speech ("speech not done in time after interruption"). The tool finishes at 14.98 and no response.item.create goes out for its call after that. The second question is transcribed at 28 to 32, and the server sends only session.usage.updated until the session closes.

So the output would go out about 8 s after the tool starts if the turn kept waiting, but the 5 s interruption timeout ends it first. With a 3 s tool it does go out.

Thanks also for pointing out that interrupt() isn't supported for GPT-Live.

Log
   0.00 DEBUG livekit.agents: created new realtime session for activity, id=<livekit.agents.llm.duplex_adapter._DuplexRealtimeSession object at 0x0000011854BE4680>
   0.00 DEBUG livekit.plugins.openai: connecting to GPT-Live API {"lk.pii.url": "wss://api.openai.com/v1/live/sessions"}
   0.00 DEBUG livekit.agents: using audio io: `mic` -> `AgentSession` -> `spk`
   0.00 WARNING livekit.agents: resume_false_interruption is enabled but audio output does not support pause, it will be ignored {"audio_output": "spk"}
   0.00 DEBUG livekit.agents: using transcript io: `AgentSession` -> (none)
   1.28 DEBUG livekit.plugins.openai: gpt-live client event {"lk.pii.event": {"type": "session.start", "event_id": "session_start_f1823cc9dda8", "session": {"model": "gpt-live-1", "instructions": "You are a phone support agent. Speak short, polite Japanese. For any price question, always call lookup_fee before answering.", "audio": {"format": {"type": "audio/pcm", "rate": 24000}, "output": {"voice": "marin"}}, "delegation": {"type": "responses", "responses": {"model": "gpt-6-luna", "tools": [{"name": "lookup_fee", "description": "Look up the renewal fee of a product.\n", "parameters": {"properties": {"product": {"description": "the product (domain, server, ...)", "title": "Product", "type": "string"}}, "required": ["product"], "title": "LookupFeeArgs", "type": "object"}, "type": "function"}], "reasoning": {"effort": "low"}}}}}}
   1.52 INFO livekit.agents.repro: repro: first question
   2.19 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"event_id": "event_EXJjAUfjfHZEkXEVGgUzc", "type": "session.started", "client_event_id": "session_start_f1823cc9dda8", "session": {"id": "live_u7_EXJj9p3oMkXYZGboB6b4AMn0sHgKHJfV", "expires_at": 1791616563, "model": "gpt-live-1", "instructions": "You are a phone support agent. Speak short, polite Japanese. For any price question, always call lookup_fee before answering.", "audio": {"output": {"voice": "marin"}, "format": {"type": "audio/pcm", "rate": 24000}}, "delegation": {"type": "responses", "responses": {"model": "gpt-6-luna", "reasoning": {"effort": "low"}, "tools": [{"type": "function", "name": "lookup_fee", "description": "Look up the renewal fee of a product.\n", "parameters": {"properties": {"product": {"description": "the product (domain, server, ...)", "title": "Product", "type": "string"}}, "required": ["product"], "title": "LookupFeeArgs", "type": "object"}}], "tool_choice": "auto"}}, "status": "active", "input": []}}}
   3.32 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 2200, "end_ms": 2400, "delta": "ใƒ‰", "event_id": "event_EXJjBumijJObrcCUJ08zZ"}}
   3.49 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 2600, "end_ms": 2800, "delta": "ใƒกใ‚คใƒณ", "event_id": "event_EXJjB3zWuoJ408A7nIxXH"}}
   3.69 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 2800, "end_ms": 3000, "delta": "ใฎ", "event_id": "event_EXJjBwbG6r65e39WHj3oP"}}
   4.26 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 3400, "end_ms": 3600, "delta": "ๆ›ดๆ–ฐ", "event_id": "event_EXJjCPNv21CWlSxJlY7Xb"}}
   4.69 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 3800, "end_ms": 4000, "delta": "ๆ–™้‡‘", "event_id": "event_EXJjCqtaro3L5dLoDZ5Y6"}}
   5.11 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 4200, "end_ms": 4400, "delta": "ใฏ", "event_id": "event_EXJjDuWWNOT9Po88sA671"}}
   5.64 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 4600, "end_ms": 4800, "delta": "ใ€ใ„", "event_id": "event_EXJjD7XcxEASvcGh5T4CM"}}
   5.77 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 4800, "end_ms": 5000, "delta": "ใใ‚‰", "event_id": "event_EXJjE7Rrm91lVEvKJ29lC"}}
   5.84 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 5000, "end_ms": 5200, "delta": "ใงใ™ใ‹", "event_id": "event_EXJjEFE5yzzGt10Wvff3a"}}
   6.05 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.delegation.created", "offset_ms": 5000, "delegation": {"id": "item_EXJjEBl3iHXHic9PptjsX", "type": "delegation", "response_id": "resp_006c80957453e71e006ac9ca18129887d0aef1aa2c7132776e", "target": "responses"}, "event_id": "event_EXJjE0GqwXva5h2qcMDQy"}}
   6.07 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"event_id": "event_EXJjEFJbWBxA5yA10PyRF", "type": "response.event", "delegation_id": "item_EXJjEBl3iHXHic9PptjsX", "event": {"type": "response.created", "response": {"id": "resp_006c80957453e71e006ac9ca18129887d0aef1aa2c7132776e", "object": "response", "created_at": 1791609368, "status": "in_progress", "access_programs": null, "background": false, "completed_at": null, "error": null, "frequency_penalty": 0.0, "incomplete_details": null, "instructions": null, "max_output_tokens": null, "max_tool_calls": null, "model": "gpt-6-luna", "moderation": null, "output": [], "parallel_tool_calls": true, "presence_penalty": 0.0, "previous_response_id": "resp_006c80957453e71e016ac9ca1437d487d0817e83593d950053", "prompt_cache_key": "live:9073e07beb99881f735440f8590bbf53127b8bbf8f1d2f1ad69035d1280", "prompt_cache_retention": "24h", "reasoning": {"context": "all_turns", "effort": "low", "mode": "standard", "summary": null}, "safety_identifier": null, "service_tier": "auto", "store": true, "temperature": 1.0, "text": {"format": {"type": "text"}, "verbosity": "medium"}, "tool_choice": "auto", "tool_usage": {"image_gen": {"input_tokens": 0, "input_tokens_details": {"image_tokens": 0, "text_tokens": 0}, "output_tokens": 0, "output_tokens_details": {"image_tokens": 0, "text_tokens": 0}, "total_tokens": 0}, "web_search": {"num_requests": 0}}, "tools": [], "top_logprobs": 0, "top_p": 0.98, "truncation": "disabled", "usage": null, "user": "user-iNYbXnd1VBaBbiRBSNB0tpvo", "metadata": {}}, "sequence_number": 0}}}
   6.09 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"event_id": "event_EXJjEHTUQyrcdnzqr0rym", "type": "response.event", "delegation_id": "item_EXJjEBl3iHXHic9PptjsX", "event": {"type": "response.in_progress", "response": {"id": "resp_006c80957453e71e006ac9ca18129887d0aef1aa2c7132776e", "object": "response", "created_at": 1791609368, "status": "in_progress", "access_programs": null, "background": false, "completed_at": null, "error": null, "frequency_penalty": 0.0, "incomplete_details": null, "instructions": null, "max_output_tokens": null, "max_tool_calls": null, "model": "gpt-6-luna", "moderation": null, "output": [], "parallel_tool_calls": true, "presence_penalty": 0.0, "previous_response_id": "resp_006c80957453e71e016ac9ca1437d487d0817e83593d950053", "prompt_cache_key": "live:9073e07beb99881f735440f8590bbf53127b8bbf8f1d2f1ad69035d1280", "prompt_cache_retention": "24h", "reasoning": {"context": "all_turns", "effort": "low", "mode": "standard", "summary": null}, "safety_identifier": null, "service_tier": "auto", "store": true, "temperature": 1.0, "text": {"format": {"type": "text"}, "verbosity": "medium"}, "tool_choice": "auto", "tool_usage": {"image_gen": {"input_tokens": 0, "input_tokens_details": {"image_tokens": 0, "text_tokens": 0}, "output_tokens": 0, "output_tokens_details": {"image_tokens": 0, "text_tokens": 0}, "total_tokens": 0}, "web_search": {"num_requests": 0}}, "tools": [], "top_logprobs": 0, "top_p": 0.98, "truncation": "disabled", "usage": null, "user": "user-iNYbXnd1VBaBbiRBSNB0tpvo", "metadata": {}}, "sequence_number": 1}}}
   6.44 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.output_transcript.delta", "start_ms": 5400, "end_ms": 5600, "delta": "็ขบ่ช", "event_id": "event_EXJjEn1jSxBOQeNtHTkjj"}}
   6.45 DEBUG livekit.agents: aec warmup active, disabling interruptions for 3.00s
   6.59 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.output_transcript.delta", "start_ms": 5600, "end_ms": 5800, "delta": "ใ„ใŸ", "event_id": "event_EXJjEvlxpcCKAo0JkAKkG"}}
   6.70 DEBUG livekit.agents: conversation_item_added {"role": "user", "lk.pii.text": "ใƒ‰ใƒกใ‚คใƒณใฎๆ›ดๆ–ฐๆ–™้‡‘ใฏใ€ใ„ใใ‚‰ใงใ™ใ‹"}
   6.79 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.output_transcript.delta", "start_ms": 5800, "end_ms": 6000, "delta": "ใ—ใพใ™", "event_id": "event_EXJjFFLdFE0uaAbT2pv7z"}}
   6.83 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"event_id": "event_EXJjFGzxKgpnHBbh5qhOZ", "type": "response.event", "delegation_id": "item_EXJjEBl3iHXHic9PptjsX", "event": {"type": "response.output_item.added", "item": {"id": "fc_006c80957453e71e006ac9ca190c4887d080bc9f995f3b33a1", "type": "function_call", "status": "in_progress", "arguments": "", "call_id": "call_FGQmKAXEvNrjxpwxxxp6XX2m", "name": "lookup_fee"}, "output_index": 0, "sequence_number": 2}}}
   6.86 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"event_id": "event_EXJjF0cUJ8EXyjXdnYeOb", "type": "response.event", "delegation_id": "item_EXJjEBl3iHXHic9PptjsX", "event": {"type": "response.function_call_arguments.delta", "delta": "{\"", "item_id": "fc_006c80957453e71e006ac9ca190c4887d080bc9f995f3b33a1", "obfuscation": "5W1aGFK4mAutfO", "output_index": 0, "sequence_number": 3}}}
   6.86 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"event_id": "event_EXJjF1Hgog83EO4d9yxgK", "type": "response.event", "delegation_id": "item_EXJjEBl3iHXHic9PptjsX", "event": {"type": "response.function_call_arguments.delta", "delta": "product", "item_id": "fc_006c80957453e71e006ac9ca190c4887d080bc9f995f3b33a1", "obfuscation": "epOLuQAXG", "output_index": 0, "sequence_number": 4}}}
   6.91 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"event_id": "event_EXJjFyG4u2DuzsvsUBj3P", "type": "response.event", "delegation_id": "item_EXJjEBl3iHXHic9PptjsX", "event": {"type": "response.function_call_arguments.delta", "delta": "\":\"", "item_id": "fc_006c80957453e71e006ac9ca190c4887d080bc9f995f3b33a1", "obfuscation": "tVlnPsJgSdsZo", "output_index": 0, "sequence_number": 5}}}
   6.91 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"event_id": "event_EXJjF2rdRkZBWyZGgR7cO", "type": "response.event", "delegation_id": "item_EXJjEBl3iHXHic9PptjsX", "event": {"type": "response.function_call_arguments.delta", "delta": "domain", "item_id": "fc_006c80957453e71e006ac9ca190c4887d080bc9f995f3b33a1", "obfuscation": "1RB6XuTzqQ", "output_index": 0, "sequence_number": 6}}}
   6.91 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"event_id": "event_EXJjF2GZL012NuQ6ao5Zk", "type": "response.event", "delegation_id": "item_EXJjEBl3iHXHic9PptjsX", "event": {"type": "response.function_call_arguments.delta", "delta": "\"}", "item_id": "fc_006c80957453e71e006ac9ca190c4887d080bc9f995f3b33a1", "obfuscation": "ntfcHYJeEVvB8Q", "output_index": 0, "sequence_number": 7}}}
   6.98 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"event_id": "event_EXJjFEBO73fGln5oAZdwN", "type": "response.event", "delegation_id": "item_EXJjEBl3iHXHic9PptjsX", "event": {"type": "response.function_call_arguments.done", "arguments": "{\"product\":\"domain\"}", "item_id": "fc_006c80957453e71e006ac9ca190c4887d080bc9f995f3b33a1", "output_index": 0, "sequence_number": 8}}}
   6.98 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"event_id": "event_EXJjFWXralXQmwod3v1WA", "type": "response.event", "delegation_id": "item_EXJjEBl3iHXHic9PptjsX", "event": {"type": "response.output_item.done", "item": {"id": "fc_006c80957453e71e006ac9ca190c4887d080bc9f995f3b33a1", "type": "function_call", "status": "completed", "arguments": "{\"product\":\"domain\"}", "call_id": "call_FGQmKAXEvNrjxpwxxxp6XX2m", "name": "lookup_fee"}, "output_index": 0, "sequence_number": 9}}}
   6.98 DEBUG livekit.agents: executing tool {"function": "lookup_fee", "lk.pii.arguments": "{\"product\": \"domain\"}", "speech_id": "speech_eec234d07f55"}
   6.98 INFO livekit.agents.repro: repro: tool start
   7.20 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.output_transcript.delta", "start_ms": 6200, "end_ms": 6400, "delta": "ใ€‚", "event_id": "event_EXJjF6nUpbOtHOTR8nFkh"}}
   7.26 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"event_id": "event_EXJjFNGkn91HCKl5ksi5g", "type": "response.event", "delegation_id": "item_EXJjEBl3iHXHic9PptjsX", "event": {"type": "response.completed", "response": {"id": "resp_006c80957453e71e006ac9ca18129887d0aef1aa2c7132776e", "object": "response", "created_at": 1791609368, "status": "completed", "access_programs": null, "background": false, "completed_at": 1791609369, "error": null, "frequency_penalty": 0.0, "incomplete_details": null, "instructions": null, "max_output_tokens": null, "max_tool_calls": null, "model": "gpt-6-luna", "moderation": null, "output": [], "parallel_tool_calls": true, "presence_penalty": 0.0, "previous_response_id": "resp_006c80957453e71e016ac9ca1437d487d0817e83593d950053", "prompt_cache_key": "live:9073e07beb99881f735440f8590bbf53127b8bbf8f1d2f1ad69035d1280", "prompt_cache_retention": "24h", "reasoning": {"context": "all_turns", "effort": "low", "mode": "standard", "summary": null}, "safety_identifier": null, "service_tier": "default", "store": true, "temperature": 1.0, "text": {"format": {"type": "text"}, "verbosity": "medium"}, "tool_choice": "auto", "tool_usage": {"image_gen": {"input_tokens": 0, "input_tokens_details": {"image_tokens": 0, "text_tokens": 0}, "output_tokens": 0, "output_tokens_details": {"image_tokens": 0, "text_tokens": 0}, "total_tokens": 0}, "web_search": {"num_requests": 0}}, "tools": [], "top_logprobs": 0, "top_p": 0.98, "truncation": "disabled", "usage": {"input_tokens": 777, "input_tokens_details": {"cache_write_tokens": 0, "cached_tokens": 0}, "output_tokens": 18, "output_tokens_details": {"reasoning_tokens": 0}, "total_tokens": 795}, "user": "user-iNYbXnd1VBaBbiRBSNB0tpvo", "metadata": {}}, "sequence_number": 10}}}
   7.58 INFO livekit.agents.repro: repro: interrupt (agent_state=speaking)
   7.58 DEBUG livekit.agents: conversation_item_added {"role": "assistant", "lk.pii.text": "็ขบ่ชใ„ใŸใ—ใพใ™ใ€‚"}
   7.58 DEBUG livekit.agents: waiting for function call to finish before fully cancelling {"functions": ["func_exec_lookup_fee"], "speech_id": "speech_eec234d07f55"}
   9.44 DEBUG livekit.agents: aec warmup expired, re-enabling interruptions
  12.58 ERROR livekit.agents: speech not done in time after interruption, cancelling the speech arbitrarily. {"speech_id": "speech_eec234d07f55", "timeout": 5.0}
  14.98 INFO livekit.agents.repro: repro: tool end
  14.98 DEBUG livekit.agents: tools execution completed {"speech_id": "speech_eec234d07f55"}
  17.04 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.usage.updated", "usage": {"seconds": 16.0}, "context_window": {"usage_ratio": 0.0091796875}, "event_id": "event_EXJjPzSmuaFYCXeiTD1R4"}}
  17.05 DEBUG livekit.plugins.openai: gpt-live context window utilization {"usage_ratio": 0.0091796875}
  26.58 INFO livekit.agents.repro: repro: second question
  28.01 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 27400, "end_ms": 27600, "delta": "ใƒ‰ใƒก", "event_id": "event_EXJjaXRej0CMt0QrXVqjl"}}
  28.41 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 27800, "end_ms": 28000, "delta": "ใ‚คใƒณใฎ", "event_id": "event_EXJjaoz2utlW4h0SYLIL1"}}
  29.12 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 28400, "end_ms": 28600, "delta": "ๆ›ดๆ–ฐ", "event_id": "event_EXJjbbSsvpSI2TmlGi4oa"}}
  29.60 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 29000, "end_ms": 29200, "delta": "ๆ–™้‡‘", "event_id": "event_EXJjbD1mwYAbyJTz20poX"}}
  30.05 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 29400, "end_ms": 29600, "delta": "ใ‚’", "event_id": "event_EXJjcuIrh0iKnR1iK4CWv"}}
  30.63 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 30000, "end_ms": 30200, "delta": "ใ€็จŽ่พผใฟ", "event_id": "event_EXJjcKI6X2s2wZVyk2LJS"}}
  31.11 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 30400, "end_ms": 30600, "delta": "ใง", "event_id": "event_EXJjd87KWzuC6Yu44kqYE"}}
  31.19 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 30600, "end_ms": 30800, "delta": "ๆ•™", "event_id": "event_EXJjdIMXkmf64ztT98KCm"}}
  31.39 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 30800, "end_ms": 31000, "delta": "ใˆใฆ", "event_id": "event_EXJjdQC2IYtCDpE5FgssF"}}
  32.00 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.input_transcript.delta", "start_ms": 31400, "end_ms": 31600, "delta": "ใใ ใ•ใ„", "event_id": "event_EXJjeNnP0P5MwnndrXEF2"}}
  32.00 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.usage.updated", "usage": {"seconds": 31.0}, "context_window": {"usage_ratio": 0.01175}, "event_id": "event_EXJjeQJqXkwKqRDEkIA5L"}}
  32.00 DEBUG livekit.plugins.openai: gpt-live context window utilization {"usage_ratio": 0.01175}
  32.76 DEBUG livekit.agents: conversation_item_added {"role": "user", "lk.pii.text": "ใƒ‰ใƒกใ‚คใƒณใฎๆ›ดๆ–ฐๆ–™้‡‘ใ‚’ใ€็จŽ่พผใฟใงๆ•™ใˆใฆใใ ใ•ใ„"}
  46.98 DEBUG livekit.plugins.openai: gpt-live server event {"lk.pii.event": {"type": "session.usage.updated", "usage": {"seconds": 46.0}, "context_window": {"usage_ratio": 0.01409375}, "event_id": "event_EXJjt3YaV1sojxCMrguxx"}}
  46.98 DEBUG livekit.plugins.openai: gpt-live context window utilization {"usage_ratio": 0.01409375}
  56.58 INFO livekit.agents.repro: repro: end
  56.58 DEBUG livekit.plugins.openai: gpt-live client event {"lk.pii.event": {"type": "session.close"}}
  61.57 DEBUG livekit.agents: session closed {"reason": "user_initiated", "error": null}

TANGBUDU avatar Oct 10 '26 05:10 TANGBUDU

@TANGBUDU

Thanks for the log. The interrupted turn does wait for the running tool, but SpeechHandle cancels any interrupted speech 5 s after the interrupt (INTERRUPTION_TIMEOUT). Your tool takes 8 s, so the turn is cancelled at 12.58, before the tool returns. The tool still finishes, but nothing sends its output, so the call stays open on the backend and later questions wait behind it. That also explains why a 3 s tool works.

created a fix #7759, and btw, please consider to use ctx.update for long running tools, and avoid session.interrupt on gpt-live that doesn't support it.

longcw avatar Oct 12 '26 08:10 longcw