@@ -153,7 +153,10 @@ export class ExtensionHost extends EventEmitter implements ExtensionHostInterfac
153153 super ( )
154154
155155 this . options = options
156- this . options . integrationTest = true
156+
157+ // Set up quiet mode early, before any extension code runs.
158+ // This suppresses console output from the extension during load.
159+ this . setupQuietMode ( )
157160
158161 // Initialize client - single source of truth for agent state (including mode).
159162 this . client = new ExtensionClient ( {
@@ -162,9 +165,7 @@ export class ExtensionHost extends EventEmitter implements ExtensionHostInterfac
162165 } )
163166
164167 // Initialize output manager.
165- this . outputManager = new OutputManager ( {
166- disabled : options . disableOutput ,
167- } )
168+ this . outputManager = new OutputManager ( { disabled : options . disableOutput } )
168169
169170 // Initialize prompt manager with console mode callbacks.
170171 this . promptManager = new PromptManager ( {
@@ -222,8 +223,6 @@ export class ExtensionHost extends EventEmitter implements ExtensionHostInterfac
222223 this . initialSettings . reasoningEffort = this . options . reasoningEffort
223224 }
224225 }
225-
226- this . setupQuietMode ( )
227226 }
228227
229228 // ==========================================================================
@@ -267,7 +266,8 @@ export class ExtensionHost extends EventEmitter implements ExtensionHostInterfac
267266 // ==========================================================================
268267
269268 private setupQuietMode ( ) : void {
270- if ( this . options . integrationTest ) {
269+ // Skip if already set up or if integrationTest mode
270+ if ( this . originalConsole || this . options . integrationTest ) {
271271 return
272272 }
273273
@@ -292,18 +292,16 @@ export class ExtensionHost extends EventEmitter implements ExtensionHostInterfac
292292 }
293293
294294 private restoreConsole ( ) : void {
295- if ( this . options . integrationTest ) {
295+ if ( ! this . originalConsole ) {
296296 return
297297 }
298298
299- if ( this . originalConsole ) {
300- console . log = this . originalConsole . log
301- console . warn = this . originalConsole . warn
302- console . error = this . originalConsole . error
303- console . debug = this . originalConsole . debug
304- console . info = this . originalConsole . info
305- this . originalConsole = null
306- }
299+ console . log = this . originalConsole . log
300+ console . warn = this . originalConsole . warn
301+ console . error = this . originalConsole . error
302+ console . debug = this . originalConsole . debug
303+ console . info = this . originalConsole . info
304+ this . originalConsole = null
307305
308306 if ( this . originalProcessEmitWarning ) {
309307 process . emitWarning = this . originalProcessEmitWarning
0 commit comments