fix(web): stop crashing the native React Compiler on ChatView #20340
chatview-split/send-phases fromrefs/pull/20340/head·merged by juliusmarminge View on GitHubPart of the ChatView split so the React Compiler can compile it.
Problem. ChatView never compiled, and the compiler never said why. The native React Compiler hit an internal codegen error on one Math.max(...) call in the "woke from snooze" check, abandoned the whole component after spending ~15s on it, and reported only that crash. None of the earlier layers could change that on their own.
Fix. The check is now isThreadWokeUnseen in ChatView.logic, with tests. With the crash gone, the compiler reaches ChatView's real problems and lists them, which the next layer fixes.
| Before | This PR | |
|---|---|---|
| Compiler result on ChatView | internal error | 32 reasons it skips ChatView |
| Of those: refs read during render | – | 18 |
try/finally or throw in try | – | 10 |
useMemo deps it can't preserve | – | 4 |
Stack progress#
| Layer | ChatView lines | ChatView component body | Compiler on ChatView | Files held to strict compiler lint |
|---|---|---|---|---|
| main | 11,660 | 10,007 | crashes (internal error) | 0 |
| #20161 pending approvals and questions hook | 11,222 | 9,624 | crashes (internal error) | 0 |
| #20164 terminal drawer and panel file | 10,614 | 9,624 | crashes (internal error) | 0 |
| #20289 one terminal open/close hook | 10,466 | 9,481 | crashes (internal error) | 0 |
| #20292 compile-required lint list | 10,466 | 9,481 | crashes (internal error) | 2 |
| #20294 pending hook compiles | 10,466 | 9,481 | crashes (internal error) | 3 |
| #20296 /usage-limits panel hook | 10,397 | 9,416 | crashes (internal error) | 4 |
| #20304 queued-message editing hook | 10,172 | 9,200 | crashes (internal error) | 5 |
| #20308 linked pull request hook | 10,078 | 9,106 | crashes (internal error) | 6 |
| #20309 proactive panel hook | 9,950 | 8,984 | crashes (internal error) | 7 |
| #20312 agent-opened previews hook | 9,855 | 8,890 | crashes (internal error) | 8 |
| #20315 right panel close hook | 9,743 | 8,779 | crashes (internal error) | 9 |
| #20316 worktree setup hook | 9,660 | 8,695 | crashes (internal error) | 10 |
| #20321 two onSend phases split out | 9,660 | 8,613 | crashes (internal error) | 10 |
| → #20340 compiler no longer crashes on ChatView | 9,647 | 8,599 | skips (32 reasons) | 10 |
| #20379 ChatView compiles | 9,616 | 8,469 | compiles | 11 |
| #20380 re-render fixes from profiling | 9,661 | 8,514 | compiles | 11 |
| #20392 provider pushes keep identity | 9,628 | 8,481 | compiles | 11 |
| #20393 keyboard shortcuts command map | 9,340 | 8,265 | compiles | 13 |
| #20396 Sidebar compiles, no manual memos | 9,340 | 8,265 | compiles | 14 |
| #20397 ChatComposer compiles | 9,340 | 8,265 | compiles | 14 |
| #20401 project script editing hook | 9,110 | 8,049 | compiles | 15 |
| #20402 MessagesTimeline compiles | 9,110 | 8,049 | compiles | 16 |
| #20418 ChatView strict: no memos, no sync effects | 8,901 | 7,855 | compiles | 17 |
Measured with the native React Compiler (oxc-transform-react) on each layer's ChatView.tsx. "Crashes" means it hit an internal codegen error and left ChatView uncompiled; "skips" means it reported reasons it could not compile it. Strict files must compile with no bailouts, no manual memoization and no effect-rule violations; lint and reactCompiledFiles.test.ts enforce it.
🤖 Generated with Claude Code (Claude Opus 5.5)
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Approvability#
Verdict: Approved at
94fb2f7Macroscope's review found this PR approvable — This is a small, tested extraction of an existing pure ChatView predicate to unblock compiler analysis. The production behavior remains equivalent, with no new capability, product-default change, deployment change, or static-analysis suppression.
No code changes detected at
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).30f3439. Prior analysis still applies.Important
Review skipped#
Review was skipped as selected files did not have any reviewable changes.
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
46b09934-8b59-4c5a-afb3-78212d10456a
📥 Commits
-
Reviewing files that changed from the base of the PR and between 94fb2f78845d504ee0d3cc7a80c9d2f587b04cfb and 30f3439ffd7620c420a058e3cea4a17394b9216f.
You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- 🔍 Trigger review
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
1863b8c3-d8bd-4d8f-a14a-d374c51bb714
📥 Commits
-
Reviewing files that changed from the base of the PR and between bd54ae3a5ca3b9483426df32c5ca4c079a54d1ac and 94fb2f78845d504ee0d3cc7a80c9d2f587b04cfb.
📒 Files selected for processing: 3
-
apps/web/src/components/ChatView.logic.test.tsapps/web/src/components/ChatView.logic.tsapps/web/src/components/ChatView.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
-
📝 Walkthrough
-
Added
isThreadWokeUnseento determine whether a thread wake is unseen.ChatViewnow uses this helper to control wake notification visibility, with tests covering timestamp and thread-state rules.Changes: Thread wake visibility
Layer / File(s) Summary Unseen wake rules
apps/web/src/components/ChatView.logic.ts,apps/web/src/components/ChatView.logic.test.tsAdded isThreadWokeUnseenand tests for missing or invalid timestamps, settled threads, later visits, and completed runs.ChatView visibility integration
apps/web/src/components/ChatView.tsxReplaced inline wake visibility logic with a call to isThreadWokeUnseen, passing the wake time, settled status, last visit, and latest run completion.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
t3dotgg
Merge Risk: ⚪ Minimal · up to
94fb2-
This refactor moves the "woke from snooze" check into a tested helper so the compiler no longer crashes on ChatView. No behavior change is expected, and no merge-blocking risk was found.
Pre-merge checks:
3 · 1-
Failed checks: 1 warningCheck name Status Explanation Resolution Description check The description explains the problem and the code change, but it does not provide the required Scope and approval section or focused Verification details with test commands and observed results. Add a Scope and approval section with the related issue, maintainer approval, or justification for this focused fix. Add a Verification section that lists the tests or manual checks run, their observed results, and any checks that were not … Passed checks: 3 passed-
Check name Status Explanation Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Title check The title clearly identifies the main change: preventing the native React Compiler from crashing on ChatView.
Full details: Description check
-
Resolution
Add a Scope and approval section with the related issue, maintainer approval, or justification for this focused fix. Add a Verification section that lists the tests or manual checks run, their observed results, and any checks that were not run.
-
✨ Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge merged this9ef9274
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes