Skip to content
This repository was archived by the owner on Jun 14, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions web_ui/static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1054,13 +1054,17 @@ function AudionutsUAGUI() {
const reader = response.body.getReader();
const decoder = new TextDecoder();
let buffer = '';
let sawTerminalEvent = false;
let sawErrorEvent = false;
let sawOutputEvent = false;

const processSSELine = (line) => {
if (localController && localController.signal.aborted) return;
if (!line.trim() || !line.startsWith('data: ')) return;
try {
const data = JSON.parse(line.substring(6));
if (data.type === 'html' || data.type === 'html_full') {
sawOutputEvent = true;
try {
const rawHtml = data.data || '';
const clean = sanitizeHtml(rawHtml);
Expand All @@ -1085,10 +1089,23 @@ function AudionutsUAGUI() {
} catch (e) {
console.error('Failed to render HTML fragment:', e);
}
} else if (data.type === 'exit') {
} else if (data.type === 'system') {
if (data.data) {
appendSystemMessage(String(data.data));
}
} else if (data.type === 'error') {
sawTerminalEvent = true;
sawErrorEvent = true;
const msg = data.data ? String(data.data) : 'Execution error';
appendSystemMessage(`✗ ${msg}`, 'error');
} else if (data.type === 'exit') {
sawTerminalEvent = true;
if (!(localController && localController.signal.aborted)) {
appendSystemMessage('');
appendSystemMessage(`✓ Process exited with code ${data.code}`);
if (Number(data.code) !== 0) {
sawErrorEvent = true;
}
Comment on lines 1105 to +1108

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Use error semantics for non-zero exit line

At Line 1105, the UI always prints ✓ Process exited..., even when Line 1106-Line 1108 classifies the exit as an error. This creates conflicting status in the same run.

Suggested fix
           } else if (data.type === 'exit') {
             sawTerminalEvent = true;
+            const exitCode = Number(data.code);
+            const isErrorExit = !Number.isFinite(exitCode) || exitCode !== 0;
+            if (isErrorExit) {
+              sawErrorEvent = true;
+            }
             if (!(localController && localController.signal.aborted)) {
               appendSystemMessage('');
-              appendSystemMessage(`✓ Process exited with code ${data.code}`);
-              if (Number(data.code) !== 0) {
-                sawErrorEvent = true;
-              }
+              appendSystemMessage(
+                `${isErrorExit ? '✗' : '✓'} Process exited with code ${data.code}`,
+                isErrorExit ? 'error' : 'info'
+              );
             }
           }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
appendSystemMessage(`✓ Process exited with code ${data.code}`);
if (Number(data.code) !== 0) {
sawErrorEvent = true;
}
} else if (data.type === 'exit') {
sawTerminalEvent = true;
const exitCode = Number(data.code);
const isErrorExit = !Number.isFinite(exitCode) || exitCode !== 0;
if (isErrorExit) {
sawErrorEvent = true;
}
if (!(localController && localController.signal.aborted)) {
appendSystemMessage('');
appendSystemMessage(
`${isErrorExit ? '✗' : '✓'} Process exited with code ${data.code}`,
isErrorExit ? 'error' : 'info'
);
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web_ui/static/js/app.js` around lines 1105 - 1108, The current code always
calls appendSystemMessage with a success checkmark for all exits even though
non-zero codes set sawErrorEvent; change the logic around appendSystemMessage in
the exit handler so it uses the exit code to choose the proper message and
semantics: when Number(data.code) === 0 call appendSystemMessage with the
success message (✓ Process exited...), otherwise call appendSystemMessage (or a
dedicated error logger used elsewhere) with an error-formatted message (e.g., ✗
or "Process exited with non-zero code") and set sawErrorEvent = true; update
references to appendSystemMessage, sawErrorEvent and data.code to implement this
branching so the UI no longer shows a success checkmark on error exits.

}
}
} catch (e) {
Expand Down Expand Up @@ -1121,8 +1138,16 @@ function AudionutsUAGUI() {
/* eslint-enable no-constant-condition */
// Only append the final completion message when not aborted.
if (!(localController && localController.signal.aborted)) {
appendSystemMessage('✓ Execution completed');
appendSystemMessage('');
if (sawErrorEvent) {
appendSystemMessage('✗ Execution finished with errors', 'error');
appendSystemMessage('');
} else if (!sawTerminalEvent && !sawOutputEvent) {
appendSystemMessage('✗ Execution ended without output', 'error');
appendSystemMessage('');
} else {
appendSystemMessage('✓ Execution completed');
appendSystemMessage('');
}
}
} catch (error) {
// Suppress abort errors as they are expected when a user cancels.
Expand Down