Skip to content

Commit 031c894

Browse files
committed
fix(tui): surface error detail in abort notification
When an agent run aborts during the error lifecycle phase, the TUI now includes the error message in the abort notification instead of showing only the generic 'run aborted' text. Previously emitChatAborted did not forward errorMessage, unlike its sibling emitChatError which already passed error details. This made tool-call validation failures, model errors, and timeouts look identical to the user. Fixes #90982
1 parent 65848d0 commit 031c894

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎src/tui/embedded-backend.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ export class EmbeddedTuiBackend implements TuiBackend {
806806
});
807807
}
808808

809-
private emitChatAborted(runId: string, run: LocalRunState) {
809+
private emitChatAborted(runId: string, run: LocalRunState, errorMessage?: string) {
810810
this.clearPendingLifecycleError(runId);
811811
run.markQueuedRunReady();
812812
const alreadyFinal = run.finalSent;
@@ -822,6 +822,7 @@ export class EmbeddedTuiBackend implements TuiBackend {
822822
runId,
823823
sessionKey: run.sessionKey,
824824
state: "aborted",
825+
...(errorMessage ? { errorMessage } : {}),
825826
});
826827
}
827828

@@ -934,7 +935,8 @@ export class EmbeddedTuiBackend implements TuiBackend {
934935
if (phase === "error") {
935936
run.finishing = false;
936937
if (aborted) {
937-
this.emitChatAborted(evt.runId, run);
938+
const errorMessage = typeof evt.data?.error === "string" ? evt.data.error : undefined;
939+
this.emitChatAborted(evt.runId, run, errorMessage);
938940
return;
939941
}
940942
const errorMessage = typeof evt.data?.error === "string" ? evt.data.error : undefined;

‎src/tui/tui-event-handlers.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,11 @@ export function createEventHandlers(context: EventHandlerContext) {
679679
if (evt.state === "aborted") {
680680
forgetLocalBtwRunId?.(evt.runId);
681681
const wasActiveRun = state.activeChatRunId === evt.runId;
682-
chatLog.addSystem("run aborted");
682+
const abortMessage =
683+
evt.errorMessage && evt.errorMessage.length > 0
684+
? `run aborted: ${evt.errorMessage}`
685+
: "run aborted";
686+
chatLog.addSystem(abortMessage);
683687
terminateRun({ runId: evt.runId, wasActiveRun, status: "aborted" });
684688
maybeRefreshHistoryForRun(evt.runId);
685689
}

0 commit comments

Comments
 (0)