Skip to content

feat(activity): reveal threads in floating terminal workspace - #23239

Merged
AmethystLiang merged 3 commits into
mainfrom
agent-activity-open-floating-terminal
Sep 27, 2026
Merged

AmethystLiang merged 3 commits into
mainfrom
agent-activity-open-floating-terminal

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​128 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​126
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39

Problem

Clicking on activity threads from floating terminal agents didn't work—the panel wasn't revealed and the pane wasn't activated, unlike threads from regular workspaces.

Solution

Added special routing for floating terminal threads in activity actions:

  • Detects when a thread belongs to the floating terminal workspace (by checking worktree ID)
  • Toggles the floating panel open if it's currently closed
  • Activates the thread's tab and pane without attempting workspace activation (floating terminal has no catalog workspace)
  • Preserves focus on the already-active pane in split terminals to avoid unnecessary focus shifts

Changes

activity-thread-actions.ts: Routes floating threads to floating-specific activation path using TOGGLE_FLOATING_TERMINAL_EVENT

activity-thread-actions.test.ts: Added tests for floating thread selection with and without an open panel, and for retained threads whose tabs were closed

focus-terminal-tab-surface.ts: When focusing a tab (not a specific pane), preserves the currently-focused pane instead of resetting focus

focus-terminal-tab-surface.split-focus.test.ts: New test covering deferred focus behavior in split terminals

Verification

  • Unit tests pass for floating thread routing and split focus scenarios
  • Focus preservation tested with deferred animations in split layouts

When selecting an activity thread from the floating terminal workspace, automatically open the floating panel if closed. Improves split pane focus handling to preserve active panes during thread reveals.
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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

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: 0ff25809-a6ae-4ea4-89b3-52aff3db9a23

📥 Commits

Reviewing files that changed from the base of the PR and between a75a0af and b6bd613.

📒 Files selected for processing (1)
  • src/renderer/src/app-shell/use-floating-workspace-panel.ts

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


📝 Walkthrough

Walkthrough

Floating-terminal activity threads now bypass workspace activation and reveal the floating panel when it is hidden before tab activation and pane focus. The panel toggle listener binds during the layout-effect phase. Tab-wide terminal focus requests without a leaf identifier now prefer an already-focused matching helper. Tests cover floating-panel visibility, threads without a tab, and deferred focus for null and explicit leaf requests.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to b6bd6

Floating-terminal thread activation and split-pane focus behavior are covered by the supplied change context, with no specific regression identified that needs correction before merging.

Architecture Summary

Architecture risk: 🔵 Low · up to b6bd6

The change affects 1 system.

Changed systems: src

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — src (ui) was modified; 5 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in src/renderer/src/lib/focus-terminal-tab-surface.split-focus.test.ts: Adds a test that stubs animation-frame scheduling, builds a two-pane terminal tab, and simulates the right pane receiving focus between deferred focus callbacks. It asserts that a null leaf request leaves focus on the right pane, while an explicit 'left' request focuses the left pane.
  • observed — Modified behavior in src/renderer/src/lib/focus-terminal-tab-surface.ts: For requests without a leafId, the function now checks for an already-focused matching helper first, then falls back to the first matching helper. Requests with a leafId still use the scoped query directly.
  • observed — Modified behavior in src/renderer/src/components/activity/activity-thread-actions.test.ts: The test setup imports floating-terminal identifiers and adds mocks for panel visibility and event dispatch.
  • observed — Modified behavior in src/renderer/src/components/activity/activity-thread-actions.test.ts: Adds a mock for isFloatingWorkspacePanelVisible.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, solution, implementation areas, and reported verification, but it omits several required template sections and information, including an issue link, visual proof … Complete the required template sections. Add the linked issue, attach before-and-after visual proof or state N/A with a reason, document the test commands and platforms, complete the Review, Agent skill upstream boundary, Notes, and Checkli…
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: revealing activity threads in the floating terminal workspace.
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.
Full details: Description check

Explanation

The description explains the problem, solution, implementation areas, and reported verification, but it omits several required template sections and information, including an issue link, visual proof or an explicit N/A reason, testing details and platforms, review notes, the agent-skill boundary declaration, and checklist confirmations.

Resolution

Complete the required template sections. Add the linked issue, attach before-and-after visual proof or state N/A with a reason, document the test commands and platforms, complete the Review, Agent skill upstream boundary, Notes, and Checklist sections, and include the ELI5 and Why sections.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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 critical issues — one edge-case question inline.

Reviewed changes

  • Floating thread routing — activateThreadTarget now detects thread.worktree.id === FLOATING_TERMINAL_WORKTREE_ID, skips activateAndRevealWorkspace (no catalog workspace exists for the sentinel), opens the panel via TOGGLE_FLOATING_TERMINAL_EVENT when it is closed, then activates and focuses the thread's tab.
  • Focus preservation — tab-wide focusTerminalTabSurface (leafId == null) now prefers an already-focused matching helper before falling back to the first uncovered pane, preventing the panel's deferred tab-wide focus from stealing the pane-specific reveal.
  • Tests — floating routing (open/closed panel, closed-tab case) plus a happy-dom split-focus test that reproduces the focus race.

I verified the store chain end to end: setActiveTab resolves the owner to the floating workspace and activateTab writes groupsByWorktree[FLOATING][*].activeTabId / activeGroupIdByWorktree[FLOATING], which is exactly what the panel derives its visible tab from. The :focus selector also matches the real renderer's focus recipient (.xterm-helper-textarea), per the repo's e2e focus probes. Tests pass (25/25) and oxlint is clean.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Floating tabs persist even after disabling the feature, but the panel
ignores toggle events while disabled. Enable the setting first so that
subsequent toggle commands take effect.

@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

  • Enable-first floating reveal — revealFloatingWorkspacePanel now sets floatingTerminalEnabled: true and awaits updateSettings before deferring the panel toggle by a frame, so a floating activity row is no longer a silent no-op when the feature was disabled. The already-enabled path (toggleFloatingWorkspacePanelIfHidden) is unchanged, and the shape mirrors the existing os-markdown-file-open-bridge.ts enable-then-reveal.
  • Test coverage — added the disabled-feature case asserting the settings write precedes the deferred requestAnimationFrame toggle; it would fail against the previous unconditional-dispatch code.

The prior review's concern (the disable path left the click inert) is addressed, and the 2 affected test files pass (13/13).

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

@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: d85f1a27-e08b-41d8-a642-477f0c387058

📥 Commits

Reviewing files that changed from the base of the PR and between 51217e3 and a75a0af.

📒 Files selected for processing (2)
  • src/renderer/src/components/activity/activity-thread-actions.test.ts
  • src/renderer/src/components/activity/activity-thread-actions.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.

Enable-then-toggle callers dispatch events immediately, which passive useEffect rebind can miss. useLayoutEffect ensures the handler is bound synchronously before the next paint.

@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

Delta since the prior pullfrog review (a75a0af3 → b6bd6138) — one production file, a binding-timing fix:

  • Listener rebind timing — use-floating-workspace-panel.ts now binds the TOGGLE_FLOATING_TERMINAL_EVENT listener in useLayoutEffect instead of useEffect, so the rebind that captures enabled === true completes at commit rather than after paint. The handler closure captures enabled, so a passive binding could still hold the stale false closure when the enable-first path's deferred requestAnimationFrame toggle fires, silently dropping the click. This matches the fix an independent reviewer proposed for the same race.

The two affected test files pass (13/13) at head b6bd6138. Prior feedback (the disabled-feature silent no-op) remains addressed.

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

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