fix(providers): stop OpenRouter/HF stream timeout on reasoning models - #25
Merged
Conversation
qwen/qwen3.6-27b streams delta.reasoning before any delta.content. The openaiCompatible stream parser only forwarded delta.content, so the caller's 30s first-byte timeout (providers.ts) tripped during the reasoning phase even though data was flowing — every OpenRouter/HF fallback timed out. Emit one empty liveness ping on the first reasoning chunk (bypassing the thinking-tag filter, which swallows empty strings) so the timeout disarms without leaking reasoning text. Content still streams normally. Adds 2 tests (reasoning-before-content pings once; content-first does not ping); server suite 325/325. Logs Option 2 (actually suppress reasoning on these providers) as a low-priority follow-up in PRODUCTION-TODO.
Reviewer's GuideThe PR updates the OpenAI-compatible SSE parser to treat the first reasoning-only delta as a one-time empty liveness signal, preventing first-byte timeouts while continuing to suppress reasoning content; tests cover both reasoning-first and content-first streams, and the remaining provider-specific reasoning suppression work is documented. Sequence diagram for reasoning-stream liveness pingsequenceDiagram
participant Provider as OpenAI-compatible provider
participant Parser as chatWithOpenAiCompatibleStream
participant Caller as Stream caller
Provider->>Parser: SSE delta.reasoning
Parser->>Caller: onChunk('')
Note over Parser,Caller: One-time ping disarms first-byte timeout
Provider->>Parser: SSE delta.reasoning
Note over Parser: Reasoning text is suppressed
Provider->>Parser: SSE delta.content
Parser->>Caller: onChunk(content)
Parser-->>Caller: Return accumulated content
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: Comment |
Ocean82
added a commit
that referenced
this pull request
Sep 6, 2026
…ect ecosystem note (#27) The 2026-09-06 launch deploy failed at the nginx -t gate and rolled back: nginx.conf:12 includes /etc/letsencrypt/le_http_01_cert_challenge.conf (a Certbot HTTP-01 renewal include) which had gone missing, so nginx -t failed for the whole config even though our site config was identical to the repo. Fixed by recreating the include empty + root-owned (the correct idle state; removing the include line would break Certbot renewal). nginx -t then passed, reloaded, and the server half of the deploy was completed manually (tsc build, pm2 restart on Node 22, pm2 save). Strict health green; public / 200, /app 301, /health 200; live Groq probe returned clean 200 (no <think> dump). Also corrects the stale "deploy the committed ecosystem.config.cjs" pending item: that file is .gitignored (contains secrets), so it is never checked out on the box and there is nothing to migrate to. The manual pm2 start + pm2 save dump is the intended steady state and deploy.sh's pm2 restart reuses it. Marked not-applicable rather than pending.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One of the three provider bugs blocking launch. qwen/qwen3.6-27b streams reasoning tokens (delta.reasoning) before any content. The openaiCompatible stream parser only forwarded delta.content, so the caller's 30s first-byte timeout (providers.ts) fired during the reasoning phase — every OpenRouter/HuggingFace fallback timed out even though data was flowing.
Fix: emit one empty liveness ping on the first delta.reasoning chunk (bypassing the thinking-tag filter, which swallows empty strings) so the first-byte timeout disarms. No reasoning text is leaked; content streams normally.
Tests: +2 (reasoning-before-content pings exactly once; content-first path does not ping). Server suite 325/325.
Related: the other two provider bugs — Groq reasoning_format (fixed by #24's deploy, verified live 200 + clean output) and Ollama NUM_CTX=2048 overriding the Modelfile (fixed on the box, set to 8192) — are resolved. Groq is primary and healthy. Option 2 (actually suppress reasoning on these fallback providers, vs just not-timing-out) is logged in PRODUCTION-TODO as low-priority polish.
Summary by Sourcery
Keep OpenRouter and Hugging Face reasoning-model streams alive until content arrives without exposing reasoning output.
Bug Fixes:
Documentation:
Tests: