From ea30ad253dcab8070bc47f66cc3f6e9efaeb5dc0 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Mon, 9 Nov 2026 15:21:24 -0800 Subject: [PATCH] fix(next): align with route-handler framing in 16.4.5 and hash Bun patches into turbo tasks --- apps/sim/lib/core/utils/sse.ts | 5 +++-- apps/sim/lib/mothership/request/session/sse.ts | 5 +---- turbo.json | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/sim/lib/core/utils/sse.ts b/apps/sim/lib/core/utils/sse.ts index b856926a43d..b68af4bf783 100644 --- a/apps/sim/lib/core/utils/sse.ts +++ b/apps/sim/lib/core/utils/sse.ts @@ -1,9 +1,10 @@ /** - * Standard headers for Server-Sent Events responses + * Standard headers for Server-Sent Events responses. `no-transform` keeps Next's response + * compression and intermediaries from buffering the stream to compress it. */ export const SSE_HEADERS = { 'Content-Type': 'text/event-stream', - 'Cache-Control': 'no-cache', + 'Cache-Control': 'no-cache, no-transform', Connection: 'keep-alive', 'X-Accel-Buffering': 'no', } as const diff --git a/apps/sim/lib/mothership/request/session/sse.ts b/apps/sim/lib/mothership/request/session/sse.ts index a1a92dfcf0e..9f68c2ff611 100644 --- a/apps/sim/lib/mothership/request/session/sse.ts +++ b/apps/sim/lib/mothership/request/session/sse.ts @@ -14,7 +14,4 @@ export function encodeSSEEnvelope(envelope: unknown): Uint8Array { return encoder.encode(`data: ${JSON.stringify(presented)}\n\n`) } -export const SSE_RESPONSE_HEADERS = { - ...SSE_HEADERS, - 'Content-Encoding': 'none', -} as const +export const SSE_RESPONSE_HEADERS = SSE_HEADERS diff --git a/turbo.json b/turbo.json index 1838c7cecd0..8cda5cad432 100644 --- a/turbo.json +++ b/turbo.json @@ -18,6 +18,10 @@ // invalidate the cache. "cacheMaxAge": "7d", "cacheMaxSize": "40GB", + // Bun applies `patches/*` to installed dependencies, but `bun.lock` records only each patch's + // path, so editing a patch leaves every task hash unchanged and replays a build of the + // unpatched dependency. Hash the patch contents into every task. + "globalDependencies": ["patches/**"], "tasks": { "ci:runtime": { "dependsOn": ["^ci:runtime"],