Skip to content

Universal Tools Sidebar#378

Merged
arul28 merged 2 commits into
mainfrom
ade/universal-tools-sidebar-864ee473
May 27, 2026
Merged

Universal Tools Sidebar#378
arul28 merged 2 commits into
mainfrom
ade/universal-tools-sidebar-864ee473

Conversation

@arul28
Copy link
Copy Markdown
Owner

@arul28 arul28 commented May 27, 2026

Summary

Describe the change.

What Changed

Key files and behaviors.

Validation

How you tested.

Risks

Anything to watch.

ADE   Open in ADE  ·  ade/universal-tools-sidebar-864ee473 branch  ·  PR #378

Greptile Summary

This PR implements the "Universal Tools Sidebar," allowing the Work sidebar's tool panels (iOS Simulator, App Control, Built-in Browser) to insert context directly into a draft AgentChatPane even before a chat session exists. A new "draft" variant is added to WorkSidebarContextTarget, and a draftContextTargetId string (format: work:draft:<laneId>:<draftKind>) is threaded from TerminalsPage through WorkViewAreaWorkStartSurfaceAgentChatPane so the sidebar can dispatch matching window events to the correct composer.

  • Draft routing in AgentChatPane: dispatchAgentChatEvent now emits either sessionId (chat) or draftTargetId/laneId/draftKind (draft) details; matchesThisDraft guards on forceDraft and draftContextTargetId to prevent stale or cross-lane delivery.
  • Lane mismatch is now informational only: The mismatch banner still renders for iOS/App Control views owned by a different lane, but context insertion is no longer blocked.
  • Supporting improvements: CodexPlanCard gains an Array.isArray guard on event.steps, inline markdown display for step-free complete plans; ChatProposedPlanCard renders the full plan body with ChatMarkdown; agentChatService.ts adds shouldPreserveRequestedCodexPolicy.

Confidence Score: 5/5

Safe to merge — the draft routing is well-guarded and thoroughly tested.

The draft context target flows cleanly from TerminalsPage through the prop chain into the AgentChatPane event listeners; matchesThisDraft correctly gates on both forceDraft and an exact draftContextTargetId match, preventing cross-lane or cross-pane delivery. All simulator mutation callbacks still check ownedByOtherChat. Tests cover the new routing path, auto-create lane hint, and policy-preservation logic.

No files require special attention.

Important Files Changed

