惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
人人都是产品经理
人人都是产品经理
小众软件
小众软件
博客园 - Franky
WordPress大学
WordPress大学
Jina AI
Jina AI
Google DeepMind News
Google DeepMind News
I
InfoQ
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
F
Fortinet All Blogs
博客园 - 【当耐特】
IT之家
IT之家
G
Google Developers Blog
J
Java Code Geeks
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
云风的 BLOG
云风的 BLOG
Recent Announcements
Recent Announcements
有赞技术团队
有赞技术团队
V
Visual Studio Blog
U
Unit 42
阮一峰的网络日志
阮一峰的网络日志
月光博客
月光博客
GbyAI
GbyAI
雷峰网
雷峰网

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
refactor: keep OpenAI streams on OpenClaw transport · ope...
steipete · 2026-05-02 · via Recent Commits to openclaw:main

@@ -16,13 +16,13 @@ import * as piAi from "@mariozechner/pi-ai";

1616

* Key behaviours:

1717

* - Per-session `OpenAIWebSocketManager` (keyed by sessionId)

1818

* - Tracks `previous_response_id` to send only incremental tool-result inputs

19-

* - Falls back to `streamSimple` (HTTP) if the WebSocket connection fails

19+

* - Falls back to the OpenClaw HTTP transport if the WebSocket connection fails

2020

* - Cleanup helpers for releasing sessions after the run completes

2121

*

2222

* Complexity budget & risk mitigation:

2323

* - **Transport aware**: respects `transport` (`auto` | `websocket` | `sse`)

2424

* - **Transparent fallback in `auto` mode**: connect/send failures fall back to

25-

* the existing HTTP `streamSimple`; forced `websocket` mode surfaces WS errors

25+

* the existing HTTP path; forced `websocket` mode surfaces WS errors

2626

* - **Zero shared state**: per-session registry; session cleanup on dispose prevents leaks

2727

* - **Full parity**: all generation options (temperature, top_p, max_output_tokens,

2828

* tool_choice, reasoning) forwarded identically to the HTTP path

@@ -63,7 +63,7 @@ import type { ResponseCreateEvent } from "./openai-ws-types.js";

6363

import { log } from "./pi-embedded-runner/logger.js";

6464

import { resolveProviderEndpoint } from "./provider-attribution.js";

6565

import { normalizeProviderId } from "./provider-id.js";

66-

import { createBoundaryAwareStreamFnForModel } from "./provider-transport-stream.js";

66+

import { createOpenClawTransportStreamFnForModel } from "./provider-transport-stream.js";

6767

import {

6868

buildAssistantMessageWithZeroUsage,

6969

buildStreamErrorAssistantMessage,

@@ -124,7 +124,9 @@ type AssistantMessageWithPhase = AssistantMessage & { phase?: OpenAIResponsesAss

124124125125

const defaultOpenAIWsStreamDeps: OpenAIWsStreamDeps = {

126126

createManager: (options) => new OpenAIWebSocketManager(options),

127-

createHttpFallbackStreamFn: (model) => createBoundaryAwareStreamFnForModel(model),

127+

// WebSocket auto-mode HTTP fallback must keep the OpenClaw transport path so

128+

// degraded sessions do not leak cache-boundary markers or lose strict tools.

129+

createHttpFallbackStreamFn: (model) => createOpenClawTransportStreamFnForModel(model),

128130

streamSimple: (...args) => piAi.streamSimple(...args),

129131

};

130132

@@ -697,8 +699,8 @@ async function runWarmUp(params: {

697699

* connection; subsequent calls reuse it, sending only incremental tool-result

698700

* inputs with `previous_response_id`.

699701

*

700-

* If the WebSocket connection is unavailable, the function falls back to the

701-

* standard `streamSimple` HTTP path and logs a warning.

702+

* If the WebSocket connection is unavailable, the function falls back to an

703+

* OpenClaw HTTP transport when available, or the standard `streamSimple` path.

702704

*

703705

* @param apiKey OpenAI API key

704706

* @param sessionId Agent session ID (used as the registry key)

@@ -1358,6 +1360,9 @@ export const __testing = {

13581360

}

13591361

: defaultOpenAIWsStreamDeps;

13601362

},

1363+

getDefaultHttpFallbackStreamFnForTest(model: ProviderRuntimeModel): StreamFn | undefined {

1364+

return defaultOpenAIWsStreamDeps.createHttpFallbackStreamFn(model);

1365+

},

13611366

setWsDegradeCooldownMsForTest(nextMs?: number) {

13621367

wsDegradeCooldownMsOverride = nextMs;

13631368

},