Repository navigation
Done
Labels
Description
背景
#2234 之后,recall 和 agent read 共用 dim-agent-capabilities::narrative 的叙事投影(Recall.md §3)。从 flow 测试截取实际的 agent read 页面,发现三处问题。这三处都不是 #2234 引入的:recall 读自己的线时同样存在,只是 leader 读成员时更明显。
1. 单行块把结束标签带进了行里
03:53 5d9a6832-… dim-state source=dim/environment/clients: No client connection is attached.</dim-state>
- 原因:块的正文和结束标签在同一行时,行里取的"正文第一行"(
first_body_line→first_line,narrative.rs)会把</dim-state>一起带上。 - 期望:行里只显示正文,不带结束标签。展开(
open)时显示块的原文,保持不变。
2. 多行内容在行里只剩第一行,引子行没有信息
原标题是"环境状态块占了很多行",方向是折叠或隐藏这些块。讨论后改为下面的方向,原因见评论。
03:53 9a6170af-… dim-state source=dim/environment/clients: 1 client connection attached:
03:53 1128eee2-… dim-agent-message …: Agent default, your team leader, assigned you this work:
- 现状:§3.4 规定 "a quoted text is its first line":引用的文本在行里只取第一行(
first_line/body_line,narrative.rs),包括用户文本、回复、结果和块的正文。第一行只是一句引子时,行里就没有内容,只知道"连上了一个客户端""分配了一项工作",不知道是哪个、是什么,必须open。 - 这才是第 2 点的根子:环境状态这些行的问题不在条数多,而在一行里没有信息。它们本来就是模型收到过的正常输入,按 §14 与 §4 不能隐藏或合并。第 3 点"标题只有开场白"也是同一个原因。
- 方向:把多行内容压成一行。正文里的换行和连续空白都合并成一个空格,不加分隔符,再按现有规则截到 120 字符:
dim-state source=dim/environment/clients: 1 client connection attached: tui pid=4123 … dim-agent-message …: Agent default, your team leader, assigned you this work: fix the parser bug in…- 通用:只处理文本,不认识任何生产方。
- 一行最多 600 字符、一页 20 个条目的上限不变。
open仍然显示原文;about照旧匹配全文。
- 待定:
- 范围:只用于块的正文,还是所有引用的文本(用户文本、回复、结果)都一样。全部统一最一致,但 recall 的输出变化面更大。
- 分隔符:不加。
·这类符号是原文里没有的字,会被当成内容或结构,带来语义变化;压成空格只丢掉分行位置,原排版用open看。
3. 由消息发起的轮次,标题只有标签和 UUID
03:53 2650a1eb-… turn: dim-agent-message agent=e528c115-… session=9a7a19b2-… — called hold ×2 — completed
- 现状:轮次索引用一轮的第一段用户文本做标题。没有用户文本时,就用第一个块的标签和属性,所以看不出是谁发的、要做什么,要
open才知道。这符合 §3.4 的规则,但可读性差。 - 对照:同一条消息在一轮里显示为
dim-agent-message …: Agent default, your team leader, assigned you this work:。这一行带了第一行正文,但第一行只是一句固定的开场白,真正的内容在后面。 - 可能的方向(待定):标题采用和行一样的"标签: 正文第一行";或者对第一行固定、内容在后面的块,取第一个有内容的行。
验收
- 三处各有 flow 测试,覆盖
recall(第二人称)和agent read(第三人称)。 - 一行最多 600 字符、一页 20 个条目的上限不变。
- 投影仍然不认识任何块的生产方。
- 第 1、3 点由 fix(narrative): tell a block's body without its closing tag, title turns by it #2263 修复;本 issue 剩第 2 点。
Activity
yyhhyyyyyy commentedon Nov 27, 2026
Reading the three points against main (
4b3bb51c), here is a technical assessment of each.1. The closing tag on single-line blocks: valid, this is a rendering defect.
The line of a blocks-only input is built by
first_body_line, which splits at the opening tag and takes the first line of what follows, but never strips the closing tag. The sibling helperbody_line, used for line writes, does strip it. The two extraction paths are inconsistent, and the defect only shows for blocks whose body and closing tag share one line, which is exactly the shape of the single-line<dim-state>snapshots (snapshot). Recall.md §3.4 specifies the line as<blocks>: <first line of the first block's body>; the closing tag is the block's framing, not its body, so this is an implementation defect rather than intended behavior. The fix is small: one extraction path, andopenkeeps showing the block's full original text, as the issue asks.2. The environment state block noise: the problem is real, but none of the three sketched directions lands cleanly, and the cleanest variant needs a design decision.
First the facts behind the noise. These snapshots are appended as
input/messageevents with an Append-mode Raw block and no key, by design (EnvironmentClients.md, "no key"; agent-environment.md: "A snapshot is normal history. Compaction may remove it; it is not replayed"). Producer-side dedup only suppresses a snapshot identical to the last appended one, so a detach/attach flap writes every alternating state. prompt.md states explicitly that thesourceattribute does not stand in for an input key. On the read side, the projection is producer-agnostic by design (Recall.md §3.4: "it knows no producer, so a new kind of block needs no change to it"), and §14 requires that every eventproject_historyplaces in context belongs to a thing, so inputs cannot simply be hidden from the line list.Against those constraints: direction (a), a block declaring whether it deserves a line, conflicts with the completeness requirement above and with §4's rule that
openonly takes an id shown on a line, since the input is still a message the model received. For direction (c), showing the input only when its turn is opened, the turn index (level 1) already omits in-turn inputs; the five-line excerpt in this issue is already an opened turn (open=<turn>), and omitting the input from the opened turn as well hits the same completeness and handle problem as (a). Direction (b), folding consecutive state blocks, is the closest to viable, though three details matter: these blocks have nokey, so a fold would key off thesourceattribute (today only tag text, explicitly without key semantics); folding alternating states hides real transitions, whereas strict duplicates are already suppressed by the producer; and even in the excerpt above, the branch-open snapshot (5d9a6832) is separated from the later pair (9a6170af,09b107b8) by a message and a tool call, so a consecutive-only fold collapses only adjacent snapshots (two into one here), not ones separated by messages or calls. If a read-side fold is still wanted, it would be a new generic rule on the opened-turn and search line lists: a run of consecutive blocks with the same state tag andsourcecollapses to one line (such as the latest), with the earlier inputs in the run shown when that entry is opened (open=<id>). Unlike §3.5, which keeps one line per keyed input, that changes Recall.md §3.2, §4 (one origin event id per line) and §14 as well as the rule thatsourcecarries no key semantics, so it needs a design decision in this issue before implementation rather than a quick patch. One more note: keying these blocks would not fix this issue, because keyed blocks still appear as one line per consumed input in an opened turn (§3.5 only marks the live one(current)and a retiring one(ended), leaving superseded versions on their own lines); keying would address context occupancy across compaction, not narrative noise.3. Turn titles for message-opened turns: the readability gap is real; the first sketched direction is sound, the second is not.
This is conforming behavior, not a defect: Recall.md §3.6 says that when no opening input carries user text, the title is the first line write, or else the driving input's
<blocks>.line_writerecognizes only the BranchLine markers (dim-branch-message,dim-branch-idle,dim-branch-ended), so a turn opened by a<dim-agent-message>falls to the<blocks>form, which is the tag with its attributes and no body line. Adopting the sametag: first body lineshape as the line itself is fully generic: it knows no producer, it makes every blocks-opened turn more informative, and for agent messages the first body line happens to carry the sender's name and relationship (Agent <name>, your team leader, ..., written bymessage_input), which is exactly the information a reader needs. The second direction, skipping a fixed boilerplate first line to reach the first content line, does not work within the design: the projection cannot know what counts as boilerplate without recognizing the producer, there is no generic field that marks it, and the greeting line is itself information (who sent it, in what role). The 120-character cut on each variable part already bounds the longer title within the 600-character line budget.On acceptance: flow tests for both the second person (
recall) and the third person (agent read) are reasonable since both share this projection (Recall.md §3.8), and the existing suites incrates/dim-agent-capabilities/tests/recall_flow.rsandcrates/dim-app-server/tests/transport_flow/collaboration.rscover the two readers. Points 1 and 3 (and any read-side rule for point 2) do not change what producers write or what context assembly sends in requests; they change only the rendered tool results, so mock-model flow tests are the right level of verification.eric8810 commentedon Nov 27, 2026
第 2 点的方向改了,issue 描述已更新。
原因:@yyhhyyyyyy 的分析说明,环境状态块是模型收到过的正常输入,按 §14(上下文里的每个事件都属于某件事)和 §4(
open只接受行上显示过的 id)不能隐藏。折叠一串同类块又要让source承担 key 的含义,还会改 §3.2、§4、§14。再看实际输出,这些行的问题不在条数多,而在一行里没有信息:§3.4 规定引用的文本只取第一行,第一行如果只是引子(1 client connection attached:、Agent default, your team leader, assigned you this work:),行里就没有内容。新方向:把多行内容压成一行。各行用分隔符连接,连续空白合并,再截到 120 字符。这只处理文本,投影仍然不认识任何生产方,长度上限也不变。它同时补上了第 3 点标题里"只剩开场白"的那部分。
还要定:
·。第 1、3 点在 #2263 里修。
eric8810 commentedon Nov 27, 2026
第 2 点按能力扩展处理,先把规则写进 Recall.md §3.4 再实现。首版只作用于块正文,不扩大到用户文本、回复和结果,因为后者会改变 recall 的既有输出面;换行和连续空白合并成一个空格,不加分隔符(分隔符是原文没有的字,会改变语义),再按现有规则截到 120 字符。投影仍不识别生产方,
open仍显示原文,一行 600 字符和一页 20 条的上限不变。第 1、3 点由 #2263 处理,本 issue 只跟踪第 2 点。fix(narrative): tell a block's body without its closing tag, title tu…
eric8810 commentedon Nov 27, 2026
由 #2280 关闭(yyhhyyyyyy 与 zerob13 均 approve,12:15Z 合并)。第 1 点随 #2263 发布;第 2 点随 #2280 发布,Recall.md 的输入行/轮次标题规则和 recall flow 用例已合入。
feat(narrative): read a block's body as one line