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

推荐订阅源

Martin Fowler
Martin Fowler
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
The Cloudflare Blog
WordPress大学
WordPress大学
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 司徒正美
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
J
Java Code Geeks
云风的 BLOG
云风的 BLOG
C
Check Point Blog
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
V
V2EX
F
Fortinet All Blogs
B
Blog
大猫的无限游戏
大猫的无限游戏
N
Netflix TechBlog - Medium
B
Blog RSS Feed
A
About on SuperTechFans
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

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
fix(azure):Drain split provider stream frames (#80927) · ...
galiniliev · 2026-05-13 · via Recent Commits to openclaw:main

@@ -70,6 +70,7 @@ import { mergeTransportMetadata, sanitizeTransportPayloadText } from "./transpor

7070

const DEFAULT_AZURE_OPENAI_API_VERSION = "2024-12-01-preview";

7171

const OPENAI_CODEX_RESPONSES_EMPTY_INPUT_TEXT = " ";

7272

const GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP = "skip_thought_signature_validator";

73+

const AZURE_RESPONSES_FIRST_EVENT_TIMEOUT_MS = 30_000;

7374

const log = createSubsystemLogger("openai-transport");

74757576

type ReplayableResponseOutputMessage = Omit<ResponseOutputMessage, "id"> & { id?: string };

@@ -649,6 +650,61 @@ function resolveOpenAIStrictToolFlagWithDiagnostics(

649650

return strict;

650651

}

651652653+

function createResponsesFirstEventTimeoutError(model: Model<Api>, timeoutMs: number): Error {

654+

return new Error(

655+

`Azure OpenAI Responses stream did not deliver a first event within ${timeoutMs}ms after HTTP streaming headers. ` +

656+

`provider=${model.provider} model=${model.id}. ` +

657+

"The provider may be stalled while parsing the tool payload; retry with a smaller tool surface or enable OPENCLAW_DEBUG_MODEL_PAYLOAD=tools to inspect exposed tools.",

658+

);

659+

}

660+661+

function withResponsesFirstEventTimeout(

662+

openaiStream: AsyncIterable<unknown>,

663+

model: Model<Api>,

664+

timeoutMs: number | undefined,

665+

): AsyncIterable<unknown> {

666+

if (timeoutMs === undefined || timeoutMs <= 0 || !Number.isFinite(timeoutMs)) {

667+

return openaiStream;

668+

}

669+

return {

670+

async *[Symbol.asyncIterator]() {

671+

const iterator = openaiStream[Symbol.asyncIterator]();

672+

let timer: ReturnType<typeof setTimeout> | undefined;

673+

const clear = () => {

674+

if (timer) {

675+

clearTimeout(timer);

676+

timer = undefined;

677+

}

678+

};

679+

try {

680+

const first = await new Promise<IteratorResult<unknown>>((resolve, reject) => {

681+

timer = setTimeout(

682+

() => reject(createResponsesFirstEventTimeoutError(model, timeoutMs)),

683+

timeoutMs,

684+

);

685+

iterator.next().then(resolve, reject);

686+

}).finally(clear);

687+

if (first.done) {

688+

return;

689+

}

690+

yield first.value;

691+

for (;;) {

692+

const next = await iterator.next();

693+

if (next.done) {

694+

return;

695+

}

696+

yield next.value;

697+

}

698+

} catch (error) {

699+

void iterator.return?.().catch(() => undefined);

700+

throw error;

701+

} finally {

702+

clear();

703+

}

704+

},

705+

};

706+

}

707+652708

async function processResponsesStream(

653709

openaiStream: AsyncIterable<unknown>,

654710

output: MutableAssistantOutput,

@@ -660,6 +716,7 @@ async function processResponsesStream(

660716

usage: MutableAssistantOutput["usage"],

661717

serviceTier?: ResponseCreateParamsStreaming["service_tier"],

662718

) => void;

719+

firstEventTimeoutMs?: number;

663720

},

664721

) {

665722

let currentItem: Record<string, unknown> | null = null;

@@ -669,7 +726,12 @@ async function processResponsesStream(

669726

const eventTypes = new Map<string, number>();

670727

const sseDebugMode = resolveModelSseDebugMode();

671728

const blockIndex = () => output.content.length - 1;

672-

for await (const rawEvent of openaiStream) {

729+

const guardedStream = withResponsesFirstEventTimeout(

730+

openaiStream,

731+

model,

732+

options?.firstEventTimeoutMs,

733+

);

734+

for await (const rawEvent of guardedStream) {

673735

const event = rawEvent as Record<string, unknown>;

674736

const type = stringifyUnknown(event.type);

675737

eventCount += 1;

@@ -1421,7 +1483,9 @@ export function createAzureOpenAIResponsesTransportStreamFn(): StreamFn {

14211483

`elapsedMs=${Date.now() - requestStartedAt}`,

14221484

);

14231485

stream.push({ type: "start", partial: output as never });

1424-

await processResponsesStream(responseStream, output, stream, model);

1486+

await processResponsesStream(responseStream, output, stream, model, {

1487+

firstEventTimeoutMs: AZURE_RESPONSES_FIRST_EVENT_TIMEOUT_MS,

1488+

});

14251489

if (options?.signal?.aborted) {

14261490

throw new Error("Request was aborted");

14271491

}

@@ -2455,7 +2519,9 @@ export const __testing = {

24552519

sanitizeOpenAICodexResponsesParams,

24562520

buildOpenAICompletionsClientConfig,

24572521

processOpenAICompletionsStream,

2522+

processResponsesStream,

24582523

formatModelTransportDebugBaseUrl,

24592524

summarizeResponsesPayload,

24602525

summarizeResponsesTools,

2526+

withResponsesFirstEventTimeout,

24612527

};