From 3dae5d4aab96a9dd5d8422676270b7ad5deef640 Mon Sep 17 00:00:00 2001 From: ranxianglei Date: Sun, 25 Oct 2026 20:32:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20every=20surface=20self-identifies?= =?UTF-8?q?=20its=20lane=20=E2=80=94=20status/overview=20origin=20field,?= =?UTF-8?q?=20web=20sys.lane=20row,=20/acp=20panels=20via=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Multi-lane machines (proxy lane + per-agent test lanes) made version-only surfaces ambiguous: three lanes can share 0.1.206 while only one carries the commit under test. Now /__bili/status and /__bili/overview expose origin (the host:port this lane was addressed by), the web Overview card shows a running-lane row, the /acp panel version line appends '· via ', and the pi / dsh / dsh-native / opencode armed-idle notices say 'via ' (armedIdleNotice grows an optional base argument). --- src/agent/dsh-acp.ts | 4 ++-- src/agent/dsh-native.ts | 6 +++--- src/agent/opencode-acp-command.ts | 2 +- src/agent/pi.ts | 2 +- src/agent/shared.ts | 4 ++-- src/plugin.ts | 2 +- src/server/admin.ts | 13 ++++++++----- src/web/client.ts | 1 + src/web/i18n.ts | 2 ++ src/web/page.ts | 1 + tests/dsh-acp.test.ts | 2 +- 11 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/agent/dsh-acp.ts b/src/agent/dsh-acp.ts index ff31c463a5..88cf477e5a 100644 --- a/src/agent/dsh-acp.ts +++ b/src/agent/dsh-acp.ts @@ -36,7 +36,7 @@ async function statusOutcome(): Promise { } const version = await fetchProxyVersion(base); if (version) { - return { kind: "success", text: armedIdleNotice(version) }; + return { kind: "success", text: armedIdleNotice(version, base) }; } return { kind: "error", @@ -72,7 +72,7 @@ async function cacheOutcome(): Promise { version = undefined; } if (version) { - return { kind: "success", text: `billion-context@${version} — proxy connected, compression armed. No model request yet; send one, then run /acp-cache again.` }; + return { kind: "success", text: `billion-context@${version} — proxy connected via ${base}, compression armed. No model request yet; send one, then run /acp-cache again.` }; } return { kind: "error", diff --git a/src/agent/dsh-native.ts b/src/agent/dsh-native.ts index e5d5bd479b..1de8536674 100644 --- a/src/agent/dsh-native.ts +++ b/src/agent/dsh-native.ts @@ -1463,14 +1463,14 @@ async function statusOutcome(ctx: PluginContext, invocation?: CommandInvocation) const version = await fetchProxyVersion(base); return { kind: "success", - text: `${wireNote}billion-context${version ? `@${version}` : ""} — proxy connected, compression armed. Runtime info${typeof ri.source === "string" ? ` (${ri.source})` : ""}: ${parts.join(" ")}. No model request yet; send one, then run /acp again for the full panel.`, + text: `${wireNote}billion-context${version ? `@${version}` : ""} — proxy connected via ${base}, compression armed. Runtime info${typeof ri.source === "string" ? ` (${ri.source})` : ""}: ${parts.join(" ")}. No model request yet; send one, then run /acp again for the full panel.`, }; } const version = await fetchProxyVersion(base); if (version) { return { kind: "success", - text: `${wireNote}billion-context@${version} — proxy connected, compression armed. No model request seen yet; send one, then run /acp again.`, + text: `${wireNote}billion-context@${version} — proxy connected via ${base}, compression armed. No model request seen yet; send one, then run /acp again.`, }; } return { @@ -1518,7 +1518,7 @@ async function cacheOutcome(ctx: PluginContext, invocation?: CommandInvocation): version = undefined; } if (version) { - return { kind: "success", text: `billion-context@${version} — proxy connected, compression armed. No model request seen yet; send one, then run /acp-cache again.` }; + return { kind: "success", text: `billion-context@${version} — proxy connected via ${base}, compression armed. No model request seen yet; send one, then run /acp-cache again.` }; } return { kind: "error", diff --git a/src/agent/opencode-acp-command.ts b/src/agent/opencode-acp-command.ts index 20a029c7bc..4c04c18a17 100644 --- a/src/agent/opencode-acp-command.ts +++ b/src/agent/opencode-acp-command.ts @@ -123,7 +123,7 @@ export function createAcpCommandHooks(getProxyBase: () => string | undefined, ct } catch { version = undefined; } - text = version !== undefined ? armedIdleNotice(version) : noSessionWarning(); + text = version !== undefined ? armedIdleNotice(version, proxyBase) : noSessionWarning(); } else { text = "bili: proxy returned no status panel"; } diff --git a/src/agent/pi.ts b/src/agent/pi.ts index bef3be815d..0fc7598aa2 100644 --- a/src/agent/pi.ts +++ b/src/agent/pi.ts @@ -1137,7 +1137,7 @@ export function createBiliPlugin(agentOverride?: string, opts?: { retryIntervalM version = undefined; } if (version !== undefined) { - notify(armedIdleNotice(version), "info"); + notify(armedIdleNotice(version, proxyBase), "info"); } else { notify(noSessionWarning(), "warning"); } diff --git a/src/agent/shared.ts b/src/agent/shared.ts index de88a2d000..9770212b33 100644 --- a/src/agent/shared.ts +++ b/src/agent/shared.ts @@ -487,8 +487,8 @@ export const V2_SYNTHETIC_TEXT = "[bili-acp-status] ACP status panel was display /** Armed-but-idle /acp notice (proxy live, no model request sent yet). One * source of truth for pi / dsh / opencode (#883). */ -export function armedIdleNotice(version: string): string { - return `billion-context@${version} — proxy connected, compression armed. No model request yet; send one, then run /acp again.`; +export function armedIdleNotice(version: string, base?: string): string { + return `billion-context@${version} — proxy connected${base ? ` via ${base}` : ""}, compression armed. No model request yet; send one, then run /acp again.`; } /** Fallback when the version probe also fails — a warning, not an info notice. */ diff --git a/src/plugin.ts b/src/plugin.ts index 29a7de3d90..55024362d1 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -1752,7 +1752,7 @@ export function handlePluginStatus(conversationId: string, res: import("node:htt // same addition so the Session-only derivation (unpruned − sent) still // isolates pruned originals on one scale. panel = buildStatusPanel({ - version: `billion-context@${PROXY_VERSION}${BUILD_COMMIT && BUILD_COMMIT !== "unknown" ? ` (${BUILD_COMMIT})` : ""} · pack: ${session.meta.activePack ?? "default"}${deps.inlineLane ? " · inline" : ""}`, + version: `billion-context@${PROXY_VERSION}${BUILD_COMMIT && BUILD_COMMIT !== "unknown" ? ` (${BUILD_COMMIT})` : ""} · pack: ${session.meta.activePack ?? "default"}${deps.inlineLane ? " · inline" : ""}${deps.webOrigin ? ` · via ${deps.webOrigin}` : ""}`, // #2671: effective storage mode — legacy/shadow/full, including // the encryption-blocked downgrade. Display-only, from the env the // store actually resolved. diff --git a/src/server/admin.ts b/src/server/admin.ts index 9c127196b6..bd0fb963e9 100644 --- a/src/server/admin.ts +++ b/src/server/admin.ts @@ -229,9 +229,9 @@ export async function handleAdminRoute(req: http.IncomingMessage, res: http.Serv if (req.method === "GET" && req.url === "/__bili/stats") return sendStats(res); if (req.method === "GET" && req.url?.startsWith("/__bili/cache-report")) return sendCacheReport(res, req.url); if (req.method === "GET" && req.url?.startsWith("/__bili/session-report")) return sendSessionReport(res, req.url); - if (req.method === "GET" && req.url === "/__bili/status") return sendStatus(res, opts); + if (req.method === "GET" && req.url === "/__bili/status") return sendStatus(res, opts, typeof req.headers.host === "string" ? req.headers.host : undefined); if (req.method === "GET" && req.url === "/__bili/resign") return sendResignStatus(res); - if (req.method === "GET" && req.url === "/__bili/overview") return sendOverview(res, opts); + if (req.method === "GET" && req.url === "/__bili/overview") return sendOverview(res, opts, typeof req.headers.host === "string" ? req.headers.host : undefined); if (req.method === "GET" && (req.url === "/__bili/sessions" || req.url?.startsWith("/__bili/sessions?"))) return sendWebSessions(res, req); if (req.method === "GET" && req.url?.startsWith("/__bili/logs")) return sendWebLogs(res, req); if (req.method === "GET" && req.url?.startsWith("/__bili/diagnostics")) return sendDiagnostics(res, req.url); @@ -1169,7 +1169,9 @@ function updateReadyPayload(): { kind: "available" | "ready"; version: string; s return updateBannerPayload(getUpdateVisibility(VERSION)); } -async function sendStatus(res: http.ServerResponse, opts: ProxyOptions): Promise { +// laneHost: the host:port this lane was addressed by (req.headers.host) — surfaces on +// the status/overview wires so multi-lane machines can tell instances apart. +async function sendStatus(res: http.ServerResponse, opts: ProxyOptions, laneHost?: string): Promise { let diskVersion: string | undefined; let stale = false; let lastInstall: Awaited>; @@ -1190,7 +1192,7 @@ async function sendStatus(res: http.ServerResponse, opts: ProxyOptions): Promise loggerLog("warn", `split-session canary (#2170): conversation ${w.base} has live traffic under multiple session keys (design persona forks are excluded): ${w.sessions.map((s) => `${s.id} (requests=${s.requests})`).join("; ")}. For a non-persona host this is the #2165 failure shape (stolen anchor / never-compressing split) — investigate if unexpected.`); } } - res.end(JSON.stringify({ version: VERSION, commit: BUILD_COMMIT, diskVersion, stale, lastInstall, updateReady: updateReadyPayload(), autoRestartOnUpdate: opts.autoRestartOnUpdate, advisory: currentAdvisoryPayload(), updatePolicy: updatePolicyPayload(), pluginAdvisories: detectCostAdvisories(process.env), inFlight: totalInFlight(), splitSessions: splitWarnings, conflicts: summarizeConflicts(listSessions()), storage: storageStatusWire(), snapshotShadow: snapshotShadowStatusWire(), attribution: attributionStatusWire() }, null, 2)); + res.end(JSON.stringify({ version: VERSION, commit: BUILD_COMMIT, origin: laneHost ?? null, diskVersion, stale, lastInstall, updateReady: updateReadyPayload(), autoRestartOnUpdate: opts.autoRestartOnUpdate, advisory: currentAdvisoryPayload(), updatePolicy: updatePolicyPayload(), pluginAdvisories: detectCostAdvisories(process.env), inFlight: totalInFlight(), splitSessions: splitWarnings, conflicts: summarizeConflicts(listSessions()), storage: storageStatusWire(), snapshotShadow: snapshotShadowStatusWire(), attribution: attributionStatusWire() }, null, 2)); } // #2090 plan A — read-only view backing the web UI's "Signed upstreams" card: @@ -1214,7 +1216,7 @@ function sendResignStatus(res: http.ServerResponse): void { }, null, 2)); } -async function sendOverview(res: http.ServerResponse, opts: ProxyOptions): Promise { +async function sendOverview(res: http.ServerResponse, opts: ProxyOptions, laneHost?: string): Promise { let diskVersion: string | undefined; let stale = false; let lastInstall: Awaited>; @@ -1238,6 +1240,7 @@ async function sendOverview(res: http.ServerResponse, opts: ProxyOptions): Promi res.end(JSON.stringify({ overview, version: VERSION, + origin: laneHost ?? null, commit: BUILD_COMMIT, diskVersion, stale, diff --git a/src/web/client.ts b/src/web/client.ts index 1670879b63..3cfc74910d 100644 --- a/src/web/client.ts +++ b/src/web/client.ts @@ -1019,6 +1019,7 @@ function changelogCatOf(rawLine) { pb.appendChild(tr); }); $("sys-version").textContent = d.version ? (d.commit ? d.version + " (" + d.commit + ")" : d.version) : "?"; + $("sys-lane").textContent = d.origin || t("common.none"); $("sys-disk-version").textContent = d.diskVersion || t("common.none"); $("sys-inflight").textContent = String(d.inFlight || 0); const bt = d.blindTunnels || {}; diff --git a/src/web/i18n.ts b/src/web/i18n.ts index fe4ffb9dc9..ffbcd72967 100644 --- a/src/web/i18n.ts +++ b/src/web/i18n.ts @@ -109,6 +109,7 @@ export const MESSAGES: Record> = { "ov.view_all": "查看全部 →", "sys.title": "系统状态", "sys.version": "版本", + "sys.lane": "运行实例", "sys.disk_version": "磁盘版本", "sys.inflight": "进行中请求", "sys.blind_tunnels": "MITM 盲隧道(CONNECT 后无 TLS)", @@ -724,6 +725,7 @@ export const MESSAGES: Record> = { "ov.view_all": "View all →", "sys.title": "System status", "sys.version": "Version", + "sys.lane": "Running lane", "sys.disk_version": "On-disk version", "sys.inflight": "In-flight requests", "sys.blind_tunnels": "MITM blind tunnels (CONNECT without TLS)", diff --git a/src/web/page.ts b/src/web/page.ts index 9d47752098..35e6d7bf8a 100644 --- a/src/web/page.ts +++ b/src/web/page.ts @@ -57,6 +57,7 @@ export function renderPage(origin: string, version: string, embed = false, theme
${zh("sys.title")}
${zh("sys.version")}
${zh("sys.disk_version")}
+
${zh("sys.lane")}
${zh("sys.inflight")}
0
${zh("sys.blind_tunnels")}
0
diff --git a/tests/dsh-acp.test.ts b/tests/dsh-acp.test.ts index 71b97ad1ba..b58d0335ec 100644 --- a/tests/dsh-acp.test.ts +++ b/tests/dsh-acp.test.ts @@ -89,7 +89,7 @@ test("/acp on an armed-but-idle proxy renders the idle notice", async () => { }, ); assert.equal(outcome.kind, "success"); - assert.match(outcome.text, /billion-context@9\.9\.9 — proxy connected, compression armed/); + assert.match(outcome.text, /billion-context@9\.9\.9 — proxy connected via .+, compression armed/); }); test("/acp when the proxy is unreachable reports an error", async () => { From 18c4d5d272d54e4f7ad55904deb2d0f207634c8a Mon Sep 17 00:00:00 2001 From: ci-check Date: Sun, 25 Oct 2026 21:33:42 +0800 Subject: [PATCH 2/2] fix: report lane origin on the two idle surfaces #4698 missed (hermes, opencode-v2) Review of PR #4698 found its "every surface self-identifies its lane" goal missed two surfaces that carry their own idle notices instead of routing through armedIdleNotice(): - hermes-plugin /acp + /acp-cache idle lines now say "proxy connected via , compression armed" (origin was already in scope at both sites, guarded by the existing !origin early-return) - opencode-v2 /acp idle lines now say "proxy connected via , no ACP session yet" (base = state.proxyBase ?? proxyBaseFromEnv(), guarded by the existing !base early-error) Test pins updated to assert the via clause against the real fake-proxy origin (http://127.0.0.1:). Targeted verification: hermes-native + opencode-v2 + dsh-acp + opencode-acp-command + plugin-agent + acp-panel + web-sessions + advisory-endpoint-parity + storage-mode-label + dsh-native + build-info = 297 pass / 0 fail / 1 skip; tsc clean; unused-export gate clean. --- hermes-plugin/__init__.py | 4 ++-- src/agent/opencode-v2.ts | 4 ++-- tests/hermes-native.test.ts | 2 +- tests/opencode-v2.test.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hermes-plugin/__init__.py b/hermes-plugin/__init__.py index 772408a8f4..75099f0a7c 100644 --- a/hermes-plugin/__init__.py +++ b/hermes-plugin/__init__.py @@ -1205,7 +1205,7 @@ def acp_command(raw_args: str = "", *, session_id: str = "") -> Optional[str]: return panel.strip() version = _fetch_version(origin) if version: - return (f"billion-context@{version} — proxy connected, compression armed. " + return (f"billion-context@{version} — proxy connected via {origin}, compression armed. " "No model request yet; send one, then run /acp again.") return f"bili: proxy not reachable at {origin} — is the bili proxy still running?" except Exception as exc: @@ -1230,7 +1230,7 @@ def acp_cache_command(raw_args: str = "", *, session_id: str = "") -> Optional[s if not isinstance(cid, str) or not cid: version = _fetch_version(origin) if version: - return (f"billion-context@{version} — proxy connected, compression armed. " + return (f"billion-context@{version} — proxy connected via {origin}, compression armed. " "No model request yet; send one, then run /acp-cache again.") return f"bili: proxy not reachable at {origin} — is the bili proxy still running?" code, payload = http_post_json( diff --git a/src/agent/opencode-v2.ts b/src/agent/opencode-v2.ts index 4fc531898e..c3dea872bf 100644 --- a/src/agent/opencode-v2.ts +++ b/src/agent/opencode-v2.ts @@ -553,7 +553,7 @@ export function createOpencodeV2Setup(options: OpencodeV2SetupOptions = {}): (ct version = undefined; } text = version !== undefined - ? `billion-context@${version} — proxy connected, no ACP session yet. Send a model request, then run /acp again.` + ? `billion-context@${version} — proxy connected via ${base}, no ACP session yet. Send a model request, then run /acp again.` : "bili: no ACP session yet (send a model request first, then run /acp)"; } else if (!status) { // fetchStatus soft-fails to undefined both when the proxy 404s an absent or @@ -561,7 +561,7 @@ export function createOpencodeV2Setup(options: OpencodeV2SetupOptions = {}): (ct // manifest to claim "connected" only when it answers. const version = await fetchProxyVersion(base).catch(() => undefined); text = version !== undefined - ? `billion-context@${version} — proxy connected, no ACP session yet. Send a model request, then run /acp again.` + ? `billion-context@${version} — proxy connected via ${base}, no ACP session yet. Send a model request, then run /acp again.` : "bili: cannot reach the bili proxy (run `bili start`, then run /acp again)"; } else { const errText = status?.error; diff --git a/tests/hermes-native.test.ts b/tests/hermes-native.test.ts index 2052004123..0ff8532d7d 100644 --- a/tests/hermes-native.test.ts +++ b/tests/hermes-native.test.ts @@ -1114,7 +1114,7 @@ describe("in-session slash commands (#3697)", () => { }); assert.ok(out, err); assert.match(out!.cmd_acp!, /^billion-context@test-1/); - assert.match(out!.cmd_acp!, /proxy connected, compression armed\. No model request yet; send one, then run \/acp again\./); + assert.match(out!.cmd_acp!, /proxy connected via http:\/\/127\.0\.0\.1:\d+, compression armed\. No model request yet; send one, then run \/acp again\./); assert.equal( out!.cmd_acp_cache, "bili: no ACP session yet for this conversation (send a model request first, then run /acp-cache)", diff --git a/tests/opencode-v2.test.ts b/tests/opencode-v2.test.ts index 3d1548766a..e57190ed9b 100644 --- a/tests/opencode-v2.test.ts +++ b/tests/opencode-v2.test.ts @@ -435,7 +435,7 @@ test("v2 setup: first /acp before any model request shows the idle notice (proxy const acp = fake.addedCommands.find((c) => c.name === "acp")!; await acp.execute({ sessionID: "ses_acp_idle" }); await until(() => fake.syntheticCalls.length === 1); - assert.match(fake.syntheticCalls[0].description!, /billion-context@9\.9\.9-test \u2014 proxy connected, no ACP session yet/); + assert.match(fake.syntheticCalls[0].description!, /billion-context@9\.9\.9-test \u2014 proxy connected via http:\/\/127\.0\.0\.1:\d+, no ACP session yet/); assert.match(fake.syntheticCalls[0].text, /not an instruction/); assert.equal(fake.syntheticCalls[0].resume, false); } finally {