Elffuss BraidHub

kikocis/continue public

Merge pull request #6518 from chezsmithy/fix-terminal-background-output

fix: :bug: When a terminal command is moved to the background preserve existing output
Changesete8ee99375f3e2e44c19e8ff7d33e207a9dd625dc48487a1aecbcdfd7cc3ef676
AuthorPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-07-09 08:49 -07:00
CommitterGitHub <noreply@github.com> · 2025-07-09 08:49 -07:00
Parentsd1910f72e429, 3a41b87ed10f

Browse the files at this changeset

1 file changed

modified gui/src/redux/thunks/moveTerminalProcessToBackground.ts +10 −3
@@ -10,9 +10,10 @@
1010
1111 /**
1212 * This thunk is used to move a terminal command to the background
13- * when the user clicks the "Continue" button in the UI
13+ * when the user clicks the "Move to background" link in the UI
1414 *
15- * It marks the command as visually complete without stopping
15+ * It preserves all existing terminal output, marks the command as
16+ * visually complete, and stops listening to further output from
1617 * the already running process
1718 */
1819 export const moveTerminalProcessToBackground = createAsyncThunk<
@@ -39,6 +40,12 @@
3940 return;
4041 }
4142
43+ // Find existing terminal output to preserve it
44+ const existingOutput = toolCall.output?.find(
45+ (item) => item.name === "Terminal",
46+ );
47+ const existingContent = existingOutput?.content || "";
48+
4249 const status =
4350 "Command moved to background. Further output will be ignored.";
4451
@@ -46,7 +53,7 @@
4653 {
4754 name: "Terminal",
4855 description: "Terminal command output",
49- content: "\n" + status,
56+ content: existingContent + (existingContent ? "\n\n" : "") + status,
5057 status: status,
5158 },
5259 ];