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.
This commit is contained in:
Sviatoslav Abakumov 2026-02-07 18:50:01 +04:00 committed by GitHub
parent 08e88f1036
commit 828c40cf68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1609,9 +1609,9 @@ export class InteractiveMode {
// Use duck typing since instanceof fails across jiti module boundaries
const customEditor = newEditor as unknown as Record<string, unknown>;
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) {