Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit b9b3ee4

Browse files
committed
refactor: remove terminalOutputLineLimit and terminalOutputCharacterLimit settings
These settings were redundant with terminalOutputPreviewSize which controls the preview shown to the LLM. The line/char limits were for UI truncation which is now handled with hardcoded defaults (500 lines, 50K chars) since they don't need to be user-configurable. - Remove settings from packages/types schemas - Remove DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT constant - Update compressTerminalOutput() to use hardcoded limits - Update ExecuteCommandTool to not pass limit parameters - Update ClineProvider state handling - Update webview context and settings - Update tests to not use removed settings
1 parent 771006d commit b9b3ee4

10 files changed

Lines changed: 18 additions & 103 deletions

File tree

packages/types/src/cloud.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ export const organizationDefaultSettingsSchema = globalSettingsSchema
9999
maxWorkspaceFiles: true,
100100
showRooIgnoredFiles: true,
101101
terminalCommandDelay: true,
102-
terminalOutputLineLimit: true,
103102
terminalShellIntegrationDisabled: true,
104103
terminalShellIntegrationTimeout: true,
105104
terminalZshClearEolMark: true,
@@ -111,7 +110,6 @@ export const organizationDefaultSettingsSchema = globalSettingsSchema
111110
maxReadFileLine: z.number().int().gte(-1).optional(),
112111
maxWorkspaceFiles: z.number().int().nonnegative().optional(),
113112
terminalCommandDelay: z.number().int().nonnegative().optional(),
114-
terminalOutputLineLimit: z.number().int().nonnegative().optional(),
115113
terminalShellIntegrationTimeout: z.number().int().nonnegative().optional(),
116114
}),
117115
)

packages/types/src/global-settings.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ import { languagesSchema } from "./vscode.js"
2222
*/
2323
export const DEFAULT_WRITE_DELAY_MS = 1000
2424

