DSH / Atlas
2026-10-20implementedfeature

Forge state in the Session list

会话列表中的 forge 状态

The [forge panel](2026-10-09-forge-panel.md) named a Session's branch in a chip beside the Session title. The header's action row does not shrink, so a long branch overlapped other header entries such as the background task label. Finding which Sessions work in their own worktrees, and which of their change requests need attention, also meant opening each Session's tab. The Session list offers seats for row icons and

English

Problem

The forge panel named a Session's branch in a chip beside the Session title. The header's action row does not shrink, so a long branch overlapped other header entries such as the background task label. Finding which Sessions work in their own worktrees, and which of their change requests need attention, also meant opening each Session's tab. The Session list offers seats for row icons and a hover card section, sidebar.session.row.trailing and sidebar.session.row.hover, whose occupants must not load or bind Sessions. A row needs two kinds of fact: what the Session log records, which is the worktree the panel created and entered and the change requests the Session binds, and what only polling knows, which is each change request's state and checks.

Decision

The chip beside the Session title is gone, and the tab's first row names the branch. A Session row shows, after its time, a branch glyph while the Session works in the worktree the panel created for it, and the glyph of its most urgent change request: one needing attention first, then open, draft, not yet polled, merged, and closed. An open change request's glyph keeps the row's subdued color with a dot for its checks; merged and closed ones keep their state colors. The row's hover card section names the worktree branch and what it started from, then up to three change requests with their state and checks, and how many more there are.

Log facts reach the list as projection client views, which the Session summary carries. The forgeWorktree projection also records the Session's directory from its header and each workspace-root/change or working-directory/change, and its view is the created worktree while that directory is the worktree or lies below it, else null. The forgeChangeRequests view lists the bindings without status, as the binding decision intended. The projection cache keeps both for Sessions that are not loaded.

Polled states reach the list through the forgePanel.changeRequestStates stream. One Host run serves every stream and stops with the last one. It lists Sessions through sessionQuery without loading them, takes the visible bindings of loaded Sessions from ctx.forgeSession and those of other Sessions from their cached summary, follows binding changes of loaded Sessions, and subscribes to each bound change request through the shared ctx.forge.watch; closed requests use the idle polling cadence, and merged requests remain subscribed for explicit refresh. Every changed state is stored in the forge_panel_change_requests storage domain under the SHA-256 digest of its URL, so a restart shows the last known states before the next poll, and unbound stored states are dropped only when every listed Session has known bindings. A stream sends a baseline of the states its caller may read, then changed frames, filtered through Remote access.

The browser keeps one source of states for every row and hover section: the first subscriber opens the stream, the last one closes it, and a transport reset reopens it.

Alternatives considered

Leaving change requests to the tab. The forge panel first rejected a Session-row hover section because, for one Session, it repeated the tab. The list compares every Session at once, which no tab does, and the hover section adds only the facts a row's glyphs summarize.

Keeping the branch beside the Session title. Truncating the chip would hide the branch name, and the header shows only the open Session; the list shows every Session, and the tab names the branch in full.

Polled states in a projection. Projections fold the Session log, and polled states are not logged. A projection would either log every poll, adding events that no model request needs, or depend on process-local state that a replay cannot reconstruct.

Following every listed Session's panel. A panel inspects its checkout with Git in the Session's execution world and probes sign-in; the list needs only bindings and change request states.

Loading listed Sessions to read their bindings. Listing would replay every Session log; the cached summary answers without loading.

Keeping the states only in memory. Every row would show unknown states after a restart until each change request is polled again. The stored states are derived data, so a record that fails its schema is set aside instead of failing the run.

A branch line for a Session that works in its project directory. Reading that branch needs Git in the Session's execution world, which the list must not reach without loading the Session.

Consequences

The list shows every Session's worktree and change request states without loading a Session, a restart shows the last known states at once, and the header no longer overlaps. While a row is shown, every open change request that a listed Session binds is polled, so many Sessions with open change requests mean more requests to the code host; closed requests keep polling at the idle cadence, and merged ones stop automatic polling. A Session without a cached summary shows its worktree and change requests in the list only after it is opened, and one last used before this change shows its worktree only then, because the forgeWorktree state changed and older cached rows are discarded. Checks that finish while no row is shown produce no notification.

中文

Problem

