feat(ui): launch at login and harden menu popover - #55
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 48 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (20)
📝 WalkthroughWalkthroughThe PR adds app-owned launch-at-login management, adaptive popover sizing, improved daemon-disconnected states, guarded Tauri/browser runtime handling, and compact popover/thread presentation updates. Installers now open the app instead of managing its UI LaunchAgent directly. ChangesMicrobridge UI behavior
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant Popover
participant AutostartModule
participant TauriBackend
participant LaunchAgent
User->>Popover: Open menu bar app
Popover->>AutostartModule: promptLaunchAtLoginOnce()
AutostartModule->>TauriBackend: Query capability and enabled state
TauriBackend-->>AutostartModule: Return launch-at-login state
AutostartModule-->>User: Show first-launch prompt
User->>AutostartModule: Confirm or decline
AutostartModule->>TauriBackend: Set launch-at-login
TauriBackend->>LaunchAgent: Enable or disable login item
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR moves “launch at login” ownership from installer scripts into the Tauri app (consistent across Homebrew/DMG/source installs), while also improving the tray popover’s sizing/scroll behavior and making daemon-offline states display honestly (instead of browser demo data).
Changes:
- Shift login-item management into the app via
tauri-plugin-autostart, with a first-launch prompt and a Settings → General toggle. - Rework popover geometry: fit to active screen/work area, keep footer visible, and make the thread list scroll with a fixed 10-row viewport.
- Replace “connecting…” placeholder with a dedicated Disconnected surface and tighten the browser-preview vs. real-app snapshot behavior.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/install.sh | Stop writing/bootstrapping the UI LaunchAgent; just open the app bundle. |
| scripts/install-from-release.sh | Same: remove installer-managed UI LaunchAgent and rely on in-app behavior. |
| INSTALL.md | Document the ai.microbridge.ui LaunchAgent and the new launch-at-login workflow. |
| Formula/microbridge.rb | Update caveats to mention in-app launch-at-login offer and Settings path. |
| apps/microbridge-ui/src/surfaces/Settings.tsx | Add “General” tab with launch-at-login toggle wired to new autostart APIs. |
| apps/microbridge-ui/src/surfaces/Popover.tsx | Use usePopoverFit, add scrollable thread list with fixed row height/count, and compact-mode behavior. |
| apps/microbridge-ui/src/surfaces/Disconnected.tsx | New honest offline surface shown when no snapshot yet (in-app). |
| apps/microbridge-ui/src/lib/threads.ts | Add thread row constants and a render safety limit API surface. |
| apps/microbridge-ui/src/lib/tauri.ts | Centralize “has Tauri vs. command failure” distinction and guarded invocations. |
| apps/microbridge-ui/src/lib/popoverFit.ts | New hook to cap card height per-monitor and resize the popover window to content. |
| apps/microbridge-ui/src/lib/bus.ts | Ensure demo snapshot is browser-only; return null in-app until daemon snapshot exists. |
| apps/microbridge-ui/src/lib/autostart.ts | New launch-at-login prompt-once + toggle helpers. |
| apps/microbridge-ui/src/components/DeviceEcho.tsx | Reduce echo footprint to fit better alongside a 10-row thread list. |
| apps/microbridge-ui/src/App.tsx | Show Disconnected when no snapshot (except HUD), and prompt for launch-at-login once. |
| apps/microbridge-ui/src-tauri/tauri.conf.json | Make popover focusable; adjust HUD window height. |
| apps/microbridge-ui/src-tauri/src/lib.rs | Implement popover sizing/fit commands and autostart (label pinning + blur/click guard). |
| apps/microbridge-ui/src-tauri/Cargo.toml | Add tauri-plugin-autostart dependency. |
| apps/microbridge-ui/src-tauri/Cargo.lock | Lockfile updates for autostart and transitive dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9508b2e to
8f1d13f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/microbridge-ui/src/lib/threads.ts (1)
44-62: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
limitparameter is accepted but never applied — the render-count safety valve is a no-op.
threads = rankeduses the full sorted array; it's never sliced tolimit/RENDER_LIMIT. As a result:
truncatedis alwaysfalse(threads.lengthalways equalssnapshot.sessions.length), so the "x/y" truncation label inPopover.tsxcan never appear.- The safety valve this function's own docstring describes ("a runaway session count can't put thousands of rows in the DOM") does not actually apply —
Popover.tsxrenders every session as a DOM row regardless of count.🐛 Proposed fix
const ranked = [...snapshot.sessions].sort((a, b) => { const diff = rank(b, snapshot, onKeys) - rank(a, snapshot, onKeys); if (diff !== 0) return diff; return b.updated_at_ms - a.updated_at_ms; }); - const threads = ranked; + const threads = ranked.slice(0, limit); return { threads, total: snapshot.sessions.length, truncated: snapshot.sessions.length > threads.length, };🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/microbridge-ui/src/lib/threads.ts` around lines 44 - 62, Apply the limit parameter in visibleThreads by slicing the ranked sessions to at most limit before assigning threads. Preserve the full snapshot.sessions.length as total, and compute truncated from whether the limited result is shorter than the full session list so Popover.tsx can display the truncation state.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/microbridge-ui/src/lib/bus.ts`:
- Around line 247-252: Update the listener setup around the bus-snapshot
callback and initial fetchSnapshot seed to track whether a live event has been
received; apply the fetched DAEMON_OFFLINE/initial snapshot only when no live
event arrived, preserving the live event payload when it races with
fetchSnapshot.
---
Outside diff comments:
In `@apps/microbridge-ui/src/lib/threads.ts`:
- Around line 44-62: Apply the limit parameter in visibleThreads by slicing the
ranked sessions to at most limit before assigning threads. Preserve the full
snapshot.sessions.length as total, and compute truncated from whether the
limited result is shorter than the full session list so Popover.tsx can display
the truncation state.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4f021aac-65dc-422e-bfdc-22b72aa37c16
⛔ Files ignored due to path filters (1)
apps/microbridge-ui/src-tauri/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (17)
Formula/microbridge.rbINSTALL.mdapps/microbridge-ui/src-tauri/Cargo.tomlapps/microbridge-ui/src-tauri/src/lib.rsapps/microbridge-ui/src-tauri/tauri.conf.jsonapps/microbridge-ui/src/App.tsxapps/microbridge-ui/src/components/DeviceEcho.tsxapps/microbridge-ui/src/lib/autostart.tsapps/microbridge-ui/src/lib/bus.tsapps/microbridge-ui/src/lib/popoverFit.tsapps/microbridge-ui/src/lib/tauri.tsapps/microbridge-ui/src/lib/threads.tsapps/microbridge-ui/src/surfaces/Disconnected.tsxapps/microbridge-ui/src/surfaces/Popover.tsxapps/microbridge-ui/src/surfaces/Settings.tsxscripts/install-from-release.shscripts/install.sh
Summary
Verification
Notes
The physical Micro is not required for this UI and launch-at-login change. Hardware HID validation remains a separate device-arrival gate.