25-
/**
26-
* Default terminal output character limit constant.
27-
* This provides a reasonable default that aligns with typical terminal usage
28-
* while preventing context window explosions from extremely long lines.
29-
*/
30-
export const DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT = 50_000
31-
3225
/**
3326
* Terminal output preview size options for persisted command output.
3427
*
@@ -183,8 +176,6 @@ export const globalSettingsSchema = z.object({
183176
maxImageFileSize: z.number().optional(),
184177
maxTotalImageSize: z.number().optional(),
185178

186-
terminalOutputLineLimit: z.number().optional(),
187-
terminalOutputCharacterLimit: z.number().optional(),
188179
terminalOutputPreviewSize: z.enum(["small", "medium", "large"]).optional(),
189180
terminalShellIntegrationTimeout: z.number().optional(),
190181
terminalShellIntegrationDisabled: z.boolean().optional(),
@@ -374,8 +365,6 @@ export const EVALS_SETTINGS: RooCodeSettings = {
374365
soundEnabled: false,
375366
soundVolume: 0.5,
376367

377-
terminalOutputLineLimit: 500,
378-
terminalOutputCharacterLimit: DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT,
379368
terminalShellIntegrationTimeout: 30000,
380369
terminalCommandDelay: 0,
381370
terminalPowershellCounter: false,

packages/types/src/vscode-extension-host.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,6 @@ export type ExtensionState = Pick<
302302
| "soundEnabled"
303303
| "soundVolume"
304304
| "maxConcurrentFileReads"
305-
| "terminalOutputLineLimit"
306-
| "terminalOutputCharacterLimit"
307305
| "terminalOutputPreviewSize"
308306
| "terminalShellIntegrationTimeout"
309307
| "terminalShellIntegrationDisabled"

src/core/environment/getEnvironmentDetails.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import pWaitFor from "p-wait-for"
66
import delay from "delay"
77

88
import type { ExperimentId } from "@roo-code/types"
9-
import { DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT } from "@roo-code/types"
109

1110
import { formatLanguage } from "../../shared/language"
1211
import { defaultModeSlug, getFullModeDetails } from "../../shared/modes"
@@ -26,11 +25,7 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
2625

2726
const clineProvider = cline.providerRef.deref()
2827
const state = await clineProvider?.getState()
29-
const {
30-
terminalOutputLineLimit = 500,
31-
terminalOutputCharacterLimit = DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT,
32-
maxWorkspaceFiles = 200,
33-
} = state ?? {}
28+
const { maxWorkspaceFiles = 200 } = state ?? {}
3429

3530
// It could be useful for cline to know if the user went from one or no
3631
// file to another between messages, so we always include this context.
@@ -112,11 +107,7 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
112107
let newOutput = TerminalRegistry.getUnretrievedOutput(busyTerminal.id)
113108

114109
if (newOutput) {
115-
newOutput = Terminal.compressTerminalOutput(
116-
newOutput,
117-
terminalOutputLineLimit,
118-
terminalOutputCharacterLimit,
119-
)
110+
newOutput = Terminal.compressTerminalOutput(newOutput)
120111
terminalDetails += `\n### New Output\n${newOutput}`
121112
}
122113
}
@@ -144,11 +135,7 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
144135
let output = process.getUnretrievedOutput()
145136

146137
if (output) {
147-
output = Terminal.compressTerminalOutput(
148-
output,
149-
terminalOutputLineLimit,
150-
terminalOutputCharacterLimit,
151-
)
138+
output = Terminal.compressTerminalOutput(output)
152139
terminalOutputs.push(`Command: \`${process.command}\`\n${output}`)
153140
}
154141
}

src/core/tools/ExecuteCommandTool.ts

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ import * as vscode from "vscode"
44

55
import delay from "delay"
66

7-
import {
8-
CommandExecutionStatus,
9-
DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT,
10-
DEFAULT_TERMINAL_OUTPUT_PREVIEW_SIZE,
11-
PersistedCommandOutput,
12-
} from "@roo-code/types"
7+
import { CommandExecutionStatus, DEFAULT_TERMINAL_OUTPUT_PREVIEW_SIZE, PersistedCommandOutput } from "@roo-code/types"
138
import { TelemetryService } from "@roo-code/telemetry"
149

1510
import { Task } from "../task/Task"
@@ -69,11 +64,7 @@ export class ExecuteCommandTool extends BaseTool<"execute_command"> {
6964
const provider = await task.providerRef.deref()
7065
const providerState = await provider?.getState()
7166

72-
const {
73-
terminalOutputLineLimit = 500,
74-
terminalOutputCharacterLimit = DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT,
75-
terminalShellIntegrationDisabled = true,
76-
} = providerState ?? {}
67+
const { terminalShellIntegrationDisabled = true } = providerState ?? {}
7768

7869
// Get command execution timeout from VSCode configuration (in seconds)
7970
const commandExecutionTimeoutSeconds = vscode.workspace
@@ -98,8 +89,6 @@ export class ExecuteCommandTool extends BaseTool<"execute_command"> {
9889
command: unescapedCommand,
9990
customCwd,
10091
terminalShellIntegrationDisabled,
101-
terminalOutputLineLimit,
102-
terminalOutputCharacterLimit,
10392
commandExecutionTimeout,
10493
}
10594

@@ -153,8 +142,6 @@ export type ExecuteCommandOptions = {
153142
command: string
154143
customCwd?: string
155144
terminalShellIntegrationDisabled?: boolean
156-
terminalOutputLineLimit?: number
157-
terminalOutputCharacterLimit?: number
158145
commandExecutionTimeout?: number
159146
}
160147

@@ -165,8 +152,6 @@ export async function executeCommandInTerminal(
165152
command,
166153
customCwd,
167154
terminalShellIntegrationDisabled = true,
168-
terminalOutputLineLimit = 500,
169-
terminalOutputCharacterLimit = DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT,
170155
commandExecutionTimeout = 0,
171156
}: ExecuteCommandOptions,
172157
): Promise<[boolean, ToolResponse]> {
@@ -223,8 +208,8 @@ export async function executeCommandInTerminal(
223208

224209
let accumulatedOutput = ""
225210
// Bound accumulated output buffer size to prevent unbounded memory growth for long-running commands.
226-
// The interceptor preserves full output; this buffer is only for UI display.
227-
const maxAccumulatedOutputSize = terminalOutputCharacterLimit * 2
211+
// The interceptor preserves full output; this buffer is only for UI display (100KB limit).
212+
const maxAccumulatedOutputSize = 100_000
228213
const callbacks: RooTerminalCallbacks = {
229214
onLine: async (lines: string, process: RooTerminalProcess) => {
230215
accumulatedOutput += lines
@@ -238,11 +223,7 @@ export async function executeCommandInTerminal(
238223
interceptor?.write(lines)
239224

240225
// Continue sending compressed output to webview for UI display (unchanged behavior)
241-
const compressedOutput = Terminal.compressTerminalOutput(
242-
accumulatedOutput,
243-
terminalOutputLineLimit,
244-
terminalOutputCharacterLimit,
245-
)
226+
const compressedOutput = Terminal.compressTerminalOutput(accumulatedOutput)
246227
const status: CommandExecutionStatus = { executionId, status: "output", output: compressedOutput }
247228
provider?.postMessageToWebview({ type: "commandExecutionStatus", text: JSON.stringify(status) })
248229

@@ -272,11 +253,7 @@ export async function executeCommandInTerminal(
272253
}
273254

274255
// Continue using compressed output for UI display
275-
result = Terminal.compressTerminalOutput(
276-
output ?? "",
277-
terminalOutputLineLimit,
278-
terminalOutputCharacterLimit,
279-
)
256+
result = Terminal.compressTerminalOutput(output ?? "")
280257

281258
task.say("command_output", result)
282259
completed = true

src/core/tools/__tests__/executeCommand.spec.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ describe("executeCommand", () => {
4040
mockProvider = {
4141
postMessageToWebview: vitest.fn(),
4242
getState: vitest.fn().mockResolvedValue({
43-
terminalOutputLineLimit: 500,
4443
terminalShellIntegrationDisabled: false,
4544
}),
4645
}
@@ -100,7 +99,6 @@ describe("executeCommand", () => {
10099
executionId: "test-123",
101100
command: "echo test",
102101
terminalShellIntegrationDisabled: false,
103-
terminalOutputLineLimit: 500,
104102
}
105103

106104
// Execute
@@ -141,7 +139,6 @@ describe("executeCommand", () => {
141139
executionId: "test-123",
142140
command: "echo test",
143141
terminalShellIntegrationDisabled: false,
144-
terminalOutputLineLimit: 500,
145142
}
146143

147144
// Execute
@@ -174,7 +171,6 @@ describe("executeCommand", () => {
174171
executionId: "test-123",
175172
command: "echo test",
176173
terminalShellIntegrationDisabled: true, // Forces ExecaTerminal
177-
terminalOutputLineLimit: 500,
178174
}
179175

180176
// Execute
@@ -205,7 +201,6 @@ describe("executeCommand", () => {
205201
command: "echo test",
206202
customCwd,
207203
terminalShellIntegrationDisabled: false,
208-
terminalOutputLineLimit: 500,
209204
}
210205

211206
// Execute
@@ -235,7 +230,6 @@ describe("executeCommand", () => {
235230
command: "echo test",
236231
customCwd: relativeCwd,
237232
terminalShellIntegrationDisabled: false,
238-
terminalOutputLineLimit: 500,
239233
}
240234

241235
// Execute
@@ -258,7 +252,6 @@ describe("executeCommand", () => {
258252
command: "echo test",
259253
customCwd: nonExistentCwd,
260254
terminalShellIntegrationDisabled: false,
261-
terminalOutputLineLimit: 500,
262255
}
263256

264257
// Execute
@@ -285,7 +278,6 @@ describe("executeCommand", () => {
285278
executionId: "test-123",
286279
command: "echo test",
287280
terminalShellIntegrationDisabled: false,
288-
terminalOutputLineLimit: 500,
289281
}
290282

291283
// Execute
@@ -308,7 +300,6 @@ describe("executeCommand", () => {
308300
executionId: "test-123",
309301
command: "echo test",
310302
terminalShellIntegrationDisabled: true,
311-
terminalOutputLineLimit: 500,
312303
}
313304

314305
// Execute
@@ -334,7 +325,6 @@ describe("executeCommand", () => {
334325
executionId: "test-123",
335326
command: "echo success",
336327
terminalShellIntegrationDisabled: false,
337-
terminalOutputLineLimit: 500,
338328
}
339329

340330
// Execute
@@ -360,7 +350,6 @@ describe("executeCommand", () => {
360350
executionId: "test-123",
361351
command: "exit 1",
362352
terminalShellIntegrationDisabled: false,
363-
terminalOutputLineLimit: 500,
364353
}
365354

366355
// Execute
@@ -394,7 +383,6 @@ describe("executeCommand", () => {
394383
executionId: "test-123",
395384
command: "long-running-command",
396385
terminalShellIntegrationDisabled: false,
397-
terminalOutputLineLimit: 500,
398386
}
399387

400388
// Execute
@@ -436,7 +424,6 @@ describe("executeCommand", () => {
436424
executionId: "test-123",
437425
command: "cd src && pwd",
438426
terminalShellIntegrationDisabled: false,
439-
terminalOutputLineLimit: 500,
440427
}
441428

442429
// Execute

src/core/webview/ClineProvider.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import {
4040
RooCodeEventName,
4141
requestyDefaultModelId,
4242
openRouterDefaultModelId,
43-
DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT,
4443
DEFAULT_WRITE_DELAY_MS,
4544
ORGANIZATION_ALLOW_ALL,
4645
DEFAULT_MODES,
@@ -2016,8 +2015,6 @@ export class ClineProvider
20162015
remoteBrowserEnabled,
20172016
cachedChromeHostUrl,
20182017
writeDelayMs,
2019-
terminalOutputLineLimit,
2020-
terminalOutputCharacterLimit,
20212018
terminalShellIntegrationTimeout,
20222019
terminalShellIntegrationDisabled,
20232020
terminalCommandDelay,
@@ -2156,8 +2153,6 @@ export class ClineProvider
21562153
remoteBrowserEnabled: remoteBrowserEnabled ?? false,
21572154
cachedChromeHostUrl: cachedChromeHostUrl,
21582155
writeDelayMs: writeDelayMs ?? DEFAULT_WRITE_DELAY_MS,
2159-
terminalOutputLineLimit: terminalOutputLineLimit ?? 500,
2160-
terminalOutputCharacterLimit: terminalOutputCharacterLimit ?? DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT,
21612156
terminalShellIntegrationTimeout: terminalShellIntegrationTimeout ?? Terminal.defaultShellIntegrationTimeout,
21622157
terminalShellIntegrationDisabled: terminalShellIntegrationDisabled ?? true,
21632158
terminalCommandDelay: terminalCommandDelay ?? 0,
@@ -2401,9 +2396,6 @@ export class ClineProvider
24012396
remoteBrowserEnabled: stateValues.remoteBrowserEnabled ?? false,
24022397
cachedChromeHostUrl: stateValues.cachedChromeHostUrl as string | undefined,
24032398
writeDelayMs: stateValues.writeDelayMs ?? DEFAULT_WRITE_DELAY_MS,
2404-
terminalOutputLineLimit: stateValues.terminalOutputLineLimit ?? 500,
2405-
terminalOutputCharacterLimit:
2406-
stateValues.terminalOutputCharacterLimit ?? DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT,
24072399
terminalShellIntegrationTimeout:
24082400
stateValues.terminalShellIntegrationTimeout ?? Terminal.defaultShellIntegrationTimeout,
24092401
terminalShellIntegrationDisabled: stateValues.terminalShellIntegrationDisabled ?? true,

src/integrations/terminal/BaseTerminal.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { truncateOutput, applyRunLengthEncoding } from "../misc/extract-text"
2-
import { DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT } from "@roo-code/types"
32

43
import type {
54
RooTerminalProvider,
@@ -265,17 +264,19 @@ export abstract class BaseTerminal implements RooTerminal {
265264
}
266265

267266
/**
268-
* Compresses terminal output by applying run-length encoding and truncating to line and character limits
267+
* Compresses terminal output by applying run-length encoding and truncating to reasonable limits.
268+
* Uses hardcoded defaults: 500 lines, 50K characters - these are UI display limits to prevent
269+
* memory issues, not LLM context limits (which are controlled by terminalOutputPreviewSize).
269270
* @param input The terminal output to compress
270-
* @param lineLimit Maximum number of lines to keep
271-
* @param characterLimit Optional maximum number of characters to keep (defaults to DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT)
272271
* @returns The compressed terminal output
273272
*/
274-
public static compressTerminalOutput(input: string, lineLimit: number, characterLimit?: number): string {
275-
// Default character limit to prevent context window explosion
276-
const effectiveCharLimit = characterLimit ?? DEFAULT_TERMINAL_OUTPUT_CHARACTER_LIMIT
273+
public static compressTerminalOutput(input: string): string {
274+
// Hardcoded UI display limits - these prevent unbounded memory growth
275+
// in the chat display, separate from the LLM context limits
276+
const LINE_LIMIT = 500
277+
const CHARACTER_LIMIT = 50_000
277278

278-
return truncateOutput(applyRunLengthEncoding(input), lineLimit, effectiveCharLimit)
279+
return truncateOutput(applyRunLengthEncoding(input), LINE_LIMIT, CHARACTER_LIMIT)
279280
}
280281

281282
/**

webview-ui/src/components/settings/SettingsView.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,6 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
179179
ttsSpeed,
180180
soundVolume,
181181
telemetrySetting,
182-
terminalOutputLineLimit,
183-
terminalOutputCharacterLimit,
184182
terminalOutputPreviewSize,
185183
terminalShellIntegrationTimeout,
186184
terminalShellIntegrationDisabled, // Added from upstream
@@ -391,8 +389,6 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
391389
remoteBrowserEnabled: remoteBrowserEnabled ?? false,
392390
writeDelayMs,
393391
screenshotQuality: screenshotQuality ?? 75,
394-
terminalOutputLineLimit: terminalOutputLineLimit ?? 500,
395-
terminalOutputCharacterLimit: terminalOutputCharacterLimit ?? 50_000,
396392
terminalShellIntegrationTimeout: terminalShellIntegrationTimeout ?? 30_000,
397393
terminalShellIntegrationDisabled,
398394
terminalCommandDelay,

0 commit comments

Comments
 (0)