Skip to content
Python

MCP failure notice: one quiet line + Details + Open Connectors; stable dedupe

Rohit C Prasad6bf6018a1525
diff --git a/coworker/engine.py b/coworker/engine.py
index 71739639..2d4f0165 100644
--- a/coworker/engine.py
+++ b/coworker/engine.py
@@ -283,13 +283,15 @@ class TurnEngine:
return message.get("kind") == "error"
return False
- def _append_notice(self, kind: str, text: Optional[str] = None) -> None:
+ def _append_notice(self, kind: str, text: Optional[str] = None, **fields: Any) -> None:
"""Persist a turn-ending marker (error/interrupted) as a display-only `notice`
message: it survives reload like the transcript does, but `_outbound_messages`
- drops the role so no provider ever sees it."""
+ drops the role so no provider ever sees it. Extra `fields` (e.g. the failing
+ MCP server's name) persist on the message for structured rendering."""
notice: dict[str, Any] = {"role": "notice", "kind": kind, "ts": time.time()}
if text:
notice["text"] = text
+ notice.update({k: v for k, v in fields.items() if v is not None})
self.messages.append(notice)
async def retry(self) -> AsyncIterator[Event]:
diff --git a/coworker/providers/registry.py b/coworker/providers/registry.py
index e4eaa37b..5464c677 100644
--- a/coworker/providers/registry.py
+++ b/coworker/providers/registry.py
@@ -362,7 +362,7 @@ DESCRIPTORS: list[ProviderDescriptor] = [
),
ProviderDescriptor(
name="openai-codex",
- title="ChatGPT (OpenAI subscription)",
+ title="ChatGPT subscription",
needs_key=False,
fields=[],
build=_build_codex,
diff --git a/coworker/server/app.py b/coworker/server/app.py
index fdd7c64b..4343a33d 100644
--- a/coworker/server/app.py
+++ b/coworker/server/app.py
@@ -2383,10 +2383,13 @@ def create_app(manager: SessionManager) -> FastAPI:
# them (drill 2026-08-20: three silent startup failures in a row).
for name, err in manager.pop_mcp_failures(session_id):
detail = f": {err}" if err else ""
+ # `server` makes the notice structured: the GUI renders one quiet line
+ # with the full error behind a disclosure + an Open-Connectors action
+ # (owner ruling 2026-08-21) instead of a wall of stderr.
engine._append_notice(
"mcp_error",
- f"MCP server “{name}” failed to start{detail}"[:300]
- + " — see Settings ▸ Connectors",
+ f"MCP server “{name}” failed to start{detail}"[:500],
+ server=name,
)
# Auto-compaction failure prompt (OPE-27): only an ATTENDED session may be asked
# Retry/Trim — unattended runs auto-trim (the policy in engine._compact_now).
diff --git a/coworker/server/manager.py b/coworker/server/manager.py
index 08dd74b3..baff0a55 100644
--- a/coworker/server/manager.py
+++ b/coworker/server/manager.py
@@ -126,6 +126,14 @@ def _approval_body(request) -> str:
return "\n".join(p for p in (reason, preview) if p)
+def _stable_error(error: str) -> str:
+ """An error string with per-process noise removed, for change detection only:
+ hex object addresses and long digit runs (pids, ports, timestamps) vary between
+ identical failures across relaunches."""
+ stable = re.sub(r"0x[0-9a-fA-F]+", "0xADDR", error or "")
+ return re.sub(r"\d{4,}", "N", stable)
+
+
class SessionManager:
def __init__(
self,
@@ -1259,11 +1267,15 @@ class SessionManager:
def _should_notify_mcp_failure(self, name: str, error: str) -> bool:
"""True once per failure episode: the first session after `name` starts
failing (or its error text changes) notices; unchanged-broken stays quiet.
- Persisted in prefs so an app relaunch doesn't re-stamp the same complaint."""
+ Persisted in prefs so an app relaunch doesn't re-stamp the same complaint.
+ Compared on a NORMALIZED error: stderr often embeds per-process values
+ (0x… object addresses, pids), which made "the same" failure look new on
+ every relaunch and re-stamp every session (owner-hit 2026-08-21)."""
+ stable = _stable_error(error)
notified = self._prefs.setdefault("mcp_notified_errors", {})
- if notified.get(name) == error:
+ if notified.get(name) == stable:
return False
- notified[name] = error
+ notified[name] = stable
self._save_prefs()
return True
diff --git a/surfaces/gui/e2e/fixtures.ts b/surfaces/gui/e2e/fixtures.ts
index 2d8e1925..2331d900 100644
--- a/surfaces/gui/e2e/fixtures.ts
+++ b/surfaces/gui/e2e/fixtures.ts
@@ -352,7 +352,7 @@ const PROVIDERS = [
{ name: "ollama", title: "Ollama (local models)", needs_key: false, fields: [{ key: "base_url", label: "Endpoint", secret: false, required: false, help: "", placeholder: "http://127.0.0.1:11434", default: "http://127.0.0.1:11434" }], configured: true, values: {}, suggested_models: ["qwen3-coder:30b"], key_set_at: null, last_used_at: null },
// openai-codex: the subscription OAuth provider — no key form; the gallery card and
// form render sign-in state instead (auth: "oauth"). Starts signed out.
- { name: "openai-codex", title: "ChatGPT (OpenAI subscription)", needs_key: false, auth: "oauth", signed_in: false, account: null, authorizing: false, last_error: null, blurb: "Sign in with your ChatGPT plan and run OpenAI models through your subscription — no API key. Tokens stay on this machine.", fields: [], configured: false, values: {}, suggested_models: ["gpt-5.6-sol"], key_set_at: null, last_used_at: null },
+ { name: "openai-codex", title: "ChatGPT subscription", needs_key: false, auth: "oauth", signed_in: false, account: null, authorizing: false, last_error: null, blurb: "Sign in with your ChatGPT plan and run OpenAI models through your subscription — no API key. Tokens stay on this machine.", fields: [], configured: false, values: {}, suggested_models: ["gpt-5.6-sol"], key_set_at: null, last_used_at: null },
];
/** Install the API + WebSocket mocks on a page. Returns handles for assertions/seed data. */
diff --git a/surfaces/gui/e2e/seeded-history.spec.ts b/surfaces/gui/e2e/seeded-history.spec.ts
index 0b71d738..c04d97a1 100644
--- a/surfaces/gui/e2e/seeded-history.spec.ts
+++ b/surfaces/gui/e2e/seeded-history.spec.ts
@@ -96,3 +96,34 @@ test("a replayed error notice at the tail offers Retry", async ({ page }) => {
await expect(page.getByText("Error: provider unavailable")).toBeVisible();
await expect(page.getByTestId("notice-retry")).toBeVisible();
});
+
+test("a dead MCP server replays as one quiet line with Details and Open Connectors", async ({
+ page,
+}) => {
+ // Owner ruling 2026-08-21: never a wall of stderr in the transcript — the summary
+ // names the server; the raw error hides behind Details; Open Connectors is the fix path.
+ await seedSessionMessages(page, "pinned-cowork-1", [
+ { role: "user", content: "hi", ts: TS },
+ { role: "assistant", content: "Hello!" },
+ {
+ role: "notice",
+ kind: "mcp_error",
+ server: "sales-db",
+ text: "MCP server “sales-db” failed to start: unhandled errors in a TaskGroup — aws configure export-credentials --profile aicreator exited 255",
+ },
+ ]);
+ await page.goto("/");
+ await page.getByText("Draft the launch note").first().click();
+
+ const line = page.getByTestId("mcp-notice");
+ await expect(line).toContainText("sales-db");
+ await expect(line).toContainText("didn’t start");
+ // The raw error stays hidden until asked for.
+ await expect(page.getByTestId("mcp-notice-detail")).toHaveCount(0);
+ await page.getByTestId("mcp-notice-details").click();
+ await expect(page.getByTestId("mcp-notice-detail")).toContainText("TaskGroup");
+
+ // Open Connectors jumps to the Integrations surface.
+ await page.getByTestId("mcp-notice-connectors").click();
+ await expect(page.getByText("Connectors", { exact: true }).first()).toBeVisible();
+});
diff --git a/surfaces/gui/src/App.tsx b/surfaces/gui/src/App.tsx
index 7563926f..0a7cb212 100644
--- a/surfaces/gui/src/App.tsx
+++ b/surfaces/gui/src/App.tsx
@@ -1895,6 +1895,7 @@ export function App() {
onApprove={approve}
running={running}
onRetry={retry}
+ onOpenConnectors={() => setSurface("integrations")}
onUndoMemory={(id, previous) => void undoMemorySave(id, previous)}
// §33 ref #3: sub-threshold streamed text renders INSIDE the live turn
// group (header when collapsed, quiet line when expanded) — never as a
diff --git a/surfaces/gui/src/components/Transcript.tsx b/surfaces/gui/src/components/Transcript.tsx
index 8827d900..0b347357 100644
--- a/surfaces/gui/src/components/Transcript.tsx
+++ b/surfaces/gui/src/components/Transcript.tsx
@@ -342,6 +342,8 @@ interface Props {
// Re-run the failed turn (no new user message). Offered only on a retriable notice that
// is the transcript tail of an idle session — anywhere else the error is history.
onRetry?: () => void;
+ // mcp_error notices: "Open Connectors" jumps to the Connectors page (Integrations surface).
+ onOpenConnectors?: () => void;
// MEMORY-SPEC §5.1: undo a just-announced write. `previous` (set when the write was
// an edit) is the text to restore; without it the memory is deleted.
onUndoMemory?: (id: number, previous?: string) => void;
@@ -360,7 +362,49 @@ export function retryAnchor(items: Item[]): number {
return -1;
}
-export function Transcript({ items, running, streamingText, onRetry, onUndoMemory }: Props) {
+// One quiet line for a dead MCP server (owner ruling 2026-08-21): the summary names the
+// server; the raw error (stderr excerpts, tracebacks) hides behind a Details disclosure;
+// "Open Connectors" is the fix/remove path. Never a wall of blue text in the transcript.
+function McpNotice({
+ item,
+ onOpenConnectors,
+}: {
+ item: Extract<Item, { kind: "notice" }>;
+ onOpenConnectors?: () => void;
+}) {
+ const [open, setOpen] = useState(false);
+ return (
+ <div className="mcp-notice" data-testid="mcp-notice">
+ <div className="mcp-notice-line">
+ <span aria-hidden>⚠</span>
+ <span className="min-w-0 truncate">{item.text}</span>
+ <button
+ className="mcp-notice-act"
+ data-testid="mcp-notice-details"
+ onClick={() => setOpen((v) => !v)}
+ >
+ Details {open ? "⌃" : "⌄"}
+ </button>
+ {onOpenConnectors && (
+ <button
+ className="mcp-notice-act"
+ data-testid="mcp-notice-connectors"
+ onClick={onOpenConnectors}
+ >
+ Open Connectors
+ </button>
+ )}
+ </div>
+ {open && (
+ <pre className="mcp-notice-detail" data-testid="mcp-notice-detail">
+ {item.detail}
+ </pre>
+ )}
+ </div>
+ );
+}
+
+export function Transcript({ items, running, streamingText, onRetry, onOpenConnectors, onUndoMemory }: Props) {
// §33 grouping: a turn = the maximal run of assistant/tool/resolved-approval items between
// breakers (user, connector, notices, plan/dir requests…). Trailing assistant texts are the
// ANSWER and render as bubbles after the group; interior assistant texts are narration and
@@ -485,6 +529,10 @@ export function Transcript({ items, running, streamingText, onRetry, onUndoMemor
</div>
);
case "notice":
+ if (item.server && item.detail)
+ return (
+ <McpNotice key={bi} item={item} onOpenConnectors={onOpenConnectors} />
+ );
return (
<div className={"notice " + (item.tone === "warn" ? "warn" : "")} key={bi}>
{item.text}
diff --git a/surfaces/gui/src/itemsFromMessages.ts b/surfaces/gui/src/itemsFromMessages.ts
index d78e7ace..cc88bf96 100644
--- a/surfaces/gui/src/itemsFromMessages.ts
+++ b/surfaces/gui/src/itemsFromMessages.ts
@@ -81,7 +81,17 @@ export function itemsFromMessages(messages: ConversationMessage[]): Item[] {
: m.kind === "mcp_error"
? // A configured MCP server failed to start for this session — informational,
// NOT retriable (retry re-runs the model turn, which can't fix a dead server).
- { kind: "notice", tone: "warn", text: m.text || "An MCP server failed to start" }
+ // With a `server` field it renders as one quiet line + disclosure; legacy
+ // notices (no field) keep showing their full text.
+ m.server
+ ? {
+ kind: "notice",
+ tone: "warn",
+ text: `MCP server “${m.server}” didn’t start — its tools are unavailable here`,
+ server: String(m.server),
+ detail: m.text || undefined,
+ }
+ : { kind: "notice", tone: "warn", text: m.text || "An MCP server failed to start" }
: { kind: "notice", tone: "warn", text: "Error: " + (m.text || "unknown"), retriable: true },
);
}
diff --git a/surfaces/gui/src/providers/ProviderSetup.tsx b/surfaces/gui/src/providers/ProviderSetup.tsx
index afe73741..9aca2a87 100644
--- a/surfaces/gui/src/providers/ProviderSetup.tsx
+++ b/surfaces/gui/src/providers/ProviderSetup.tsx
@@ -221,12 +221,10 @@ export function useProviderSetup(opts?: { onSaved?: () => void }): ProviderSetup
const statusFor = (p: ProviderInfo, o?: { lastUsed?: boolean }) => {
if (p.auth === "oauth") {
+ // The card keeps just the state — the account email truncated badly at card
+ // width (owner-hit 2026-08-21); the detail pane shows who is signed in.
if (p.signed_in)
- return (
- <span className="block text-[12px] text-ok font-medium truncate">
- ✓ Signed in{p.account ? <span className="text-muted font-normal"> · {p.account}</span> : ""}
- </span>
- );
+ return <span className="block text-[12px] text-ok font-medium truncate">✓ Signed in</span>;
return <span className="block text-[12px] text-faint truncate">Sign in with your plan</span>;
}
if (p.configured && p.needs_key) {
@@ -248,7 +246,14 @@ export function useProviderSetup(opts?: { onSaved?: () => void }): ProviderSetup
return {
providers,
- ordered: [...providers].sort((a, b) => providerRank(a.name) - providerRank(b.name)),
+ // Alphabetical by display title (owner ruling 2026-08-21: a curated order reads
+ // as vendor bias). The old providerRank curation stays only as the tiebreaker
+ // for identical titles.
+ ordered: [...providers].sort(
+ (a, b) =>
+ a.title.localeCompare(b.title, undefined, { sensitivity: "base" }) ||
+ providerRank(a.name) - providerRank(b.name),
+ ),
refreshProviders,
sel,
info,
diff --git a/surfaces/gui/src/styles.css b/surfaces/gui/src/styles.css
index 45e1dcbc..612bad28 100644
--- a/surfaces/gui/src/styles.css
+++ b/surfaces/gui/src/styles.css
@@ -2018,3 +2018,21 @@ html[data-platform="linux"] ::-webkit-scrollbar-thumb:hover { background-color:
.artifact-menu-item:hover { background: var(--paper); }
.artifact-menu-item svg { color: var(--muted); flex: none; }
.artifact-menu-div { height: 1px; margin: 5px 4px; background: var(--line); }
+
+/* One-line MCP failure notice (owner ruling 2026-08-21): quiet summary + Details
+ disclosure + Open Connectors. Replaces the old full-error accent-blue paragraph. */
+.mcp-notice { max-width: 768px; margin: 0 auto; font-size: var(--fs-ui); color: var(--muted); }
+.mcp-notice-line { display: flex; align-items: center; gap: 8px; justify-content: center; }
+.mcp-notice-line > span[aria-hidden] { color: var(--warn-ink); flex: none; }
+.mcp-notice-act {
+ font: inherit; font-size: 12px; border: 0; background: none; color: var(--faint);
+ cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong);
+ text-underline-offset: 3px; padding: 0; flex: none;
+}
+.mcp-notice-act:hover { color: var(--ink); }
+.mcp-notice-detail {
+ margin: 8px auto 0; padding: 10px 12px; max-width: 640px; overflow-x: auto;
+ background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
+ font-family: var(--mono); font-size: var(--fs-mono); line-height: 1.5;
+ color: var(--muted); white-space: pre-wrap; text-align: left;
+}
diff --git a/surfaces/gui/src/types.ts b/surfaces/gui/src/types.ts
index ce0ef843..34c6080f 100644
--- a/surfaces/gui/src/types.ts
+++ b/surfaces/gui/src/types.ts
@@ -188,7 +188,16 @@ export type Item =
questions?: GroupedQuestion[];
resolved?: string;
}
- | { kind: "notice"; tone: "info" | "warn"; text: string; retriable?: boolean }
+ | {
+ kind: "notice";
+ tone: "info" | "warn";
+ text: string;
+ retriable?: boolean;
+ // mcp_error notices: the failing server's name + the full error, rendered as one
+ // quiet line with the detail behind a disclosure and an Open-Connectors action.
+ server?: string;
+ detail?: string;
+ }
// MEMORY-SPEC §5.1: the save notice, inline in the conversation where the user is
// already looking (a corner toast vanished before it could be read or undone —
// owner-hit 2026-07-28). Stays put. `previous` is set when an existing memory was
diff --git a/tests/test_mcp.py b/tests/test_mcp.py
index 0148516a..437c6e26 100644
--- a/tests/test_mcp.py
+++ b/tests/test_mcp.py
@@ -579,3 +579,44 @@ async def test_notice_dedupe_survives_restart(tmp_path, monkeypatch):
monkeypatch.setattr(reborn.mcp, "last_stderr", lambda n: None)
await reborn.prepare_mcp_tools("s2", workspace=str(tmp_path))
assert reborn.pop_mcp_failures("s2") == []
+
+
+async def test_notice_dedupe_ignores_per_process_noise(tmp_path, monkeypatch):
+ """Errors that embed per-process values (object addresses, pids) are the SAME
+ failure across relaunches — they must not re-stamp every session (owner-hit
+ 2026-08-21: a botocore error with a 0x… address re-noticed on every restart)."""
+ from types import SimpleNamespace
+
+ from coworker.server import SessionManager
+
+ server = SimpleNamespace(
+ name="flaky", transport="stdio", url=None, auth=None, enabled=True, include_tools=None, exclude_tools=None, requires_approval=True
+ )
+ monkeypatch.setattr(
+ "coworker.server.manager.load_mcp_servers", lambda *a, **k: [server]
+ )
+
+ errors = ["credential process <function f at 0x102ab40f0> pid 84121"]
+
+ async def ensure(s, **kw):
+ raise RuntimeError(errors[0])
+
+ mgr = SessionManager(data_dir=tmp_path / "data")
+ monkeypatch.setattr(mgr.mcp, "ensure", ensure)
+ monkeypatch.setattr(mgr.mcp, "last_stderr", lambda n: None)
+ await mgr.prepare_mcp_tools("s1", workspace=str(tmp_path))
+ assert [n for n, _ in mgr.pop_mcp_failures("s1")] == ["flaky"]
+
+ # "Relaunch": same failure, new address + pid — still quiet.
+ errors[0] = "credential process <function f at 0x1070340f0> pid 99017"
+ reborn = SessionManager(data_dir=tmp_path / "data")
+ monkeypatch.setattr(reborn.mcp, "ensure", ensure)
+ monkeypatch.setattr(reborn.mcp, "last_stderr", lambda n: None)
+ await reborn.prepare_mcp_tools("s2", workspace=str(tmp_path))
+ assert reborn.pop_mcp_failures("s2") == []
+
+ # A genuinely different error still notices.
+ errors[0] = "connection refused"
+ await reborn.prepare_mcp_tools("s3", workspace=str(tmp_path))
+ assert [n for n, _ in reborn.pop_mcp_failures("s3")] == ["flaky"]