fix(chatgpt,github_copilot): keep the token file path out of the event-loop 401 message

This commit is contained in:
mateo-berri 2026-09-03 11:29:14 -07:00
parent 3b4903b628
commit 133d0b7072
4 changed files with 7 additions and 5 deletions

View file

@ -74,8 +74,8 @@ class Authenticator:
"ChatGPT device-code login needs a human and cannot run inside a running event loop "
"(for example the LiteLLM proxy). Log in once outside the proxy with "
'`python -c "from litellm.llms.chatgpt.authenticator import Authenticator; '
'Authenticator().get_access_token()"` and mount the resulting '
f"{self.auth_file} into the proxy, or set CHATGPT_TOKEN_DIR to a directory that already holds it."
'Authenticator().get_access_token()"` and mount the resulting auth.json into the proxy, '
"or set CHATGPT_TOKEN_DIR to a directory that already holds it."
),
status_code=401,
)

View file

@ -64,9 +64,8 @@ class Authenticator:
"GitHub Copilot device-code login needs a human and cannot run inside a running event loop "
"(for example the LiteLLM proxy). Log in once outside the proxy with "
'`python -c "from litellm.llms.github_copilot.authenticator import Authenticator; '
'Authenticator().get_access_token()"` and mount the resulting '
f"{self.access_token_file} into the proxy, or set GITHUB_COPILOT_TOKEN_DIR to a directory "
"that already holds it."
'Authenticator().get_access_token()"` and mount the resulting access-token file into '
"the proxy, or set GITHUB_COPILOT_TOKEN_DIR to a directory that already holds it."
),
status_code=401,
)

View file

@ -87,6 +87,7 @@ class TestChatGPTAuthenticator:
assert exc.value.status_code == 401
assert "event loop" in str(exc.value)
assert authenticator.auth_file not in str(exc.value)
mock_login.assert_not_called()
mock_wait.assert_not_called()
@ -104,6 +105,7 @@ class TestChatGPTAuthenticator:
assert exc.value.status_code == 401
assert "event loop" in str(exc.value)
assert authenticator.auth_file not in str(exc.value)
mock_login.assert_not_called()
mock_wait.assert_not_called()

View file

@ -100,6 +100,7 @@ class TestGitHubCopilotAuthenticator:
assert exc.value.status_code == 401
assert "event loop" in str(exc.value)
assert authenticator.access_token_file not in str(exc.value)
mock_login.assert_not_called()
def test_get_access_token_failure(self, authenticator):