Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 4 additions & 24 deletions src/core/tools/__tests__/executeCommand.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,7 @@ describe("executeCommand", () => {

// Verify
expect(rejected).toBe(false)
expect(TerminalRegistry.getOrCreateTerminal).toHaveBeenCalledWith(
customCwd,
true, // customCwd provided
mockTask.taskId,
"vscode",
)
expect(TerminalRegistry.getOrCreateTerminal).toHaveBeenCalledWith(customCwd, mockTask.taskId, "vscode")
expect(result).toContain(`within working directory '${customCwd}'`)
})

Expand Down Expand Up @@ -248,12 +243,7 @@ describe("executeCommand", () => {

// Verify
expect(rejected).toBe(false)
expect(TerminalRegistry.getOrCreateTerminal).toHaveBeenCalledWith(
resolvedCwd,
true, // customCwd provided
mockTask.taskId,
"vscode",
)
expect(TerminalRegistry.getOrCreateTerminal).toHaveBeenCalledWith(resolvedCwd, mockTask.taskId, "vscode")
expect(result).toContain(`within working directory '${resolvedCwd.toPosix()}'`)
})

Expand Down Expand Up @@ -302,12 +292,7 @@ describe("executeCommand", () => {
await executeCommand(mockTask, options)

// Verify
expect(TerminalRegistry.getOrCreateTerminal).toHaveBeenCalledWith(
mockTask.cwd,
false, // no customCwd
mockTask.taskId,
"vscode",
)
expect(TerminalRegistry.getOrCreateTerminal).toHaveBeenCalledWith(mockTask.cwd, mockTask.taskId, "vscode")
})

it("should use execa provider when shell integration is disabled", async () => {
Expand All @@ -330,12 +315,7 @@ describe("executeCommand", () => {
await executeCommand(mockTask, options)

// Verify
expect(TerminalRegistry.getOrCreateTerminal).toHaveBeenCalledWith(
mockTask.cwd,
false, // no customCwd
mockTask.taskId,
"execa",
)
expect(TerminalRegistry.getOrCreateTerminal).toHaveBeenCalledWith(mockTask.cwd, mockTask.taskId, "execa")
})
})

Expand Down
2 changes: 1 addition & 1 deletion src/core/tools/executeCommandTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export async function executeCommand(
}
}

const terminal = await TerminalRegistry.getOrCreateTerminal(workingDir, !!customCwd, task.taskId, terminalProvider)
const terminal = await TerminalRegistry.getOrCreateTerminal(workingDir, task.taskId, terminalProvider)

if (terminal instanceof Terminal) {
terminal.terminal.show(true)
Expand Down
8 changes: 0 additions & 8 deletions src/integrations/terminal/TerminalRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,11 @@ export class TerminalRegistry {
* directory.
*
* @param cwd The working directory path
* @param requiredCwd Whether the working directory is required (if false, may reuse any non-busy terminal)
* @param taskId Optional task ID to associate with the terminal
* @returns A Terminal instance
*/
public static async getOrCreateTerminal(
cwd: string,
requiredCwd: boolean = false,
taskId?: string,
provider: RooTerminalProvider = "vscode",
): Promise<RooTerminal> {
Expand Down Expand Up @@ -194,12 +192,6 @@ export class TerminalRegistry {
})
}

// Third priority: Find any non-busy terminal (only if directory is not
// required).
if (!terminal && !requiredCwd) {
terminal = terminals.find((t) => !t.busy && t.provider === provider)
}

// If no suitable terminal found, create a new one.
if (!terminal) {
terminal = this.createTerminal(cwd, provider)
Expand Down
Loading