From 828c40cf68984ede829c6fa6adac9a697ca14d8a Mon Sep 17 00:00:00 2001 From: Sviatoslav Abakumov Date: Sat, 7 Feb 2026 18:50:01 +0400 Subject: [PATCH] Fix the issue of aborting retries when an extension customizes the editor (#1364) * fix(coding-agent): update test model from opus-4-5 to opus-4-6 * fix(coding-agent): delegate onEscape/onCtrlD/onPasteImage to defaultEditor When an extension provides a custom editor via setEditorComponent(), onEscape, onCtrlD, and onPasteImage were copied by value from defaultEditor. Later, when retry/compaction/branch-summary temporarily swapped defaultEditor.onEscape to an abort handler, the custom editor still held the stale reference, so pressing Escape during retry did nothing. Use closures that delegate to defaultEditor at call time, matching the pattern from f1b1d54 which fixed the same issue for onExtensionShortcut. --- .../coding-agent/src/modes/interactive/interactive-mode.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts index cc5b9863..2d7207f1 100644 --- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts +++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts @@ -1609,9 +1609,9 @@ export class InteractiveMode { // Use duck typing since instanceof fails across jiti module boundaries const customEditor = newEditor as unknown as Record; if ("actionHandlers" in customEditor && customEditor.actionHandlers instanceof Map) { - customEditor.onEscape = this.defaultEditor.onEscape; - customEditor.onCtrlD = this.defaultEditor.onCtrlD; - customEditor.onPasteImage = this.defaultEditor.onPasteImage; + customEditor.onEscape = () => this.defaultEditor.onEscape?.(); + customEditor.onCtrlD = () => this.defaultEditor.onCtrlD?.(); + customEditor.onPasteImage = () => this.defaultEditor.onPasteImage?.(); customEditor.onExtensionShortcut = (data: string) => this.defaultEditor.onExtensionShortcut?.(data); // Copy action handlers (clear, suspend, model switching, etc.) for (const [action, handler] of this.defaultEditor.actionHandlers) {