Skip to content

fix(terminal): fix output loss on cold terminals by moving read() into onDidStartTerminalShellExecution (#800)#834

Open
edelauna wants to merge 6 commits into
mainfrom
issue/800
Open

fix(terminal): fix output loss on cold terminals by moving read() into onDidStartTerminalShellExecution (#800)#834
edelauna wants to merge 6 commits into
mainfrom
issue/800

Conversation

@edelauna

@edelauna edelauna commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Related GitHub Issue

Closes: #800

Description

Two related bugs caused terminal output loss and premature task completion on cold terminals:

Root cause — early execution.read() call

TerminalProcess.run() was calling execution.read() immediately after executeCommand(), before the shell had started executing the command. VSCode does not buffer stream data retroactively: on a cold terminal (e.g. zsh with a heavy .zshrc) the shell takes 3+ seconds to initialise, so the stream window opened before any output was produced — delivering zero chunks. On warm terminals this wasn't visible because the shell was already running and output arrived within the open window.

Fix: remove the early read() call entirely. read() is now always called inside onDidStartTerminalShellExecution in TerminalRegistry, which fires exactly when the command starts executing — the earliest point at which output is reliably captured. The activeShellExecution === e.execution early-return guard (which silently prevented re-reading on warm terminals) is replaced by an ownExecution-based check that still rejects stale events for superseded executions.

Secondary fix — idle timeout misfiring during shell initialisation

The 3s idle sentinel in the stream loop (chunkCount === 0, no end event) was self-finalising before onDidStartTerminalShellExecution had fired on cold shells — reporting the command as done before it even started. The sentinel now only self-finalises after shell_execution_started has been received; if it fires before that, the timer is re-armed and the loop continues waiting.

Also in this PR

  • Replace pWaitFor polling with onDidChangeTerminalShellIntegration event for waitForShellIntegration (event-driven, no polling)
  • Write POSIX multiline commands to a temp script file (/tmp/roo-cmd-*.sh) to avoid the VSCode { ... }-wrapping bug that closes the stream before read() is called; quote paths to handle spaces (e.g. Git Bash on Windows: "C:\Program Files\Git\bin\bash.exe" "C:\...\roo-cmd-*.sh")
  • D-marker self-finalize with 1s grace period for exit code
  • Stale-execution guard in TerminalRegistry for onDidEndTerminalShellExecution

Test Procedure

  • Unit tests: src/integrations/terminal/__tests__/TerminalProcess.spec.ts and TerminalRegistry.spec.ts
  • E2E (all pass, 76/76): zero-chunk multiline, terminal reuse, long-running silent command, cold shell init, fast-exit shell race, terminal profile
  • Manual: verified on bash, zsh (cold and warm), PowerShell, and Git Bash on Windows

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes.
  • Documentation Impact: No user-facing documentation updates required.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.

Summary by CodeRabbit

  • Bug Fixes
    • Improved terminal command completion and result delivery during shell startup, shell-integration activation, and fast/rapid execution.
    • Prevented premature idle-timeout self-finalization for long-running commands without intermediate output.
    • Fixed terminal reuse race conditions, including improved handling of multiline POSIX commands to restore proper streaming and completion signaling.
  • Tests
    • Added new E2E regression coverage for cold shell initialization, fast-exit races, zero-chunk races, terminal reuse, and long-running silent commands (including completion-order scenarios).

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@edelauna, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 1 minute

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 58d269e9-df38-4c29-9c5d-fab61a91bf5f

📥 Commits

Reviewing files that changed from the base of the PR and between fbbcbc6 and 4acf277.

📒 Files selected for processing (5)
  • apps/vscode-e2e/src/suite/tools/fast-exit-shell-race.test.ts
  • src/core/tools/__tests__/executeCommandTool.spec.ts
  • src/integrations/terminal/TerminalProcess.ts
  • src/integrations/terminal/TerminalRegistry.ts
  • src/integrations/terminal/__tests__/TerminalProcess.spec.ts
📝 Walkthrough

Walkthrough

Changes

The terminal execution path now uses event-driven shell readiness, execution identity checks, race-aware stream handling, multiline temporary scripts, and faster tool-result finalization. New unit and Linux VS Code E2E coverage exercises shell startup, completion, reuse, silent commands, and zero-chunk races.

Terminal execution reliability

Layer / File(s) Summary
Shell readiness and execution ownership
src/integrations/terminal/Terminal.ts, src/integrations/terminal/TerminalProcess.ts, src/integrations/terminal/TerminalRegistry.ts, src/__mocks__/vscode.js, src/integrations/terminal/__tests__/*
Shell integration activation is event-driven, and terminal start/end events are correlated with the active shell execution.
Stream races and multiline command execution
src/integrations/terminal/TerminalProcess.ts, src/integrations/terminal/__tests__/TerminalProcess.spec.ts, src/integrations/terminal/__tests__/TerminalProcessExec.*.spec.ts
Stream consumption handles completion races, idle timeouts, end markers, shell-specific multiline commands, temporary scripts, and cleanup.
Execute command completion finalization
src/core/tools/ExecuteCommandTool.ts, src/core/tools/__tests__/executeCommandTool.spec.ts
Command results are finalized and resolved before queued UI output, with background execution excluded from shell-completion waiting.
Shell race E2E scenarios
apps/vscode-e2e/src/fixtures/*, apps/vscode-e2e/fixtures/*, apps/vscode-e2e/src/runTest.ts, apps/vscode-e2e/src/suite/tools/*
Replay fixtures and Linux E2E suites cover cold initialization, fast exits, silent commands, terminal reuse, and zero-chunk output.

Estimated code review effort: 5 (Critical) | ~90+ minutes

Sequence Diagram(s)

sequenceDiagram
  participant ExecuteCommandTool
  participant TerminalProcess
  participant VSCodeShell
  participant TerminalRegistry
  ExecuteCommandTool->>TerminalProcess: run command
  TerminalProcess->>VSCodeShell: await shell integration and execute
  VSCodeShell->>TerminalRegistry: emit start/end execution events
  TerminalRegistry->>TerminalProcess: provide matching stream and completion
  TerminalProcess-->>ExecuteCommandTool: return command result
Loading

Possibly related issues

Possibly related PRs

Suggested labels: awaiting-review

Suggested reviewers: taltas, navedmerchant, hannesrudolph, jamesrobert20

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the terminal output-loss fix and matches the implementation.
Description check ✅ Passed The PR description follows the template and covers issue, implementation, tests, checklist, and docs; optional sections are omitted.
Linked Issues check ✅ Passed The changes address #800 by capturing shell output at start events and preventing premature completion on cold terminals.
Out of Scope Changes check ✅ Passed The added fixtures, tests, and terminal changes all support the terminal-capture fix; no unrelated scope is evident.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue/800

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@edelauna edelauna changed the title fix(terminal): detect D marker directly to recover from lost VSCode s… fix(terminal): recover from lost VSCode shell-integration completion signals (#800) Jul 5, 2026
@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

@edelauna edelauna mentioned this pull request Jul 5, 2026
@edelauna edelauna force-pushed the issue/800 branch 2 times, most recently from 094ae8a to a84430a Compare July 7, 2026 22:07
@edelauna edelauna changed the title fix(terminal): recover from lost VSCode shell-integration completion signals (#800) fix(terminal): fix output loss on cold terminals by moving read() into onDidStartTerminalShellExecution (#800) Jul 12, 2026
@edelauna edelauna force-pushed the issue/800 branch 2 times, most recently from ec1a244 to 596ab97 Compare July 13, 2026 02:00
@edelauna edelauna marked this pull request as ready for review July 13, 2026 02:44

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
src/integrations/terminal/__tests__/TerminalRegistry.spec.ts (1)

344-387: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider adding coverage for the ownExecution === undefined transient window.

Both new tests here pre-assign ownExecution before dispatching the event, so they don't exercise the case where a stale start event arrives while the new process's ownExecution is still undefined (see the corresponding concern raised on TerminalRegistry.ts lines 58-89). Adding a test for that specific ordering would pin down current behavior and guard against regressions once/if the fallback logic is tightened.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/integrations/terminal/__tests__/TerminalRegistry.spec.ts` around lines
344 - 387, The tests should cover a start event arriving while the active
TerminalProcess has ownExecution undefined. Add a case alongside the existing
startHandler tests that creates the process without assigning ownExecution,
dispatches an execution event, and verifies the transient-window behavior: the
event must not incorrectly replace the active stream or invoke read unless that
is the established expected behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/vscode-e2e/src/suite/tools/fast-exit-shell-race.test.ts`:
- Line 93: Update the timeout in the fast-exit shell race test to 60_000ms,
matching the surrounding test cohort, and remove the temporary diagnostic
comment.

In `@src/core/tools/__tests__/executeCommandTool.spec.ts`:
- Line 195: Update the test assertion in the executeCommandTool test to verify
the custom working directory, such as /custom/path, rather than only checking
for the generic “Command” text. Assert the directory in the returned result or
the terminal creation arguments, while preserving the existing
command-completion coverage.

In `@src/integrations/terminal/TerminalProcess.ts`:
- Around line 549-556: Harden temporary script creation in the command-building
method around scriptPath by using an exclusive file creation mechanism or a
private directory instead of a guessable filename under os.tmpdir(). Preserve
the returned shell command path, and if using fs.mkdtempSync, update
cleanupScriptFile() to remove the created directory as well as its script.

In `@src/integrations/terminal/TerminalRegistry.ts`:
- Around line 58-89: The execution-ownership guard in the
onDidStartTerminalShellExecution handler must not accept undefined ownExecution
for reused terminals. Update the logic around TerminalProcess and
terminal.process so the undefined-ownExecution fallback is allowed only for
genuinely cold, newly created terminals, while reused terminals require an
execution match before calling read() and setActiveStream().

---

Nitpick comments:
In `@src/integrations/terminal/__tests__/TerminalRegistry.spec.ts`:
- Around line 344-387: The tests should cover a start event arriving while the
active TerminalProcess has ownExecution undefined. Add a case alongside the
existing startHandler tests that creates the process without assigning
ownExecution, dispatches an execution event, and verifies the transient-window
behavior: the event must not incorrectly replace the active stream or invoke
read unless that is the established expected behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3d9cb986-5221-4471-b98c-9ba55f032765

📥 Commits

Reviewing files that changed from the base of the PR and between a441e02 and 987bfbb.

📒 Files selected for processing (28)
  • apps/vscode-e2e/fixtures/cold-shell-init.json
  • apps/vscode-e2e/fixtures/fast-exit-shell-race.json
  • apps/vscode-e2e/fixtures/long-running-silent-command.json
  • apps/vscode-e2e/fixtures/terminal-reuse-shell-race.json
  • apps/vscode-e2e/fixtures/zero-chunk-shell-race.json
  • apps/vscode-e2e/src/fixtures/cold-shell-init.ts
  • apps/vscode-e2e/src/fixtures/fast-exit-shell-race.ts
  • apps/vscode-e2e/src/fixtures/long-running-silent-command.ts
  • apps/vscode-e2e/src/fixtures/terminal-reuse-shell-race.ts
  • apps/vscode-e2e/src/fixtures/zero-chunk-shell-race.ts
  • apps/vscode-e2e/src/runTest.ts
  • apps/vscode-e2e/src/suite/tools/cold-shell-init.test.ts
  • apps/vscode-e2e/src/suite/tools/fast-exit-shell-race.test.ts
  • apps/vscode-e2e/src/suite/tools/long-running-silent-command.test.ts
  • apps/vscode-e2e/src/suite/tools/terminal-reuse-shell-race.test.ts
  • apps/vscode-e2e/src/suite/tools/zero-chunk-shell-race.test.ts
  • src/__mocks__/vscode.js
  • src/core/tools/ExecuteCommandTool.ts
  • src/core/tools/__tests__/executeCommandTool.spec.ts
  • src/integrations/terminal/Terminal.ts
  • src/integrations/terminal/TerminalProcess.ts
  • src/integrations/terminal/TerminalRegistry.ts
  • src/integrations/terminal/__tests__/TerminalProcess.spec.ts
  • src/integrations/terminal/__tests__/TerminalProcessExec.bash.spec.ts
  • src/integrations/terminal/__tests__/TerminalProcessExec.cmd.spec.ts
  • src/integrations/terminal/__tests__/TerminalProcessExec.pwsh.spec.ts
  • src/integrations/terminal/__tests__/TerminalProfile.spec.ts
  • src/integrations/terminal/__tests__/TerminalRegistry.spec.ts

Comment thread apps/vscode-e2e/src/suite/tools/fast-exit-shell-race.test.ts Outdated
Comment thread src/core/tools/__tests__/executeCommandTool.spec.ts Outdated
Comment thread src/integrations/terminal/TerminalProcess.ts Outdated
Comment thread src/integrations/terminal/TerminalRegistry.ts
@github-actions github-actions Bot added awaiting-review PR changes are ready and waiting for maintainer re-review and removed awaiting-review PR changes are ready and waiting for maintainer re-review labels Jul 13, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/integrations/terminal/TerminalProcess.ts (1)

293-331: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Concurrent iterator.next() calls skip the first output chunk.

When the idle timeout fires (line 322) and shellExecutionStarted is true, the continue on line 331 re-enters the loop and calls iterator.next() again on line 294 while the previous .next() promise is still pending. This violates the async iterator protocol — the spec states .next() should not be called before the previous call resolves. The first .next() will eventually resolve with chunk A, but the loop is now awaiting the second .next(), which resolves with chunk B. Chunk A is silently lost. Since the first chunk frequently contains the ]633;C start marker used by matchAfterVsceStartMarkers (line 368), losing it can cause the entire output to be mis-parsed.

🐛 Proposed fix: hoist `nextChunk` outside the loop
 	// A sentinel for the no-data idle timeout (see below).
 	const IDLE_SENTINEL = Symbol("idle")

 	// How long to wait for the first chunk before assuming the command finished with
 	// no output (VSCode bug: { ... }-wrapped multiline commands often produce zero
 	// stream data AND delay onDidEndTerminalShellExecution by 60+ seconds).
 	// Only applies before any data arrives (chunkCount === 0).
 	const IDLE_TIMEOUT_MS = 3_000

+	// Hoist nextChunk outside the loop so that re-arming after an idle timeout
+	// reuses the same pending .next() promise instead of calling .next() again
+	// while the previous call is still unresolved (which violates the async
+	// iterator protocol and can silently skip the first chunk).
+	let nextChunk = iterator.next()
 	while (true) {
-		const nextChunk = iterator.next()
 		const racers: Promise<typeof DONE_SENTINEL | typeof IDLE_SENTINEL | IteratorResult<string>>[] = [
 			nextChunk,
 			shellExecutionComplete.then(() => DONE_SENTINEL as typeof DONE_SENTINEL),
 		]
@@
 			this.startHotTimer(data)

 			if (this.matchBeforeVsceEndMarkers(this.fullOutput) !== undefined) {
 				sawEndMarker = true
 				console.info(
 					`[Terminal Process] D marker observed in stream after ${chunkCount} chunk(s), +${Date.now() - streamStartedAt}ms`,
 				)
 				break
 			}
+			// Advance to the next chunk only after the current one has been consumed.
+			nextChunk = iterator.next()
 		}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/integrations/terminal/TerminalProcess.ts` around lines 293 - 331, Prevent
concurrent async-iterator reads in the stream-consumption loop. In the loop
surrounding iterator.next(), create and retain the pending nextChunk promise
outside the loop, then race that same promise with the idle and completion
signals; only request the subsequent iterator result after the current result
has resolved, including when re-arming after IDLE_SENTINEL, so the first output
chunk is preserved.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/integrations/terminal/TerminalProcess.ts`:
- Around line 293-331: Prevent concurrent async-iterator reads in the
stream-consumption loop. In the loop surrounding iterator.next(), create and
retain the pending nextChunk promise outside the loop, then race that same
promise with the idle and completion signals; only request the subsequent
iterator result after the current result has resolved, including when re-arming
after IDLE_SENTINEL, so the first output chunk is preserved.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 92e7377b-2e69-4e6e-a61e-c6cfa64ee56e

📥 Commits

Reviewing files that changed from the base of the PR and between 987bfbb and ec4e0f8.

📒 Files selected for processing (4)
  • apps/vscode-e2e/src/suite/tools/fast-exit-shell-race.test.ts
  • src/core/tools/__tests__/executeCommandTool.spec.ts
  • src/integrations/terminal/TerminalProcess.ts
  • src/integrations/terminal/TerminalRegistry.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/vscode-e2e/src/suite/tools/fast-exit-shell-race.test.ts
  • src/integrations/terminal/TerminalRegistry.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/integrations/terminal/TerminalProcess.ts (1)

280-487: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Wrap stream loop and post-loop in try/finally for resource cleanup.

The stream consumption loop (lines 298-409) and post-loop processing (lines 411-487) are not protected by try/finally. If an error occurs (e.g., iterator.next() throws, or an event listener throws during this.emit(...)), two resources leak:

  1. Temp script file/directorycleanupScriptFile() at line 465 is never reached, leaving the mkdtempSync directory and cmd.sh on disk.
  2. Async iterator — the manual iterator.next() loop doesn't call iterator.return() on exit, unlike for await which calls it automatically. The underlying VSCode stream iterator may hold open resources.

Additionally, "completed" and "continue" events would not be emitted, potentially hanging the caller.

🛡️ Proposed try/finally wrapper
 	const iterator = stream[Symbol.asyncIterator]()
+	try {
 		// A unique sentinel to distinguish "shellExecutionComplete won the race" from a real chunk.
 		const DONE_SENTINEL = Symbol("done")
 		// A sentinel for the no-data idle timeout (see below).
@@
 		this.stopHotTimer()
 		this.emit("completed", this.stripCursorSequences(this.removeVSCodeShellIntegration(this.fullOutput)))
 		this.emit("continue")
+	} catch (error) {
+		console.error("[Terminal Process] Error during stream processing:", error)
+		this.emit("completed", `<terminal process error: ${error instanceof Error ? error.message : String(error)}>`)
+		this.emit("continue")
+		throw error
+	} finally {
+		void iterator.return?.().catch(() => {})
+		this.cleanupScriptFile()
+	}

The explicit this.cleanupScriptFile() at line 465 can be removed since the finally block now handles it on all paths. cleanupScriptFile() is idempotent so keeping both is also safe.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/integrations/terminal/TerminalProcess.ts` around lines 280 - 487, Wrap
the manual stream-consumption and post-loop processing in a try/finally. In the
finally block, call iterator.return() when available and always invoke
cleanupScriptFile(), ensuring both resources are released when iterator.next()
or event emission throws; remove the redundant normal-path cleanup call if
appropriate. Preserve the existing completion and continue emissions on
successful execution.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/integrations/terminal/TerminalProcess.ts`:
- Around line 280-487: Wrap the manual stream-consumption and post-loop
processing in a try/finally. In the finally block, call iterator.return() when
available and always invoke cleanupScriptFile(), ensuring both resources are
released when iterator.next() or event emission throws; remove the redundant
normal-path cleanup call if appropriate. Preserve the existing completion and
continue emissions on successful execution.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 83e41e38-07c4-4286-818b-4ebda83c56ac

📥 Commits

Reviewing files that changed from the base of the PR and between ec4e0f8 and faa933e.

📒 Files selected for processing (4)
  • apps/vscode-e2e/src/suite/tools/fast-exit-shell-race.test.ts
  • src/core/tools/__tests__/executeCommandTool.spec.ts
  • src/integrations/terminal/TerminalProcess.ts
  • src/integrations/terminal/TerminalRegistry.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/integrations/terminal/TerminalRegistry.ts
  • apps/vscode-e2e/src/suite/tools/fast-exit-shell-race.test.ts
  • src/core/tools/tests/executeCommandTool.spec.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/integrations/terminal/TerminalProcess.ts`:
- Around line 316-326: Update the Promise.race handling in TerminalProcess so
the stream loop breaks only when raceResult equals DONE_SENTINEL; do not use
doneSignal.done in that condition, allowing a winning IteratorResult chunk to be
appended even if completion fired concurrently. Add a regression test covering
the final-chunk/completion race.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 71f2d49c-bf5d-4f56-ab05-27322ea3cfc8

📥 Commits

Reviewing files that changed from the base of the PR and between faa933e and fbbcbc6.

📒 Files selected for processing (4)
  • apps/vscode-e2e/src/suite/tools/fast-exit-shell-race.test.ts
  • src/core/tools/__tests__/executeCommandTool.spec.ts
  • src/integrations/terminal/TerminalProcess.ts
  • src/integrations/terminal/TerminalRegistry.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/vscode-e2e/src/suite/tools/fast-exit-shell-race.test.ts
  • src/core/tools/tests/executeCommandTool.spec.ts
  • src/integrations/terminal/TerminalRegistry.ts

Comment thread src/integrations/terminal/TerminalProcess.ts
@github-actions github-actions Bot added the awaiting-review PR changes are ready and waiting for maintainer re-review label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR changes are ready and waiting for maintainer re-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]

1 participant