Skip to content

fix: prevent stream request log loss on early disconnect#140

Merged
mxyhi merged 1 commit intomainfrom
fix/stream-log-drop-fallback
Feb 11, 2026
Merged

fix: prevent stream request log loss on early disconnect#140
mxyhi merged 1 commit intomainfrom
fix/stream-log-drop-fallback

Conversation

@mxyhi
Copy link
Owner

@mxyhi mxyhi commented Feb 11, 2026

背景

用户反馈在流式请求(尤其是 /v1/responses)提前中断时,存在“请求发生但日志未入库”的问题。

变更

  • 为流式日志路径增加 Drop 兜底落库机制,避免仅依赖 None/Err 分支。
  • 统一将该兜底语义扩展到:
    • 基础流与 model override 流
    • responses/chat/anthropic 转换流
    • codex/gemini/kiro 兼容流
  • 兜底日志标记 response_error = "stream dropped before completion"
  • 新增中断场景回归测试(基础流 + 转换流)。

验证

  • cargo test -p token_proxy_core proxy::response::tests:: -- --nocapture
  • cargo test -p token_proxy_core

@mxyhi mxyhi merged commit 2e5a434 into main Feb 11, 2026
1 check passed
@mxyhi mxyhi deleted the fix/stream-log-drop-fallback branch February 11, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant