Repository navigation
Conversation
Some relays (api.cline.bot observed 2026-10) return a successful
chat-completion summary as { "data": { choices: [...] } } with nothing
else at the top level. The body parses as valid JSON, so completeness
checking and every summary extractor see no choices/content/output and
report an empty summary — the request then burns its entire retry
budget (32 replays observed in production) on a payload that actually
succeeded.
unwrapDataEnvelope removes exactly one such shell before parsing:
only when the outer object carries none of the known body shapes
(choices/content/output/output_text/candidates), data is a plain
object exposing one of those shapes, and the outer object is not an
error. Double envelopes, data arrays, foreign data payloads, error
bodies and standard responses all pass through untouched.
Applied at the four parse entry points: completed() openai branch,
parseSummary JSON entry, extractSummaryText and extractSummaryFromSse
(per-frame, since envelopes may wrap individual SSE frames).
[bot] 🏷 Review in progress — fetched the branch, reading all four application points plus every other caller of the touched extractors ( |
…h too Review supplement for the data-envelope fix: runNudgeDecision (ranxianglei#2228) reads its non-streaming answer through extractDecisionText, which had the same blind spot as the summary extractors — a relay that wraps successful completions in a single data envelope makes every decision call fail to parse, so the ladder silently degrades model-decided timing to the legacy advisory nudge after DECIDE_FALLBACK_THRESHOLD strikes. Apply the same unambiguous single-shell unwrap at the entry of extractDecisionText (no import cycle: preflight does not import nudge-decide).
The four application points of unwrapDataEnvelope previously left extractSummaryFromSse's per-frame unwrap without a direct regression test. Add: an openai SSE stream whose frame is data-enveloped now yields its delta text (and a double envelope still yields nothing), plus extractDecisionText reading a model answer through the envelope while standard bodies stay untouched.
[bot] 🏷 Review complete — verdict: 可合 (mergeable), pending CI green on the new head. 先说验证(审核三步):
结构化八问:
验证证据:本地定向套件 90/90 绿(envelope 6 例 + preflight-sse-extraction + preflight-empty-summary + external-summary-http + nudge-decide + nudge-model-decided),typecheck clean;全量回归交远程 CI(新 head 判定:可合。 方向正确、范围收敛、测试有牙(happy-path passthrough 与各拒绝形态均有引用相等断言)、diff 干净。合并由人执行;请盯一眼新 head 的 CI。 |
[bot] 🏷 CI 更新:新 head |
|
(ai: zhipuai-lb/glm-5.3) 孤儿票清理:提交两周未更新、无 issue 关联,且相关领域已有后续修复落地。为避免重复劳动关闭;如果你想继续推进,请 reopen 并补一个关联 issue(Fixes #N),我们会优先审查。感谢贡献! |
Problem
Some OpenAI-compatible relays wrap a successful chat-completion body in a single
dataenvelope:{ "data": { "choices": [ { "finish_reason": "stop", "index": 0, "message": { "role": "assistant", "content": "..." } } ] } }Observed live on
api.cline.bot(2026-10, bothcline-glm-5.3-flashandcline-deepseek-v4.1-flash).The body parses as valid JSON, so
parseSummarytreats it as a plain-JSON completion — butcompleted()sees nochoicesandextractSummaryTextfinds no summary text. The successful payload is then rejected as "contains no summary", and the preflight retry chain shrinks ranges and re-queries until its whole budget is burned. In production (agent session backed by that relay) this produced 55 failed summary parses and a 32-replay burn with a 715-second first round while the model answers were actually fine.Fix
unwrapDataEnveloperemoves exactly one such shell before parsing, and only when it is unambiguous:choices/content/output/output_text/candidates),datais a plain object exposing one of those shapes,errorpresent → untouched).Everything else passes through untouched: double envelopes,
{data: [...]}arrays, foreigndatapayloads, error bodies wearing adatacostume, and all standard bodies (no behavior change on the happy paths).Applied at the four parse entry points:
completed()openai branch (completeness check)parseSummaryJSON entryextractSummaryText(non-SSE extraction)extractSummaryFromSseper-frame (envelopes can wrap individual SSE frames)Tests
tests/data-envelope-summary.test.ts(6 cases):datauntouchedcreateSummaryHttpCandidateaccepts a data-enveloped completion body and still rejects an error bodynpm run typecheckclean; full suite unchanged versus baseline (summary-path tests all green; the 9 pre-existingzcode-nativefailures on this machine reproduce on pristine master without the patch — environment-dependent, unrelated).Related
Fixes the production failure mode where a relay's non-standard success shape converts a healthy summary response into a full retry-budget burn; complements the existing rejection/diagnosis chain (#726/#727/#780/#784) which correctly treats incomplete bodies as failures but had no path for complete-but-wrapped ones.