Skip to content

Fix status bar render loop in runtime target hook - #18685

Merged
Jinwoo-H merged 1 commit into
mainfrom
sep04-statusbar-error-regression
Sep 4, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
sep04-statusbar-error-regression

Conversation

@Jinwoo-H

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

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

ELI5

The status bar asked Zustand for a newly created runtime-target object on every store snapshot. React treated each object as a different snapshot, rendered forever, and eventually replaced the status bar with its error boundary. This changes the subscription to the stable execution-host ID and derives the runtime target afterward.

What Changed

  • Subscribe to the primitive worktree execution-host ID in useWorktreeRuntimeTarget.
  • Memoize the derived RuntimeClientTarget outside the Zustand selector.
  • Add a production-component regression oracle that checks both the visible boundary state and the underlying maximum-update-depth exception.

Why

The runtime-target hook owns the conversion from worktree host ownership to the RPC target. Fixing it there protects every consumer while preserving local, paired-runtime, direct-SSH, and folder-workspace routing. A call-site workaround or selector cache would leave the unstable ownership boundary in place.

Linked Issue

Visual Proof

Before

F0BV5N4FLUR.png

After

statusbar-fixed-candidate.png

Testing

  • Reproduced on untouched origin/main with the visible status-bar boundary and Maximum update depth exceeded.

  • Identical deterministic oracle: good hourly passed; PR fix(ports): route the status-bar popover scan to the workspace's host #17048 merge, bad hourly, and baseline main failed; candidate passed; candidate with the fix disabled failed.

  • pnpm tc

  • 54 relevant test files / 383 tests

  • Final status-bar render-stability and host-routing suites: 11/11

  • Post-commit render-stability oracle: 1/1

  • pnpm run check:code-quality:changed

  • Electron/Playwright CDP on macOS with an isolated profile: correct worktree identity, Ports control visible, boundary text absent, zero renderer console errors.

  • Linux, Windows, and SSH were assessed structurally; no platform or wire behavior changed. CI will cover the full platform/build matrix.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Fresh performance, architecture/adversarial, and regression reviews were clean. The internal review-until-clean loop completed with no in-scope findings.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No persisted state, IPC/RPC payload, polling, retry, or wire contract changed. Direct SSH still resolves to no runtime client target.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 439c858e-d84a-4a9a-bcad-8d17f28ad2ee

📥 Commits

Reviewing files that changed from the base of the PR and between 3e4fd4a and b8dcc75.

📒 Files selected for processing (2)
  • src/renderer/src/components/status-bar/PortsStatusSegment.render-stability.test.tsx
  • src/renderer/src/runtime/use-worktree-runtime-target.ts

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


📝 Walkthrough

Walkthrough

The runtime target hook now selects the execution host ID and memoizes the derived runtime target with useMemo. A new test renders PortsStatusSegment inside RecoverableRenderErrorBoundary with mocked dependencies. The test verifies that no boundary error or “Maximum update depth exceeded” error occurs and that the ports button remains mounted.

Merge Risk: ⚪ Minimal · up to b8dcc

This stabilizes status-bar runtime target rendering while preserving routing behavior, with regression coverage for the previous render-loop failure. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: fixing the status bar render loop in the runtime target hook.
Description check ✅ Passed The description is complete and relevant. It explains the problem, implementation, rationale, testing, visual evidence, platform considerations, review status, and checklist results. The linked issue …
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@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

  • Status bar render-loop fix — useWorktreeRuntimeTarget now subscribes to the primitive execution-host ID and memoizes the derived RuntimeClientTarget, removing the fresh-object-per-snapshot that drove the infinite re-render.
  • Render-stability regression oracle — a new PortsStatusSegment.render-stability.test.tsx mounts the segment under its real error boundary and asserts both the boundary text and the Maximum update depth exceeded exception stay absent.

The fix is correct at the seams that matter: ExecutionHostId is a string union ('local' | 'ssh:*' | 'runtime:*'), so the selector is now referentially stable, and the useMemo keeps the derived target stable for the downstream useCallback deps in PortsStatusSegment, PortRow, and WorktreePortRow. I verified the test is a genuine oracle by reverting the production change locally — all three soft assertions fail with the exact Maximum update depth exceeded boundary log — and it passes with the fix restored.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@iverJisty

Copy link
Copy Markdown
Contributor

Thank you for catching and fixing the issue

@Jinwoo-H
Jinwoo-H merged commit 5412276 into main Sep 4, 2026
29 checks passed
nwparker added a commit that referenced this pull request Sep 4, 2026
#18685 landed the fix (select the host id, derive in useMemo) without a
regression guard. This is that guard: it drives 50 unrelated store writes and
asserts the consumer re-renders once and the returned target keeps its identity.
Confirmed to fail against the pre-#18685 hook (51 renders).
nwparker added a commit that referenced this pull request Sep 4, 2026
…18625)

#18685 landed the fix (select the host id, derive in useMemo) without a
regression guard. This is that guard: it drives 50 unrelated store writes and
asserts the consumer re-renders once and the returned target keeps its identity.
Confirmed to fail against the pre-#18685 hook (51 renders).
penghuizhang pushed a commit to penghuizhang/orca that referenced this pull request Sep 19, 2026
cherry-picked from upstream stablyai/orca 5412276 (author: Jinwoo Hong)
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#18625)

stablyai#18685 landed the fix (select the host id, derive in useMemo) without a
regression guard. This is that guard: it drives 50 unrelated store writes and
asserts the consumer re-renders once and the returned target keeps its identity.
Confirmed to fail against the pre-stablyai#18685 hook (51 renders).
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.

2 participants