diff --git a/CHANGELOG.md b/CHANGELOG.md index 38585c6613a..724ae2b6669 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,6 +88,7 @@ Docs: https://docs.openclaw.ai - Discord/streaming: show live reasoning text in progress drafts instead of a bare `Reasoning` status line. - Doctor/status: warn when `OPENCLAW_GATEWAY_TOKEN` would shadow a different active `gateway.auth.token` source for local CLI commands, while avoiding false positives when config points at the same env token. Fixes #74271. Thanks @yelog. +- Gateway/HTTP: avoid loading managed outgoing-image media handlers for unrelated requests, so disabled OpenAI-compatible routes return 404 without waiting on lazy media sidecars. Thanks @vincentkoc. - Gateway/OpenAI-compatible: send the assistant role SSE chunk as soon as streaming chat-completion headers are accepted, so cold agent setup cannot leave `/v1/chat/completions` clients with a bodyless 200 response until their idle timeout fires. - Agents/media: avoid direct generated-media completion fallback while the announce-agent run is still pending, so async video and music completions do not duplicate raw media messages. (#77754) - TUI/sessions: bound the session picker to recent rows and use exact lookup-style refreshes for the active session, so dusty stores no longer make TUI hydrate weeks-old transcripts before becoming responsive. Thanks @vincentkoc. diff --git a/src/gateway/server-http.ts b/src/gateway/server-http.ts index cf9cd84a10c..b613fd7f9f9 100644 --- a/src/gateway/server-http.ts +++ b/src/gateway/server-http.ts @@ -214,6 +214,10 @@ function isToolsInvokePath(pathname: string): boolean { return pathname === "/tools/invoke"; } +function isManagedOutgoingImagePath(pathname: string): boolean { + return pathname.startsWith("/api/chat/media/outgoing/"); +} + function isSessionKillPath(pathname: string): boolean { return /^\/sessions\/[^/]+\/kill$/.test(pathname); } @@ -724,20 +728,22 @@ export function createGatewayHttpServer(opts: { }), ); - requestStages.push({ - name: "chat-managed-image-media", - run: async () => - (await getManagedImageAttachmentsModule()).handleManagedOutgoingImageHttpRequest( - req, - res, - { - auth: resolvedAuth, - trustedProxies, - allowRealIpFallback, - rateLimiter, - }, - ), - }); + if (isManagedOutgoingImagePath(scopedRequestPath)) { + requestStages.push({ + name: "chat-managed-image-media", + run: async () => + (await getManagedImageAttachmentsModule()).handleManagedOutgoingImageHttpRequest( + req, + res, + { + auth: resolvedAuth, + trustedProxies, + allowRealIpFallback, + rateLimiter, + }, + ), + }); + } if (controlUiEnabled) { requestStages.push({