Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): stop crashing the native React Compiler on ChatView #20340

Mergedjuliusmarmingemerged 1 commit intochatview-split/send-phases fromrefs/pull/20340/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Part 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.

BeforeThis PR
Compiler result on ChatViewinternal error32 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

LayerChatView linesChatView component bodyCompiler on ChatViewFiles held to strict compiler lint
main11,66010,007crashes (internal error)0
#20161 pending approvals and questions hook11,2229,624crashes (internal error)0
#20164 terminal drawer and panel file10,6149,624crashes (internal error)0
#20289 one terminal open/close hook10,4669,481crashes (internal error)0
#20292 compile-required lint list10,4669,481crashes (internal error)2
#20294 pending hook compiles10,4669,481crashes (internal error)3
#20296 /usage-limits panel hook10,3979,416crashes (internal error)4
#20304 queued-message editing hook10,1729,200crashes (internal error)5
#20308 linked pull request hook10,0789,106crashes (internal error)6
#20309 proactive panel hook9,9508,984crashes (internal error)7
#20312 agent-opened previews hook9,8558,890crashes (internal error)8
#20315 right panel close hook9,7438,779crashes (internal error)9
#20316 worktree setup hook9,6608,695crashes (internal error)10
#20321 two onSend phases split out9,6608,613crashes (internal error)10
→ #20340 compiler no longer crashes on ChatView9,6478,599skips (32 reasons)10
#20379 ChatView compiles9,6168,469compiles11
#20380 re-render fixes from profiling9,6618,514compiles11
#20392 provider pushes keep identity9,6288,481compiles11
#20393 keyboard shortcuts command map9,3408,265compiles13
#20396 Sidebar compiles, no manual memos9,3408,265compiles14
#20397 ChatComposer compiles9,3408,265compiles14
#20401 project script editing hook9,1108,049compiles15
#20402 MessagesTimeline compiles9,1108,049compiles16
#20418 ChatView strict: no memos, no sync effects8,9017,855compiles17

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)


Devin Review
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. juliusmarminge added labelsmacroscope-review

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at 94fb2f7

      Macroscope'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 30f3439. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      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_status to false in 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.ts
      • apps/web/src/components/ChatView.logic.ts
      • apps/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 isThreadWokeUnseen to determine whether a thread wake is unseen. ChatView now 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.ts
      Added isThreadWokeUnseen and tests for missing or invalid timestamps, settled threads, later visits, and completed runs.
      ChatView visibility integration
      apps/web/src/components/ChatView.tsx
      Replaced 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: Passed 3 · Failed 1
      Failed Failed checks: 1 warning
      Check nameStatusExplanationResolution
      Description checkWarningThe 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 Passed checks: 3 passed
      Check nameStatusExplanation
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Title checkPassedThe 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
      Comment `@coderabbitai help` to get the list of available commands.
    5. juliusmarminge merged this9ef9274

    6. juliusmarminge closed this

Sign in to join this conversation.