fix: Re-check PR badge when session becomes active#469
Conversation
🔍 Multi-Model Code Review — PR #469 (R1)PR: fix: Re-check PR badge when session becomes active Consensus Findings (2+ of 3 models agree)🔴 CRITICAL — ExpandedSessionView: Fetch storm on every render when no PR existsFlagged by: Opus, Sonnet, Codex (all 3) File: The new
This creates an unbounded process-spawning storm for the common "no PR" case during streaming responses. The 5-minute cache TTL is defeated because Note: Fix: Add an edge guard similar to
🟡 MODERATE — No fetch-in-flight guard allows overlapping process spawnsFlagged by: Opus, Sonnet | Not flagged by: Codex (flagged as minor concurrent fetch concern) Files: Both Neither component has a Fix: Add private bool _prFetchInFlight;
private async Task FetchPrUrlAsync(string dir)
{
if (_prFetchInFlight) return;
_prFetchInFlight = true;
try { /* existing logic */ }
finally { _prFetchInFlight = false; }
}Items NOT reaching consensus (1 of 3 models only)
Verification Summary
Recommended Action
Specific ask:
|
🔄 R2 Multi-Model Re-Review — PR #469PR: fix: Re-check PR badge when session becomes active R1 Findings — Status🔴 CRITICAL — ExpandedSessionView fetch storm (3/3 models confirm STILL PRESENT)File: The
This is unbounded process spawning. The 5-minute cache TTL is defeated because
Fix needed: Add an activation-transition guard to ExpandedSessionView (e.g., track session identity changes or a 🟡 MODERATE — No fetch-in-flight guard (3/3 models confirm STILL PRESENT)Files: Neither component has a Fix needed: Add 🟡 MODERATE —
|
When clicking a session in the sidebar or switching expanded views, invalidate the PrLinkService cache and re-fetch if no PR was found previously. This ensures PR badges appear promptly after creating a PR or switching branches, without aggressive polling. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…idate calls - ExpandedSessionView: track session identity via _lastExpandedSessionId to only re-check PR badge on session switch, not every render cycle (fixes fetch storm during streaming — gh pr view was spawned 10-20x/sec) - ExpandedSessionView: remove PrLinkService.Invalidate() call that defeated the 5-minute cache TTL on every render - SessionListItem: remove PrLinkService.Invalidate() call for consistency (becameActive guard already limits re-checks to activation transitions) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
59f6fb9 to
71ca4e2
Compare
- Clear _prUrl and _prLabel when session identity changes, preventing stale PR badges from session A appearing on session B (same-dir case) - Capture Session.SessionId before await in FetchPrUrlAsync and discard results if session changed during the async operation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔍 PR #469 — R3 Multi-Model Re-Review (Post-Fix)Models: Claude Opus 4.6, Claude Sonnet 4.6, GPT-5.3 Codex | CI: No checks configured Previous Findings Status
New Findings (R3)
Fix DetailsCommit 1 (
Commit 2 (
Test Results✅ All 3111 tests pass Verdict: ✅ Approve — All original findings fixed. R3 findings addressed in 2nd commit. Clean, minimal changes with correct edge-trigger patterns matching existing codebase conventions. |
🔍 PR #469 — R4 Performance-Focused Multi-Model ReviewModels: Claude Opus 4.6, Claude Sonnet 4.6, GPT-5.3 Codex | CI: No checks configured | Focus: Performance Previous Findings (R1–R3)All 5 findings from R1–R3 remain ✅ Fixed — unanimous 3/3. Performance Analysis (3/3 Consensus on All Points)
Pre-Existing Observation (Not a Regression)🟢 MINOR: Double subprocess on cold cache (3/3 flagged as pre-existing)
Test Results✅ All 3111 tests pass Verdict: ✅ Approve — Performance CleanThe PR is well-structured from a performance perspective. The hot path (streaming at 20Hz) adds zero meaningful overhead. Fetch storms are structurally impossible. All guards are one-shot edge-triggered. The 5-min cache is fully respected. No regressions, no render loops, no memory concerns. |
When clicking a session in the sidebar or switching expanded views, invalidate the PrLinkService cache and re-fetch if no PR was previously found. This ensures PR badges appear promptly after creating a PR or switching branches. **Changes:** - **SessionListItem**: Track IsActive transitions; on activation, invalidate cache + re-fetch if no PR cached - **ExpandedSessionView**: Re-check on session switch if no PR cached No change to SessionCard (dashboard) — the 5-minute cache TTL handles that naturally. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When clicking a session in the sidebar or switching expanded views, invalidate the PrLinkService cache and re-fetch if no PR was previously found. This ensures PR badges appear promptly after creating a PR or switching branches.
Changes:
No change to SessionCard (dashboard) — the 5-minute cache TTL handles that naturally.