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.
This commit is contained in:
Sviatoslav Abakumov 2026-01-25 23:11:09 +04:00 committed by GitHub
parent 225fcb3830
commit 27b27d9441
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)}`);
}
}