Skip to content

Commit d38e30e

Browse files
committed
fix(gateway): skip media sidecar for unrelated HTTP routes
1 parent 8aa7b7a commit d38e30e

2 files changed

Lines changed: 21 additions & 14 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Docs: https://docs.openclaw.ai
8888

8989
- Discord/streaming: show live reasoning text in progress drafts instead of a bare `Reasoning` status line.
9090
- 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.
91+
- 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.
9192
- 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.
9293
- 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)
9394
- 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.

‎src/gateway/server-http.ts‎

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ function isToolsInvokePath(pathname: string): boolean {
214214
return pathname === "/tools/invoke";
215215
}
216216

217+
function isManagedOutgoingImagePath(pathname: string): boolean {
218+
return pathname.startsWith("/api/chat/media/outgoing/");
219+
}
220+
217221
function isSessionKillPath(pathname: string): boolean {
218222
return /^\/sessions\/[^/]+\/kill$/.test(pathname);
219223
}
@@ -724,20 +728,22 @@ export function createGatewayHttpServer(opts: {
724728
}),
725729
);
726730

727-
requestStages.push({
728-
name: "chat-managed-image-media",
729-
run: async () =>
730-
(await getManagedImageAttachmentsModule()).handleManagedOutgoingImageHttpRequest(
731-
req,
732-
res,
733-
{
734-
auth: resolvedAuth,
735-
trustedProxies,
736-
allowRealIpFallback,
737-
rateLimiter,
738-
},
739-
),
740-
});
731+
if (isManagedOutgoingImagePath(scopedRequestPath)) {
732+
requestStages.push({
733+
name: "chat-managed-image-media",
734+
run: async () =>
735+
(await getManagedImageAttachmentsModule()).handleManagedOutgoingImageHttpRequest(
736+
req,
737+
res,
738+
{
739+
auth: resolvedAuth,
740+
trustedProxies,
741+
allowRealIpFallback,
742+
rateLimiter,
743+
},
744+
),
745+
});
746+
}
741747

742748
if (controlUiEnabled) {
743749
requestStages.push({

0 commit comments

Comments
 (0)