ductor icon indicating copy to clipboard operation
ductor copied to clipboard

Windows: Claude Code OAuth auth is misdetected because auth check does not resolve npm .cmd shim

Open Tony-ooo opened this issue 5 months ago • 1 comments

Summary

On Windows, Ductor can fail to detect an authenticated Claude Code CLI when Claude is installed via npm and authenticated through OAuth.

The Claude CLI itself reports loggedIn: true, but Ductor's auth detection reports Claude as only installed, so /model hides the Claude provider.

Environment

  • Ductor: 0.17.0
  • OS: Windows
  • Claude Code CLI: 2.1.169
  • Claude installed via npm, which creates shim files such as claude.cmd and claude.ps1

Reproduction

  1. Install and authenticate Claude Code on Windows.

  2. Confirm that this works in a shell:

    claude auth status
    

    It returns JSON with loggedIn: true.

  3. Run Ductor's auth detection.

Actual behavior

Ductor reports Claude as installed instead of authenticated.

As a result, /model does not show the CLAUDE provider, because the model selector only displays providers with AuthStatus.AUTHENTICATED.

Expected behavior

Ductor should detect Claude as authenticated when claude auth status reports loggedIn: true.

Root cause

In ductor_bot/cli/auth.py, _claude_cli_logged_in() runs:

subprocess.run(["claude", "auth", "status"], ...)

On Windows, Python subprocess execution does not reliably resolve the npm shim when called without the executable extension. The actual executable shim is typically claude.cmd.

This causes FileNotFoundError, which is caught and converted into False, so Claude OAuth auth is missed.

Suggested fix

Resolve the CLI path before invoking it, matching what the Claude provider already does for normal execution:

import shutil

claude_cli = shutil.which("claude") or "claude"
subprocess.run([claude_cli, "auth", "status"], ...)

Local validation

Before patch:

{
  "claude": "installed",
  "codex": "authenticated",
  "gemini": "not_found"
}

After patch:

{
  "claude": "authenticated",
  "codex": "authenticated",
  "gemini": "not_found"
}

Tony-ooo avatar Jun 09 '26 18:06 Tony-ooo

Fixed in v0.18.0 — the auth checks now resolve the npm .cmd shim via shutil.which before probing (Claude and agy had this). Thanks for the precise root-cause and suggested fix! 🙏

Release notes: https://github.com/PleasePrompto/ductor/releases/tag/v0.18.0

PleasePrompto avatar Jun 12 '26 14:06 PleasePrompto