Skip to content

Environment variable based proxy is not working due to aiohttp default settings when using kimi login #1234

@CyCle1024

Description

@CyCle1024

What version of Kimi Code CLI is running?

kimi, version 1.13.0

Which open platform/subscription were you using?

Kimi Code

Which model were you using?

kimi-for-coding

What platform is your computer?

Linux 5.15.0-89-generic x86_64 x86_64

What issue are you seeing?

I'm using kimi-cli on remote machine, and I must using https proxy to access internet. When I running command kimi login, it hangs for a while and then show error:

Login failed: Connection timeout to host https://auth.kimi.com/api/oauth/device_authorization

What steps can reproduce the bug?

In a container with only https proxy url based internet access, just run kimi login.

What is the expected behavior?

No response

Additional information

After I do some debugging, I found the hang problem is caused by the following code:
https://github.com/MoonshotAI/kimi-cli/blob/1.13.0/src/kimi_cli/auth/oauth.py#L314-L321
aiohttp session post a request to the url, but the default param trust_env of aiohttp.ClientSession is False, see
https://github.com/MoonshotAI/kimi-cli/blob/1.13.0/src/kimi_cli/utils/aiohttp.py#L12 and
https://github.com/aio-libs/aiohttp/blob/50241d68c1133875ad98a6eadbc71d03ea4b2e0c/aiohttp/client.py#L331. It would not respect environment variable based proxy url setting such as HTTPS_PROXY or https_proxy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions