Repository navigation
feat(workbench): add Goal-backed main conversations with scoped dispatch, approvals, and todos - #10072
feat(workbench): add Goal-backed main conversations with scoped dispatch, approvals, and todos#10072maxliux5 wants to merge 11 commits into
Conversation
…tch, approvals, and todos
Add Goal-backed Main Conversations to LoopX Workbench without introducing parallel ledgers:
- Direct "Start a thing" entry launches real LoopX Goals via existing /api/loopx/launch/{preview,apply} and <GoalConfirm>, retiring the manual <LoopxToggle> while preserving permission/project selection, Core failure states, ordinary threads, and sidebar 3-way filtering (All / Main / Ordinary).
- Persona-style MainConversationDock above the composer reuses StewardDispatchService, StewardInboxService, and <GoalTasks> for per-matter UI/model dispatch, child approval alerts with jump-to-<ActionSheet> and return chip, and persistent Core Goal todos.
- Enforces server-side LoopxBinding authority ceilings on model-side dispatch (LOOCHAT_MAIN_SOCKET / LOOCHAT_MAIN_TOKEN, scrubbed from child workers), fail-closed permission checks, standalone permissionMode='read_only' readonly handling, SQL-before-LIMIT matter scoping, and concurrent/idempotent clientRequestId handling.
Signed-off-by: maxliux5 <5958865+maxliux5@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
Independent review
- [P2] 派发回执应留在其所属 Goal。在第一个 Goal 派发尚未返回时切到第二个 Goal,第二个面板的输入被禁用。第一个请求失败后,第二个面板显示第一个 Goal 的错误。 让派发状态和回执按发起的 thread ID 与 Goal 管理。异步完成仅更新其发起范围。 派发回执
- [P2] 同键不同验收条件应报冲突。相同 clientRequestId 先派发包含开头的验收要求,再改为包含附录。HTTP 返回 200 和 reused:true,仍返回原任务和原验收要求。 把会改变执行及验收的归一化输入统一绑定到幂等指纹,并在新请求与已保存请求不一致时返回冲突。 派发指纹
动机 / Motivation
使用主对话来派发子任务并在多个 Goal 间切换的操作者,以及使用派发键重试的 HTTP 调用者。 候选增加独立的 Goal 派发面板和派发重试。面板反馈应跟随原 Goal,同键响应应准确对应已提交的执行与验收条件。 隔离生产构建能创建两条 Goal 对话。正常派发后可进入子会话处理确认,返回原 Goal 后提示消失。相同派发请求仅启动一次。 浏览器使用两个合成 Goal 和脚本模型。本轮验证限定在本地 Workbench 和真实 daemon 入口。
改动思路 / Approach
24 文件,增 4,283 行、删 236 行,变更覆盖 Workbench daemon、浏览器、文案和测试。 Workbench 挂载按 Goal 值切换但保留同一个 React 面板实例。HTTP 交给既有 Steward ledger,现行派发指纹没有纳入 doneWhen。
装载查询已有 expectedScope 校验。本轮发现的遗漏在派发状态与完成时更新。
具体改动 / Changes
- OWNER。异步派发反馈始终留在发起的 Goal。 配对反例见 P2。 MainConversationDock.tsx
- REPLAY。同键异义明确报冲突。 配对反例见 P2。 steward-dispatch.ts
- APPROVAL。正常确认可以回到原 Goal。 独立验证通过。 App.tsx
关键代码讲解
- 异步 catch 直接更新当前面板错误。 handleDispatch
- 已保存任务的指纹漏掉验收条件。 sessionHandoff
- 并发指纹也漏掉验收条件。 inflightClientRequests
- 当前线程直接传入同一面板实例。 MainConversationDock
- 真实 HTTP 转发显式 doneWhen 和客户端请求键。 POST /api/steward/handoff
对主干的风险 / Risks
原候选构建、39 项定向 daemon 用例、双 Goal 的 Chromium 正例通过。两个独立反例均可复现。 本地 quick premerge 的 4 项直接检查与 4 项选中检查通过。 正常确认只在对应子会话完成,回原 Goal 后待审提示清空。相同任务键返回相同任务和唯一 adapter 启动。
一次只变化 doneWhen,继续被判定为相同请求。重试可继续用原有 ledger 捕捉具体输入冲突。
我的整体评价 / Verdict
需要修改。 两个重放和中途切换场景暴露了结果归属偏差。
已检查隔离桌面中两个 Goal、派发面板和待确认条目同屏。 独立浏览器验证限桌面、合成 Core 和脚本模型。真实云模型、窄屏和将候选安装到使用中的服务未参与本轮验证。
通过现有面板和 daemon 的入口直接观察到这两个结果。
English verdict: REQUEST_CHANGES at 67a73a1. A delayed dispatch error appears in another Goal, and retries with changed acceptance criteria silently return the original task. The ordinary approval and identical-request replay paths passed.
… task cards, and dock cleanup Signed-off-by: maxliux5 <5958865+maxliux5@users.noreply.github.com>
|
This pull request has merge conflicts with Choose the remote for the base repository, not an out-of-date fork. git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEADFor a same-repository clone whose Keep the DCO |
…licit coverage bounds Signed-off-by: maxliux5 <5958865+maxliux5@users.noreply.github.com>
…conversations Signed-off-by: maxliux5 <5958865+maxliux5@users.noreply.github.com> # Conflicts: # apps/workbench/packages/web/src/loopx/loopx.css
…themes Signed-off-by: maxliux5 <5958865+maxliux5@users.noreply.github.com>
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
阻塞问题
[P2] 持久化重放时校验派发验收条件。对已完成首次派发的 Goal-bound spawn,用同一个 clientRequestId、同一个 objective,把 doneWhen 从 Include the opening 改成 Include the appendix,这里仍返回 HTTP 200 与 reused:true,任务只保存第一次的验收条件。独立 HTTP/SQLite 用例确认完全相同的重试会复用原任务,新 key 会保存新条件。请把规范化的 doneWhen 纳入在途和持久化重放的同一语义校验,并覆盖同键改条件应返回 409 的场景。
动机 / Motivation
受影响场景为绑定 Goal 的 Workbench 主对话调用方用同一个 clientRequestId 重试 spawn,并修改 doneWhen。新派发会把验收条件写进任务计划。完全相同的请求在首次完成后重试时,应该复用原任务。修改验收条件后仍得到 HTTP 200 和 reused:true,响应及原任务保留第一次的条件。 本轮验收范围限于 Goal 主对话、派发及审批入口。 本次审核 5876db1,提案基点 8cbe419,目标 main 8fca137 试合成功。
改动思路 / Approach
范围覆盖主对话对 Goal 的绑定、审批与任务派发,关键共享边界是 spawn 请求的持久化重放。在 Workbench daemon 的任务计划与幂等性逻辑 上核对 POST /api/steward/handoff。持久化重放沿用 client_request_id_conflict 语义时,同键重试必须校验已接受的任务验收条件。 同键原样重试复用同一个任务,新键创建带新条件的任务。组件复核确认切换 Goal 时隔离前一 Goal 的交接和审批状态。 入口
具体改动 / Changes
27 个文件,新增 7,614 行,删除 240 行。HTTP 路由把 Goal 绑定写入派发上下文,建档、重试和冲突都调用同一 daemon。任务计划按输入生效后由主对话读取。前一头关于切换 Goal 的反馈可复核。MainConversationDock 按 thread:goal 保存派发与审批结果,异步响应写回发起方作用域,切换后前一 Goal 的失败不会覆盖当前操作。Workbench UI 定向 10 项、daemon 定向 4 项及 Workbench 打包通过。旧冲突用例已覆盖修改 objective,本次增加只改验收条件的独立负例,覆盖已有用例漏掉的任务创建后重放分支。依据 docs/development/frontend-delivery.md 核对 existing-invariants 和 proposed-outcome。前者的现有调用及拒绝语义已经验证。后者要求当前入口在失败后能给出准确结果,本次负例未通过。 实现
对主干的风险 / Risks
在真实 Workbench HTTP daemon 和临时 SQLite 上,执行首次 spawn、同键原样重试、同键仅修改 doneWhen、新键采纳新条件四步。快速 premerge 门通过。 已验证 HTTP/SQLite、组件竞态和本地打包。完整浏览器和安装后旅程仍待独立验证。 核验路径
语义与 CI 对齐
持久化重放沿用 client_request_id_conflict 语义时,同键重试必须校验已接受的任务验收条件。 让在途与持久化重放使用同一份包含 doneWhen 的规范化请求语义。补一个 HTTP 用例,覆盖同键同条件复用、同键改条件返回 409、新键采用新条件。
我的整体评价 / Verdict
请求修改。让在途与持久化重放使用同一份包含 doneWhen 的规范化请求语义。补一个 HTTP 用例,覆盖同键同条件复用、同键改条件返回 409、新键采用新条件。 远端 CI 按评审配置未查询。
英文简短结论
English verdict: REQUEST_CHANGES 5876db1. Persisted spawn replay accepts changed acceptance criteria under the same request key. Validate doneWhen and return a conflict.
…nd cross-loop receipt hardening Implement the user-selected Neon Plan A (Mist Blue) UI iteration on PR #10072 without modifying backend, daemon, scheduler, or protocol contracts: - Bottom loop dock (MainConversationDock + loopx.css): frameless Mist Blue pills with top hairline removed, zero persistent capsule borders, status semantics separated from Mist Blue active state and neutral :focus-visible outline, and single-row mobile fit (>=34px). - Lighter frameless inline task rows (LoopInlineTaskCards) preserving real backend states, readable summaries, and direct child thread jump while keeping baseline LoopSupervisionBar direct click/chat semantics intact. - Compact Alma-style sidebar (Sidebar + sidebar.ts): single top-bar '新建' entry reusing Menu ('新 loop' / '新对话'; direct when single-mode), on-demand kind filter with counts over actually displayed sessions (including multi-host merged views), real-data status groups ('要你处理' / '进行中' / '最近', omitting empty groups) preserving '置顶' semantics and existing sections/projects/'+' actions in recent-activity order, plus softened top-left LoopX brand icon and Escape layering fix. - Frontend cross-loop receipt hardening (supervision.ts + MainConversationDock): synchronous per-scope snapshot projection to prevent 1-frame cross-loop flash, per-scope sequence guard against out-of-order supervise/revoke writes, and scoped dispatch selections and proposal dismiss actions. Signed-off-by: maxliux5 <5958865+maxliux5@users.noreply.github.com>
…er to Mist Blue Signed-off-by: maxliux5 <5958865+maxliux5@users.noreply.github.com>
Signed-off-by: maxliux5 <5958865+maxliux5@users.noreply.github.com>
Summary
Adds Goal-backed
loopconversations (Main Conversations) to LoopX Workbench so users can start and manage a multi-agent piece of work directly from the sidebar without toggling a manual LoopX switch, while reusing existing LoopX Goal, Steward dispatch, Steward supervision grants, Steward approval inbox, and Core Goal Todo owners (no parallel ledgers).This update (
134253998, building oned54aeb86) completes the user-selected Neon Plan A (Mist Blue / 雾蓝) UI alignment without modifying any backend, daemon, scheduler, protocol, or page-layout code:134253998, delta vsed54aeb86: 3 files, +54 / -31 lines): aligns the two remaining warm-orange waiting surfaces—LoopInlineTaskCardsnormal needs-attention row (.loop-inline-task-card.is-waiting) andMainConversationDockpending approval banner (.main-dock-alert)—to existing Mist Blue tokens (color-mix(in srgb, var(--loop-pill-mist-bg) 55%, var(--bg))lighter cool-blue/slate surface,--loop-pill-mist-dotdot & arrow,--loop-pill-mist-fgstatus label, deep neutral--textprimary copy, neutral--mutedsupervised tag on waiting rows, and unchanged primary去处理CTA). True error/danger (--danger), in-progress amber (--loop-pill-amber), completed moss green (--loop-pill-moss), running (--positive), and top-bar supervision waiting (--warn) remain untouched.border-top: 0), zero persistent capsule borders (border: 0), semantic status dots/arcs separated from Mist Blue active fill and neutral keyboard:focus-visiblering, single-row mobile 390px fit (>= 34px).StewardTaskRecord+StewardSurfaceSnapshot+Threadstate; baselineLoopSupervisionBardirect click & chat-input supervision semantics remain unchanged.新建entry reusing<Menu>(新 loop/新对话; direct to新对话when single-mode), on-demand kind filter (全部 / loop / 普通) with live counts over displayed sessions (including multi-host merged views), real-data status groups (要你处理/进行中/最近, omitting empty groups) preserving置顶semantics and existing sections, project names, recent-activity ordering,+actions,LoopX 管家,看板, and overflow pages, plus a softened top-left LoopX brand icon and two-layerEscapehandling.useLoopMatterState(eliminating 1-frame cross-loop data flash on switch), per-scope monotonic sequence guard against out-of-ordersupervise/revokeresolution, and scoped dispatch agent/permission selections plus proposal dismiss actions inMainConversationDock.Design note:
apps/workbench/docs/main-conversations-design.md.Open Backend Review Item (Recorded Separately — Out of Scope for This UI Iteration)
#pullrequestreview-6182997296(P2,CHANGES_REQUESTEDon5876db136): Persisted spawn replay inapps/workbench/packages/daemon/src/steward-dispatch.tsstill returns HTTP200reused: trueinstead of409conflict whenclientRequestIdandobjectivematch butdoneWhenchanges.ed54aeb86and134253998because these UI iterations are strictly scoped to frontend styling/UX and frontend cross-loop receipt isolation (zero backend/daemon/scheduler/protocol edits). Tracked explicitly for the next backend-authorized pass before merge.Dependencies & Reuse
maindirectly (mergeable=MERGEABLE); mergedorigin/main(8cbe4197b, including Show observed host turns in the Workbench Goal overview #9955 & Verify Workbench Goal retries and managed plan identity after restart #9957) cleanly via normal merge commit625c944e1.LoopxService(/api/loopx/launch/{preview,apply}),LoopxBindings,<GoalConfirm>,<GoalPermissionPicker>,<ProjectPicker>.StewardDispatchService(steward_tasksSQLite table,/api/steward/handoff,/api/steward/tasks, git worktree isolation & FIFO write mutex) andstewardServerUnix socket.StewardSupervisionService(GET /api/steward/supervision,GET /api/steward/supervision/grants,POST /api/steward/tasks/:id/supervision/{grant,revoke}) and existing General Settings (supervisionEnabled).StewardInboxService.surface(),ThreadManager.listPendingApprovals(),POST /api/approvals/:id,POST /api/steward/tasks/:id/review,<ActionSheet>,<CoreActionProposalCard>.<GoalTasks key={goalId} />(/api/loopx/status.json?goal_id=,/api/loopx/api/chat/todo/{dry-run,apply}).User Workflow & Key Changes
Sidebar.tsx,sidebar.ts,loopx.css,zh/en/jalocales)loopnaming across the unified top-bar新建menu (新 loop/新对话; direct to新对话when single-mode), on-demand 3-way filter (全部 /loop/ 普通, collapsed behind筛选, leaving a one-click clear chip when collapsed while filtered; counts reflect the actually displayed session set including multi-host merged views), child return chip (← loop · <title>), and command palette.新对话pill; keepsLoopX 管家(with real waiting dot, non-truncating on desktop),看板, and overflow menu (including新建分区when no sections exist) reachable.要你处理,进行中, and最近(omitting empty groups), keeping置顶with its original semantics and preserving real sections, project names, recent-activity ordering, and existing+/ menu operations inside最近; softens only the top-left LoopX brand icon in light and dark themes.LoopSupervisionBar.tsx,loopx/supervision.ts,App.tsx)帮我督办above the activeloopconversation AND standalone chat commands (帮我督办,停止督办,/supervise,/unsupervise) routed through the exact sameexecuteLoopSupervision()controller (never calling instance-widePOST /api/steward/supervision/tickfrom UI).localStorage, keyed by${thread.id}:${goalId}) with honest coverage-boundary copy,readonlycapped strictly to['retry', 'continue'], and pause-before-approval behavior.supervise/revokesettling.MainConversationDock.tsx,LoopInlineTaskCards.tsx,loopx.css)#eaf1fc/#1e4489/ dot#2b5bb3, light selected#d2e3fc/#0f306b; dark waiting#202b3d/#bad2ff/ dot#7ca8f8, dark selected#2f4a72/#edf4ff, paired with untouched semantic accents (--loop-pill-amber#b8732a/#e2a862,--loop-pill-moss#357a55/#6db68d,--positive,--danger) and independent neutral:focus-visible(--loop-kbd-focus).134253998) — reuses existing tokens only (0new hex constants):ed54aeb86)134253998, CSS Token).loop-inline-task-card.is-waitingbgcolor-mix(--warn 6%/10%, --bg)color-mix(var(--loop-pill-mist-bg) 55%, var(--bg))(:hover80%)#f3f7fd(srgb 0.955 0.970 0.994)#202730(srgb 0.127 0.151 0.190).main-dock-alertbgcolor-mix(--warn 8%/12%, --bg)color-mix(var(--loop-pill-mist-bg) 55%, var(--bg))#f3f7fd(srgb 0.955 0.970 0.994)#202730(srgb 0.127 0.151 0.190)var(--loop-pill-mist-bg)var(--loop-pill-mist-bg)(unchanged)rgb(234, 241, 252)#eaf1fcrgb(32, 43, 61)#202b3d.loop-inline-task-dot.is-waiting,.main-dock-alert-dot,.is-waiting .loop-inline-task-arrowvar(--warn)var(--loop-pill-mist-dot)rgb(43, 91, 179)#2b5bb3rgb(124, 168, 248)#7ca8f8.loop-inline-task-status.is-waiting(需要你)var(--warn)var(--loop-pill-mist-fg)rgb(30, 68, 137)#1e4489rgb(186, 210, 255)#bad2ff.is-waiting .loop-inline-task-sup-note(· 已授权督办)var(--loopx-blue)(500)var(--muted)(400)rgb(107, 107, 107)#6b6b6brgb(155, 155, 155)#9b9b9b去处理CTAvar(--text)/var(--accent)#0d0d0d/#0d0d0don#fff#ececec/#ecececon#212121border-top: 0) and all persistent capsule borders (border: 0), keeps all 4 capsules (要你处理/进行中/已完成/待办) on one>= 34pxrow at 390px mobile width, restores focus to the trigger tab onEscape, and scopes dispatch/approval state per(thread.id, goalId).67a73a177)LOOCHAT_MAIN_SOCKET/LOOCHAT_MAIN_TOKENserver-bound authority, fail-closedread_only/askpermission checks, filter-before-LIMITSQL scoping, and synchronousinflightClientRequestsdeduplication.First-Screen Visual Evidence
134253998(packaged Vite web bundle + real Workbench daemon in isolated Playwright Chromium; test doubles: in-process syntheticfakeCoreHTTP server +fake-acp.mjsnatural-copy wrapper inpackages/e2e/test/main-conversations.spec.mjs). All captures use synthetic isolated Workbench data only; live remote paid LLM providers and live host deployment were not executed. No private data, credentials, or local paths are published.核对风控依赖安装) driving the inline task card, pending approval banner, and要你处理 1Mist Blue capsule simultaneously—confirming lighter cool-blue/slate surface harmony, neutral· 已授权督办, unchanged去处理CTA, both waiting entry points (LoopInlineTaskCardsdirect child jump & banner去处理→ approvals tray → child<ActionSheet>→ approve → return), and untouched error (--danger), in-progress amber (--loop-pill-amber), and completed moss (--loop-pill-moss) states.Waiting Card & Approval Banner Mist Blue Alignment — Before (
ed54aeb86) vs After (134253998)ed54aeb86, Desktop Light — Warm--warnTints)134253998, Desktop Light — Unified Lighter Mist Blue)ed54aeb86, Desktop Dark — Warm--warnTints)134253998, Desktop Dark — Unified Lighter Mist Blue)ed54aeb86, Desktop Unified新建Menu + On-Demand Filter — unchanged)134253998, Desktop Active Supervision1 / 1— Amber / Moss Untouched)Mobile Narrow Viewport (390×844) — Before (
ed54aeb86) vs After (134253998)ed54aeb86, Mobile Light — Warm--warnTints)134253998, Mobile Light — Unified Lighter Mist Blue)134253998, Mobile Light — Selected Deep Mist Tray)134253998, Mobile Dark — Settled Single-Row Dock)Validation & Checks Run (
134253998)npm --prefix apps/workbench run build(@loopx/loochat+@loopx/loochat-webVite production bundle +@calli/ext-loopx): PASSnpm --prefix apps/workbench run typecheck(all 6 workspaces): PASSnpm --prefix apps/workbench test -w @loopx/loochat-web: 733/733 pass, 0 failPATH, isolated real Chromium + built daemon & web; test doubles:fakeCore+fake-acp.mjsnatural-copy wrapper):packages/e2e/test/main-conversations.spec.mjs: 2/2 pass, 0 fail (uiTickRequests=0in both tests; verifies light & dark ChromiumgetComputedStyleMist Blue parity on both.loop-inline-task-card.is-waitingand.main-dock-alert, neutral· 已授权督办, both waiting entry clicks (inlineCardAdirect child<ActionSheet>+ return and banner去处理→ tray → child<ActionSheet>→ approve → return), simultaneous要你处理 / 进行中 / 最近, dynamic empty-group omission, two-layerEscape, unified新建, mobile 390×844 single-row dock, and zero-subtask supervision lifecycle).sidebar.spec.mjs,phone.spec.mjs,drafts.spec.mjs,conversation.spec.mjs,locale.spec.mjs,appearance.spec.mjs,model-preferences.spec.mjs,note-isolation.spec.mjs,sidebar-merged-hosts.spec.mjs,agents.spec.mjs): 40/40 pass, 0 fail (+ 1 upstream skip insidebar.spec.mjs).general-settings.spec.mjs(baselineorigin/main/api/general-settingspayload includesledgerCapture/supervisionEnabled),longthread.spec.mjs(baselineorigin/mainduplicate.turn-ruler).python3 -m loopx.cli canary premerge --from-git-diff --git-diff-base origin/main: 14/14 pass, 0 failures (diff_check,check_rfc_bilingual.py, 5 catalog canaries, 8 risk-profile smokes,public_boundary).fake-acp.mjstest double).doneWhenpersisted spawn replay insteward-dispatch.ts,#pullrequestreview-6182997296), intentionally left untouched per UI-only scope.