Skip to content

fix: surface refs for live sessions with stale HasRefs#71

Merged
gavin-jeong merged 1 commit into
masterfrom
fix/live-session-refs-stale-hasrefs
Jul 16, 2026
Merged

fix: surface refs for live sessions with stale HasRefs#71
gavin-jeong merged 1 commit into
masterfrom
fix/live-session-refs-stale-hasrefs

Conversation

@gavin-jeong

Copy link
Copy Markdown
Collaborator

Problem

라이브(진행 중) 세션에서 방금 만든 PR/Jira 링크가 References 패널에 안 뜨고 "No PR or Jira links in this session" 이 뜨는 문제.

원인: 세션 스캐너는 JSONL에 /pull/ 이 있으면 HasRefs=true 로 켜는데, 라이브 세션은 스캔 이후에도 파일이 계속 커진다. PR URL이 방금 기록됐다면 그 시점 스냅샷의 HasRefs 는 아직 false다. References preview는 offline extract를 HasRefs 에 gate하고 있어서, rescan/refresh 전까지 링크가 안 나타났다.

Fix

  • updateSessionRefsPreview 가 라이브 세션은 mayHaveRefs = HasRefs || IsLive 로 취급 → 파일에서 바로 offline extract(ExtractSessionRefsFromFile, 네트워크 없음, 빠름) 실행. rescan 안 기다리고 즉시 링크 표시.
  • 빈 상태 렌더링도 mayHaveRefs 사용 → 라이브 세션은 extract 진행 중일 때 "No PR..." 대신 "Resolving…" 표시.
  • refsInFlight dedup + updateSessionPreview cacheKey 게이트가 프레임당 재파싱을 계속 막으므로 CPU 스파이크 없음.

Test

  • 신규 회귀 테스트 TestLiveSessionDispatchesExtractWithoutHasRefs (HasRefs=false + IsLive=true 에서 extract 발동 + "Resolving…" 표시 검증)
  • go build ./..., go vet ./..., go test ./... 전부 통과

A live (in-progress) session keeps growing after the scan that set HasRefs,
so a PR/Jira URL written moments ago (e.g. a PR just created in that same
session) hasn't flipped HasRefs yet — the flag is a stale snapshot. The
References preview gated its offline extract on HasRefs, so such links showed
'No PR or Jira links in this session' until a rescan/refresh.

- updateSessionRefsPreview now treats live sessions as possibly-having-refs
  (mayHaveRefs = HasRefs || IsLive) and runs the cheap offline extract straight
  off the file, so freshly-added links surface without waiting for a rescan.
- Empty-state render uses mayHaveRefs so a live session with a pending extract
  shows 'Resolving…' instead of the misleading 'No PR or Jira links'.
- refsInFlight dedup + updateSessionPreview cacheKey still gate re-parsing.

Regression test: TestLiveSessionDispatchesExtractWithoutHasRefs.
@Kairo-Kim Kairo-Kim added the auto-review/approved Auto-approved by the Slack auto-reviewer bot label Jul 16, 2026

@jinsekim jinsekim left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jinsekim jinsekim left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gavin-jeong
gavin-jeong merged commit 5cd5fdb into master Jul 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-review/approved Auto-approved by the Slack auto-reviewer bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants