From d6d2cecfb5cc44c4e676da3767a3edfa91a944d5 Mon Sep 17 00:00:00 2001 From: richblack Date: Thu, 14 May 2026 12:06:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(cypher):=20resumeFromPaused=20=E6=BC=8F=20n?= =?UTF-8?q?ode-id=20namespace=20=E5=B0=8E=E8=87=B4=E4=B8=8B=E6=B8=B8?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=89=BE=E4=B8=8D=E5=88=B0=20paused=20?= =?UTF-8?q?=E7=B5=90=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mira 7B.3f PATCH 測試踩到:classify 跟 compose 都是 claude_api(兩次 paused/resumed), upsert_index_entry config 寫 `{{compose_index_entry.data.text}}`,但 PATCH 跑出的 block content 是字面 `{{compose_index_entry.data.text}}` —— 模板沒被替換。 根因:resumeFromPaused 把 callback_result spread 到 top-level,但漏了 `[paused_node_id]: callback_result` 的 namespace 包裝。同步路徑的 propagateCtx 有做這件事,resume 路徑沒做,行為不一致。 修:mergedContext 加 [paused_node_id]: callback_result 一行,跟 propagateCtx 對齊。 arcrun.md 同步補三-B「新零件 checklist」+ 三-C「workers_dev=true 全 component 自動化」收尾紀錄。 --- .agents/specs/arcrun/arcrun.md | 22 ++++++++++++++++++++++ cypher-executor/src/graph-executor.ts | 5 ++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.agents/specs/arcrun/arcrun.md b/.agents/specs/arcrun/arcrun.md index 149b355..dc026a4 100644 --- a/.agents/specs/arcrun/arcrun.md +++ b/.agents/specs/arcrun/arcrun.md @@ -207,6 +207,28 @@ P0 #10 修完後 mira 嘗試做 wiki 多段結構,又踩出三個 cypher bindi |---|---|---|---| | 2026-05-14 | `kbdb_upsert_block` | mira 7B.3f index-entry per-entity upsert,繞過 workflow 缺 IF/branch 能力(P1 #1)。內部 GET by page_name → 找到 PATCH 沒找到 POST。page_name 當 idempotency key。 | polaris/mira/.agents/specs/mira-app/design.md §3.5.12.4.1 | +**新零件 checklist(避免 P1 #1 重蹈 kbdb_upsert_block 漏白名單覆轍)**: + +每加一個 API/data 零件(不是 logic primitive),都要: +- [ ] `registry/components/{name}/main.go` + `component.contract.yaml` + `go.mod` +- [ ] `tinygo build -target=wasi` 通 +- [ ] `.component-builds/{name}/` 完整 4 檔(`wrangler.toml` 含 `workers_dev = true` + `pnpm-lock.yaml` + `tsconfig.json` + `src/index.ts`) +- [ ] **`cypher-executor/src/lib/component-loader.ts` 的 `WASM_HTTP_RUNNER_IDS` 加 canonical_id**(漏這條 cypher-executor 永遠拋「找不到零件」,端對端會死靜悄悄) +- [ ] `acr validate workflow.yaml` 通 +- [ ] 直接 curl `https://{kebab}.arcrun.dev` + `https://arcrun-{kebab}.{WORKER_SUBDOMAIN}.workers.dev` 都 200 + +--- + +### 三-C、P1 #2:workers_dev = true 全 component 自動化(2026-05-14 已收) + +**原痛點**:每新部署一個 component worker,要去 CF Dashboard 手動 Enable workers.dev URL,否則 cypher-executor fetch 該 worker 會 404。 + +**解**:32 個 `.component-builds/*/wrangler.toml` 全部加 `workers_dev = true`。CI 每次 deploy 自動啟用對應 workers.dev URL,零手動。 + +**未來新 component**:模板 (`component-worker-template/`) 應該預設帶 `workers_dev = true`,新人 fork 不會踩。已列入「新零件 checklist」第 3 條。 + +**為何不走 `*.acr-comp.uncle6.me` 自訂 zone**:CF Universal SSL 只發一層子域,sub-sub `*.acr-comp.uncle6.me` 不蓋;要 ACM ($10/月) 才能簽。違反 arcrun「fork 後 self-host 用 free tier 跑得起來」核心目標。workers_dev=true 走 CF 默認的 workers.dev cert,free tier OK,更乾淨。 + --- ### 原 P0 #9 調查紀錄(保留作歷史參考) diff --git a/cypher-executor/src/graph-executor.ts b/cypher-executor/src/graph-executor.ts index 3c33748..7ffc66e 100644 --- a/cypher-executor/src/graph-executor.ts +++ b/cypher-executor/src/graph-executor.ts @@ -136,10 +136,13 @@ export class GraphExecutor { await kvSetNodeOutput(kvStore, paused_node_id, callback_result); } - // 把 callback_result spread 進 context(替代 paused 結果) + // 把 callback_result spread 進 context(替代 paused 結果)+ node-id namespace + // 2026-05-14 補:以前漏 namespace,導致下游 `{{paused_node_id.data.text}}` 模板抓不到, + // 必須跟同步路徑(propagateCtx)行為一致。 const mergedContext: Record = { ...paused_context, ...(callback_result && typeof callback_result === 'object' ? callback_result : {}), + [paused_node_id]: callback_result, }; if (kvStore) { if (!mergedContext._kv_outputs) mergedContext._kv_outputs = {};