Skip to content

[codex] Fix OAuth wait cancellation in /login#1906

Draft
digging-airfare-4u wants to merge 1 commit intoMoonshotAI:mainfrom
digging-airfare-4u:codex/fix-oauth-login-cancel-1905
Draft

[codex] Fix OAuth wait cancellation in /login#1906
digging-airfare-4u wants to merge 1 commit intoMoonshotAI:mainfrom
digging-airfare-4u:codex/fix-oauth-login-cancel-1905

Conversation

@digging-airfare-4u
Copy link
Copy Markdown

@digging-airfare-4u digging-airfare-4u commented Apr 15, 2026

Summary

Fixes #1905.

This change makes the Kimi Code OAuth device login flow cancellable while the shell UI is waiting for browser authorization.

What changed

  • added a cancellable wait path to the OAuth device polling loop
  • passed a cancel event from the shell /login flow into the OAuth login routine
  • attached a temporary shell modal so Esc, Ctrl+C, and Ctrl+D can cancel the waiting state
  • clarified the shell interaction: pressing Esc while waiting for browser authorization cancels the current login attempt and returns to the shell prompt, rather than navigating back to platform selection
  • added regression tests for both the OAuth polling loop and the shell login cancel path

Root cause

The device authorization loop only polled and slept, with no cancel signal. The shell-level /login flow also did not hook the waiting state into the existing running-prompt cancel handling.

Validation

  • uv run pytest tests/auth/test_oauth_login.py tests/ui_and_conv/test_shell_oauth.py tests/ui_and_conv/test_shell_prompt_router.py
  • uv run ruff check src/kimi_cli/auth/oauth.py src/kimi_cli/ui/shell/oauth.py tests/auth/test_oauth_login.py tests/ui_and_conv/test_shell_oauth.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: /login OAuth wait cannot be cancelled with Esc

1 participant