Skip to content

fix(gui): ignore stale Startup secondary responses - #2416

Draft
luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:fix/startup-secondary-generation
Draft

fix(gui): ignore stale Startup secondary responses#2416
luvs01 wants to merge 1 commit into
lidge-jun:devfrom
luvs01:fix/startup-secondary-generation

Conversation

@luvs01

@luvs01 luvs01 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fence the detached Startup settings/tray follow-up with a per-request generation after primary health has already rendered.
  • Invalidate older secondary callbacks when Refresh starts, apiBase changes, or the component unmounts.
  • Prevent stale secondary responses from overwriting newer UI state or the Startup session cache while preserving the existing early health paint.

Verification

  • Bun 1.4 focused Startup regressions: bun test --isolate tests/startup-revisit-cache.test.tsx tests/startup-usage-loading-race.test.tsx tests/startup-install-result-reconciliation.test.tsx — 9 passed, 0 failed, 24 assertions.
  • The new stale-first/fresh-second regression verifies a superseded settings response cannot replace the newer cached runtime notice.
  • GUI bun x tsc -b — passed.
  • Focused GUI oxlint src/pages/Startup.tsx tests/startup-revisit-cache.test.tsx — passed.
  • bun run typecheck — passed.
  • bun run privacy:scan — passed.
  • git diff --check — passed.
  • Independent exact-diff review — no actionable findings.
  • Exact head e667804cddf6c49e7f15f25e0f68c03520c7128a, based directly on dev at 4f41a8e936141af7ee828e335da314b9dc1ef761.
  • Screenshot not applicable: this changes no layout or visual state; it only rejects a superseded asynchronous result that should never become visible.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. This is an internal stale-response guard with no public API or configuration change.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults. This changes no credential or authorization behavior.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • Bug Fixes

    • Prevented outdated Startup settings or tray results from replacing newer data after a refresh or API-base change.
    • Improved handling of cancelled and superseded requests.
  • Tests

    • Added regression coverage to ensure newer Startup cache data is preserved when an older request finishes later.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 22, 2026
@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • UI screenshot required.

What to do

  • Add a screenshot of the UI change to the PR description.

Review readiness checklist

  • ✅ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

4/4 boxes ticked.

This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c2cb6e5e-f46a-4f8d-8652-c3cc61aeb32e

📥 Commits

Reviewing files that changed from the base of the PR and between 4f41a8e and e667804.

📒 Files selected for processing (2)
  • gui/src/pages/Startup.tsx
  • gui/tests/startup-revisit-cache.test.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Startup now tracks request generations to prevent superseded settings and tray responses from updating the page. A regression test verifies that stale responses do not overwrite newer session cache data.

Changes

Startup stale request protection

Layer / File(s) Summary
Generation guard for startup requests
gui/src/pages/Startup.tsx
The Startup page increments a secondary-request generation during API-base cleanup and each startup fetch. The result handler ignores aborted or superseded requests.
Regression coverage for stale cache writes
gui/tests/startup-revisit-cache.test.tsx
The asynchronous test delays an earlier settings response, refreshes the Startup data, and verifies that the stale response cannot overwrite the fresh session cache.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to e6678

This change rejects superseded Startup responses so newer UI and cached runtime state are not overwritten; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: ingwannu, lidge-jun, wibias

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing stale Startup secondary responses from updating state.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions
github-actions Bot marked this pull request as draft August 22, 2026 20:15
@luvs01

luvs01 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

Screenshot waiver requested: this is a stale asynchronous-result guard, not a new visual state. Normal and error rendering are unchanged; the only observable effect is that an older settings/tray callback can no longer overwrite a newer Refresh, API-base, or unmount lifecycle, so a screenshot would be identical. Could a maintainer apply the gui-screenshot-waived label?

@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 49 / 80

