fix: command execution event listener race condition

Description

Fixes a bug where Duo agent terminal commands frequently appear to hang. The command runs (output is visible in integrated temrinal), but the agent never detects completion and waits for the server timeout (~120s) before proceeding.

This is because we registered the completion listener and opened the output stream after starting the command. VS Code delivers terminal events on a later tick and doesn't replay missed ones, so a fast command's completion event was dropped. We now register the listener and open the stream synchronously, before the command starts.

Also sprinkles way more [TerminalManager] debug logs around the place to make future customer logs in this space richer.

Related to #2296

How has this been tested?

  • run the vscode extension host

  • open Duo Agentic Chat / Flows

  • Ask "run zsh -v" (or some other command you expect to run very quickly)

  • Before: command would sometimes run then hang for 2 mins until the timeout hit. After: command should consistently run and Duo will continue the session without waiting for timeout.

  • If src/browser or src/common has been modified, please consider interoperability with the Web IDE. See Running the Extension in WebIDE.

Screenshots (if appropriate)

What CHANGELOG entry will this MR create?

  • fix: Bug fix fixes - a user-facing issue in production - included in changelog
Edited by Elwyn Benson

Merge request reports

Loading
Loading