Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(mcp-market): retain source badges in stale results

vastsa8f07fad1305c
diff --git a/apps/desktop/src/components/settings/McpMarketPanel.tsx b/apps/desktop/src/components/settings/McpMarketPanel.tsx
index 71c695351..72693454c 100644
--- a/apps/desktop/src/components/settings/McpMarketPanel.tsx
+++ b/apps/desktop/src/components/settings/McpMarketPanel.tsx
@@ -236,11 +236,6 @@ export function McpMarketPanel({
id ? sources.find((source) => source.id === id)?.name : undefined;
- const remoteIds = useMemo(
- () => new Set(remote.entries.map((entry) => entry.id)),
- [remote.entries],
- );
-
/**
* The last successful list stands in only while the current query has
* nothing of its own to show — a failure, or the retry that follows one.
@@ -253,6 +248,10 @@ export function McpMarketPanel({
remote.entries.length === 0 &&
(remote.status === "error" || remote.status === "loading");
const displayEntries = showingSnapshot && snapshotForQuery ? snapshotForQuery.entries : remote.entries;
+ const remoteIds = useMemo(
+ () => new Set(displayEntries.map((entry) => entry.id)),
+ [displayEntries],
+ );
const visible = useMemo(() => {
const query = search.trim().toLocaleLowerCase();
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 400f8aa84..39af82dd5 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -16699,10 +16699,11 @@ plugin-form fixtures in an isolated temporary directory at runtime.
- **Expected**: Both markets repeat the current search, show loading while the
request runs, retain a Retry action for partial failures, and clear the failed
source after recovery. After a successful load, a later failure keeps that
- list on screen, says when it was taken, and still offers Retry; the retained
- list disappears once a retry succeeds, and it never stands in for a
- different query or for a failure with nothing loaded. The test makes no live
- network request and does not change the main-process network policy.
+ list on screen, says when it was taken, retains each remote source badge,
+ and still offers Retry; the retained list disappears once a retry succeeds,
+ and it never stands in for a different query or for a failure with nothing
+ loaded. The test makes no live network request and does not change the
+ main-process network policy.
- **Specs linked**: `04-ux/06-settings-ia.md`, ADR 0177, ADR 0272
- **Acceptance**: Quality
- **Milestone**: M6+
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 23a307952..45136145b 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -8753,7 +8753,7 @@ runner 会在运行时的隔离临时目录中生成六个插件形态 fixture
- **前提条件**:渲染技能市场和 MCP 市场面板,并在 IPC 边界模拟市场 API。每个 API 依次返回全部失败、一个来源失败的结果、完整成功结果。第二组先加载成功、随后失败、重试后恢复;第三组在成功后切换搜索词再失败,使快照属于另一个查询;第四组在从未成功过的情况下失败。
- **步骤**:打开两个市场;全部失败后点击重试;确认加载播报和恢复的目录条目;部分失败后再次点击重试。随后先加载出列表、令下一次查询失败、重试,再切换搜索词后失败一次。
-- **预期**:两个市场都按当前查询重新请求,期间显示加载状态;部分来源失败时仍有重试入口;来源恢复后失败项清除。成功加载过后再遇失败,列表保留上次成功加载的结果并标注时间,重试入口保留;重试成功后保留列表消失,且该列表不回答其他查询、也不在从未成功过时出现。测试不访问公网,也不改变主进程网络策略。
+- **预期**:两个市场都按当前查询重新请求,期间显示加载状态;部分来源失败时仍有重试入口;来源恢复后失败项清除。成功加载过后再遇失败,列表保留上次成功加载的结果并标注时间,MCP 条目的来源角标也保留,重试入口保留;重试成功后保留列表消失,且该列表不回答其他查询、也不在从未成功过时出现。测试不访问公网,也不改变主进程网络策略。
- **链接规格**:`04-ux/06-settings-ia.md`、ADR 0177、ADR 0272
- **验收**:Quality
- **里程碑**:M6+
diff --git a/scripts/e2e/market-retry.tsx b/scripts/e2e/market-retry.tsx
index 2f58be190..9b708c3fe 100644
--- a/scripts/e2e/market-retry.tsx
+++ b/scripts/e2e/market-retry.tsx
@@ -220,6 +220,10 @@ globalThis.marketRetryProbe = async () => {
await until(() => status().includes(i18n.t("settings.mcpMarket.remoteError")), `${locale}: MCP snapshot run 2 did not fail`);
assert(snapshotLine(), `${locale}: MCP failure with a snapshot shows no snapshot line`);
assert(container.textContent?.includes("Recovered Server") === true, `${locale}: MCP retained list is missing`);
+ assert(
+ container.querySelector(".mcpm-badge.is-remote"),
+ `${locale}: retained MCP entry lost its remote source badge`,
+ );
}
return { ok: true };
} finally {