Skip to content

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

Merged
juliusmarminge merged 1 commit into
chatview-split/send-phasesfrom
chatview-split/compiler-unblock
Oct 17, 2026
Merged

juliusmarminge merged 1 commit into
chatview-split/send-phasesfrom
chatview-split/compiler-unblock

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

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.

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)


Devin Review

@juliusmarminge
juliusmarminge added this pull request to stack #20165 October 16, 2026 17:32
@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Oct 16, 2026
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 16, 2026
@github-actions github-actions Bot added the size:M 30-99 changed lines (additions + deletions). label Oct 16, 2026
@juliusmarminge
juliusmarminge marked this pull request as ready for review October 16, 2026 20:59
@macroscopeapp

macroscopeapp Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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 94fb2f7 and 30f3439.

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 bd54ae3 and 94fb2f7.

📒 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 name Status Explanation Resolution
Description check Warning 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 Passed checks: 3 passed
Check name Status Explanation
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.
Title check Passed 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

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

`Math.max(...)` inside ChatView's woke-visibility memo hit an internal
codegen invariant in oxc's React Compiler, so it abandoned the whole
component after spending ~15s on it, and never reported the real reasons
ChatView can't compile. The check is now the pure isThreadWokeUnseen in
ChatView.logic, with tests. The compiler now reaches ChatView's real
bailouts (ref reads during render, try/finally in handlers, memo
mismatches), which the next layers fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the chatview-split/compiler-unblock branch from 94fb2f7 to 30f3439 Compare October 17, 2026 00:11
@juliusmarminge
juliusmarminge merged commit 9ef9274 into main Oct 17, 2026
30 checks passed
@juliusmarminge
juliusmarminge deleted the chatview-split/compiler-unblock branch October 17, 2026 00:39
vedprakash2302 added a commit to vedprakash2302/Cody that referenced this pull request Oct 17, 2026
Brings in upstream through pingdotgg#20797 (144aae4).

- React Compiler cleanup (pingdotgg#20340 and ~300 perf/refactor PRs): the web components Cody patches were rewritten without manual memoization. Cody's worktree base selection, scheduled task thread picker, Tailscale SSH remote open login, and WSL tailnet pairing links were reapplied onto the new code, also without manual memoization.
- Adapted: ChatView now keeps the chosen worktree base per thread, like upstream's new per-thread branch and env mode overrides, instead of clearing it from effects.
- AutoInstallUpdatesRow: dropped useCallback for the new no-manual-memo lint rule.
- Worktree handoff MCP: the custom path option is gone, so Cody's base-ref test no longer passes one.
- Git runs with safe.bareRepository=explicit (pingdotgg#20440): Cody's worktree base test now names the bare repo with --git-dir.
- fetchRemoteTrackingBranch: kept Cody's non-interactive env with upstream's `--` before the remote name.
- Superseded: none.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant