Skip to content

Conversation

@cte
Copy link
Collaborator

@cte cte commented Sep 3, 2025

fix.mp4

Important

Focuses the extension's sidebar when receiving bridge commands by updating BaseChannel and refactoring BridgeOrchestrator.

  • Behavior:
    • BaseChannel now focuses the sidebar using vscode.commands.executeCommand before handling commands.
    • BridgeOrchestrator refactored to separate connect and disconnect logic.
  • Classes:
    • BaseChannel: Updated handleCommand to focus sidebar before delegating to handleCommandImplementation.
    • BridgeOrchestrator: Refactored connectOrDisconnect into connect and disconnect methods.
    • ExtensionChannel and TaskChannel: Updated constructors to use BaseChannelOptions.
  • Tests:
    • Updated tests in ExtensionChannel.test.ts and TaskChannel.test.ts to reflect changes in command handling and channel initialization.

This description was created by Ellipsis for ca86c7b. You can customize this summary. It will automatically update as commits are pushed.

@cte cte requested review from jr and mrubens as code owners September 3, 2025 18:10
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Sep 3, 2025
Copy link

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! I've reviewed the changes and found that the implementation is solid overall. The refactoring to use the template method pattern in BaseChannel is a clean architectural improvement. I've left some suggestions inline to help improve error handling and robustness.

*/
public async handleCommand(command: TCommand): Promise<void> {
// Common functionality: focus the sidebar
await vscode.commands.executeCommand(`${this.extensionMetadata.name}.SidebarProvider.focus`)
Copy link

Choose a reason for hiding this comment

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

Good implementation of the template method pattern! The separation between common functionality (focus) and subclass-specific logic is clean.

However, I have two concerns about the focus command execution:

  1. Potential Race Condition: The focus command is executed asynchronously, but we don't wait for confirmation that the focus actually succeeded before proceeding. Could this lead to commands being processed before the UI is ready?

  2. Error Handling: Consider wrapping this in a try-catch block. If the focus command fails (e.g., extension not fully loaded), should we still proceed with command handling?

{
"name": "@roo-code/types",
"version": "1.69.0",
"version": "1.70.0",
Copy link

Choose a reason for hiding this comment

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

Is this version bump following semantic versioning correctly? This seems like a minor feature addition (adding focus behavior) rather than a breaking change. Should this perhaps be 1.69.1 instead of 1.70.0?


// Create extension channel instance
extensionChannel = new ExtensionChannel(instanceId, userId, mockProvider)
extensionChannel = new ExtensionChannel({
Copy link

Choose a reason for hiding this comment

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

Good job updating the tests to accommodate the new constructor signatures! However, would it be valuable to add specific tests that verify the focus command is called before command handling? This would help ensure the new behavior is properly tested.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 3, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Sep 3, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

Looks good, the only issue is the failing unit test

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 3, 2025
@hannesrudolph hannesrudolph added PR - Needs Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 3, 2025
@cte cte merged commit 280b75d into main Sep 3, 2025
8 checks passed
@cte cte deleted the cte/focus-extension-on-bridge-command branch September 3, 2025 19:23
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Sep 3, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer PR - Needs Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants