bug(chat): Reload retains failed MCP servers after they are disabled or removed
Problem
Disabling optional MCP servers in Codex configuration and clicking Reload in an existing AO chat does not clear their previous failed states. The chat continues showing “2 tool servers did not start” for tools the user intentionally disabled.
Reproduction
- Start a Codex chat with Paper and MCP_DOCKER configured while their local applications are stopped; both fail startup.
- Set
enabled = falsein both[mcp_servers.paper]and[mcp_servers.MCP_DOCKER]in the user Codex configuration. - Wait until the turn finishes, then click Reload in the failure banner.
- Reload succeeds, but both disabled servers remain failed in the conversation snapshot and the banner remains.
Expected: after a successful authoritative configuration/inventory refresh, disabled or removed servers no longer appear as current failures. Preserve failures for servers that are still enabled. Actual: disabled servers retain their historical failed states after repeated reloads.
Verified evidence
Reproduced locally on Windows on September 10, 2026, against PR #5020 head 33ed97c49c3d3bfd0be423e6ac765885a67392a8 with uncommitted local Windows account-storage and MCP reload fixes. This is not a clean-main reproduction.
The local MCP reload fix replaces unsupported detail: "summary" with the provider-declared toolsAndAuthOnly value and only reports positively initialized inventory entries as ready. The stale-state behavior persists after that protocol fix.
Latest verification:
paper enabled = false
MCP_DOCKER enabled = false
POST /api/v1/sessions/<session>/conversation/mcp/reload
HTTP 200, elapsed 5.71 seconds
GET /api/v1/sessions/<session>/conversation
paper: failed
MCP_DOCKER: failed
The screenshot/user report shows the same two-server failure banner remaining after Reload. No credentials or private configuration are included here.
Code findings
backend/internal/service/chat/controller.go:2857:applyMCPServersmerges updates by name intoc.mcpServersand preservesmcpServerOrder; names absent from an update are never removed.controller.go:2915: an empty reload result explicitly returns the previous server list unchanged.controller.go:2930: a nonempty reload result uses the same merge path, so omitted disabled/removed servers also survive.backend/internal/adapters/chatdriver/codexappserver/conversation.go:767: the reload contract returns a server slice without distinguishing a complete inventory from partial notifications or an unavailable inventory.
The merge behavior is appropriate for individual startup notifications, but cannot reconcile removed servers after configuration changes. An empty slice also cannot safely distinguish “no configured servers” from “inventory unavailable.” Do not simply clear every failure on any successful reload; that could hide real enabled-server failures or erase state after an incomplete refresh.
Suggested coverage
- Failed server is disabled/removed, then successful authoritative reload omits it: remove stale failure from snapshot and banner.
- All servers disabled: authoritative empty inventory clears the list.
- Inventory read fails or is partial: retain known state.
- Still-enabled failed server remains visible.
- Startup notifications arriving during reload are reconciled without losing current state.
Related: #3748 covers a nondismissible banner and Reload disabled during an active turn. This report is about stale server state after a successful idle reload, not dismissibility or mid-turn behavior.
New Report
Hit this too, on Linux (Arch, kernel 6.19), AO desktop 0.13.1-nightly.202609170454, codex-cli 0.153.4. Analyzed against a47db0e06.
The project Orchestrator chat showed "5 tool servers did not start" (linear, vercel, github, kapa, gitlab) even though four of those servers are disabled in ~/.codex/config.toml, and github no longer uses an env var.
Stored conversation snapshot (conversations.mcp_servers_json):
linear failed not logged in
context7 ready
vercel failed not logged in
github failed Environment variable GITHUB_TOKEN for MCP server 'github' is not set
kapa failed not logged in
gitlab failed not logged in
Current provider view (codex mcp list):
context7 disabled
github enabled (http_headers_helper, no GITHUB_TOKEN)
gitlab disabled
kapa disabled
linear disabled
vercel disabled
Every row in the snapshot is outdated, including context7: ready for a server that is now disabled. That fits the merge-by-name path in applyMCPServers: Codex reports one server per notification and stops reporting disabled ones, so nothing ever removes the old entries.
Workaround that cleared it locally: with the controller stopped, set mcp_servers_json = NULL for the conversation. The next controller start fills it in again from live notifications.
@codebanditssss is this issue on linux too?
Yes - this has also been reproduced on Linux.
Existing evidence from the report above:
- Arch Linux, kernel 6.19
- AO Desktop
0.13.1-nightly.202609170454 - Codex CLI
0.153.4 - analyzed against commit
a47db0e06
The stored conversation retained stale failed entries for disabled MCP servers (linear, vercel, kapa, and gitlab) and also retained stale context7: ready state after that server was disabled. The current codex mcp list no longer matched the stored mcp_servers_json, which is consistent with applyMCPServers merging reported servers by name without removing servers omitted from the authoritative configuration. Clearing mcp_servers_json while the controller was stopped allowed the next controller start to repopulate it from live notifications.