From e4911a8fe25ba9ce00ffb56ba50d28be42c77e35 Mon Sep 17 00:00:00 2001 From: Prateek Date: Sun, 15 Feb 2026 04:10:44 +0530 Subject: [PATCH] fix: apply all cached fields + allow terminal sessions to enrich once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses two new bugbot comments: 1. **Cached terminal data applied incompletely** (#2808048773): - Problem: Only copied some fields (state, ciStatus, etc.) but omitted title, additions, deletions - Fix: Added missing fields when applying cached data 2. **Terminal PRs remain permanently unenriched** (#2808048771): - Problem: Terminal sessions with no cache never got enriched → kept stale defaults forever - Fix: Removed the "skip enrichment for terminal with no cache" logic - Behavior: Terminal sessions now enrich at least once (or when cache expires), then skip subsequent enrichments **Behavior change:** - Before: Terminal session without cache → skip enrichment forever → stale data - After: Terminal session without cache → enrich once → cache for 60s → skip while cached This ensures terminal sessions get accurate PR data at least once, while still avoiding unnecessary API calls for sessions that already have fresh cached data. Co-Authored-By: Claude Sonnet 4.5 --- packages/web/src/app/page.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/web/src/app/page.tsx b/packages/web/src/app/page.tsx index 65f293a3a..90eedbf31 100644 --- a/packages/web/src/app/page.tsx +++ b/packages/web/src/app/page.tsx @@ -45,7 +45,11 @@ export default async function Home() { // Apply cached data if available (for both terminal and non-terminal sessions) if (cached) { if (sessions[i].pr) { + // Apply ALL cached fields (not just some) sessions[i].pr.state = cached.state; + sessions[i].pr.title = cached.title; + sessions[i].pr.additions = cached.additions; + sessions[i].pr.deletions = cached.deletions; sessions[i].pr.ciStatus = cached.ciStatus as "none" | "pending" | "passing" | "failing"; sessions[i].pr.reviewDecision = cached.reviewDecision as | "none" @@ -62,7 +66,8 @@ export default async function Home() { sessions[i].pr.unresolvedComments = cached.unresolvedComments; } - // Skip enrichment for terminal sessions or merged/closed PRs (data already applied from cache) + // Skip enrichment if cache is fresh AND (terminal OR merged/closed) + // This allows terminal sessions to be enriched once when cache is missing/expired if ( terminalStatuses.has(core.status) || cached.state === "merged" || @@ -72,12 +77,6 @@ export default async function Home() { } } - // Skip enrichment for terminal sessions with no cache - // (they won't have PR data to enrich anyway) - if (terminalStatuses.has(core.status)) { - return Promise.resolve(); - } - let project = config.projects[core.projectId]; if (!project) { const entry = Object.entries(config.projects).find(([, p]) =>