From 8dbbd0d10c4a0bf2cdbac1413277b2e76eee4faf Mon Sep 17 00:00:00 2001 From: chahinebrini Date: Wed, 8 Jul 2026 03:37:25 +0200 Subject: [PATCH] fix(server): no-store Cache-Control on hub HTML pages Browsers were caching /board and /team, so a stale page kept showing old markup and didn't reflect live task/agent state (looked like the pre-redesign team page + tasks appearing unclaimed though the server had them claimed). Co-Authored-By: Claude Opus 4.8 --- src/server/routes.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/server/routes.ts b/src/server/routes.ts index 99b370d..91778eb 100644 --- a/src/server/routes.ts +++ b/src/server/routes.ts @@ -36,6 +36,16 @@ function wantsHtml(request: { headers: { accept?: string } }): boolean { } export async function registerRoutes(app: FastifyInstance, cwd: string): Promise { + // Never let a browser cache a hub HTML page — otherwise a stale board/team + // page keeps showing old markup and doesn't reflect live task/agent state. + app.addHook('onSend', async (_request, reply, payload) => { + const ct = reply.getHeader('content-type'); + if (typeof ct === 'string' && ct.includes('text/html')) { + reply.header('Cache-Control', 'no-store, must-revalidate'); + } + return payload; + }); + // Static, self-contained Trello-like board. Polls /tasks, /handoffs and // /decisions on the same origin; no build step, no deps. Cached once — the // markup is constant, only the data it fetches changes.