From 8c2959fc7320f56eec7082afb55752290978139e Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 16 Sep 2025 02:50:25 +0200 Subject: [PATCH] fix(provider): safely call curl.post for model policy Wrap curl.post in pcall to prevent errors when enabling model policy. This avoids potential crashes if the request fails. --- lua/CopilotChat/config/providers.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/CopilotChat/config/providers.lua b/lua/CopilotChat/config/providers.lua index 3a4c7d24..5d0126e6 100644 --- a/lua/CopilotChat/config/providers.lua +++ b/lua/CopilotChat/config/providers.lua @@ -333,7 +333,7 @@ M.copilot = { for _, model in ipairs(models) do if not model.policy then - curl.post('https://api.githubcopilot.com/models/' .. model.id .. '/policy', { + pcall(curl.post, 'https://api.githubcopilot.com/models/' .. model.id .. '/policy', { headers = headers, json_request = true, body = { state = 'enabled' },