Repository navigation
Conversation
📝 WalkthroughWalkthroughThe change updates floating-terminal opening and force-close policies, adds event-driven overlay opening, and routes activity-view HTTP links to floating terminal tabs without changing the active worktree. Main-surface resolution now controls activity, landing, and creation rendering. Tests cover floating-terminal policies, activity-view link routing, and activity surface resolution. PI hook normalization now ignores 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
src/renderer/src/lib/floating-terminal.ts (1)
36-60: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDerive
shouldForceCloseFloatingTerminalfromshouldOpenFloatingTerminalOnRequestto avoid divergence.The two predicates are exact logical negations of each other (
!enabled && count===0≡!(enabled || count>0)). Keeping them as independently-written booleans risks one being tweaked later without updating the other, silently breaking the open/close policy contract.♻️ Proposed refactor
export function shouldOpenFloatingTerminalOnRequest({ enabled, visibleTabCount }: { enabled: boolean visibleTabCount: number }): boolean { return enabled || visibleTabCount > 0 } export function shouldForceCloseFloatingTerminal({ enabled, visibleTabCount }: { enabled: boolean visibleTabCount: number }): boolean { - return !enabled && visibleTabCount === 0 + return !shouldOpenFloatingTerminalOnRequest({ enabled, visibleTabCount }) }src/renderer/src/App.tsx (1)
610-629: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueDrop
floatingVisibleTabCountfrom this effect's dependency array.Neither
toggleFloatingTerminal(only readsfloatingTerminalEnabled) noropenFloatingTerminal(intentionally reads live store state, per the comment) closes overfloatingVisibleTabCount. Keeping it in the deps array causes the listeners to be removed and re-added on every floating-tab count change for no functional benefit.⚡ Proposed fix
- }, [floatingTerminalEnabled, floatingVisibleTabCount, setFloatingTerminalOpenWithFocus]) + }, [floatingTerminalEnabled, setFloatingTerminalOpenWithFocus])src/renderer/src/lib/http-link-routing.ts (1)
24-24: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse the store’s
activeViewunion here.
src/renderer/src/lib/http-link-routing.ts:24should useUISlice['activeView'](orAppState['activeView']) instead ofstringso the'activity'check stays type-safe.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: a0c045b3-14cb-49f9-976a-afca94da1e3b
📥 Commits
Reviewing files that changed from the base of the PR and between e218bf8 and c6cdf10e5fdc20dd305c0bf5a3263a1950489b80.
📒 Files selected for processing (7)
src/main/agent-hooks/server.test.tssrc/renderer/src/App.tsxsrc/renderer/src/lib/floating-terminal.test.tssrc/renderer/src/lib/floating-terminal.tssrc/renderer/src/lib/http-link-routing.test.tssrc/renderer/src/lib/http-link-routing.tssrc/shared/agent-hook-listener.ts
… Agents View stablyai#7791: Pi/OMP normalize no longer maps session_shutdown to done (only agent_end). Prevents mid-work status drop while the PTY is still running. stablyai#7813: From Agents View (activity), http links create floating browser tabs and request the floating panel open. Pure open/force-close policy allows visibility when tabs exist even if floatingTerminalEnabled is off. App listens for open with live store reads. Tests: normalize session_shutdown null; activity routing + requestOpen spy; policy table for enabled/count cases. Fixes stablyai#7791 Fixes stablyai#7813
CodeRabbit on stablyai#7838: ActivityPrototypePage could mount alongside WorktreeCreationPanel or Landing when activeView is activity. Gate it on activeWorktreeId and !creationLayoutActive so those surfaces own the slot.
5f5470b to
6035f52
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/app-main-surface.test.ts (1)
1-14: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the remaining branches of
resolveMainSurface.Only the "activity, no worktree" case is tested.
resolveMainSurfacehas 4 branches (creation-wins-over-terminal, creation-wins-over-activity, landing, and thenullfallback), and this exact function is what fixed a previously-reported bug (activity page rendering alongside the creation/landing fallback). Given its importance to preventing surface-overlap regressions, it's worth locking down each branch with a test case.✅ Suggested additional test cases
describe('resolveMainSurface', () => { it('keeps activity available without an active worktree', () => { expect( resolveMainSurface({ activeView: 'activity', activeWorktreeId: null, creationLayoutActive: false }) ).toBe('activity') }) + + it('prefers creation over activity when creation layout is active', () => { + expect( + resolveMainSurface({ + activeView: 'activity', + activeWorktreeId: null, + creationLayoutActive: true + }) + ).toBe('creation') + }) + + it('prefers creation over terminal when creation layout is active', () => { + expect( + resolveMainSurface({ + activeView: 'terminal', + activeWorktreeId: null, + creationLayoutActive: true + }) + ).toBe('creation') + }) + + it('resolves landing when terminal view has no active worktree', () => { + expect( + resolveMainSurface({ + activeView: 'terminal', + activeWorktreeId: null, + creationLayoutActive: false + }) + ).toBe('landing') + }) + + it('returns null for terminal view with an active worktree', () => { + expect( + resolveMainSurface({ + activeView: 'terminal', + activeWorktreeId: 'wt-1', + creationLayoutActive: false + }) + ).toBe(null) + }) })
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0ea7df70-b5d9-487d-bfa8-3107c24a8f94
📒 Files selected for processing (9)
src/main/agent-hooks/server.test.tssrc/renderer/src/App.tsxsrc/renderer/src/app-main-surface.test.tssrc/renderer/src/app-main-surface.tssrc/renderer/src/lib/floating-terminal.test.tssrc/renderer/src/lib/floating-terminal.tssrc/renderer/src/lib/http-link-routing.test.tssrc/renderer/src/lib/http-link-routing.tssrc/shared/agent-hook-listener.ts
|
@Jinwoo-H When you have capacity, could you review this focused Pi status / Agents View routing PR? Its current head is mergeable and CodeRabbit is green. |
|
reviewing it now |
Summary
session_shutdowntodone(onlyagent_enddoes). This prevents mid-work status drop / “disconnect” UI while the PTY is still running; Pi can emitsession_shutdownon internal session boundaries during long work.activeView === 'activity') create browser tabs on the floating workspace and request the floating panel open. Pure open/force-close policy allows the panel to show when floating tabs exist even iffloatingTerminalEnabledis off.Apphandles the open event with live store reads soopen=trueafter tab creation.Root causes (brief)
normalizePiCompatibleEventtreatedsession_shutdownlikeagent_end→doneagent_end→done; shutdown returns nullrequestOpenFloatingTerminal+ open/force policyScreenshots
No UI chrome redesign. Behavior change: browser overlay usable while staying in Agents View; Pi status stays
workingacrosssession_shutdown.Testing
pnpm run typecheck:node(clean)src/main/agent-hooks/server.test.ts—session_shutdown does not map to done (#7791)src/renderer/src/lib/http-link-routing.test.ts— activity routes to floating +requestOpenFloatingTerminalsrc/renderer/src/lib/floating-terminal.test.ts— open/force-close policy table (incl.enabled=false, count>0)AI Review Report
agent_end, status may stay working until end/PTY teardown — matches reported symptom.openvia policy). LivegetState()in open handler avoids stale count aftercreateBrowserTab. Main terminal chrome gates unchanged; floating is the within-activity surface. Does not enable floating feature for unrelated empty opens when pref is off and count is 0.openLinksInApp+ remote runtime still force system browser as before.Security Audit
orca-open-floating-terminal).openLinksInApp, remote runtime, andforceSystemBrowser.Notes
fix/pi-disabled-extensions).Fixes #7791
Fixes #7813