From 9f777ff43e47f1053b4bd8a18d994dff00a13500 Mon Sep 17 00:00:00 2001 From: uncle6me-web Date: Fri, 31 Jul 2026 15:34:27 +0800 Subject: [PATCH] =?UTF-8?q?t161+t162=20=E4=BF=AE=20leo=20prod=20=E5=AF=A6?= =?UTF-8?q?=E6=92=9E=E5=85=A9=E7=97=85=EF=BC=9A=E5=BA=AB=E6=B8=85=E5=96=AE?= =?UTF-8?q?=E9=9D=9C=E9=BB=98=E7=A9=BA=E7=99=BD=EF=BC=8F=E3=80=8C=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E6=9B=B4=E6=96=B0=E3=80=8D=E5=81=87=E8=AD=A6=E5=A0=B1?= =?UTF-8?q?=E8=BF=B4=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit t162(假警報,實錘):daemon cloudVersionStale() 讀 cypher /health 的 bundle_version 比對 minCloudBuilt(2026-07-28),但 **/health 從來只回 {ok:true}、沒有這個欄位** ⇒ 恆讀到空字串 ⇒ 恆判 stale ⇒ 「知識庫需要更新」永遠不消失,重裝也沒用 (leo:「按下就跳到 install,但重新更新後並不會消失,這個訊息是幹嘛的?」)。 安裝器其實一直有注入 ARCRUN_BUNDLE_VERSION(worker.js:819),只是沒人吐出來。 修:/health 讀該 var 誠實回報(未注入則省略欄位=老實例,daemon 判 stale 是對的)。 新 bundle 注入值 2026-07-31+ ≥ 2026-07-28 ⇒ 重裝後警報自然消失。 t161(庫清單空白):portal 前端 guard401 → dropSession() **靜默**清 token 跳登入頁, 畫面不說任何原因 ⇒ 用戶看到的是「庫不見了」而非「請重新登入」(leo:「實際上根本 沒連上任何庫,清單空白」)。修:dropSession 帶原因寫進 #login-status—— 「你的登入已過期,請重新登入(你的資料都還在,不會遺失)。」 資料側無恙(portal_library records=2 已驗),純讀側 session 過期+靜默 UX 缺陷。 驗:cypher tsc 全綠;vitest 9 failed/187 passed=基線不變。 Co-Authored-By: Claude Fable 5 --- console-ui/public/portal/index.html | 10 +++++++++- cypher-executor/src/routes/health.ts | 16 +++++++++++++--- cypher-executor/src/types.ts | 7 +++++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/console-ui/public/portal/index.html b/console-ui/public/portal/index.html index 6fefeac..6c41341 100644 --- a/console-ui/public/portal/index.html +++ b/console-ui/public/portal/index.html @@ -674,11 +674,19 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return { if (!location.hash) location.hash = '#/' + HOME; route(); } - function dropSession() { + // t161(leo 07-31 實撞:「實際上根本沒連上任何庫,清單空白」):session 過期時 + // 舊行為=靜默清 token 跳回登入頁,**畫面不說任何原因** ⇒ 用戶以為「庫不見了/系統壞了」。 + // 友善=前端:踢回登入頁時一定要說「為什麼」,用戶才知道下一步做什麼(重新登入即可,資料都在)。 + function dropSession(reason) { S.token = ''; S.profile = null; try { localStorage.removeItem('arcrun_portal_session'); } catch (e) { /* noop */ } showAuth(); + var msg = reason || '你的登入已過期,請重新登入(你的資料都還在,不會遺失)。'; + try { + var el = $('login-status'); + if (el) el.textContent = msg; + } catch (e) { /* 登入殼還沒渲染就算了 */ } } function boot() { if (!S.token) { showAuth(); return; } diff --git a/cypher-executor/src/routes/health.ts b/cypher-executor/src/routes/health.ts index 5485639..7d09505 100644 --- a/cypher-executor/src/routes/health.ts +++ b/cypher-executor/src/routes/health.ts @@ -3,9 +3,19 @@ import type { Bindings } from '../types'; export const healthRouter = new Hono<{ Bindings: Bindings }>(); -healthRouter.get('/health', (c) => - c.json({ ok: true }) -); +// t162(leo 07-31 實撞:「小幫手一直顯示知識庫需要更新…重新更新後並不會消失」): +// daemon cloudVersionStale() 讀 /health 的 `bundle_version` 判斷是否過舊—— +// 但本端點過去只回 {ok:true},**從沒吐這個欄位** ⇒ daemon 恆讀到空字串 +// ⇒ 恆判 stale ⇒ 假警報永遠不消失(安裝器其實一直有注入 ARCRUN_BUNDLE_VERSION var, +// 只是沒有人把它吐出來)。修=誠實回報本實例的 bundle 版本。 +// 未注入(本地 dev/很舊的實例)就省略該欄——daemon 對空字串仍判 stale, +// 那是**正確的**(真的是老實例,該更新)。 +healthRouter.get('/health', (c) => { + const bundleVersion = c.env.ARCRUN_BUNDLE_VERSION; + return c.json( + bundleVersion ? { ok: true, bundle_version: bundleVersion } : { ok: true }, + ); +}); healthRouter.get('/', (c) => c.json({ diff --git a/cypher-executor/src/types.ts b/cypher-executor/src/types.ts index 94efb72..c0ce895 100644 --- a/cypher-executor/src/types.ts +++ b/cypher-executor/src/types.ts @@ -68,6 +68,13 @@ export type Bindings = { // 必填:cypher-executor 用此組出 component worker URL(避開同 zone 自循環死鎖,見 P0 #9) // self-hosted fork 必須改 wrangler.toml [vars] 為自己的帳號 subdomain WORKER_SUBDOMAIN: string; + /** + * t162:本實例安裝時的 bundle 版本(格式 `YYYY-MM-DD+`)。 + * 由安裝器 deployBundledWorker 注入(worker.js:805),**給 daemon 比對用**—— + * daemon `/health` 讀不到就恆判「需要更新」(假警報迴圈,leo 07-31 實撞)。 + * 未注入(本地 dev/舊實例)= undefined,/health 省略該欄。 + */ + ARCRUN_BUNDLE_VERSION?: string; // Platform telemetry api_key(可選,wrangler secret) // 對應 SDD .agents/specs/llm-interface/ M1.2 // 設了會把 agent-telemetry block 都聚集在 platform_telemetry user_id 下