jcode run hangs forever with OAuth providers when default_provider is an API-key provider
Nobody has claimed this yet.
- 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". --ndjsonemits only{"type":"start","provider":"OpenRouter","model":"anthropic/claude-sonnet-4"}and then nothing — it never reaches the connection phase (connecting/waiting for responseare 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→ tokioblock_onon a condvar, all worker threads idle (waiting on a future that never wakes). The only open socket is the memory/embedding agent's connection toapi.anthropic.com; the actual chat request never opens a socket.
Trigger isolation
- Keep
default_provider = "deepseek", change onlydefault_modelto a Claude model → still hangs. - Set
default_provider = "claude"(or"openai") with a matchingdefault_model→runworks, and after that--provider/--modelflags also work for per-run switching (verified switching toopenaiand back todeepseek).
So the trigger is default_provider being an API-key / openai-compatible provider while requesting an OAuth provider via run.
Reproduction
~/.jcode/config.toml:default_provider = "deepseek",default_model = "deepseek-v4-pro". Log in toclaudeandopenaivia OAuth (jcode login).jcode auth statusshows bothavailable.jcode run --provider claude --model claude-fable-5 --tool-profile none --quiet "OK"→ hangs forever. (Same with--provider openai --model gpt-5.6-sol.)- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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