-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Problem (one or two sentences)
When Roo Code is opened in a new tab via the command palette (roo-cline.openInNewTab), events are not emitted through the RooCodeAPI EventEmitter. This prevents external extensions from receiving task events (taskCreated, message, taskCompleted, etc.) when users work in tab mode.
Context (who is affected and when)
This bug affects:
- Telemetry extensions that track task metrics
- Automation tools that respond to Roo Code events
- Integration extensions that need to know when tasks start/complete
- Any external tooling relying on the
RooCodeAPIEventEmitter
Reproduction steps
-
Create an extension that listens to Roo Code events via the API:
const rooCodeExtension = vscode.extensions.getExtension("RooVeterinaryInc.roo-cline") const api = rooCodeExtension.exports as RooCodeAPI api.on("taskCreated", (taskId) => { console.log("Task created:", taskId) })
-
Open Roo Code using "Open Roo Code in a new tab" command (via command palette)
-
Start a new task in the tab
Expected result
The taskCreated event should fire
Actual result
No events are emitted
Variations tried (optional)
Currently, users can:
- Use the sidebar view instead of tab mode (events work correctly)
- Start tasks programmatically via
api.startNewTask({ newTab: true })(events work correctly)
App Version
3.47.3
API Provider (optional)
None
Model Used (optional)
No response
Roo Code Task Links (optional)
No response
Relevant logs or errors (optional)
After analyzing the source code, the issue is in how tab providers are created vs. how the API registers listeners:
### In `src/extension/api.ts`:
The API class has a `registerListeners()` method that forwards events from a `ClineProvider` to the API's EventEmitter:
private registerListeners(provider: ClineProvider) {
provider.on(RooCodeEventName.TaskCreated, (taskId) => {
this.emit(RooCodeEventName.TaskCreated, taskId)
})
// ... other event forwarding
}
### When opening via API (works correctly):
In `startNewTask()` with `newTab: true`:
// Line 185-186 in api.ts
provider = await openClineInNewTab({ context: this.context, outputChannel: this.outputChannel })
this.registerListeners(provider) // ✅ Events are forwarded
### When opening via command (broken):
In `src/activate/registerCommands.ts`:
openInNewTab: () => openClineInNewTab({ context, outputChannel })
// ❌ registerListeners() is never called on the returned tabProvider
The `openClineInNewTab()` function creates a new `ClineProvider` and returns it, but when called from the command handler, the returned provider is discarded without registering event listeners.
The `sidebarProvider` correctly emits events because it's created during extension activation and passed to the API constructor. The issue is specifically with dynamically-created tab providers that bypass the API's event registration.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working