diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 93cfaebf9f..11611ba9dc 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Fixed + +- Fixed `startup.quiet` leaving MCP and LSP startup status events visible during launch ([#2639](https://github.com/can1357/oh-my-pi/issues/2639)). + ## [15.13.3] - 2026-06-15 ### Added diff --git a/packages/coding-agent/src/modes/interactive-mode.ts b/packages/coding-agent/src/modes/interactive-mode.ts index 5ec4da69d6..b6aa4df97a 100644 --- a/packages/coding-agent/src/modes/interactive-mode.ts +++ b/packages/coding-agent/src/modes/interactive-mode.ts @@ -542,6 +542,7 @@ export class InteractiveMode implements InteractiveModeContext { if (eventBus) { this.#eventBusUnsubscribers.push( eventBus.on(LSP_STARTUP_EVENT_CHANNEL, data => { + if (this.settings.get("startup.quiet")) return; this.#handleLspStartupEvent(data as LspStartupEvent); }), ); @@ -551,6 +552,7 @@ export class InteractiveMode implements InteractiveModeContext { logger.warn("Ignoring malformed mcp:connecting event", { data }); return; } + if (this.settings.get("startup.quiet")) return; this.showStatus(formatMCPConnectingMessage(data.serverNames)); }), ); diff --git a/packages/coding-agent/src/sdk.ts b/packages/coding-agent/src/sdk.ts index cc08d02d86..06e45aea0c 100644 --- a/packages/coding-agent/src/sdk.ts +++ b/packages/coding-agent/src/sdk.ts @@ -1608,8 +1608,9 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {} let startDeferredMCPDiscovery: | ((liveSession: AgentSession, activation: DeferredMCPActivation) => void) | undefined; + const startupQuiet = settings.get("startup.quiet"); const onMCPConnecting = (serverNames: string[]) => { - if (!options.hasUI || serverNames.length === 0) return; + if (!options.hasUI || startupQuiet || serverNames.length === 0) return; eventBus.emit(MCP_CONNECTING_EVENT_CHANNEL, { serverNames } satisfies McpConnectingEvent); }; const mcpDiscoverOptions = { @@ -2696,7 +2697,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {} type: "completed", servers: result.servers, }; - eventBus.emit(LSP_STARTUP_EVENT_CHANNEL, event); + if (!startupQuiet) eventBus.emit(LSP_STARTUP_EVENT_CHANNEL, event); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); logger.warn("LSP server warmup failed", { cwd, error: errorMessage }); @@ -2708,7 +2709,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {} type: "failed", error: errorMessage, }; - eventBus.emit(LSP_STARTUP_EVENT_CHANNEL, event); + if (!startupQuiet) eventBus.emit(LSP_STARTUP_EVENT_CHANNEL, event); } })(); } diff --git a/packages/coding-agent/test/interactive-mode-lsp-startup.test.ts b/packages/coding-agent/test/interactive-mode-lsp-startup.test.ts index 4142527a5c..10e49a2538 100644 --- a/packages/coding-agent/test/interactive-mode-lsp-startup.test.ts +++ b/packages/coding-agent/test/interactive-mode-lsp-startup.test.ts @@ -119,4 +119,16 @@ describe("InteractiveMode LSP startup welcome banner", () => { expect(findServerLine()).toContain(theme.status.enabled); expect(findServerLine()).not.toContain(theme.status.pending); }); + + it("does not render LSP startup warnings when startup.quiet is enabled", () => { + session.settings.set("startup.quiet", true); + const showWarningSpy = vi.spyOn(mode, "showWarning").mockImplementation(() => {}); + + eventBus.emit(LSP_STARTUP_EVENT_CHANNEL, { + type: "failed", + error: "rust-analyzer timed out", + } satisfies LspStartupEvent); + + expect(showWarningSpy).not.toHaveBeenCalled(); + }); }); diff --git a/packages/coding-agent/test/interactive-mode-mcp-connecting.test.ts b/packages/coding-agent/test/interactive-mode-mcp-connecting.test.ts index 166a2394ba..cb1f67cf1e 100644 --- a/packages/coding-agent/test/interactive-mode-mcp-connecting.test.ts +++ b/packages/coding-agent/test/interactive-mode-mcp-connecting.test.ts @@ -103,6 +103,17 @@ describe("InteractiveMode MCP connecting banner", () => { expect(showStatusSpy).toHaveBeenCalledWith(formatMCPConnectingMessage(serverNames)); }); + it("does not render the mcp:connecting status when startup.quiet is enabled", () => { + session.settings.set("startup.quiet", true); + const showStatusSpy = vi.spyOn(mode, "showStatus").mockImplementation(() => {}); + + eventBus.emit(MCP_CONNECTING_EVENT_CHANNEL, { + serverNames: ["sequential", "critic"], + } satisfies McpConnectingEvent); + + expect(showStatusSpy).not.toHaveBeenCalled(); + }); + it("rejects a malformed mcp:connecting payload via the guard instead of letting it throw", () => { const showStatusSpy = vi.spyOn(mode, "showStatus").mockImplementation(() => {}); const warnSpy = vi.spyOn(logger, "warn").mockImplementation(() => {});