Code review page
代码评审页
The [forge panel](2026-10-09-forge-panel.md) shows the change requests one Session created or pushed. A reviewer also needs the change requests that ask for their review, that they created, or that involve them, read and reviewed without first finding or creating the Session that owns them, and a conversation with the Agent about one of them that does not mix into an unrelated existing conversation.
English
Problem
The forge panel shows the change requests one Session created or pushed. A reviewer also needs the change requests that ask for their review, that they created, or that involve them, read and reviewed without first finding or creating the Session that owns them, and a conversation with the Agent about one of them that does not mix into an unrelated existing conversation.
Decision
A left-navigation Code review page in dsh-experimental-client-ui-forge lists three viewer lists and shows one change request in full.
- Lists — an optional
ForgeProvidercapability (viewer,listForViewer,countForViewer) returns summaries of open change requests; GitHub answers each list with one GraphQL search, because one document with several searches times out. The Host reads the lists only while a page or count stream lasts, outside the forge's status polling, since a batch snapshot of dozens of change requests exceeds GitHub's query timeout; only the shown change request is polled throughForgeService.watch. - Reads by URL — the page's
forgePanel/review*methods name a change request by URL and no Session; they share the Session-bound methods' implementation and are reachable only by callers that may use the Host's code host credentials. - Description —
readDescriptionreturns the Markdown body, labels, and signed addresses for private attachments, which the page substitutes before rendering with HTML omitted. - Activity — two more optional
ForgeProvidermethods,readActivityandaddComment, give the summary tab the comments, submitted reviews, commits, and changes of state of a change request and a field that adds a comment. A provider maps its host's records to one entry type, so the page words every entry in the reader's language and shows a host's own sentence only for a record the type has no kind for. A review's comments on lines stay on the changes tab, which already reads, answers, and resolves them; the activity counts them and opens that tab. - Automatic merge — a snapshot's optional
autoMergeand the optionalForgeProvider.setAutoMergelet the merge action turn the host's automatic merge on for a confirmed head, show that it is on, and cancel it. The field is optional so a provider that sets none changes nothing, and the snapshot carries what the signed-in user may do, so no surface asks the host before it draws the button. Merge queues and merge trains stay out: there the same button would queue the change request, which is another action. - Changes — the page draws the changes view itself, split from the right-sidebar tab, with a panel state that holds only the shown change request; plugin lenses, annotations, and slots stay with the Session tab, whose extension points name a Session.
- Chat — the chat tab embeds
conversation.contentfor the blank SessionconnectWorkspaceresolves in the Workspace named like the repository, and never offers an existing conversation. A Workspace picked in the Hero is handled by the page, as every owner of the content handles its own picks: the page connects that Workspace's blank and shows it in the chat tab, where the main Conversation opens it as the main Session. The change request is bound when the Session's first message enters its inbox, so a blank that is never used stays unbound. - Hosts — the page lists every configured host together, GitHub and GitLab. A host whose read failed is read again later each time without delaying the others, since the bundle ships a GitLab host most users are not signed in to. A repository scope names its host and is read there only: one
owner/namecan exist on two hosts, and a GitLab project path nests groups. The filter offers each host once the lists span several, and a host that could not be read shows one notice after the lists. A row names no host, because every row would then need a second line of small text; choosing among accounts of one host is not offered.
Alternatives considered
- A Session per change request for reading — rejected: reading the description or the diff would create Sessions nobody converses in, and bind them.
- Reviewing in an existing conversation — rejected by the user: the conversation's context would mix with the review.
- Listing through the status poller — rejected: the batch snapshot query times out at the list sizes a reviewer has.
- Binding when the chat opens — rejected: the blank Session is shared with New Session, so it would carry the binding into an unrelated conversation.
Consequences
The forge registry gains a fifth optional capability family and a rate-limited failure code, recorded in the upgrade guide. A Host restart before the chat's first message forgets the staged binding.
中文
Problem
forge 面板显示一个会话创建或推送的变更请求。评审者还需要请自己评审的、自己创建的以及与自己有关的变更请求,不必先找到或创建拥有它们的会话就能阅读和评审;也需要就其中一个与 Agent 对话,而且这段对话不能混进无关的已有对话。
Decision
dsh-experimental-client-ui-forge 在左侧导航中加入“代码评审”页,列出三个登录用户列表,并完整显示一个变更请求。
- 列表——可选的
ForgeProvider能力(viewer、listForViewer、countForViewer)返回未关闭变更请求的摘要;GitHub 每个列表用一次 GraphQL 搜索回答,因为在一个文档中放多个搜索会超时。Host 只在页面流或计数流存在时读取列表,不经过 forge 的状态轮询,因为几十个变更请求的批量快照会超过 GitHub 的查询时限;只有显示中的变更请求经ForgeService.watch轮询。 - 按 URL 读取——页面的
forgePanel/review*方法以 URL 而不是会话指定变更请求;它们与会话绑定的方法共用实现,只有可以使用 Host 代码托管凭据的调用方能访问。 - 描述——
readDescription返回 Markdown 正文、标签以及私有附件的签名地址,页面替换这些地址后以省略 HTML 的方式渲染。 - 动态——另外两个可选的
ForgeProvider方法readActivity与addComment为概要标签页提供变更请求的评论、已提交的评审、提交和状态变化,以及一个添加评论的输入框。提供方把所在主机的记录映射为同一种条目类型,所以页面用读者的语言表述每个条目,只有该类型没有对应种类的记录才显示主机自己的句子。评审在行上留下的评论仍在变更标签页,那里已经能读取、回复和解决它们;动态只显示条数并打开该标签页。 - 自动合并——快照可选的
autoMerge与可选的ForgeProvider.setAutoMerge让合并操作可以为确认过的 head 启用平台的自动合并、显示它已启用,并取消它。该字段是可选的,所以不设置自动合并的提供方不受影响;快照带着当前用户能做什么,所以任何界面在绘制按钮前都不必询问平台。合并队列与合并列车不在其中:在那里同一个按钮会把变更请求加入队列,那是另一种操作。 - 变更——页面自己绘制变更视图(从右侧栏标签中拆出),面板状态只含显示中的变更请求;插件的透镜、行注释和插槽仍只在会话标签中,因为这些扩展点以会话为对象。
- 对话——对话标签为
connectWorkspace在与仓库同名的工作区中解析出的空白会话嵌入conversation.content,从不提供已有对话。在 Hero 中选择工作区由页面自己处理,这与内容的每个属主处理各自的选择一致:页面连接该工作区的空白会话并在对话标签中显示它,而主 Conversation 会把它打开为主会话。该会话的首条消息进入收件箱时才绑定变更请求,因此从未使用的空白会话保持未绑定。 - 主机——页面把所有已配置的主机合并列出,包括 GitHub 与 GitLab。读取失败的主机每次间隔更久再读,不拖慢其他主机,因为套件自带的 GitLab 主机多数用户并未登录。仓库范围带有主机,只在该主机上读取:同一个
owner/name可以存在于两个主机,GitLab 的项目路径还有嵌套分组。列表跨多个主机时,筛选列出每个主机;读取失败的主机在列表之后显示一条提示。列表行不写主机,否则每一行都要多一行小字;同一主机的多个账号之间不提供选择。
Alternatives considered
- 每个变更请求用一个会话来阅读——否决:阅读描述或 diff 会创建无人对话的会话并绑定它们。
- 在已有对话中评审——用户否决:对话上下文会与评审混在一起。
- 经状态轮询列出——否决:在评审者常见的列表规模下,批量快照查询会超时。
- 打开对话时就绑定——否决:空白会话与“新会话”共用,会把绑定带进无关的对话。
Consequences
forge 注册表增加第五组可选能力和 rate-limited 失败码,记录在升级指南中。在对话的首条消息之前重启 Host 会丢失暂存的绑定。