CommandCodeAI / CommandCodeAI/command-code

API 524 on non-streaming requests that take too long (~180s); streaming works fine

未關閉
#696 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
沒有語言資料
星號
4k
分支
350
PR 合併指標
30 天內沒有已合併 PR

描述

Summary

API 524s on non-streaming requests that take too long.

Expected Behavior

API should return the response even if streaming is turned off.

Actual Behavior

API returns 524 on non-streaming requests that take longer than ~180s. Streaming works fine on the same task. The 524 body is the relay's own envelope: {"error":{"type":"server_error","message":"Upstream model provider is temporarily unavailable..."}}. The ceiling appears variable: a non-streaming 16K request succeeded at 109.5s while a 12K request died at 180.2s. This looks like the relay buffering the full non-streaming response and timing out on long generations.

Steps to reproduce the issue
  1. Send a non-streaming chat/completions request with high reasoning_effort and a prompt that produces a long generation (>~2 min).
  2. The relay holds the connection open while it buffers the response.
  3. After ~180s the request dies with HTTP 524.
  4. The same request with stream: true succeeds, even past 204s.
Command Code Version

n/a - api

Operating System

Linux

Terminal/IDE

Hermes

Shell

No response

Session file (optional)

No response

Fix prompt (optional)

No response

Additional context

same model (deepseek/deepseek-v4-flash), same prompt, same reasoning_effort=max, direct to api.commandcode.ai/provider/v1:

Non-streaming, max_tokens 12288 → 524 at 180.2s
Non-streaming, max_tokens 16384 → 200 OK at 109.5s
Non-streaming, max_tokens 8192 (hard prompt) → 200 OK at 100.5s
Non-streaming, max_tokens 8192 (easy prompt) → 200 OK at 1.9s
Streaming, max_tokens 16384 (same hard prompt) → 200 OK at 204.6s

commandcode relay A/B test — 2026-08-16 19:00-20:00 PDT
Endpoint: https://api.commandcode.ai/provider/v1/chat/completions
Model: deepseek/deepseek-v4-flash · reasoning_effort=max
Hard prompt: "Think very carefully and at length about the history of computing, step by step, in extreme detail. Cover every era in depth. Write a very long essay."
Easy prompt (control): "Write a haiku about the ocean."
Test scripts: run_tests.py (round 1), run_tests2.py (round 2) — same directory.

{"label": "T8k_control", "status": 200, "elapsed_s": 1.9, "bytes": 988, "ok": true, "finish": "stop", "content_len": 71, "reasoning_len": 0, "usage": {"prompt_tokens": 104, "completion_tokens": 52, "total_tokens": 156, "completion_tokens_details": {"reasoning_tokens": 36}}}
{"label": "T12k_boundary", "status": 524, "elapsed_s": 180.2, "bytes": 127, "ok": false, "api_error": "{'message': 'Upstream model provider is temporarily unavailable. Please try again in a moment.', 'type': 'server_error'}"}
{"label": "T16k_repeat", "status": 200, "elapsed_s": 109.5, "bytes": 68903, "ok": true, "finish": "stop", "content_len": 3491, "reasoning_len": 0, "usage": {"prompt_tokens": 128, "completion_tokens": 8850, "total_tokens": 8978, "completion_tokens_details": {"reasoning_tokens": 8057}}}
{"label": "Tstream_16k", "status": 200, "elapsed_s": 204.6, "bytes": 5421554, "ok": true, "raw_head": "data: {"id":"gen_01M06TNW59PYEZ36TQ5CBYDB5S","object":"chat.completion.chunk","created":1786935702,"model":"deepseek/dee"}
{"label": "T8k_hard", "status": 200, "elapsed_s": 100.5, "bytes": 48345, "ok": true, "finish": "length", "content_len": 28296, "reasoning_len": 0, "usage": {"prompt_tokens": 128, "completion_tokens": 8192, "total_tokens": 8320, "completion_tokens_details": {"reasoning_tokens": 2357}}}

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從已回報的端點以及同一目錄中所參照的 run_tests.py 和 run_tests2.py 指令碼開始。比較非串流與串流的情況,然後追蹤負責長時間請求的 relay 路徑。當長時間的非串流生成能夠成功返回而不是 HTTP 524,同時現有的串流行為保持不變時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

領域
api
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
冷清
描述清晰度
需要釐清
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。