Genie React

Genie vs agent-react-devtools: one named the re-render, the other reported 291 first mounts

Both tools give your coding agent React DevTools data as text. On the same React 19 bug, Genie named the cause and proved the fix, and agent-react-devtools' profile went wrong.

Genie and agent-react-devtools both hand your coding agent React internals as text, but they answer different questions. On the same seeded bug in a React 19.3.1 dashboard, Genie named the store field behind a wasted render and proved the fix with an exit code. agent-react-devtools read the component's props and hooks correctly, but its profile marked 291 components as first mounts and left the re-rendering component out.

Both tools ran on apps/realworld-dashboard in this repo, against the same interaction. The Genie steps were re-run on Genie 1.1.0, and the Genie output below comes from that re-run. The full log has the untrimmed output.

Ticking an order re-renders the sidebar

On the Orders page, ticking one order's checkbox re-renders SidebarNav, the left navigation. The sidebar shows nothing about the selection. The app ships with this bug on purpose. The answer key is evals/realworld/dashboard/order-selection-rerenders-sidebar.json.

What Genie reports

Your agent opens a render window, drives the click with agent-browser, and asks why SidebarNav rendered:

npx genie-react call react_clear_renders '{}' --session upd-g
agent-browser --session upd-g click @e146
npx genie-react call react_quiesce '{"idleMs":500,"timeoutMs":10000}' --fail-on-result-error --session upd-g
npx genie-react call react_render_causes '{"component":"SidebarNav","limit":5}' --session upd-g

The answer, trimmed to the event:

SidebarNav #8993711849514 {…,necessity:unnecessary,necessityReason:output-unchanged,…,source:{location:/src/layout/app-shell.tsx:38:9,…}}
  ← external-store inferred anonymous-external-store {changedFields:[selectedOrderIds]}

The render changed nothing on screen. An external store caused it, and the store field that changed is selectedOrderIds. Genie 1.0.2 listed that field only in the full view. The cause is graded inferred, so it is a lead, not proof. Adding "view":"full" shows the store's before and after values and how SidebarNav subscribed:

selectionEqual:false,subscriptionFired:true,…,changedFields:[selectedOrderIds],…,selector:null,equality:object-is

The store fired, selectedOrderIds changed, and selector:null says SidebarNav subscribed with no selector. The source confirms it:

const { recentlyViewed } = useWorkspaceStore()

What agent-react-devtools reports

agent-react-devtools runs a daemon that the app connects to through react-devtools-core, the backend of React DevTools. I installed version 0.5.0 in a scratch copy of the same app. In the copy, its reactDevtools() Vite plugin replaced Genie's, and I removed <Genie />, so no Genie code ran in that page. One setup step was missing from its README. The browser threw Could not resolve "react-devtools-core" until I installed that optional peer dependency myself. The README does say agent-browser must run headed, because "headless Chromium does not properly execute the devtools connect script".

Other agents share this machine, so I passed a private --state-dir and --port 8297 on every call. Those flags are left out below. Once connected, finding and inspecting the component worked:

$ agent-react-devtools find SidebarNav
@c?(id:38) [fn] SidebarNav
$ agent-react-devtools get component 38
#38 [fn] SidebarNav
props:
  data: {"collapsed":true,"onToggle":"() => {}"}
  cleaned: [["onToggle"]]
  unserializable: []
