Skip to content

fix(mobile): keep the working rings turning on the OTA page - #25299

Merged
Jinwoo-H merged 3 commits into
mainfrom
mobile-page-spinner-loop
Oct 4, 2026
Merged

Jinwoo-H merged 3 commits into
mainfrom
mobile-page-spinner-loop

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​162 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​162
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​33 $\color{#cf222e}{\Huge{\mathbf{−}}}$​44 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11

What

On the OTA page the yellow "working" rings in the workspaces list (the workspace row's AgentSpinner and the agent line's AgentStateDot) turned once and then sat still. Native animates.

Cause. Both run Animated.loop(Animated.timing(…, { useNativeDriver: true })). React Native's loop decides by the raw flag, not by whether a native driver exists: with true it hands the timing to the native loop. On the web there is no native animated module, so the timing falls back to JS and runs exactly once; the JS path never reads the loop's iteration count. Measured in the page render rig: 3°, 147°, then rotate(360deg) at every sample from 1.3 s on. Loops of an Animated.sequence (the chat's three dots, the tool-run pulse) take the JS loop path and were never affected.

Fix. The two components ran the same fifteen-line spin effect; it now lives once in useWorkingRingRotation, which sets useNativeDriver: Platform.OS !== 'web' with a one-line why. Native keeps the native driver and is unchanged; the page takes the JS loop. Each component keeps its own status branches. No web sibling; the branch is net smaller than main.

Cost on the page. The JS loop re-renders each ring per frame. Six spinners and a dot measured about 0.5 ms script per frame in headless desktop Chromium (CDP Performance.getMetrics). A phone WebView is slower; a list with five to seven working rings should land around two to three milliseconds a frame. If real lists often show more than ten working rings, or page scroll drops under 60 fps with rings on screen, the follow-up is a CSS-keyframe web sibling that runs on the compositor.

Tests (red first)

  • config/scripts/mobile-web-app-working-spinner-render.test.mjs (Chromium): mounts both rings on a probe route and samples the inline transform at 1.3, 1.8 and 2.4 s; the three angles must all differ. Red: ring 0 after 1.3 s: rotate(360deg), rotate(360deg), rotate(360deg): expected 1 to be 3, and the same for ring 1 with only the spinner fixed.
  • agent-monitoring-indicators.test.ts gains a case rendering both rings under its iOS mock and asserting each timing is created with useNativeDriver: true, so native cannot lose the driver by accident.

Ships over the air; no shell change.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 172f1cb3-ade5-443d-a6ed-9d7cf6d3cf7f
📥 Commits

Reviewing files that changed from the base of the PR and between b1144bf and bf400fe.

📒 Files selected for processing (5)
  • config/scripts/mobile-web-app-working-spinner-render.test.mjs
  • mobile/src/components/AgentSpinner.tsx
  • mobile/src/components/AgentStateDot.tsx
  • mobile/src/components/agent-monitoring-indicators.test.ts
  • mobile/src/components/use-working-ring-rotation.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

AgentSpinner and AgentStateDot now use the shared useWorkingRingRotation hook for their working-state rotations. The hook enables the native animation driver except on web. Component tests check native-driver settings on iOS. A browser test conditionally builds and serves a probe app, then samples both rings in headless Chromium and checks for render faults and page errors.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to bf400

The animation change is mergeable with a bounded test concern: on a slow browser run, the probe may not get its intended 60-second wait. Correct the test options to make that check reliable.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the mobile working-ring animation fix on the OTA page.
Description check ✅ Passed The description clearly explains the cause, fix, impact, and tests. It omits the Linked Issue, Visual Proof (or an N/A explanation), and several template checklist sections, but it is otherwise detail…
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a9f64e4e-e7ce-40d1-9d48-9c5476d88b90
📥 Commits

Reviewing files that changed from the base of the PR and between b99d28e and b1144bf.

📒 Files selected for processing (4)
  • config/scripts/mobile-web-app-working-spinner-render.test.mjs
  • mobile/src/components/AgentSpinner.tsx
  • mobile/src/components/AgentStateDot.tsx
  • mobile/src/components/agent-monitoring-indicators.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

() =>
globalThis.__orcaWorkingSpinnerProbe !== undefined ||
(globalThis.__orcaRenderCheckFaults ?? []).length > 0,
{ timeout: 60_000, polling: 100 }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Pass the wait options as the third argument.

page.waitForFunction treats the second argument as input to the predicate, not as options. If the probe does not appear, this call does not apply the intended 60-second timeout or 100 ms polling interval. Pass undefined as the second argument so a failed render reports promptly. (playwright.dev)

Proposed fix
-    { timeout: 60_000, polling: 100 }
+    undefined,
+    { timeout: 60_000, polling: 100 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{ timeout: 60_000, polling: 100 }
undefined,
{ timeout: 60_000, polling: 100 }

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

  • Single-timing loops opt out of the native driver on web — AgentSpinner.tsx and AgentStateDot.tsx now pass useNativeDriver: Platform.OS !== 'web', so the rotation loops run on the JS path on the page instead of stalling after one turn. Native keeps the native driver.
  • Page regression test — a new Chromium render test (mobile-web-app-working-spinner-render.test.mjs) mounts both rings on a probe route and asserts the sampled rotation transforms from 1.3 s on are all distinct, which fails on the buggy code.
  • Native driver pin — agent-monitoring-indicators.test.ts adds a Platform.OS: 'ios' mock and asserts the timing is created with useNativeDriver: true on native.

The root cause is accurate against react-native-web 0.21.3: Animated.loop branches on the raw useNativeDriver flag via _isUsingNativeDriver(), so a native-flagged single timing takes _startNativeLoop and never installs the JS restart recursion; on web the timing resolves to the JS thread and runs once. sequence/parallel report _isUsingNativeDriver() === false, so the three other Animated.loop sites in mobile/ (all sequences) are genuinely unaffected — the fix is complete for the affected class.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

This re-review covers the single commit since the prior pullfrog approval at b1144bf.

  • Rotated the shared spin effect into useWorkingRingRotation — AgentSpinner.tsx and AgentStateDot.tsx now call one hook that owns the Animated.Value, the conditional Animated.loop(Animated.timing(...)), and the 0deg→360deg interpolation; useNativeDriver: Platform.OS !== 'web' and its one-line Why: comment moved with it.
  • Consolidated the native-driver test — agent-monitoring-indicators.test.ts now renders both rings together and asserts Animated.timing is called twice, both with useNativeDriver: true, replacing the earlier single-component assertion.
  • Trimmed the render-test samples — mobile-web-app-working-spinner-render.test.mjs drops the two pre-1.3 s samples that were diagnostic only; the three post-1.3 s angles still must all differ, which is what catches the one-turn stall (all samples read rotate(360deg) on the buggy code).

I checked the extraction against the pre-refactor behavior: active captures exactly the old effect condition (status === 'working' && !monitoring), so the trigger set is unchanged; monitoring and non-working transitions still reset the value to 0; and the animation.stop() cleanup is preserved. The hook is invoked before both early returns so hook order stays stable, and the only AgentSpinner caller (WorktreeListRow.tsx:116) passes the same status/workingMode props.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

This re-review covers the single commit since the prior pullfrog approval at b1144bf.

  • Rotated the shared spin effect into useWorkingRingRotation — AgentSpinner.tsx and AgentStateDot.tsx now call one hook that owns the Animated.Value, the conditional Animated.loop(Animated.timing(...)), and the 0deg→360deg interpolation; useNativeDriver: Platform.OS !== 'web' and its one-line Why: comment moved with it.
  • Consolidated the native-driver test — agent-monitoring-indicators.test.ts now renders both rings together and asserts Animated.timing is called twice, both with useNativeDriver: true, replacing the earlier single-component assertion.
  • Trimmed the render-test samples — mobile-web-app-working-spinner-render.test.mjs drops the two pre-1.3 s samples that were diagnostic only; the three post-1.3 s angles still must all differ, which is what catches the one-turn stall (all samples read rotate(360deg) on the buggy code).

I checked the extraction against the pre-refactor behavior: active captures exactly the old effect condition (status === 'working' && !monitoring), so the trigger set is unchanged; monitoring and non-working transitions still reset the value to 0; and the animation.stop() cleanup is preserved. The hook is invoked before both early returns so hook order stays stable, and the only AgentSpinner caller (WorktreeListRow.tsx:116) passes the same status/workingMode props.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@Jinwoo-H
Jinwoo-H merged commit 1978469 into main Oct 4, 2026
33 checks passed
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.

1 participant