1jehuang / 1jehuang/jcode

jcode run hangs forever with OAuth providers when default_provider is an API-key provider

Open
#569 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

autonomous: likely bug priority: high triage: reproducible
Dominant language
Rust
Stars
19.9k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
30

Description

Version: v0.56.0 (9aa8c5ad), macOS (aarch64 machine, x86_64 build under Rosetta)

Summary

With [provider].default_provider = "deepseek" (an API-key / openai-compatible provider), jcode run --provider claude or --provider openai (OAuth) hangs indefinitely — no timeout, no output, no error, only killable via signal. The interactive TUI with the same OAuth provider works fine, and run with an API-key provider works fine. It affects both OAuth providers (Claude subscription and OpenAI/ChatGPT subscription).

Root cause (observed)

In the non-interactive run path, --provider / --model are effectively ignored and provider/model resolution becomes inconsistent:

  • Session journal records the impossible pair "provider_key":"deepseek","model":"anthropic/claude-sonnet-4".
  • --ndjson emits only {"type":"start","provider":"OpenRouter","model":"anthropic/claude-sonnet-4"} and then nothing — it never reaches the connection phase (connecting / waiting for response are never emitted).
  • No API stream attempt … log line is ever written (API-key providers do write it right before sending).
  • Stack sample of the hung process: main thread parked in run_main → tokio block_on on a condvar, all worker threads idle (waiting on a future that never wakes). The only open socket is the memory/embedding agent's connection to api.anthropic.com; the actual chat request never opens a socket.

Trigger isolation

  • Keep default_provider = "deepseek", change only default_model to a Claude model → still hangs.
  • Set default_provider = "claude" (or "openai") with a matching default_modelrun works, and after that --provider / --model flags also work for per-run switching (verified switching to openai and back to deepseek).

So the trigger is default_provider being an API-key / openai-compatible provider while requesting an OAuth provider via run.

Reproduction

  1. ~/.jcode/config.toml: default_provider = "deepseek", default_model = "deepseek-v4-pro". Log in to claude and openai via OAuth (jcode login). jcode auth status shows both available.
  2. jcode run --provider claude --model claude-fable-5 --tool-profile none --quiet "OK" → hangs forever. (Same with --provider openai --model gpt-5.6-sol.)
  3. Set default_provider = "claude", default_model = "claude-opus-4-8" → the exact same command completes in ~1s.

Expected

jcode run --provider <X> should use provider <X> (honoring --provider / --model over the config default), or fail fast with a clear error if the provider/model is unusable — never deadlock silently.

Workaround

Set [provider].default_provider (and default_model) to an OAuth provider; flags then work for per-run switching.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the hang with jcode run --provider claude while default_provider is set to deepseek, then trace the non-interactive jcode run entry point where command-line provider and model values are resolved against config.toml. Compare that path with the working TUI and API-key runs. Done means the requested provider and model are honored, or an unusable combination fails clearly without hanging.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
authentication, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.