Filename Overview
apps/desktop/src/renderer/components/terminals/TerminalsPage.tsx Adds draftContextTargetId computation, expands activeLaneId to prefer work.draftLaneId, and wires the new draft contextTarget kind. isPtyContextInsertableToolType correctly expanded to cover codex, cursor-cli, droid, opencode.
apps/desktop/src/renderer/components/terminals/WorkSidebar.tsx Adds 'draft' to WorkSidebarContextTarget, refactors dispatchAgentChatEvent to accept the full target, decouples laneMismatchReason from contextDisabledReason (now purely informational), and sets controlDisabledReason={null} for iOS/App Control panels.
apps/desktop/src/renderer/components/chat/AgentChatPane.tsx Adds draftContextTargetId prop, matchesThisDraft/matchesThisComposer helpers, and updates all sidebar event handlers to use composerDetail for unified chat+draft routing. Auto-create lane selection now calls onLaneChange with the primary lane.
apps/desktop/src/main/services/chat/agentChatService.ts Adds shouldPreserveRequestedCodexPolicy to keep user-requested Codex policy when a resume response echoes a stale policy, and syncs permissionMode via syncLegacyPermissionMode after every effective-thread-state application.
apps/desktop/src/renderer/components/chat/ChatIosSimulatorPanel.tsx Splits controlsOwnedElsewhere into contextControlsBlocked (only controlsDisabled) and simulatorMutationBlocked (ownedByOtherChat
apps/desktop/src/renderer/components/chat/codex/CodexPlanCard.tsx Guards event.steps with Array.isArray, adds PlanMarkdown component, introduces showCompletedMarkdownInline/showMarkdownToggle flags to display complete step-free plans inline and label the toggle 'details' vs 'live'.
apps/desktop/src/renderer/components/chat/ChatProposedPlanCard.tsx Renders the plan body text via ChatMarkdown in a scrollable container, trims body text correctly with
apps/desktop/src/renderer/components/chat/AgentChatMessageList.tsx Adds inline rendering of bodyText inside the plan-approval branch when isPlanApproval && bodyText.trim().length > 0, so the plan body is visible in the transcript without requiring a separate pane.

Reviews (2): Last reviewed commit: "ship: iteration 1 — address review findi..." | Re-trigger Greptile

@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored Preview May 27, 2026 6:08pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Warning

Review limit reached

@arul28, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 14 minutes and 23 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1f2b074d-c4f5-4b01-9a59-08946e210839

📥 Commits

Reviewing files that changed from the base of the PR and between 5e7e3f9 and 78c3372.

⛔ Files ignored due to path filters (5)
  • docs/features/chat/README.md is excluded by !docs/**
  • docs/features/chat/agent-routing.md is excluded by !docs/**
  • docs/features/chat/composer-and-ui.md is excluded by !docs/**
  • docs/features/terminals-and-sessions/README.md is excluded by !docs/**
  • docs/features/terminals-and-sessions/ui-surfaces.md is excluded by !docs/**
📒 Files selected for processing (18)
  • apps/desktop/src/main/services/chat/agentChatService.test.ts
  • apps/desktop/src/main/services/chat/agentChatService.ts
  • apps/desktop/src/renderer/components/chat/AgentChatMessageList.test.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatMessageList.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatPane.submit.test.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatPane.tsx
  • apps/desktop/src/renderer/components/chat/ChatIosSimulatorPanel.test.tsx
  • apps/desktop/src/renderer/components/chat/ChatIosSimulatorPanel.tsx
  • apps/desktop/src/renderer/components/chat/ChatProposedPlanCard.tsx
  • apps/desktop/src/renderer/components/chat/codex/CodexPlanCard.tsx
  • apps/desktop/src/renderer/components/terminals/OrchestratorComposerEntry.test.tsx
  • apps/desktop/src/renderer/components/terminals/TerminalsPage.test.tsx
  • apps/desktop/src/renderer/components/terminals/TerminalsPage.tsx
  • apps/desktop/src/renderer/components/terminals/WorkSidebar.test.tsx
  • apps/desktop/src/renderer/components/terminals/WorkSidebar.tsx
  • apps/desktop/src/renderer/components/terminals/WorkStartSurface.test.tsx
  • apps/desktop/src/renderer/components/terminals/WorkStartSurface.tsx
  • apps/desktop/src/renderer/components/terminals/WorkViewArea.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ade/universal-tools-sidebar-864ee473

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 and usage tips.

@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 27, 2026

@copilot review but do not make fixes

@capy-ai
Copy link
Copy Markdown

capy-ai Bot commented May 27, 2026

Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews.

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

PR Review

Scope: 23 file(s), +707 / −164
Verdict: Minor issues

This PR makes the Work tools sidebar usable before a chat session exists (draft draftTargetId routing), expands PTY context insertion to more agent CLIs, improves plan markdown rendering, and adjusts Codex policy sync on resume. The main residual risks are shared-resource contention on the iOS simulator and a lane-label mismatch when Auto-create is selected.


🐛 Functionality

[Medium] iOS simulator input is no longer blocked when another chat owns the session

File: apps/desktop/src/renderer/components/chat/ChatIosSimulatorPanel.tsx:L1162-L1164
Issue: controlsOwnedElsewhere now only reflects controlsDisabled, not ownedByOtherChat. The ownership banner still renders, but keyboard/tap handlers no longer early-return for non-owning chats, so live input and inspect selections can mutate the shared simulator while context is routed to a different chat/draft.
Repro: Start chat A and connect it to the iOS simulator. Open chat B, open the Work sidebar iOS tab, focus the live surface, and press a key or inspect-tap — typeText / selectPoint still run (see updated ChatIosSimulatorPanel tests).
Fix: Either restore hard blocking for ownedByOtherChat on interact/inspect paths, or gate iosSimulator.* IPC calls on the active chatSessionId in the main process so only the owning session can drive the device while still allowing read-only viewing for others.


🎨 UI/UX

[Low] Auto-create lane label disagrees with Work sidebar lane context

File: apps/desktop/src/renderer/components/chat/AgentChatPane.tsx:L6563-L6567
Issue: Choosing "Auto-create lane" keeps that label in the composer lane picker but immediately calls onLaneChange(primaryDraftLane.id), so Git/Files/iOS/browser tools bind to Primary's worktree while the user may believe tools target the not-yet-created lane.
Fix: Show an explicit helper under the picker (e.g. "Tools use Primary until the lane is created") or drive onLaneChange from the lane that will actually be created once auto-create resolves, if that path is known pre-send.


Notes

  • Draft-scoped sidebar insertion (draftContextTargetId, matchesThisDraft in AgentChatPane.tsx) and the TerminalsPage draft contextTarget wiring look coherent; tests cover wrong-target rejection and PTY/chat/draft dispatch paths.
  • Codex shouldPreserveRequestedCodexPolicy on resume is intentional for picker authority; thread/start still applies runtime policy when no requestedCodexPolicy is passed.
  • Lane-mismatch warnings without disabling insertion are deliberate (controls vs. context target); users should read the amber banner before inserting cross-lane context.
  • Plan markdown uses existing ChatMarkdown / MarkdownBlock pipelines; no new unsanitized HTML surface spotted in this diff.
Open in Web View Automation 

Sent by Cursor Automation: BUGBOT in Versic

Comment thread apps/desktop/src/renderer/components/chat/ChatIosSimulatorPanel.tsx Outdated
Comment thread apps/desktop/src/renderer/components/chat/AgentChatPane.tsx
Comment thread apps/desktop/src/main/services/chat/agentChatService.ts
@arul28
Copy link
Copy Markdown
Owner Author

arul28 commented May 27, 2026

@copilot review but do not make fixes

@arul28 arul28 merged commit 8051b85 into main May 27, 2026
28 of 29 checks passed
@arul28 arul28 deleted the ade/universal-tools-sidebar-864ee473 branch May 27, 2026 18:34
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