hooks:
  BoundStore: {"type":"undefined"}
    Store: {"density":"comfortable","hiddenColumns":"Array(0)","rece...

That Store hook holds the whole workspace store, which is the bug if you know to look for it. Next, the profile of the same click on a fresh daemon and page:

$ agent-react-devtools profile start 'select one order'
$ agent-browser --session art-m2 find label 'Select SO-105998' check
$ agent-react-devtools profile stop
Profile "select one order" (6.7s, 6 commits)
$ agent-react-devtools profile report 38
No profiling data for component 38

SidebarNav is missing from the profile. The commit with the selection lists 292 components. The exported profile marks 291 of them isFirstMount: true, including rows that already existed:

$ agent-react-devtools profile commit 5 --limit 400 | grep -nE 'SidebarNav|OrdersTable|OrderRow|BulkActionBar|AppShell'
4:  ? [memo] Memo(OrderRow)  self:0.4ms  total:0.7ms  causes:first-mount
6:  ? [fn] BulkActionBar  self:0.2ms  total:0.3ms  causes:first-mount
270:  ? [memo] Memo(OrderRow)  self:-0.2ms  total:0.0ms  causes:first-mount
…
294:  ? [fn] OrdersTable  self:-0.8ms  total:0.0ms  causes:first-mount

Genie disagrees on the real app. react_component_cohort for OrderRow after the same kind of click reported mountedUpdated: 1, mountedIdle: 8 and unmounted: 1, which is the virtualized list dropping one row. No row remounted.

The browser console explains the gap. During the profile, react-devtools-core threw inside its own commit handler:

React instrumentation encountered an error: … Unknown Fiber. Needs to be a function component to inspect hooks.
    at inspectHooksOfFiberImpl …
    at getChangeDescription …
    at recordProfilingDurations …

agent-react-devtools starts profiling with recordChangeDescriptions: true, which runs that code path. On the Dashboard page, two more profiles of a sidebar toggle that did reach React recorded 0 commits. The error comes from the shared React DevTools backend, not from agent-react-devtools' own code. The React DevTools Profiler hits the same error when you turn on "Record why each component rendered". On another app, its profile may be fine.

Proving the fix

Genie's verify turns the question into claims and exits with the verdict. Before the fix:

npx genie-react verify begin --session upd-g --name "select one order" \
  --claim 'render SidebarNav max 0' --claim 'render OrdersTable min 1' --claim 'boundaries clean'
agent-browser --session upd-g find label 'Select SO-105999' check
npx genie-react verify end vfy_7747813a-33d9-4734-ac66-f39ae7b5ba8d --session upd-g
fail vfy_7747813a-33d9-4734-ac66-f39ae7b5ba8d "select one order"  8 commits, quiet after 722 ms (react, query, router, network)
  1 fail render SidebarNav max 0  {renders:1,mounts:0,updates:1,remounts:0,semantics:exact,instances:1,activeInstances:1}
  2 pass render OrdersTable min 1  {renders:1,…}
  3 pass boundaries clean  {caughtDuringWindow:0,caughtAtEnd:0}

The command exited 1. The fix gives the store hook a selector:

-  const { recentlyViewed } = useWorkspaceStore()
+  const recentlyViewed = useWorkspaceStore((state) => state.recentlyViewed)

The same claims after the fix, ticking the next order:

pass vfy_3abb24de-4698-4a82-baf0-52b75e584e1f "select one order"  10 commits, quiet after 1324 ms (react, query, router, network)
  1 pass render SidebarNav max 0  {renders:0,mounts:0,updates:0,remounts:0,semantics:exact,instances:1,activeInstances:1}
  2 pass render OrdersTable min 1  {renders:2,…}
  3 pass boundaries clean  {caughtDuringWindow:0,caughtAtEnd:0}

The command exited 0. OrdersTable min 1 is the control. It fails if the click never reached the app. agent-react-devtools has profile export and profile diff <before.json> <after.json>, which compare two profiles. Its README does not describe a pass or fail verdict, so your agent reads the diff and decides. Verify a fix lists Genie's claim forms.

How the agent drives each one

Genieagent-react-devtools
Connects throughIts own hook, added by genie-react init or a Vite pluginreact-devtools-core, the React DevTools backend
Browser driveragent-browser, headless worked hereagent-browser, headed per its README
AnswersWhy a component rendered, with an evidence grade and coverageTree, props, hooks, and per-commit render counts and causes
Proof of a fixverify with claims and exit codes 0, 1, 4, 5Profile diff, read by the agent
React Nativegenie-react/native and a standalone hub, per the install guideinit patches Metro and the entry, per its README

I ran neither tool on React Native for this article. Both READMEs document Expo and bare React Native setups.

When agent-react-devtools is the better choice

Pick agent-react-devtools when your agent needs to browse the tree. Its README shows get tree --depth 3 printing a compact hierarchy, and get component returned props and hooks without trouble in these runs. It also helps when a human will look at the same data. profile export writes the React DevTools Profiler format. On React Native, its init command patches Metro and the entry file for common setups.

Pick Genie when the agent must explain a render and then prove a fix. On this app, Genie named selectedOrderIds and selector:null, and verify turned "it no longer re-renders" into exit code 0. Genie does not check the screen. Its verdict says ui-outcome-not-observed, so your agent still confirms the UI with agent-browser.

On this page