Repository navigation
feat(workbench): inline handoff composer with attachments, KaTeX math, cancelled-turn text preservation, and activity-bell reveal - #9698
Conversation
…, cancelled-turn text preservation, and activity-bell reveal Solves four Workbench usability and rendering issues: 1. Inline handoff/fork composer with attachments and full model controls: Replaces the narrow modal handoff dialog with an inline bottom composer reusing the New Thread Composer geometry and native AgentPicker, WorkspacePicker, and ModelPicker (including effort/speed selection, pasted/picked images, image-only handoffs, @ references, and upfront model/effort/image validation in POST /api/threads/:id/fork). 2. LaTeX math rendering across Markdown views: Adds KaTeX math rendering (remark-math + rehype-katex + custom guarded single-dollar, single-line display $$, and \(...\)/\[...\] parser) across chat replies, file previews, and skills docs while preserving currency ranges ($5-$10), shell variables ($HOME/$USER), and CSP font loading. 3. Preserve already-streamed prose on cancelled turns: Keeps trailing assistant prose visible as the turn summary when a turn is stopped mid-stream, matching both live timeline reduction and persisted history summaries instead of folding the text into a collapsed work block. 4. Locate and center active thread when turning off sidebar Activity Bell: Auto-expands collapsed project/section/done groups and folded branch drawers and smoothly centers the currently viewed thread when leaving the sidebar activity filter. Signed-off-by: maxliux5 <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
用户在工作台要把正在阅读的会话交给另一个 Agent,并保留上下文、图片和真正选中的模型。旧的交接弹窗需要另选目标,不能沿对话输入栏附图或调强度;另外,公式、停止后的部分回答和退出活动视图的定位各有缺口。候选复用内联输入栏,携带图像和模型参数,同时改进公式渲染、取消后的历史显示与侧栏定位。本次范围为 Workbench Web 和 daemon。现有 fork API 仍负责 Agent 能力和文件范围判断。快速切换 Agent 时模型目录仍会被旧响应覆盖。
改动思路 / Approach
App 打开 HandoffComposer,复用普通 Composer、AgentPicker、ModelPicker 等,再经 API client 调用原 fork 路由。文件、技能、对话共用 Markdown 安全管线,时间线和历史分区各保持自己的投影,侧栏使用已有组模型。 沿用既有输入栏与 fork 权威。模型目录提交结果时绑定同一个 Agent 及刷新序号,复用现有带生命周期保护的读取路径。 daemon 仍在创建 worktree 或 thread 前校验模型、速度、强度和图片。显示错误目录不改变后台授权。 本次范围为 Workbench Web 和 daemon。现有 fork API 仍负责 Agent 能力和文件范围判断。
具体改动 / Changes
审阅提交 dfdce35,diff 基线 1bdf851,37 个文件,+1931/-524。原居中弹窗换成 HandoffComposer。API client 与 daemon 的 fork 接收 effort、speed、images 和引用。KaTeX 在 sanitize 后渲染,三类页面复用;取消时 live 和历史读回保留可见部分回答;Activity Bell 退出定位原组及分支。每个入口的焦点、错误显示、写入权限和现有会话状态分别有测试。 复用输入栏 完整 diff
对主干的风险 / Risks
[P2] 忽略切换 Agent 前发出的模型刷新结果。 复现于当前构建的 Workbench 与隔离 daemon。打开 pi 的模型选择器后延迟其刷新,切换到 Antigravity 并等 Fast 出现,再释放 pi 响应。Fast 被 pi 的 Think 取代,Agent 标题保持 Antigravity。fetchModels 在 Promise 结尾无条件 setModels,绕过了初始化请求的生命周期检查。按当前 Agent 和请求序号丢弃过期响应,并加入按相反顺序返回的测试。
688 项 Web 单测、20 项 daemon 定向测试、TypeScript 和生产构建通过,隔离浏览器 26 项通过、1 项原有跳过。覆盖图像接力、fork、取消后恢复、侧栏回选。 保留 pi 模型请求的实际响应,切换到 Antigravity,等当前目录显示 Fast,再释放前一请求。Agent 仍为 Antigravity,选择器却显示 pi 的 Think。重开选择器可恢复 Fast,需要用户再操作一次。 将测试生成的截图和日志移出工作树后,标准 premerge 对 37 个路径通过,无阻断或人工 hold。模型目录延迟反例独立保留为失败。
我的整体评价 / Verdict
REQUEST_CHANGES。 正常路径可用。请先修复会把上一 Agent 模型显示给当前 Agent 的竞态,再复核该头。 在隔离的实际构建版上查看了桌面和窄屏。交接输入栏对齐对话,取消、附件和发送均可见。打开模型面板后,当前模型选择与强度保留在输入附近。回复中的公式排版正常,美元价格范围仍是原文。只覆盖合成会话与本地生产构建,未核实真实账号权限或系统软键盘。PR 描述目前只有作者本地截图路径,首屏证据仍需可读回链接。
English verdict: REQUEST_CHANGES at dfdce35. The packaged Workbench paths pass their ordinary tests, but a delayed catalog refresh overwrites the selected agent's models after a switch.
… katex to 0.18.10
1. Prevent stale model refreshes from overwriting the selected agent's catalog:
- Extract createModelCatalogLoader in handoff-models.ts and route both initial
agent loads and ModelPicker onOpen refreshes through the same guarded loader
tracking mounted state, active agent, and monotonic request sequence.
- Add unit tests covering cross-agent delayed refreshes, same-agent reverse
ordering, A -> B -> A round-trips, and unmount/StrictMode remount.
- Add Playwright E2E regression test in fork-subchat.spec.mjs holding pi's
refresh response until after switching to Antigravity and asserting Fast
stays intact.
2. Resolve dependency-review vulnerability on nested [email protected]:
- Align @loopx/loochat-web katex range and workspace overrides to ^0.18.10 so
rehype-katex and micromark-extension-math share the already-present patched
[email protected] with mermaid, removing the nested [email protected]
(GHSA-238p-pmpm-9mq7) and redundant [email protected] entries.
Signed-off-by: maxliux5 <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
工作台用户在交接时需要看到目标 Agent 的可用模型,并保留输入、附件和上下文。旧入口为居中弹窗。前一候选改成内联,但旧 Agent 的晚响应能覆盖新 Agent 目录。本次按 Agent 与请求序号保护目录,并保留内联输入、数学渲染、取消历史与活动返回改动。范围为 Workbench Web、daemon 与其打包验证。原 fork 仍校验模型、图片与权限。新的请求序号会在同一 Agent 的刷新失败时丢弃成功的首读。
改动思路 / Approach
App 从原动作打开 HandoffComposer,复用 Composer 与 picker,目录选择最后交给原 fork HTTP。KaTeX、取消结果和侧栏继续走各自的投影。 使当前 Agent 的成功结果有可用的回退,复用已有生命周期代数,并保留过期成功响应防护。 ThreadManager 仍先校验请求再创建会话或 worktree。当前缺陷位于目录展示。 范围为 Workbench Web、daemon 与其打包验证。原 fork 仍校验模型、图片与权限。
具体改动 / Changes
审阅提交 6688159,diff 基线 1bdf851,40 个文件,+2110/-524。上一轮跨 Agent 覆盖问题已修复。新 loader 用单一序号拒绝乱序,首读和手动刷新都用它。KaTeX 工作区锁到同一版本,处理回复与文件预览中的公式和价格字面。内联交接沿现有 fork 路由发送上下文和图片,沿用已有 Agent 能力校验。取消时实时和历史读取使用相同正文边界。活动视图关闭后会展开选中会话所在项目分组,保持当前会话可见。 加载器 · 交接入口
对主干的风险 / Risks
[P2] 刷新失败时保留当前 Agent 的成功首读。 请求启动即递增 seq。较新刷新失败后,catch 只返回 false,随后较早的成功首读仍被 seq 拒绝。新选择的 Agent 可能一直没有可选模型,须重开面板再请求。
TypeScript、生产构建、691 项 Web、20 项 daemon 用例通过,打包浏览器 27 项通过、1 项原有跳过。上一轮的 pi 晚响应回归通过,Fast 保持归属 Antigravity。 两份生产构建用同一隔离 daemon 夹具:选择 Antigravity,暂缓其 HTTP 200 首读,打开模型面板使刷新发生一次网络错误,再释放包含 Fast 的首读。前一候选 dfdce35 显示 Fast,本头仍显示“默认模型”。 抄录新快照前移出了测试自产 PNG,重新对 40 个提交路径运行标准预合并。4 项直接检查和 11 项选中检查无阻断。独立失败用例保留。
我的整体评价 / Verdict
REQUEST_CHANGES。 旧跨 Agent 问题已修复。请补齐同 Agent 刷新失败的成功目录回退。 实际桌面与窄屏观察中,交接嵌在原对话底部,附件和取消可见,窄屏文案可换行,公式与价格文字可区分。隔离生产构建及合成账号。未运行真实账号和设备键盘。模型面板展开与失败态通过打包浏览器自动检查。PR 首屏仍未附可读回的截图或预览链接。
English verdict: REQUEST_CHANGES at 6688159. The earlier cross-agent stale response is fixed. A failed newer refresh now suppresses a successful initial catalog request for the same agent. The previous head displays Fast under the same packaged reproduction, while this head remains on the default model.
…efresh fails Separates scope generation from committed request sequence in createModelCatalogLoader (handoff-models.ts): - generation increments only on mount/dispose/agent/target switches, so cross-agent, round-trip, and post-unmount responses remain rejected. - committedSeq advances only when a request in the current generation succeeds, so a failed newer on-open refresh never suppresses an earlier in-flight HTTP 200 initial catalog load for the same agent, while a slower older response still cannot overwrite a newer successful refresh. Also reloads the model catalog if HandoffComposer re-targets to another thread on the same agent, and adds both unit and isolated-context packaged Playwright E2E regression tests covering the exact failed-refresh timing. Signed-off-by: maxliux5 <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
在 Workbench 内联交接中切换 Agent 并选择模型的用户。 上次同一 Antigravity 的刷新请求失败后,成功初读被丢掉,选择器显示默认模型。 同样先让刷新报错,再放行 HTTP 200 初读,当前提交的交接输入栏显示 Fast。 范围仍是原 Workbench 用户流程,复审增量四个文件,仅调整交接目录的接受条件和测试。 实际账号权限、系统软键盘和 PR 正文内可访问的首屏图仍待验证。
改动思路 / Approach
沿用同一浏览器模型选择器与 daemon 的 fork 校验。 修复只需要改变 Workbench 客户端接受目录响应的条件。 模型列表用 generation 隔离 Agent、会话和操作的变更,committedSeq 只记录已经成功提交的请求。上一次已验证的跨 Agent 保护继续由当前回归覆盖。
具体改动 / Changes
审阅 4431cd14b306aa759563e1b6f3965a61e51f0cc6,基线 1bdf851e9447bc7c22ab29d10948a674bf4687c4。相对基线 40 个 Workbench 文件,共新增 2,253 行、删除 524 行。与上一提交相比只改目录加载器、接力输入栏以及两份测试。内联交接沿用原输入栏和 fork HTTP,支持附件与模型配置,后台继续校验权限。Markdown 共用公式解析管线并保留金额等字面文本。取消后的流式回答可在时间线和历史读回。关闭活动筛选后使用已有侧栏分组定位当前会话。全量 Web 回归覆盖这些共享入口。
关键代码讲解
createModelCatalogLoader.load客户端复核 Agent、generation 和上次成功序号。 请求提交HandoffComposer切换会话或交接方式时重置作用域并重新取得目录。 交接调用- 原
forkThread仍在创建线程前校验模型和附件。共享 Markdown、时间线与侧栏分别继续使用已有入口。
对主干的风险 / Risks
同样先让刷新报错,再放行 HTTP 200 初读,当前提交的交接输入栏显示 Fast。 实际打包 Workbench、本机 daemon 和合成 Agent。刷新错误由同源浏览器夹具注入,初次目录来自真实 daemon HTTP。 类型检查、生产构建、692 项 Web、5 项 daemon 定向测试及 4+11 项标准预检通过。 合成当前主干后,WorkBench 相关路径与评审头逐字相符。上一提交的失败反例已在同一功能入口复验。
我的整体评价 / Verdict
批准。 较新刷新失败时可以继续使用同代成功的初读,跨 Agent 和较新成功响应仍可区分。我查看了当前生产包的桌面和 390 像素窄屏。长回复与交接输入处于同一页,桌面显示 Fast,窄屏用图标触发,展开后可读 Fast。 实际账号权限、系统软键盘和 PR 正文内可访问的首屏图仍待验证。
English verdict: APPROVE at 4431cd1. The packaged Workbench keeps Fast after a failed newer same-agent refresh. The exact-head Web, scoped daemon and premerge checks passed.
Goal And Delivered Outcome
main(40 files underapps/workbench/).440px) over a backdrop scrim with custom<select>dropdowns, no image paste/upload, no effort/speed controls, and no@references — while the main thread composer already offered a full-width liquid-glass input bar with native pickers.$...$,\(...\)) and block ($$...$$,\[...\]) mathematical expressions rendered as literal TeX source across chat messages, file previews, and skills docs.ForkSubchatDialog.tsxwith inline bottomHandoffComposer.tsxreusing the New ThreadComposerwidth and nativeAgentPicker,WorkspacePicker, andModelPicker(effort + speed), with guarded model-catalog refreshes (handoff-models.ts) so stale responses after switching agents cannot overwrite the active agent's catalog, direct+image attach,Cmd/Ctrl+Vimage paste, image-only handoffs,@references, isolated handoff draft keys, and upfrontmodel/effort/speed/imagesvalidation inPOST /api/threads/:id/forkbefore worktree/thread creation (unitdaemonfork-subchat.test.ts+ webhandoff-composer.test.ts+real_entrypointfork-subchat.spec.mjs,fork.spec.mjs,auto-handover.spec.mjs).remark-math,rehype-katex, andremarkLatexMath(markdown-math.ts) acrossThreadView,FilesPanel, andSkillsPage, sharing the existing patched[email protected]via workspace overrides (0dependency advisories), plus.woff2CSP/MIME serving inhttp.ts. Renders inline/display formulas cleanly while preserving currency ranges ($5-$10), shell variables ($HOME/$USER), code spans, and XSS guards (unitmarkdown-math.test.ts+real_entrypointChromium KaTeX &.woff2font verification).timeline.ts(closeTurn(endedAt, keepNotes)+mergeWorkEntries), webhistory.ts,ThreadView.tsx, and daemonhistory.tsso trailing prose produced before a cancellation stays visible as the turn summary while earlier intermediate notes remain in the work block (unitdaemonhistory.test.ts+ webhistory.test.ts&timeline.test.ts+real_entrypointinterrupted-work.spec.mjs).locateThreadInSidebar(sidebar.ts) andSidebar.tsxlayout reveal so toggling the Activity Bell off auto-expands any collapsed project/section/done group and folded branch drawer containing the active thread and centers it inside.sidebar-scroll(unitsidebar.test.ts+real_entrypointsidebar.spec.mjs).main.Author Declaration
model_agent(Antigravity / Gemini) directed and reviewed byhuman_operator(maxliux5).Implemented against
origin/main(1bdf851e9).apps/workbench/packages/web/src/components/HandoffComposer.tsx,handoff-models.ts,Composer.tsx,ThreadActions.tsx,App.tsx,fork-subchat.css,apps/workbench/packages/daemon/src/{http,threads}.tsfork-subchat.test.ts,handoff-composer.test.ts,fork-subchat.spec.mjs,fork.spec.mjs,auto-handover.spec.mjsapps/workbench/packages/web/src/markdown-math.ts,markdown-html.{ts,css},ThreadView.tsx,FilesPanel.tsx,SkillsPage.tsx,apps/workbench/packages/daemon/src/http.ts,apps/workbench/package.jsonmarkdown-math.test.ts, Chromium built-bundle KaTeX check,npm auditapps/workbench/packages/web/src/{timeline,history}.ts,ThreadView.tsx,apps/workbench/packages/daemon/src/history.tshistory.test.ts, web{history,timeline}.test.ts,interrupted-work.spec.mjsapps/workbench/packages/web/src/sidebar.ts,Sidebar.tsxsidebar.test.ts,sidebar.spec.mjstypecheck, full web unit test suite (692/692), targeted daemon unit suites (20/20), full Workbench productionbuild, 7 Playwright E2E specs (28passed,1pre-existing legacy-assistant skip),npm auditverification (0vulnerabilities across newly added packages), and headless Chromium KaTeX/font + desktop/phone light/dark visual inspection against the built bundle. Deliberately left unrelated sidebar badge/date work out of scope (tracked separately in#9635).Scope And Continuation
apps/workbench/. No core Python control-plane, RFC, or protocol files touched. Does not modify existing sidebar branch badge styling to stay conflict-free with#9635.apps/workbench/.Validation
4431cd14b306aa759563e1b6f3965a61e51f0cc6finishedsynthetic,public_fixturestaticpassedcd apps/workbench && npm run typecheck— passed across all 6 Workbench workspaces (0errors).unitpassedcd apps/workbench && npm test -w @loopx/loochat-web—692/692passed (includinghandoff-composer.test.tsout-of-order refresh/unmount races,markdown-math.test.ts,history.test.ts,timeline.test.ts,sidebar.test.ts,i18n.test.ts).unitpassedcd apps/workbench && npx --prefix packages/daemon tsx --import ./packages/daemon/test/home-env.mjs --test packages/daemon/test/fork-subchat.test.ts packages/daemon/test/history.test.ts—20/20passed (including image/effort/non-image-model fork validation and cancelled-turn summary parity).staticpassedcd apps/workbench && npm run build— production daemon, Vite web bundle (sharing single[email protected]with KaTeX CSS/woff2 assets), and extension checks passed;npm auditconfirms0vulnerabilities across all newly added packages.real_entrypointpassedcd apps/workbench && node --test packages/e2e/test/fork-subchat.spec.mjs packages/e2e/test/fork.spec.mjs packages/e2e/test/auto-handover.spec.mjs packages/e2e/test/sidebar.spec.mjsagainst the packaged build —25/25passed (fork-subchat.spec.mjs8/8, including both delayedpirefresh vs AntigravityFastand same-agent failed-refresh fallback regressions;1pre-existing skipped test for the unshipped legacy assistant page).real_entrypointpassedcd apps/workbench && node --test packages/e2e/test/interrupted-work.spec.mjs packages/e2e/test/markdown-links.spec.mjs packages/e2e/test/composer-layout.spec.mjsagainst the packaged build —3/3passed.real_entrypointpassed[email protected]) with synthetic fixtures confirmed inline & display KaTeX rendering (3.katex,1.katex-display,0.katex-error), literal preservation of$5-$10and$HOME/$USER, and3/3KaTeX.woff2font responses with HTTP200.apps/workbench/.Frontend / Visual Evidence
changed440pxcentered modal over a dark backdrop scrim with custom<select>controls and no image attachment or effort/speed UI.$...$/$$...$$text.652pxon1440×900desktop, asserted within≤4px), preserves the native liquid-glass surface in light and dark modes with zero backdrop scrim, exposes nativeAgentPicker+ optionalWorkspacePicker+ subtle mode indicator +×exit on top, spacious textarea in the middle, and direct+image attach,@references, nativeModelPicker(with effort/speed dial), and circular send button on the bottom.390×844) light and dark layouts compact cleanly into single-row pickers and icon-only mode badge with zero horizontal overflow.$\Delta S$,$T=30\text{–}100$) and display ($$\Delta C = \sum_{t=1}^{T} \Delta S_t$$) KaTeX math renders cleanly in both light and dark themes with bundled.woff2fonts while leaving$5-$10and$HOME/$USERuntouched.npm run build) served by the real Workbench daemon in headless Chromium at4431cd14b306aa759563e1b6f3965a61e51f0cc6. Synthetic captures are kept outside Git per the Visual Evidence Retention policy (not committed as a standalone capture pack; reproducible viaLOOCHAT_FORK_SHOTS=output/playwright/workbench-handoff-math-timeline-bell node --test packages/e2e/test/fork-subchat.spec.mjs).1440×900&1280×800) and phone (390×844), light and dark themes, inline handoff composer, topic drawer, and KaTeX math rendering.syntheticComposerpattern, hiding non-applicable project/machine/permission pickers so only decision-relevant handoff controls remain visible while keeping Escape/cancel and model capability errors one step away.icons.tsx),Popoverpickers, and theme danger tokens (var(--danger)for KaTeX parse errors) with zero new raw hex values, zero native form controls, and zero layout overlap on phone or desktop.Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
N/A — changes are scoped strictly to
apps/workbench/.Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md).python3 scripts/check_rfc_bilingual.py --base origin/main --head HEADpasses, or no paired RFC changed.none.Signed-off-bytrailer (git commit -s).