설명: 이 PR 은 시작 페이지의 설정과 트레이 응답이, 이미 새 건강 상태를 그린 뒤에 늦게 도착해 캐시를 덮지 못하게 한다. 지금 CURRENT dev HEAD 는 4f41a8e93 이다. 이번 시간에 origin/dev 는 그대로다. 새 머지는 없다. 착지는 여전히 2396 사용량 CLI 오늘 비용이다. package.json 은 2.27.0 이다. src/config.ts 는 3975줄이다. src/runtime 폴더는 지금 HEAD 에 없다. 지금 HEAD 의 gui/src/pages/Startup.tsx 156줄은 건강을 먼저 돌려 주고, 설정과 트레이는 떨어진 Promise.all 로 나중에 쓴다. gui/src/client-resource.ts 316줄은 새 요청이 뜨면 이전 중단 신호를 끊는다. 그런데 fetchStartup 은 건강만 끝나면 이미 성공으로 끝난다. inflight 가 비므로 새로고침은 그 떨어진 설정 요청을 끊지 않는다. 옛 신호는 aborted 가 아니다. 156줄 가드가 옛 설정을 통과시킨다. 그래서 새 캐시의 fresh 가 stale 로 바뀐다. 이 PR 은 secondaryGenerationRef 를 두고, 요청 시작과 apiBase 정리와 언마운트에서 세대만 올린다. 늦은 콜백은 세대가 다르면 버린다. 시험은 첫 설정을 붙잡아 두고 새로고침한 뒤, 늦은 응답이 fresh 캐시를 못 덮는지 잠근다. 트레이는 같은 콜백이지만 시험은 설정만 본다. 작성자 로컬은 시작 회귀 9개, GUI tsc, oxlint, typecheck, privacy:scan 통과라고 적었다. 아직 드래프트다. bug 라벨만 있고 review-ready 는 없다. 체크리스트 네 칸은 채워져 있다. 게이트는 화면 사진이 필요하다고 드래프트를 유지한다. 작성자는 보이는 상태가 안 바뀌어서 사진 면제를 요청했다. 작성자는 luvs01 이다. 베이스는 지금 HEAD 와 같다. Closes 가 없다. CodeRabbit 은 지적 없음이다. 사용자 길이로는 새로고침 뒤에 옛 런타임 안내가 다시 뜨는 구멍이라서 49. 드래프트이고 사진 게이트가 잡혀 있다. 카탈로그 팁은 Ox Alpha x-preview-f-free + deepseek-v4-flash-vision-exp. Cursor 정적 카탈로그는 opus-4-8-fast / opus-5-fast. 2334 CursorCredentialRouter 는 여전히 src/providers/cursor-pool.ts 모듈+테스트만 있고 어댑터에 연결되지 않았다. 2332 H2 는 discovery 전용. 2320 overflow + 2342 는 이미 dev. 2188 사이드카는 이미 dev. 2382 데스크톱 앱 재시작은 이미 dev. 2292 는 아직 연다.

gui/src/pages/Startup.tsx 라인 156 - 지금 HEAD 는 건강을 먼저 돌려 주고 설정과 트레이는 떨어진 콜백이다. 중단 신호만 본다
gui/src/client-resource.ts 라인 316 - 새로고침은 inflight 만 끊는다. 건강이 이미 끝나면 옛 설정 요청은 그대로 산다
gui/src/pages/Startup.tsx 새 secondaryGenerationRef - 요청 시작과 apiBase 정리와 언마운트에서 세대를 올린다. 늦은 콜백을 버린다
gui/tests/startup-revisit-cache.test.tsx - 첫 설정을 붙잡고 새로고침한 뒤 stale 이 fresh 캐시를 못 덮는지 잠근다. 트레이는 안 본다
GitHub 게이트 - 화면 사진이 필요하다고 드래프트를 유지한다. 작성자는 면제를 요청했다. review-ready 라벨이 없다

메인테이너의 판단이 필요한 지점

  • 화면 사진 면제를 줄지. 작성자는 보이는 상태가 안 바뀐다고 했다. 게이트는 사진을 요구한다
  • 트레이 늦은 응답도 같은 시험이 필요한지. PR 은 설정만 잠근다. 콜백은 하나다
  • 드래프트인데 체크리스트가 다 채워져 있다. 면제 라벨 뒤에 레디로 올릴지
  • 이 구멍을 이슈로 남길지. 본문에 Closes 가 없다

너의 추천
지금 머지하지 말 것. 사진 면제나 레디 라벨을 먼저 받는다. 세대 가드를 더 넓히지 말 것. 건강을 먼저 그리는 순서는 그대로 둔다. 라벨은 그대로 둔다. 프리뷰 배포가 아니다.

이 댓글은 grok-bot이 작성했습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants