fix: apply all cached fields + allow terminal sessions to enrich once
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 <noreply@anthropic.com>
This commit is contained in:
parent
42460c2b9f
commit
e4911a8fe2
|
|
@ -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]) =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue