Repository navigation
feat(workbench): surface Steward monitors with one-click Run now in Steward dock/overview and raise Core ledger timeout - #10295
Conversation
…teward dock/overview and raise Core ledger timeout Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
Reviewed exact head: 10295@db5f4956a21700f6e078466c51166273b098caa2
动机 / Motivation
在推动 LoopX 管家融入 Workbench 的过程中,用户希望打开管家页就能直接看到管家自身的周期巡检任务(如可合并 PRs 巡检)并一键手动触发「立即运行」,同时当前 StewardLedgerService 读取 Core /status.json 的默认超时仅 2000ms,在真实多 Goal 机器上(4–6s)高频超时导致 coreGoals 误报不可用。
改动思路 / Approach
在完全复用现有 Core 权威 preview -> apply(monitor.update)链路、不新增任何后端旁路的前提下,从三条切面补齐闭环:① 将 StewardLedgerService 的 DEFAULT_CORE_GOALS_TIMEOUT_MS 从 2000ms 放宽至 10000ms(保留调用方显式 timeoutMs 覆盖与 fail-open);② 在 StewardStatusDock 中直接呈现「管家巡检 · N」胶囊与内联抽屉,支持一键「立即运行」与失败/门禁诚实回读;③ 在 StewardOverview 顶部默认展开「管家巡检」分组,消除原先 3–4 层折叠路径。
具体改动 / Changes
apps/workbench/packages/daemon/src/steward-ledger.ts:DEFAULT_CORE_GOALS_TIMEOUT_MS从2000调整为10_000。apps/workbench/packages/web/src/loopx/status.ts:新增resolveStewardMonitorGoal(),优先匹配绑定管家声明的goalId,否则回退到活跃的steward-agent-*Goal,并自动排除已停止 Goal。apps/workbench/packages/web/src/components/StewardInlineCards.tsx、StewardConversation.tsx、StewardPage.tsx、App.tsx:在管家对话底部状态栏新增「管家巡检 · N」胶囊与抽屉,列出全部开放continuous_monitor任务并提供单次点击「立即运行」(复用executeTodoMutationOneClick)、即时触发反馈、错误/门禁显式回读与「查看巡检 Goal」跳转。apps/workbench/packages/web/src/components/StewardOverview.tsx:在总览顶部新增默认展开的StewardMonitorGroup,支持直接浏览与一键触发管家巡检。apps/workbench/packages/web/src/i18n/locales/zh.ts、en.ts、ja.ts与apps/workbench/packages/web/test/loopx-monitors-ui.test.ts:补齐三语文案及 3 组核心单测(Goal 解析、Dock 胶囊/抽屉一键触发与 409 错误回读、Overview 顶部巡检分组)。
对主干的风险 / Risks
风险低且边界清晰。所有「立即运行」动作仍严格经由既有的服务端 preview -> apply(monitor.update)权威校验链执行,任何 failed/gated 或 409 响应都会抛出并渲染为 role=alert 错误提示,不会伪造触发成功;StewardLedgerService 超时上限放宽至 10s 仍受显式 AbortSignal 与 fail-open 保护,且保留了调用方自定义 timeoutMs。实测 tsc --noEmit(web + daemon)0 错、packages/web 884/884 测试通过、steward-ledger.test.ts 9/9 通过、npm run build 完整通过、loopx check 0 错误。
我的整体评价 / Verdict
改动精准打通了「在 Workbench 中直接看见管家与管家巡检任务并一键触发」的最后一公里,同时消除了真实多 Goal 环境下 coreGoals 的 2s 超时误报,验证完整,达到合入标准。
English Verdict: Approve — promotes Steward standing monitors with one-click canonical preview->apply Run now directly in StewardStatusDock and StewardOverview, fixes multi-Goal Core ledger 2s timeout, and passes 884/884 web tests, 9/9 ledger tests, tsc, build, and public boundary checks at 10295@db5f4956a21700f6e078466c51166273b098caa2.
Delivery Brief
continuous_monitortodos (such as mergeable-PR watches) right inside the Steward conversation and Steward Overview and manually triggerRun nowin a single click, while fixing Core ledger read timeouts on real multi-Goal machines.apps/workbench/packages/daemon/src/steward-ledger.tsdefaultedDEFAULT_CORE_GOALS_TIMEOUT_MSto2000ms, while live multi-Goal Core/status.jsonresponses take ~4–6 s, causing/api/steward/ledgerto reportcoreGoals: unavailable (timeout).steward-agent-*) was buried inside generic Goal rows requiring 3–4 clicks (open overview -> expand Goal -> expand Tasks -> find Periodic monitors -> click Run now).What Changed
apps/workbench/packages/daemon/src/steward-ledger.ts: RaisedDEFAULT_CORE_GOALS_TIMEOUT_MSfrom2000to10_000ms (preserving explicit callertimeoutMsoverrides and fail-open behavior).apps/workbench/packages/web/src/loopx/status.ts: AddedresolveStewardMonitorGoal()preferring the bound Steward's declared Goal ID and falling back to an activesteward-agent-*Goal (skipping stopped Goals).apps/workbench/packages/web/src/components/StewardInlineCards.tsx,StewardConversation.tsx,StewardPage.tsx,App.tsx: Added aSteward monitors · N(管家巡检 · N) dock pill and inline tray inStewardStatusDocklisting open Stewardcontinuous_monitortodos with direct 1-clickRun now(reusing canonicalexecuteTodoMutationOneClick->preview/applymonitor.update, honest error/gate readback, and 1-click jump to the monitor Goal).apps/workbench/packages/web/src/components/StewardOverview.tsx: Added an expanded-by-defaultSteward monitors(管家巡检) group at the top ofStewardOverviewwith 1-clickRun nowper monitor.apps/workbench/packages/web/src/i18n/locales/{zh,en,ja}.ts&apps/workbench/packages/web/test/loopx-monitors-ui.test.ts: Added localized strings and unit/UI tests covering goal resolution, dock pill/tray 1-click trigger, negative 409 error readback, and overview group trigger.Verification
tsc -p packages/web/tsconfig.json --noEmit&tsc -p packages/daemon/tsconfig.json --noEmit: 0 errorsnpm -w packages/web test: 884/884 passed (0 failed)packages/daemon/test/steward-ledger.test.ts: passednpm run build(daemon + web + ext-loopx): ✓ built cleanlyloopx check): ok=true, errors=0