Skip to content

Commit 49964a9

Browse files
Update src/core/tools/terminalKillTool.ts
Add terminalId validation Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>
1 parent 9dea0b5 commit 49964a9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/core/tools/terminalKillTool.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ export async function terminalKillTool(
3434
}
3535

3636
try {
37-
const result = await killTerminalProcess(parseInt(terminalId))
37+
const parsedId = parseInt(terminalId, 10)
38+
if (isNaN(parsedId)) {
39+
task.consecutiveMistakeCount++
40+
task.recordToolError("terminal_ctrl")
41+
pushToolResult(formatResponse.toolError(`Invalid terminal_id "${terminalId}". Must be a number.`))
42+
return
43+
}
44+
45+
const result = await killTerminalProcess(parsedId)
3846
pushToolResult(formatResponse.toolResult(result))
3947
} catch (error) {
4048
await handleError("killing terminal process", error)

0 commit comments

Comments
 (0)