Skip to content

Commit a412839

Browse files
committed
Fix GCS caching issues
- Add cache-busting query parameters to all GCS fetch calls - Set Cache-Control headers on GCS uploads to prevent CDN caching - Ensures dashboard always fetches fresh data on refresh
1 parent 911410f commit a412839

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.github/workflows/fix-remote-pr.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ jobs:
333333
334334
gcloud storage cp /tmp/agent-execution-trace.json \
335335
"gs://bot-dashboard-vectorinstitute/$DEST_PATH" \
336-
--content-type="application/json" || {
336+
--content-type="application/json" \
337+
--cache-control="no-cache, no-store, must-revalidate" || {
337338
echo "⚠️ Failed to upload trace to GCS, will rely on GitHub artifact"
338339
}
339340
@@ -367,7 +368,8 @@ jobs:
367368
# Upload updated index back to GCS
368369
gcloud storage cp /tmp/traces_index_updated.json \
369370
gs://bot-dashboard-vectorinstitute/data/traces_index.json \
370-
--content-type="application/json" || {
371+
--content-type="application/json" \
372+
--cache-control="no-cache, no-store, must-revalidate" || {
371373
echo "⚠️ Failed to update traces index"
372374
}
373375

dashboard/lib/data-fetcher.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ export async function fetchBotMetricsHistory(): Promise<BotMetricsHistory | null
5858
*/
5959
export async function fetchTraceIndex(): Promise<TraceIndex | null> {
6060
try {
61-
const response = await fetch(`${GCS_BUCKET_URL}/data/traces_index.json`, {
61+
// Add cache-busting parameter to bypass CDN cache
62+
const cacheBuster = Date.now()
63+
const response = await fetch(`${GCS_BUCKET_URL}/data/traces_index.json?t=${cacheBuster}`, {
6264
cache: 'no-store',
6365
})
6466

@@ -81,7 +83,9 @@ export async function fetchTraceIndex(): Promise<TraceIndex | null> {
8183
*/
8284
export async function fetchAgentTrace(tracePath: string): Promise<AgentTrace | null> {
8385
try {
84-
const response = await fetch(`${GCS_BUCKET_URL}/${tracePath}`, {
86+
// Add cache-busting parameter to bypass CDN cache
87+
const cacheBuster = Date.now()
88+
const response = await fetch(`${GCS_BUCKET_URL}/${tracePath}?t=${cacheBuster}`, {
8589
cache: 'no-store',
8690
})
8791

0 commit comments

Comments
 (0)