Repository navigation
feat(workbench): reach a Bot's workers from its Chat - #6637
Conversation
A Turn the Bot starts because a worker finished carries that worker as the origin of its opening message. When the Bot replies to such a Turn, Chat now shows a link under the reply that opens the worker's conversation beside the Bot's, using the side-pane support the app already has. Replies to the user's own messages show no link. Generated-by: Claude Code Co-Authored-By: Claude Opus 5.5 <[email protected]>
… waits for the user A conversation the Bot created can stop to ask for an approval or an answer. It then has not ended its run, so the Bot is not woken and says nothing, and the request shows only as a count in the sidebar. The Bot's Chat now ends with a line for each such live conversation, "<title> is waiting for your reply. Open it.", which opens that conversation beside the Bot's. Generated-by: Claude Code Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the worker in the link - The Bot's Chat now ends with a line for each conversation it created that is running or waiting for the user, which opens it beside the Bot's. While a worker runs the Bot says nothing, so this is where its progress can be reached. - The Bot's own conversations are read from the Host and refreshed every few seconds while it is visible. The sidebar list only holds top-level conversations, so the earlier attempt to read them from there never saw a worker, and the worker link fell back to a generic title. Generated-by: Claude Code Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep both sides where the Bot restart change (#6569) and the worker link and active-worker lines touch the same places: the Bot imports, the Bot view helpers, and the Bot transcript tests. Generated-by: Claude Code Co-Authored-By: Claude Opus 5.5 <[email protected]>
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
I reviewed all six changed files at 5ea10f369da758bbc551f8ca9bc538a5b584b3f7: worker-origin reply links, child-session polling, activity filtering/order, side-pane actions, translations and transcript tests.
P2: active workers beyond the first catalog page never appear. The new poll always requests position: start, replaces its state with page.sessions, and ignores page.after. The Host returns at most 32 sessions, ordered by pinning and recency rather than activity. With 32 earlier idle children and an older child still waiting for approval or running, every poll returns the same idle page; the active child has no progress/approval link in the Bot Chat. Follow the catalog cursor before filtering for activity, with appropriate revision/retry handling.
Validation: all 16 existing transcript tests passed locally with Node 24.18.1. A controlled check executing the actual refreshBotChildren function omitted a waiting child and a running child on three consecutive polls each; a cursor-following control against the same adapter found both. I checked the production 32-session limit, catalog ordering and pagination contract. This adapter check did not run a real Host or render the native UI.
Actual merge into ed79386f826ab0c2d4267dafa361240487d2f30e succeeded. CI 41955407473 failed an external-agent consent timeout and a keyboard UI wait; I have not established that this PR caused those failures. No schema or protocol change is introduced here. I did not independently repeat the contributor's macOS visual check or test a slow remote Host.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
| scope: { kind: 'children', sessionId }, | ||
| position: { kind: 'start' }, | ||
| }); | ||
| if (alive) botChildren.set(page.sessions); |
There was a problem hiding this comment.
[P2] Follow the child catalog past its first page
agent.list is paginated (SessionPage.after, at most 32 sessions). This assignment discards the continuation cursor, and each subsequent poll starts over. For example, 32 newer idle children can fill the first page while an older child is still waiting for approval or running. activeWorkers then sees no active child, so the new Chat entry never appears, however long the user waits. Read the remaining pages before applying the activity filter, accounting for catalog revision changes. The actual refresh function reproduced this for both activities with a controlled paginated Host adapter; a cursor-following control found the missing child.
|
I tested I also reproduced the pagination issue already reported here. Two additional UI observations:
Separately, I observed a mismatch between the model displayed in worker panes and the model used for Bot-dispatched runs. The Bot and global default were DeepSeek, but two created workers retained GPT-6.1 Sol and GLM-5.3 as their saved backend preferences. Their Bot-dispatched requests actually used DeepSeek. Sending “continue” directly in the GPT-labelled worker then issued a GPT request and failed with HTTP 403 / How direct input from the side pane should interact with Bot-created workers, including which model should apply, seems worth discussing separately. The immediate UI concern is that the displayed model does not clearly represent the model used for the Bot-dispatched run, leaving the distinction unclear to the user. This model-state behavior also exists in the base branch and can be tracked separately from this PR. Local validation completed:
No additional issues were found in the desktop scenarios tested so far. Code inspection, automated checks, and drafting were assisted by Codex. The desktop usage scenarios were tested manually. 简体中文我在 macOS 上测试了 我也复现了这里已经报告的分页问题。另外还有两个 UI 问题:
此外,我观察到了工作会话面板显示的模型与 Bot 派发时实际使用的模型不一致。Bot 和全局默认模型都是 DeepSeek,但创建的两个工作会话分别保存了 GPT-6.1 Sol 和 GLM-5.3 作为模型偏好。由 Bot 派发时,它们实际请求的仍然是 DeepSeek;直接在显示 GPT 的工作会话里发送“继续”后,则实际请求了 GPT,并返回 HTTP 403 / 至于从侧栏直接输入应如何影响 Bot 创建的工作会话,包括此时应该使用哪个模型,我认为可以单独讨论。目前首先想反馈的是:界面显示的模型没有清楚反映 Bot 派发时实际使用的模型,用户难以理解两者的区别。 这个模型状态问题在基线中也已经存在,可以与本 PR 分开跟踪。 本地验证结果:
目前测试过的桌面使用场景中,暂未发现其他问题。 代码检查、自动测试和评论起草使用了 Codex 协助;桌面使用场景由本人手工测试。 |
M4n5ter
left a comment
There was a problem hiding this comment.
English
Reviewed 5ea10f369. Linking Bot replies and active workers directly from MessageOrigin::BotWorker and the child catalog without adding stored state is clean, and the two cli slice failures on CI run 41955407473 are unrelated rust-preview flakes.
Three everyday-path issues worth addressing:
-
Replace the 3-second
setTimeoutpoll with anagent.catalogsubscription (plugins/agent/conversations/ui/Conversation.tsx:451-478)refreshBotChildrenqueriesagent.listevery 3 seconds whenever the Bot conversation is visible. That repeatedly scans partition SQLite databases while completely idle and adds up to 3 seconds of stale UI lag on transitions—for example,wake.rswakes the Bot ~250ms after a worker finishes, so the Bot can already be streaming or posting its reply while the bottom of Chat still shows<worker> is working.- Host
agent.catalog(scope: { kind: 'children', sessionId }, includeArchived: false) already pushes immediately when child sessions are created, start/end a turn, enter/leavewaitingapproval state, rename, or archive (the same streamproducts/maka/workbench/app/browsing.ts:160-243uses). Subscribing there—and skipping it whenformerBot()is true—eliminates both idle polling and state lag.
-
Resolve historical
BotReplyworker titles and existence viacreateMessageSendersinstead ofbotChildren(plugins/agent/conversations/ui/Conversation.tsx:479-482, 610-628, 3162-3168,products/maka/workbench/app/messageSenders.ts:30-32)workerTitle(id)only checksbotChildren()(includeArchived: false, first 32 unarchived children) andprops.knownSession(rootsOnly: true, which never holds child workers). Once a finished worker is archived, or the Bot accumulates more than 32 child runs over time, or the user views a replaced former Bot, historical replies degrade to the generic"View the record of the worker"; if a worker session was deleted, the button also stays clickable.Conversation.tsxalready mountscreateMessageSenders(position: { kind: 'at', cursor: id }, includeArchived: true) for the visible history window. ExtendingsenderSession(origin)inmessageSenders.tsto coverorigin?.kind === 'bot_worker'resolves real titles for archived and older workers, lets<BotReply>disable/hide the link whensenders.session(id) === null(deleted), and gives the Bot's Trajectory view aSenderBadgeon the wake message as well.
-
Fall back to opening the worker in the current pane when side-by-side panes don't fit (
plugins/agent/conversations/ui/SessionSurface.tsx:2138-2145,plugins/agent/conversations/ui/Conversation.tsx:3150-3168,products/maka/workbench/app/BotReply.tsx:60-100)- Per
sidePaneRoom(products/maka/workbench/app/Workbench.tsx:39-45) andApp.tsx:220-222,openBesideisundefinedwhenever the window is< 960px(half-screen split),< 1280pxwhile the right Files/Terminal panel is open (common 13"/14" laptop logical widths), or in the terminal TUI. - Because child workers are omitted from the sidebar (
rootsOnly: true), in those layouts<BotWaiting>renders active-colored text"{title} is waiting for your reply. Open it."on adisabledbutton that does nothing when clicked, leaving no way to reach the blocked approval;<BotReply>hides its record button altogether. - Falling back to
shell()?.openSession(sessionId)whenopenBesideis unavailable keeps workers reachable in narrow/preview-open layouts and TUI (with the Bot pinned at the top of the sidebar to switch right back). While updatingBotReply.tsx, please also addmaxWidth: '100%'on the row<Button>andflexShrink: 1(withtextOverflow: 'ellipsis') on<Text>so long worker titles truncate instead of overflowing a narrowed split column.
- Per
简体中文
看完了 5ea10f369。直接基于 MessageOrigin::BotWorker 和子会话目录打通汇报消息与活跃工作会话、不引入额外持久化状态的做法很干净;本次 CI(41955407473)挂掉的两个 cli 分片属于 rust-preview 基线已有的偶发抖动,与本 PR 无关。
有 3 个常规使用路径就会触发的问题建议一并处理:
-
用
agent.catalog订阅替代 3 秒setTimeout轮询(plugins/agent/conversations/ui/Conversation.tsx:451-478)- 当前只要 Bot 会话可见,
refreshBotChildren就会每 3 秒调一次agent.list。这既会在界面完全空闲时反复扫描分区 SQLite,又会带来最高 3 秒的状态滞后——例如wake.rs在工作会话结束后约 250ms 就会唤醒 Bot,经常会出现 Bot 已经在流式生成或发出汇报消息了,Chat 底部仍挂着<worker> 正在处理。 - Host 的
agent.catalog(scope: { kind: 'children', sessionId }, includeArchived: false)在子会话创建、回合开始/结束、进入/退出等待审批(waiting)、改名与归档时都会立即推送(侧栏products/maka/workbench/app/browsing.ts:160-243正是用它实时更新)。改为订阅该流(并在formerBot()为真时跳过订阅)即可同时消除空闲轮询与状态滞后。
- 当前只要 Bot 会话可见,
-
历史汇报的 worker 标题与存在性应复用已挂载的
createMessageSenders,而非依赖botChildren(plugins/agent/conversations/ui/Conversation.tsx:479-482, 610-628, 3162-3168、products/maka/workbench/app/messageSenders.ts:30-32)workerTitle(id)只查botChildren()(includeArchived: false,仅前 32 条未归档子会话)和props.knownSession(rootsOnly: true,不含子会话)。一旦已完成的工作会话被归档、Bot 长期累计运行超过 32 个子会话,或用户在查看被替换的归档旧 Bot,历史回复下方的按钮就会全部退化为无区分度的「查看『工作会话』的执行记录」;若工作会话已被删除,按钮也依然保持可点击。Conversation.tsx原本就已经按当前可见历史窗口挂载了createMessageSenders(position: { kind: 'at', cursor: id }, includeArchived: true)。直接让messageSenders.ts的senderSession(origin)同时覆盖origin?.kind === 'bot_worker',就能自动拿到已归档和更早工作会话的真实标题,在会话已删除(senders.session(id) === null)时禁用/隐藏入口,并顺带让 Bot 的 Trajectory 视图也在唤醒消息上展示对应的SenderBadge。
-
分栏空间不足或终端模式下回退为在当前面板打开工作会话(
plugins/agent/conversations/ui/SessionSurface.tsx:2138-2145、plugins/agent/conversations/ui/Conversation.tsx:3150-3168、products/maka/workbench/app/BotReply.tsx:60-100)- 按
sidePaneRoom(products/maka/workbench/app/Workbench.tsx:39-45)和App.tsx:220-222计算,窗口< 960px(常见左右半屏)、打开右侧文件/终端面板时< 1280px(常见 13/14 寸笔记本逻辑宽度),以及终端 TUI 下,openBeside均为undefined。 - 由于侧栏默认列表不含子会话(
rootsOnly: true),在这些布局下<BotWaiting>会用正常字色显示「{title}在等你的回复,点这里处理。」,但按钮处于disabled状态点击无反应,用户无法进入工作会话处理审批;<BotReply>的执行记录按钮则会直接消失。 - 建议在
openBeside不可用时回退到shell()?.openSession(sessionId)在当前面板打开(侧栏顶部常驻 Bot 入口,处理完可一键切回)。顺带给BotReply.tsx的行级<Button>加上maxWidth: '100%'、内部<Text>加上flexShrink: 1(及textOverflow: 'ellipsis'),避免打开右侧分栏后超长标题横向撑出阅读列。
- 按
Automated review generated by Antigravity.
…er titles from history, open workers in the pane when none fits Review of #6637. - The Bot's workers come from the Host's `agent.catalog` stream (scope: children) instead of a 3-second poll, so the Chat follows a worker starting, waiting or finishing without lag, and nothing is read while idle. The stream is not opened for a replaced Bot. - Each catalog window is read through its continuation cursor before the activity filter is applied, so a running or waiting worker behind a full page of idle ones is still listed. A window that changes revision while its pages are read is discarded and the next pushed one is used. - A reply's worker title and existence come from the message-sender lookup that the history window already runs (archived included), so older and archived workers keep their title and a deleted one shows no link. A wake message also shows the sender badge in the trajectory. - When no side pane fits (narrow window, files panel open, terminal), a worker opens in the current pane instead of leaving a disabled button. The rows truncate long titles. Generated-by: Claude Code Co-Authored-By: Claude Opus 5.5 <[email protected]>
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
I reviewed all nine changed files at 230287562f8e4a03661458fa9b5a63c656f7cc1e, separating the worker-panel changes from the incoming Rust branch updates. The implementation now subscribes to the Bot's child catalog, follows continuation pages, resolves historical worker titles through sender metadata, and provides a current-pane fallback.
The previous first-page-only counterexample is fixed: both waiting and running workers behind 32 or 64 idle children are found. Two P2 issues remain, detailed inline:
- Silent truncation after 16 pages.
assembleChildrenreturns a successful partial list with a continuation cursor still present. With 512 newer idle children, an older running or waiting worker is omitted on every catalog refresh. The new limit moves the original visibility failure rather than fully resolving it. - A cancelled or ended catalog subscription never reconnects.
createBotWorkersretains its last list and exits. With the same visible Bot still selected, nothing retriggers that effect: a worker can remain displayed as working after it needs approval, or disappear from this entry point entirely after an initial subscription failure. The native subscription wrapper propagates pull cancellation/end; its retry on initial subscription admission does not reopen an already-ended stream.
Validation: all 19 transcript tests passed locally with Node 24.18.1. Controlled checks executed the actual assembleChildren/activeWorkers functions at the 32, 64, 511 and 512 idle-child boundaries. A separate check executed the actual watcher body with deterministic reactive and Host adapters: after one working page, both cancellation and clean stream end left stale state; a fresh subscription exposed the waiting worker. These checks did not run a real Host or native UI.
Actual merge into a98b7d485b2dcbd3ca0d8ffc89acc074627e8e0b succeeded. CI 41990067324 is queued at this check. No schema or protocol change is introduced here. I did not independently repeat the contributor's visual check, exercise narrow-window rendering, or compile the complete generated UI types.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
| ): Promise<S[]> { | ||
| const rows = new Map(first.sessions.map((session) => [session.id, session])); | ||
| let tail = first; | ||
| for (let pages = 1; tail.after && pages < MAX_PAGES; pages += 1) { |
There was a problem hiding this comment.
[P2] Do not silently publish a truncated child catalog
At 16 pages this loop stops even when tail.after is still present, then returns the rows as a complete successful result. The Host pages at 32 sessions, ordered by pinning/recency before the activity filter. With 512 newer idle children and an older child waiting for approval or running, the actual function returns only the 512 idle records, so the Chat still has no link to that worker. A refresh starts from the beginning again. The 32/64/511 boundary controls find the worker; the 512 boundary omits it for both activities. Continue through valid advancing cursors, or retain an explicit incomplete result and schedule continuation rather than silently treating this prefix as the whole catalog.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
| // its next window, and any later change pushes again. | ||
| } | ||
| } | ||
| })().catch(() => { |
There was a problem hiding this comment.
[P2] Reopen the child catalog after its observation ends
A rejection from opened.next() reaches this empty catch; null also returns above. Neither path reconnects. The effect only depends on the Bot ID and enabled/visibility state, so subsequent worker activity cannot refresh this list while the same Bot stays visible. A controlled execution of this actual watcher accepted a working page, then received agent_observation_cancelled; it made no second subscription and kept the worker working even though a fresh catalog reported it waiting. Clean stream end behaves the same. Native ScopedSubscription.next forwards pull errors/end, and the native retry in subscribe covers initial admission only. Reconnect recoverable observations with cleanup and lifecycle guards, as the other persistent catalog consumers do.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
M4n5ter
left a comment
There was a problem hiding this comment.
English
Thanks for the quick update in 952288a02! Subscribing to agent.catalog, routing historical worker titles/existence through createMessageSenders, and falling back to openSessionHere when no side pane fits all look great.
Two small follow-ups after the rust-preview merge (230287562), plus the remaining UI polish:
- Drop the hardcoded
MAX_PAGES = 16cap inassembleChildren(products/maka/workbench/app/botTranscriptCore.ts:251, 267):
Tracking visited continuation cursors (seen) already guarantees loop termination on a fixed catalog revision without silently truncating long-lived Bots once unarchived child history exceeds 512 sessions. - Align
createBotWorkerswith#6638observation-cancellation reconnects (products/maka/workbench/app/botWorkers.ts:42-74):
230287562merged#6638(ed79386f8), where persistent workbench subscriptions rebind onisObservationCancelledacross UI service handoffs. Adding the same reconnect loop (and skipping continuation reads whenpage.revisionis unchanged) keeps active workers live across reconfiguration. - Reactive
entry()+ per-workeraccessibilityLabel+ TrajectorySenderBadgefallback (Conversation.tsx,BotReply.tsx):
Readingentry()reactively with a stable'bot/waiting'key refreshes live worker renames in place, passing the current-pane fallback tocreateMessageSenderskeeps Trajectory wake badges clickable in narrow windows/TUI, and using the{title}-bearing visible label asaccessibilityLabelmakes multiple worker buttons distinguishable.
I'll push a small commit for these and merge directly.
简体中文
感谢在 952288a02 中快速跟进!改为订阅 agent.catalog、通过 createMessageSenders 解析历史工作会话标题与存在性,以及无分栏空间时回退到 openSessionHere 的处理都很干净。
合入最新 rust-preview(230287562)后顺手收尾两处细节与 UI 小问题:
- 移除
assembleChildren中硬编码的MAX_PAGES = 16页数上限(products/maka/workbench/app/botTranscriptCore.ts:251, 267):
记录已访问游标(seen)即可在固定revision快照上保证不死循环,避免长期使用的 Bot 累计超过 512 个未归档子会话后静默截断。 - 为
createBotWorkers补齐#6638的isObservationCancelled自动重连(products/maka/workbench/app/botWorkers.ts:42-74):
230287562刚合入了#6638(ed79386f8),工作台持久订阅在 UI 服务重绑取消观察时会自动重连;补齐同一重连循环(并在page.revision未变时跳过重复续页拉取)可避免配置变更后底部活跃工作会话停留在旧快照。 - 响应式读取
entry()、区分按钮accessibilityLabel及同步 TrajectorySenderBadge回退(Conversation.tsx、BotReply.tsx):
固定'bot/waiting'key 并响应式读取entry()使重命名实时刷新,把当前面板打开回退一并传给createMessageSenders使窄窗口/TUI 下 Trajectory 唤醒徽章同样可点,并用含{title}的可见文案作为accessibilityLabel以区分多个工作会话按钮。
我直接补一个精简提交处理掉这些并合入。
Automated review generated by Antigravity.
…efresh worker labels - Remove the hardcoded MAX_PAGES = 16 limit in assembleChildren and rely on visited continuation cursors so long-lived Bots do not truncate child sessions. - Reconnect createBotWorkers on observation cancellation (#6638) and skip continuation reads when the catalog revision is unchanged. - Read entry() reactively for BotWaiting and BotReply with a stable waiting key, pass the current-pane fallback to createMessageSenders, and use worker-specific visible copy as accessibilityLabel. Generated-by: Antigravity
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
Follow-up on my two findings, at final 718f6ad56aa86d69491a3eb5b4bee31e860d620e.
The concrete pagination and observation-cancellation counterexamples are fixed. I read the six-file fix increment, including cursor cycle detection, cancellation rebinding and stream cleanup, stable reactive worker rows, sender navigation fallback and accessible labels. Controlled old/new executions now find both running and waiting workers behind 512 and 640 idle children. After agent_observation_cancelled, the actual watcher closes the old stream, subscribes again and accepts the waiting worker; the old implementation remained stale. All 20 transcript tests passed locally with Node 24.18.1, using the test's reactive/Host adapters.
I also checked the production catalog producer in plugins/agent/native/src/service.rs:58–110. It loops and ends with typed errors, rather than returning clean EOF. My earlier adapter's null case alone therefore did not establish a reachable catalog failure. The consumer still returns on null; I am not treating that adapter-only observation as a remaining P2 or claiming that every terminal error recovers.
All nine final PR file blobs match current rust-preview at 06e9852cf961c6b617abcc4b8cecfdd3b2d31f4f. This is a targeted fix verification, not a repeat of the contributor's native visual checks. I did not run Rust, the full generated UI typecheck, or the real Host. Final-head CI still has queued build/product checks at this check; no schema/protocol change is introduced by this fix.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
Summary
Refs #6504. The Bot's Chat shows only what it sent with
SendUser, so a worker it started was invisible while it ran, and its report arrived as one block. This lets the user reach a worker from the Bot's Chat, with no new stored data. It follows the interaction discussed in #6504: keep the conversation as the entry point and open the execution record beside it, using the side panes the app already has ("Open to the side").bot_worker). A Bot reply to such a Turn shows "View the record of " under it, which opens that conversation beside the Bot's. Replies to the user's own messages show no link.agent.catalogwithscope: childrenfor the Bot, so a worker starting, waiting, finishing, being renamed or archived reaches the Chat as it happens and nothing is polled. Each window is read through its continuation cursor before the activity filter is applied, so a running or waiting worker behind a full page of idle ones is still listed; a window that changes revision mid-read is discarded for the next pushed one. The sidebar list only holds top-level conversations, so it never contains a worker. The stream is not opened for a replaced Bot.Not in this PR: nested quotations and attachments from the prototype in #6504.
Verification
reportedWorkerandactiveWorkersare pure functions with tests: a worker-triggered Turn reports its worker and others report none; only the Bot's own, live, running or waiting conversations are listed, waiting first, and archived, someone else's and ordinary conversations are not. The transcript tests (14) pass; biome and theui_typestypecheck are clean.assembleChildrenis a pure function with tests: a waiting worker behind two full pages of idle ones is found by following the cursor (the test fails without it), a catalog that changes revision mid-read is refused, and a cursor that does not advance ends the read.AI use
Tool(s) and scope: Claude Code (Claude Opus 5.5) wrote the code, the tests and this description; the changes were run and checked in the app by the contributor. The commits carry
Generated-by: Claude Code.Checklist
Does this PR entail a change in behavior?