From 27b27d94412b33e527c3c6777fd60a2c36f7afc3 Mon Sep 17 00:00:00 2001 From: Sviatoslav Abakumov Date: Sun, 25 Jan 2026 23:11:09 +0400 Subject: [PATCH] fix(coding-agent): restore the correct editor after /reload (#949) This issue occurs when extension uses setEditorComponent. The restoreEditor() callback was capturing this.editor AFTER resetExtensionUI() (which restores defaultEditor), then adding that captured editor back to the container - ignoring any new editor created by extensions during session_start. On success, use this.editor (may be custom editor from extension). On failure, restore the fallback editor (safe defaultEditor state). Rename restoreEditor to dismissLoader to reflect its actual purpose. --- .../src/modes/interactive/interactive-mode.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts index dada5c42..cdcbfd26 100644 --- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts +++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts @@ -3659,11 +3659,11 @@ export class InteractiveMode { this.ui.setFocus(loader); this.ui.requestRender(); - const restoreEditor = () => { + const dismissLoader = (editor: Component) => { loader.dispose(); this.editorContainer.clear(); - this.editorContainer.addChild(previousEditor); - this.ui.setFocus(previousEditor as Component); + this.editorContainer.addChild(editor); + this.ui.setFocus(editor); this.ui.requestRender(); }; @@ -3676,7 +3676,7 @@ export class InteractiveMode { this.setupExtensionShortcuts(runner); } this.rebuildChatFromMessages(); - restoreEditor(); + dismissLoader(this.editor as Component); this.showLoadedResources({ extensionPaths: runner?.getExtensionPaths() ?? [], force: true }); const modelsJsonError = this.session.modelRegistry.getError(); if (modelsJsonError) { @@ -3684,7 +3684,7 @@ export class InteractiveMode { } this.showStatus("Reloaded extensions, skills, prompts, themes"); } catch (error) { - restoreEditor(); + dismissLoader(previousEditor as Component); this.showError(`Reload failed: ${error instanceof Error ? error.message : String(error)}`); } }