forge 面板原先在 Session 标题旁的标签中写出 Session 的分支。标题栏的操作行不会收缩,因此较长的分支名会与后台任务标签等其他标题栏条目重叠。想知道哪些 Session 在自己的 worktree 中工作、它们的哪些变更请求需要处理,也必须逐个打开 Session 的标签页。会话列表为行图标与悬浮卡片提供了位置,即 sidebar.session.row.trailing 与 sidebar.session.row.hover,其中的条目不得加载或绑定 Session。一行需要两类事实:Session 日志记录的事实,即面板创建并进入的 worktree 以及 Session 绑定的变更请求;以及只有轮询才知道的事实,即每个变更请求的状态与检查。

Decision

Session 标题旁的标签已移除,由标签页顶部一行写出分支。Session 在面板为它创建的 worktree 中工作时,会话行在时间之后显示分支图标;另有一个图标显示它最需要关注的变更请求,依次为需要处理、打开、草稿、尚未轮询、已合并、已关闭。打开中的变更请求图标保持会话行的浅色,并用圆点标出检查;已合并与已关闭的保留各自的状态颜色。会话行悬浮卡片中的部分写出 worktree 分支及其起点,再列出最多三个变更请求的状态与检查,并说明还有多少个。

日志事实经投影的客户端视图进入列表,由 Session 摘要携带。forgeWorktree 投影还从 Session 头部与每个 workspace-root/change 或 working-directory/change 记录 Session 的目录;该目录就是所创建的 worktree 或位于其下时,视图为该 worktree,否则为 null。forgeChangeRequests 视图列出绑定但不含状态,与绑定决策的设想一致。投影缓存为未加载的 Session 保留这两项。

轮询到的状态经 forgePanel.changeRequestStates 流进入列表。宿主用一次运行服务所有流,最后一条流结束时运行停止。它经 sessionQuery 列出 Session 而不加载它们,已加载 Session 的可见绑定取自 ctx.forgeSession,其他 Session 的取自缓存的摘要;它跟随已加载 Session 的绑定变化,并经共享的 ctx.forge.watch 订阅每个已绑定的变更请求;已关闭的按空闲间隔轮询,已合并的保留订阅以接收显式刷新结果。每个变化了的状态以其 URL 的 SHA-256 摘要为键存入 forge_panel_change_requests 存储域,因此重启后在下次轮询之前就能显示最近已知的状态;仅在所有已列出 Session 的绑定均已知时删除无人绑定的已存状态。每条流先发送调用方可读状态的 baseline,之后发送 changed 帧,均经 Remote 访问控制过滤。

浏览器为所有会话行与悬浮卡片部分只保留一个状态来源:第一个订阅方打开流,最后一个关闭它,传输重置后重新打开。

Alternatives considered

把变更请求只留给标签页。 forge 面板最初否决了 Session 行悬浮分区,因为对单个 Session 而言它与标签页重复。列表能同时比较所有 Session,这是任何标签页都做不到的;悬浮部分也只补充会话行图标所概括的事实。

保留 Session 标题旁的分支。 截断标签会遮住分支名,而且标题栏只显示当前打开的 Session;列表显示每个 Session,标签页则完整写出分支。

把轮询状态放进投影。 投影折叠的是 Session 日志,而轮询到的状态不写入日志。放进投影要么为每次轮询记录事件,而这些事件没有任何模型请求需要;要么让投影依赖重放无法重建的进程内状态。

为每个已列出的 Session 跟随其面板。 面板会在 Session 的执行环境中用 Git 检查检出并检查登录状态;列表只需要绑定与变更请求状态。

加载已列出的 Session 来读取绑定。 列表将重放每个 Session 的日志;缓存的摘要无需加载就能回答。

只把状态保存在内存中。 重启后每一行都会显示未知状态,直到每个变更请求再次被轮询。已存状态是派生数据,因此不符合 schema 的记录会被放到一边,而不是让运行失败。

为在项目目录中工作的 Session 显示分支一行。 读取该分支需要在 Session 的执行环境中运行 Git,而列表不加载 Session 就无法到达那里。

Consequences

列表无需加载 Session 就能显示每个 Session 的 worktree 与变更请求状态,重启后立即显示最近已知的状态,标题栏也不再重叠。有会话行显示期间,已列出 Session 绑定的每个打开中的变更请求都会被轮询,因此有大量带打开变更请求的 Session 时,对代码托管平台的请求会增多;已关闭的继续按空闲间隔轮询,已合并的停止自动轮询。没有缓存摘要的 Session 要打开之后才会在列表中显示其 worktree 与变更请求;此变更之前最后使用的 Session 也要到那时才显示其 worktree,因为 forgeWorktree 的状态已变化,旧的缓存行会被丢弃。没有会话行显示期间结束的检查不会有通知。