From b01d1509b243828662b6db2dc1990a20a3e9fd7b Mon Sep 17 00:00:00 2001 From: Leo Stoianov Date: Thu, 25 Jun 2026 12:45:51 +0200 Subject: [PATCH] Fix delete/get/list_dispatch: keyword auth_header + ClientResp.data unwrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit delete_dispatch, get_dispatch and list_dispatch pass the grant positionally to AuthMixin#auth_header, which only accepts the `video_grant:` keyword, so every call raises ArgumentError ("wrong number of arguments (given 1, expected 0)") before reaching the server. create_dispatch is the only method that passes it correctly. get_dispatch and list_dispatch additionally read .agent_dispatches directly off the Twirp::ClientResp returned by rpc, rather than its .data payload — a latent NoMethodError the auth_header bug masked. Pass video_grant: and unwrap res.data in all three methods. Co-Authored-By: Claude Opus 4.8 --- lib/livekit/agent_dispatch_service_client.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/livekit/agent_dispatch_service_client.rb b/lib/livekit/agent_dispatch_service_client.rb index d696d6b..2c0c51e 100644 --- a/lib/livekit/agent_dispatch_service_client.rb +++ b/lib/livekit/agent_dispatch_service_client.rb @@ -53,7 +53,7 @@ def delete_dispatch(dispatch_id, room_name) self.rpc( :DeleteDispatch, request, - headers: auth_header(VideoGrant.new(roomAdmin: true, room: room_name)), + headers: auth_header(video_grant: VideoGrant.new(roomAdmin: true, room: room_name)), ) end @@ -69,10 +69,10 @@ def get_dispatch(dispatch_id, room_name) res = self.rpc( :ListDispatch, request, - headers: auth_header(VideoGrant.new(roomAdmin: true, room: room_name)), + headers: auth_header(video_grant: VideoGrant.new(roomAdmin: true, room: room_name)), ) - if res.agent_dispatches.size > 0 - return res.agent_dispatches[0] + if res.data.agent_dispatches.size > 0 + return res.data.agent_dispatches[0] end nil end @@ -87,9 +87,9 @@ def list_dispatch(room_name) res = self.rpc( :ListDispatch, request, - headers: auth_header(VideoGrant.new(roomAdmin: true, room: room_name)), + headers: auth_header(video_grant: VideoGrant.new(roomAdmin: true, room: room_name)), ) - res.agent_dispatches + res.data.agent_dispatches end end end