Skip to content

fix(runtime): increment flush_count to activate infinite-loop circuit breaker#794

Merged
trueadm merged 2 commits intomainfrom
fix/runtime-flush-count-increment
Mar 7, 2026
Merged

fix(runtime): increment flush_count to activate infinite-loop circuit breaker#794
trueadm merged 2 commits intomainfrom
fix/runtime-flush-count-increment

Conversation

@anubra266
Copy link
Copy Markdown
Collaborator

@anubra266 anubra266 commented Mar 7, 2026

Summary

  • Adds flush_count++ in flush_microtasks before the > 1001 guard check
  • flush_count was declared, checked, and reset but never incremented — making the infinite reactive update loop protection completely inoperative
  • Without this fix, any component where a reactive update triggers another reactive update will hang the browser indefinitely

Closes #793


Note

Medium Risk
Touches core runtime scheduling/flush behavior; while the change is tiny, it can alter how extreme reactive-update loops are handled and could mask issues by early-bailing.

Overview
Ensures the reactive update infinite-loop circuit breaker in flush_microtasks actually triggers by incrementing flush_count on each flush and resetting it when the guard trips.

This prevents unbounded microtask-driven update cycles from hanging the browser by bailing out after the threshold is exceeded.

Written by Cursor Bugbot for commit cce985b. This will update automatically on new commits. Configure here.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
new-website Ready Ready Preview, Comment Mar 7, 2026 5:32am
ripple Ready Ready Preview, Comment Mar 7, 2026 5:32am

Request Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 7, 2026

@ripple-ts/adapter

pnpm add https://pkg.pr.new/@ripple-ts/adapter@794

@ripple-ts/adapter-bun

pnpm add https://pkg.pr.new/@ripple-ts/adapter-bun@794

@ripple-ts/adapter-node

pnpm add https://pkg.pr.new/@ripple-ts/adapter-node@794

@ripple-ts/cli

pnpm add https://pkg.pr.new/@ripple-ts/cli@794

create-ripple

pnpm add https://pkg.pr.new/create-ripple@794

@ripple-ts/eslint-parser

pnpm add https://pkg.pr.new/@ripple-ts/eslint-parser@794

@ripple-ts/eslint-plugin

pnpm add https://pkg.pr.new/@ripple-ts/eslint-plugin@794

@ripple-ts/prettier-plugin

pnpm add https://pkg.pr.new/@ripple-ts/prettier-plugin@794

ripple

pnpm add https://pkg.pr.new/ripple@794

@ripple-ts/rollup-plugin

pnpm add https://pkg.pr.new/@ripple-ts/rollup-plugin@794

@ripple-ts/typescript-plugin

pnpm add https://pkg.pr.new/@ripple-ts/typescript-plugin@794

@ripple-ts/vite-plugin

pnpm add https://pkg.pr.new/@ripple-ts/vite-plugin@794

commit: d10867c

@anubra266 anubra266 requested review from leonidaz and trueadm March 7, 2026 05:27
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

…cuit breaker

flush_count was declared and checked (> 1001) and reset, but never
incremented. The infinite reactive update loop guard was effectively dead
code — a cycle where a reactive update triggers another update would run
forever without being caught. Adding flush_count++ before the guard check
activates the circuit breaker as intended.
…ermanent lockout

After the circuit breaker triggered (flush_count > 1001), the early return
skipped the flush_count = 0 reset below, leaving flush_count permanently
above 1001. Every subsequent flush_microtasks call — even from legitimate
non-circular reactive updates — would immediately return without processing,
permanently breaking reactivity. Reset flush_count before returning so the
system recovers after an infinite-loop is aborted.
@trueadm trueadm merged commit 43aaafa into main Mar 7, 2026
12 checks passed
@trueadm trueadm deleted the fix/runtime-flush-count-increment branch March 7, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(runtime): flush_count is never incremented — infinite reactive loop circuit breaker is dead code

2 participants