Skip to content

Commit e4e03fa

Browse files
pashpashpashCline Evaluationsaoudrizwan
authored
reverting timeout if no first chunk (RooCodeInc#3899)
* reverting timeout if no first chunk * Create fresh-days-end.md --------- Co-authored-by: Cline Evaluation <[email protected]> Co-authored-by: Saoud Rizwan <[email protected]>
1 parent 1089267 commit e4e03fa

File tree

2 files changed

+5
-34
lines changed

2 files changed

+5
-34
lines changed

.changeset/fresh-days-end.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": patch
3+
---
4+
5+
Fix bug where terminal would get stuck and output "capture failure"

src/integrations/terminal/TerminalProcess.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -35,42 +35,8 @@ export class TerminalProcess extends EventEmitter<TerminalProcessEvents> {
3535
let isFirstChunk = true
3636
let didOutputNonCommand = false
3737
let didEmitEmptyLine = false
38-
let firstChunkTimeout: NodeJS.Timeout
39-
40-
const isWindows = process.platform === "win32"
41-
const timeoutMs = isWindows ? 5000 : 500
42-
43-
const onTimeout = () => {
44-
// In rare cases (e.g. running the same command twice like `npm run build`),
45-
// the shell integration stream enters a broken state where no data is ever emitted.
46-
// We never even get the first chunk, which bricks the UI and locks the user out.
47-
// Interestingly, the stream still gets created, and future commands (like `ls`) will work,
48-
// suggesting the stream itself isn't one-shot—but certain shell states break its behavior.
49-
// To recover, we add a timeout waiting for the first chunk.
50-
// If it doesn’t arrive in time, we assume the terminal is broken, dispose it,
51-
// and emit an error so the user can safely retry in a clean terminal.
52-
53-
Logger.debug(
54-
`[TerminalProcess.run] First chunk timeout hit — terminal likely in bad state. Terminating terminal.`,
55-
)
56-
try {
57-
terminal.dispose()
58-
} catch (err) {
59-
Logger.debug(`[TerminalProcess.run] Failed to dispose terminal: ${String(err)}`)
60-
}
61-
this.emit(
62-
"error",
63-
new Error("The command ran successfully, but we couldn't capture its output. Please proceed accordingly."),
64-
)
65-
this.emit("completed")
66-
this.emit("continue")
67-
}
68-
69-
firstChunkTimeout = setTimeout(onTimeout, timeoutMs)
7038

7139
for await (let data of stream) {
72-
clearTimeout(firstChunkTimeout)
73-
7440
// 1. Process chunk and remove artifacts
7541
if (isFirstChunk) {
7642
/*

0 commit comments

Comments
 (0)