Skip to content

feat(collaboration): read a member's line through the narrative projection - #2234

Merged
eric8810 merged 5 commits into
mainfrom
agent-read-narrative
Nov 27, 2026
Merged

eric8810 merged 5 commits into
mainfrom
agent-read-narrative

Conversation

@eric8810

@eric8810 eric8810 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #2221

What changes

  • Narrative projection becomes a component. Recall's projection moves from recall.rs / recall/search.rs into dim-agent-capabilities::narrative. It takes a Session's tree, a line id, the reader's own turn (optional), a grammatical person and the Recall query, and returns the Recall page. It reads nothing else and writes nothing.
  • recall keeps its declaration and description. It reads its own line in the second person. Its output changes in two places, both shared with agent read:
    • Opening a call now lists the effects its result declared, wrote <path> or ran <command> (exit <code>), and about searches them. The call's line leaves them out (Recall.md §3.4).
    • An unknown handle's refusal adds how to start again: Read without open or before for the latest turns.
  • agent read reads through it. After the existing resolve check, it reads the member's current line in the third person. The third person tells the same lines and adds nothing; it only drops the address to the reader (you called → called, (current version in your context) → (current version), (while you were working) → (while working), …). The table is in Recall.md §3.8.
  • Parameters and description. after / branchId / limit become before / open / offset / about / tool, with Recall's property descriptions. The read bullet becomes "a briefing of a team member's activity, latest turns first; open a turn or anything in it by its id, or search with about."

Decisions on the open questions in #2221

  • Where the component's design lives. Recall.md stays the owner, because §3–§6 already define the projection; a new §3.8 records the component and its two persons. Collaboration.md gains "Read a member's line", which links there.
  • context.turn_id. Optional. An observer has no turn of its own, so every unfinished turn on the read line is in progress.
  • Who may read whom. Unchanged: resolve decides, as before.
  • Compatibility. This is an incompatible change, recorded in Collaboration.md:
    • The {agentId, sessionId, branchId, events, nextCursor} page and the continuation branchId are gone. A call's full arguments, result and declared effects are read by opening it.
    • A handle belongs to the line it was shown on. After the member's default line moves, a handle the new line does not have is refused, and the reader starts again from the latest turns (Recall.md §3.8).
    • The branch tool's own read page keeps effects.
    • No stored data changes.

Tests

The agent read flow tests now cover the acceptance list in #2221:

  • the latest turns first, with no reader address;
  • opening a turn;
  • opening a call with its full arguments, result and declared effects, with the effects absent from the result text;
  • about finding the wrote <path> phrase that opening shows;
  • an about search;
  • a refused query;
  • team_member_not_found.

The other read tests are adapted the same way:

  • a member reading its leader;
  • a cancelled turn;
  • undispatched calls reading as "not run", including reused call ids;
  • a read following the member's default line, and refusing the left line's handle with the restart hint;
  • reads of an unloaded or stored member.

Recall gains opening_a_call_shows_the_effects_it_declared. The SQLite Recall test now includes a call with a declared file write, and checks that about="wrote <path>" finds it the same way the full projection does; without the search fix it misses the call.

cargo test --workspace --locked, cargo clippy --workspace --all-targets --locked -- -D warnings and cargo run --locked -p xtask -- check pass locally.

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 6894806. No findings.

This PR moves Recall's narrative projection into dim-agent-capabilities::narrative and adds a third-person reader for Collaboration's agent read. The rename in 6894806 (Voice/Own/Observer to Person/Second/Third) changes no rendered string and leaves no old identifier in the touched code or docs.

Verified:

  • Recall is behavior-preserving: recall_definition is unchanged from main (crates/dim-agent-capabilities/src/recall.rs:37-72), and run parses the query then delegates to narrative::read with Person::Second (recall.rs:120-132). All 29 recall_flow tests pass at this head.
  • Component boundary: narrative::read takes the tree, the line id, the reader's own turn when it has one, the person, the query and the cancellation (crates/dim-agent-capabilities/src/narrative.rs:79-86); it only reads through the tree and the branch and writes nothing.
  • Third person matches the documented table: the Person labels (narrative.rs:40-74), reply labels (:1316-1330), compaction line (:1332-1337), write lines (:1431-1470) and the turn summary (:1026). The English and Chinese tables list the same strings (docs/design/plugins/Recall.md:357-376, docs/zh/design/plugins/Recall.md:160-175), and the rename left every string unchanged.
  • agent read: the query is parsed before anything is read (crates/dim-app-server/src/collaboration.rs:1128), and the read resolves the member, takes its current default line and reads it in the third person with no own turn (:1491-1515). The schema requires action, agentId and sessionId, allows only about/tool/before/open/offset for read, and rejects the removed after/branchId/limit fields (:3102-3201). The action bullet is updated for both the leader and member descriptions (:3074-3075, :3090-3091).
  • Docs: Collaboration describes the member read and its page compatibility (docs/design/plugins/Collaboration.md:40-44 and the Chinese copy); the architecture page links to section 3.8; the timeline-branches pages record that the old page's branchId continuation is gone.
  • Tests: with an isolated home, TMPDIR, XDG and target dir and the pinned toolchain, cargo fmt --all -- --check passes; the 29 recall tests pass; the affected collaboration tests a_read_tells_the_line_the_member_is_on, member_work_absorbs_messages_and_spans_turns, undispatched_results_name_calls_from_their_starts, members_cancel_close_and_leave_the_team and leader_delegates_and_team_members_communicate pass.
  • Merges: clean trees with origin/main a8d84e9 (cae5cdb8), #2174 673342a0, #2197 44e19200 and #2206 68ff0118.
  • CI at this head (run 45809901697): changes, macos-native and windows-cli pass; verify (linux) is still running; other jobs skip.

Not run locally: the full workspace suite, clippy and xtask check (the PR body reports them passing), and the pending verify job.

The PR is open, not a draft, mergeable. APPROVE.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 68948065c8ee5558ae58a9232187e1a29176c434. Recall retains its existing behavior, and the affected Recall, Collaboration and separate branch-read effects tests pass in exact CI. Two existing member-read guarantees are lost:

  1. Declared effects. If a tool declares a file write separately from the result text, the existing member-read page exposes it. In the narrative page, even opening the call shows only its arguments and result, so the reader can no longer tell which path was written. Preserve that information, or explicitly decide to remove the guarantee and align both Session Boundary translations. Verify with a fixture where the effect is absent from the tool's result text. Prior projection · Existing contract
  2. Continuing a read after a default-line change. A returned before/open handle can belong to a line that is no longer the member's default. The next call resolves the new default and can reject the handle, with no way to continue on the original line. The old flow verified continuation across this switch. Preserve continuation, or explicitly choose line-dependent handles and document how the reader restarts. Verify by following a returned handle after switching the member's default line. Prior integration contract

These are static contract findings. I found no existing in-repo client using the old page, and the stored data format and branch-read effects do not change.

@eric8810

Copy link
Copy Markdown
Collaborator Author

Both points are addressed in 7cd0385. Thanks for the review, zerob13.

  1. Declared effects are kept. Opening a call now lists each effect its result declared under the ending, wrote <path> or ran <command> (exit <code>), with the command shortened the same way the digest shortens it. A call's line still leaves them out. Recall and the member read share this, so recall gains the same detail. Docs: Recall §3.4 "Declared effects". Session Boundary §5 and its rule-4/9 row now name the narrative projection as the reader, in both languages, with the Collaboration compatibility note to match. Test: opening_a_member_call_shows_the_effects_it_declared. Its fixture's result text is only touched, so the path and the command come only from the effects. It also checks that a result declaring none shows none.
  2. Handles are tied to their line, by choice. A read follows the member's current default line, and no branchId comes back. A handle that line does not have is refused with No turn or line has id <id>. Read without open or before for the latest turns., which tells the reader how to start again. Docs: Recall §3.8, and the Collaboration compatibility note in both languages. Test: a_read_tells_the_line_the_member_is_on now opens the side line's turn after the default moves back to main and checks that refusal.

clippy, cargo test --workspace --locked and xtask check pass locally.

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 7cd0385. I reviewed the full main...head diff again. Both findings in the changes-requested review are fixed and can be withdrawn.

Declared effects. A result's declared effects now travel with the call: the fold keeps them, shortened (crates/dim-agent-capabilities/src/narrative.rs:175, :524), and the full view appends them under the ending (narrative.rs:1105-1113, :1615-1628). The line view still omits them because it renders through call_line and ending(..., false) (narrative.rs:961, :1523, :1554). opening_a_member_call_shows_the_effects_it_declared uses a fixture whose result text is only touched; it asserts the verbatim path, the command cut at 200 characters with the cut marked and exit 0, nothing for a result that declared none, and no effects on the search line. With only the effect append reverted the test fails with ok: touched and no effect line; it passes at head. Session Boundary section 5 and the rule-9 row now name the narrative projection in both languages (docs/design/contracts/session-boundary.md:135, :165; docs/zh/design/contracts/session-boundary.md:135, :165), so the old contract contradiction is gone.

Default-line change. Handles are event ids from the line the read saw (Recall section 4), and a handle the current line does not have answers No turn or line has id <id>. Read without open or before for the latest turns. (narrative.rs:1607-1613, reached from narrative.rs:751, :762, narrative/search.rs:724, :928, :1131). This is the alternative the changes-requested review allowed: line-dependent handles with the restart documented. Recall section 3.8 and Collaboration's compatibility note state it in both languages (docs/design/plugins/Recall.md:386-389, docs/design/plugins/Collaboration.md:44; zh copies at docs/zh/design/plugins/Recall.md:179, docs/zh/design/plugins/Collaboration.md:42). a_read_tells_the_line_the_member_is_on moves the member's default from the side line back to main, asserts the main page no longer tells the side turn, and asserts the exact refusal for the side turn id; with the extended refusal reverted to the old text the test fails, and at head it passes. The before path shares unknown(), but the test asserts the refusal only for open.

Verified:

  • 29 capabilities_flow recall tests pass. The 8 affected collaboration tests pass at head: the two above plus member_work_absorbs_messages_and_spans_turns, undispatched_results_name_calls_from_their_starts, leader_delegates_and_team_members_communicate, members_cancel_close_and_leave_the_team, stored_member_read_acquires_it_and_it_can_unload_and_work_again, the_idle_unload_pass_keeps_a_leader_with_an_open_request.
  • cargo fmt --all -- --check passes. Not run locally: clippy, the full workspace suite, xtask check.
  • Merges: clean with origin/main 06f1402 and with the heads of open #2226, #2238 and #2239.
  • CI at this head (run 45841869875): changes, macos-native and windows-cli pass. verify (linux) fails inside xtask check at execStop: internal(control) names no catalog service; main 06f1402 fails the same check and #2239 is the declared follow-up, so I do not attribute it to this PR. ci-ok fails only because verify failed.

Optional, non-blocking:

  • P3: Recall section 6's One thing (docs/design/plugins/Recall.md:527-528), the section 2 search description (:43-44) and acceptance item 3 (:680-682) still describe a call's full view or full text without the declared effect lines that section 3.4 now adds, and no recall_flow case declares an effect. A future change to the shared body could drop them from recall while the doc still matches and only the Collaboration test notices. Fix: mention the effect lines in those three places and add one recorded case with a declared effect.
  • P3: The PR description still says recall's output is unchanged and lists the tests from before 7cd0385. At this head recall gains the effect lines (narrative.rs:1105-1113) and the longer unknown-id hint (narrative.rs:1609). Fix: update the description before merge.
  • One inline P3 on crates/dim-agent-types/src/tool.rs:600-601: the shortening comment now undercounts its callers.

APPROVE.

Comment thread crates/dim-agent-types/src/tool.rs Outdated
/// page. The digest calls this, and both read pages call it through
/// [`ToolResult::shortened_effects`], so the three cannot drift.
/// page. The digest calls this, and the read page calls it through
/// [`ToolResult::shortened_effects`], so the two cannot drift.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional P3. The comment now says the digest and "the read page" are the two callers that cannot drift, but the branch read page calls ToolEffect::shortened directly (crates/dim-agent-capabilities/src/timeline_tree.rs:5937) and Session Boundary names three readers (docs/design/contracts/session-boundary.md:135). A later reader or projection can trust this count, add a call path without shortened, and let the 200-character cut and the marked cut drift between the digest, the branch read page and the narrative projection. Fix: name all three and the wrapper each uses, for example: "The digest and the branch read page call it directly; the narrative projection calls it through ToolResult::shortened_effects, so no reader can drift."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b4bc909. The comment now names the digest and the branch read page as the direct callers and the narrative projection through ToolResult::shortened_effects, matching crates/dim-agent-capabilities/src/context_policy.rs:2033, crates/dim-agent-capabilities/src/timeline_tree.rs:5937 and crates/dim-agent-capabilities/src/narrative.rs:524. Withdrawn.

@eric8810
eric8810 requested a review from zerob13 November 26, 2026 15:03

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two original acceptance items are closed: opening a call now shows its declared effects, and a stale handle after a default-line change returns restart guidance. All 38 selected stock tests passed locally.

New regression: about can miss a phrase shown by open. In both Collaboration and SQLite-backed Recall, a file-write effect declared separately from a tool result renders as wrote <path>. Searching for the path finds the call; searching for the rendered phrase does not. The prefilter tries to match the rendered verb in the stored event before rendering it. Verify that the rendered phrase returns the same call ID in both readers with the effect absent from the tool result text, as required by the full-text search contract.

The required CI gate is separately red at the known main catalog error; Linux workspace and Node steps did not run.

@eric8810

Copy link
Copy Markdown
Collaborator Author

Fixed in b4bc909.

zerob13: about missed the phrase open shows. The bounded search narrows candidates by the longest query word, and it requires that word to be in the stored events. wrote, exit and signal exist only in the rendering, so about="wrote <path>" picked wrote and missed the call. These three words now join the label words the prefilter skips (narrative/search.rs), so it narrows by the path instead and checks the rendered body as before.

  • SQLite Recall (storage_flow/recall.rs): the history now includes a touch call whose result text is only touched and which declares a file write. about="wrote /work/src/parse.py" and about="wrote" are compared with the full projection and must name the call. Without the fix this test fails with exactly the miss you described.
  • Collaboration (opening_a_member_call_shows_the_effects_it_declared): about="wrote <path>" returns the same call id that open shows the effect under.

yyhhyyyyyy's P3s:

  • Recall §2's search description, §6's One thing and acceptance item 3 now name the declared effects, in both languages.
  • New opening_a_call_shows_the_effects_it_declared in recall_flow opens and searches a call carrying a write, an exit and a signal.
  • The tool.rs comment names all three readers and the wrapper each one uses.
  • The PR description says what recall's output now changes.

The failing CI is the execStop: internal(control) names no catalog service check already failing on main (#2239), not this PR. clippy, cargo test --workspace --locked and xtask check pass locally.

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous search blocker is fixed: the phrase shown by open now finds the same call in both Collaboration and SQLite Recall, even when the tool result does not include the effect.

Keep the Collaboration acceptance test independent of the leader's reply. The assertion expects the search digest to include the message label and note for leader, its second line. When only the message itself matches, the digest correctly shows the first line only, as documented, and the test fails. This assertion was introduced earlier in this PR and missed in prior review. It failed in two normal parallel runs on the current merge tree and once on the previous tree. Acceptance: without relying on an echo, verify that about finds the message and that open on its handle returns the complete body.

The hosted run stopped at the old main catalog failure and did not run the Linux workspace suite. #2240 has since landed; that gate is separate from the test failure above.

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at b4bc909. I reviewed the full main...head diff again, not only the new commit. The changes-requested finding on the about miss is fixed and can be withdrawn, and all three P3s from my previous review are fixed and withdrawn.

The search miss is fixed. about now finds the effect phrases that opening a call shows, in both readers. wrote, exit and signal join the prefilter's label list (crates/dim-agent-capabilities/src/narrative/search.rs:610), so a query such as wrote /work/a.txt no longer narrows on a word that exists only in the rendering (:616). Skipping a label only widens the candidate set; Narrative::matches still requires every query word in the thing's body (crates/dim-agent-capabilities/src/narrative.rs:806-809), so the change cannot add a false positive or hide a match. Every other eligible word still narrows: the SQLite case still asserts the text index for uniqueneedle (crates/dim-app-server/tests/storage_flow/recall.rs:175-185), and it passes.

  • SQLite reader: storage_flow/recall.rs:122-123 searches wrote /work/src/parse.py and wrote against a call whose result text is only touched; :160-168 compares the indexed answer with the full projection and requires the call. With search.rs from 7cd0385 this case fails at :160 with the call missing from the indexed side; at b4bc909 it passes.
  • Collaboration reader: crates/dim-app-server/tests/transport_flow/collaboration.rs:6138-6142 searches the rendered phrase and requires the call id that open shows the effect under. With the old labels it fails at :6139 with Nothing matches about "wrote /work/src/parse.py".; at head it passes.
  • crates/dim-agent-capabilities/tests/recall_flow.rs:1846 passes at 7cd0385 too, because it answers through the in-memory testing projection and never reaches text_candidates. It still guards the full view and the line; the SQLite case is the prefilter guard.

Effects stay off lines. body appends the effects only for the full view (crates/dim-agent-capabilities/src/narrative.rs:1105-1113, :1615-1628); call_line renders through ending(call, origin, false) and never appends them (:1523-1538). The new cases assert the search line and the index line carry none (recall_flow.rs:1891-1896, collaboration.rs:6132-6135).

Previous P3s.

  • crates/dim-agent-types/src/tool.rs:597-601 now names the digest and the branch read page as the direct callers and the narrative projection through ToolResult::shortened_effects; the call sites match (crates/dim-agent-capabilities/src/context_policy.rs:2033, crates/dim-agent-capabilities/src/timeline_tree.rs:5937, crates/dim-agent-capabilities/src/narrative.rs:524). Withdrawn.
  • Recall section 2 (docs/design/plugins/Recall.md:43), section 6 (:527-528) and acceptance item 3 (:680-681) now name the declared effects; the Chinese copies match (docs/zh/design/plugins/Recall.md:23, :289, :404), and the new recall_flow case declares a write, an exit and a signal. Withdrawn.
  • The PR description now states recall's two output changes and the tests at this head. Withdrawn.

Verified with the pinned toolchain and isolated HOME, TMPDIR, XDG and target dir: cargo fmt --all -- --check passes; the new recall_flow case, opening_a_member_call_shows_the_effects_it_declared, the SQLite recall case and a_read_tells_the_line_the_member_is_on pass at b4bc909. Not run locally: clippy, the full workspace suite, xtask check.

Merges are clean with origin/main b622321 (which now includes #2240) and with the heads of #2226, #2227, #2238 and #2239; this PR touches none of their files. CI at b4bc909 (run 45857054512): changes, macos-native and windows-cli pass; verify (linux) fails in xtask check at execStop: internal(control) names no catalog service, because this head predates #2240, which merged to main as b622321 at 16:31:12 and removes that entry. The failure is not attributable to this PR and should clear on a rebase or a rerun against the current main; ci-ok fails only because verify failed. The PR stays BLOCKED by the older changes-requested review, which I cannot dismiss.

Optional, non-blocking:

  • P3: The new Chinese paragraph links the English anchor. Problem: docs/zh/design/plugins/Recall.md:133 links ../contracts/session-boundary.md#5-context-mapping, but the Chinese document's section 5 heading at docs/zh/design/contracts/session-boundary.md:133 has a Chinese anchor; the English slug is right only for docs/design/contracts/session-boundary.md:133. Failure scenario: a Chinese reader clicks "Session Boundary section 5" and lands at the top of the contract instead of section 5. Fix: use the anchor GitHub generates from the Chinese heading, as the other Chinese cross-links in this PR do. (Inline.)
  • P3: Test comment misattached. Problem: crates/dim-agent-capabilities/tests/recall_flow.rs:1842 (/// A turn with one consumed input and one reply.) now sits above the new test at :1846, and fn simple_turn at :1900 lost its description. Failure scenario: a reader of the test file sees the wrong description for both; there is no runtime effect. Fix: move the comment back above fn simple_turn; the new test keeps its section 3.4 comment.

APPROVE.

Comment thread docs/zh/design/plugins/Recall.md Outdated

**结果**是 `content` 的文本;blob 和图片为 `[file]` 与 `[image]`;工具带入的上下文消息为 `with <n> context messages`。展开这次调用时给出全部内容。结果比调用晚到不同的分钟时,结局带上结果的时间。

**声明的效果**是工具在文本之外声明自己做过的事:写了一个文件,或运行了一条命令([Session Boundary §5](../contracts/session-boundary.md#5-context-mapping))。它们属于这次调用的记录,不属于结果文本:行里不出现;展开这次调用时,在结局下逐条给出,`wrote <path>` 或 `ran <command> (exit <code>)`、`(signal <name>)` 或不带状态,命令按摘要的规则截短。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional P3. Problem: this new link uses the English slug #5-context-mapping, but it points at the Chinese document, whose section 5 heading has a Chinese slug. Failure scenario: a Chinese reader clicks the link and lands at the top of the contract instead of section 5. Evidence: docs/zh/design/plugins/Recall.md:133 links ../contracts/session-boundary.md#5-context-mapping; the heading is at docs/zh/design/contracts/session-boundary.md:133, and the English slug is right only for docs/design/contracts/session-boundary.md:133. Fix: use the anchor GitHub generates from the Chinese heading, as the other Chinese cross-links in this PR do.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in fe06212.

@Simon-He95 Simon-He95 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at b4bc909dd.

Direction is right. The narrative projection moves into dim-agent-capabilities::narrative as a pure read over the owner's tree; recall and agent read both call it (recall.rs with the caller's turn and second person, collaboration.rs with the member's current line, no turn, third person). There is no second projection and no second business logic: the module only reads through TreeCommands/the branch facade and writes nothing. Recall.md §3.8 carries the component and the person table; Collaboration.md owns only its read section and links there. The agent read parameter/result change is the incompatible change #2221 already calls for, recorded in Collaboration.md in both languages, and no App Server RPC, event, wire or storage shape changes. I found no built-in TUI or dim-electron consumer of the old agent read schema; it is a model-facing tool contract.

One blocker, in the PR's own acceptance test:

P2 — the read assertion depends on the leader's reply race. crates/dim-app-server/tests/transport_flow/collaboration.rs:1849-1852 searches with about: "note for leader" and requires the page to contain both dim-agent-message and note for leader. The member-to-leader message line renders as <dim-agent-message …>: Agent default, a member of your team, sent you this message: — the marker plus the first body line. note for leader is the third line and never appears on that line. The only line that can satisfy the second conjunct is the leader's reply Echo: note for leader, produced by the stub model, and the test never waits for the leader after sending the message (only member_session.idle("main")). Under scheduling the reply, or even its input/consumed, may be missing at the read's pinned head, so the search returns only the message line and the assertion fails — the three failures zerob13 observed. Fix it by asserting the message line, taking the id it returns, and opening that id to assert the full body contains note for leader; that is also what #2221's acceptance asks to prove. Do not add a wait and keep the echo-dependent conjunct.

P3 (non-blocking):

  • docs/zh/design/plugins/Recall.md:133 links #5-context-mapping, but the target is ## 5. 上下文映射 in the Chinese contract; use the generated Chinese anchor (#5-上下文映射).
  • crates/dim-agent-capabilities/tests/recall_flow.rs:1842: the doc comment /// A turn with one consumed input and one reply. now sits above opening_a_call_shows_the_effects_it_declared; it belongs to fn simple_turn at :1900.
  • Optional: the five read property descriptions are duplicated verbatim in recall.rs:44-64 and collaboration.rs:3106-3116; if they can drift, share them the way ABOUT already is. The third-person negative check covers only the index; a future-drift risk, not a current defect.

CI: verify (linux) stops at the same pre-existing main execStop failure; windows-cli and macos-native pass. On a rebase over #2240 the workspace suite will run, which is where the P2 above can surface, so it should be fixed first.

No architecture or external-interface blocker besides the test.

…ction

agent read returned a raw event page: the first read gave the oldest
events, limit counted a sequence window rather than items, and a tool
call showed only its name, so a leader could not see where a member was
stuck. recall already tells a line as turns, lines and things with
event-id handles, but that projection lived inside the recall tool.

The projection moves to dim-agent-capabilities' narrative module, which
reads one line of a Session's tree for a query and a voice. recall reads
its own line in the own voice and is unchanged. agent read resolves the
member as before and reads its current line in the observer voice, which
tells the same lines without addressing the reader and adds nothing.

agent read takes before/open/offset/about/tool in place of
after/branchId/limit and returns the narrative page; the event page, its
effects items and the continuation branchId are gone. Recall.md §3.8
records the voices, and Collaboration.md records the read and the
incompatible change.
The projection's switch only chooses between "you called" and "called",
so it is the grammatical person of the account, not a voice. Person has
Second for recall and Third for agent read; Recall.md §3.8 and the pages
that link to it say the same.
Opening a call now lists the effects its result declared, a file written
or a command run, shortened as the digest shortens them; the call's line
still leaves them out. Recall and a member read share this, so the member
read keeps what the old event page carried.

A handle a line does not have is refused with the way to start again:
read without open or before for the latest turns. A member read follows
the member's current line, so a handle from a line it moved off now
reads as that refusal, documented in Recall 3.8 and Collaboration.
The bounded search narrows candidates by a word of the query that the
stored events must contain. The words a declared effect renders with,
wrote, exit and signal, are not stored, so a search for "wrote <path>"
picked one of them and missed the call. They now join the other words
only the rendering adds.

The SQLite Recall comparison now records a call whose effect is absent
from its result text, a recall flow opens and searches one, and the
member read finds the phrase it shows. Recall's search, one-thing view
and acceptance item name the effect lines, and the shortening comment
names all three readers.
…body

The member's read searched "note for leader" and required the page to
show it, but the message's line tells only its first line; only the
leader's echo reply could supply the phrase, and the test never waited
for it. The read now takes the message's handle from the search and
opens it for the whole body. The Chinese Recall link points at the
Chinese contract's anchor, and simple_turn has its comment back.
@eric8810

Copy link
Copy Markdown
Collaborator Author

Rebased onto main (now including #2240) and fixed in the head commit, so CI should get past the catalog check and run the Linux workspace suite.

zerob13 / Simon-He95: the member-reads-leader assertion raced the leader's echo. Simon-He95's diagnosis is right: the message's line tells only its first line, so only Echo: note for leader could supply the phrase. The test now:

  • searches about: "note for leader";
  • takes the handle of the dim-agent-message line;
  • opens it and asserts the body contains sent you this message:\nnote for leader.

It no longer depends on the leader's reply and adds no wait. It passed 10 runs in a row together with the member_work tests.

P3s (yyhhyyyyyy, Simon-He95):

  • The Chinese Recall paragraph now links #5-上下文映射.
  • simple_turn has its comment back.

Not done: sharing the five read property descriptions between recall.rs and collaboration.rs. That would make the two tool declarations depend on one source; I'd rather leave it to its own change.

Locally: clippy and xtask check pass. One cargo test --workspace --locked run had a single failure, agents::agent_profile_supplies_session_defaults, in files this PR does not touch. It passed three runs on its own, so it looks like load-related flakiness, not this change.

@eric8810
eric8810 force-pushed the agent-read-narrative branch from b4bc909 to fe06212 Compare November 27, 2026 03:15

@zerob13 zerob13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at fe06212ce583d84b69061dd9c3d026c9ab62c687. The last acceptance item is resolved. In an isolated run before the leader replies, about finds the original message handle; its digest correctly shows only the first line, and open on that handle returns the full body. Adding a word absent from the body returns no match. The corrected assertion no longer relies on the leader's echo. The collaboration and session-default tests also passed 20 paired runs; the cause of the earlier isolated workspace failure was not established.

PR check passed Linux workspace, selected macOS and Windows checks, and ci-ok on ba2826e3dd466a8f669ff500562aa4a3a64e11eb; the old catalog failure did not recur. No remaining blocker from this review.

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at fe06212.

This PR moves Recall's narrative projection into dim-agent-capabilities::narrative as a read-only projection over the owner's tree: recall reads its own line in the second person, and Collaboration's agent read reads a member's current line in the third person. The agent read parameter and result change is the intended incompatible change; no App Server RPC, event, wire or storage shape changes.

The P2 is fixed and withdrawn. leader_delegates_and_team_members_communicate no longer needs the leader's echo. It searches about: "note for leader", takes the message line's event id, opens that id, and asserts the full body has sent you this message:\nnote for leader (crates/dim-app-server/tests/transport_flow/collaboration.rs:1879-1890); the old echo-dependent assertion is gone. I ran the case 20 times sequentially, 10 times under 12 CPU burners, and 24 times as 8 concurrent instances; all 54 passed, and CI verify (linux) passes at this head. With every model call whose input contained note for leader delayed 5 seconds, including the leader's echo, the case still passed in 20.5 seconds, so the read found and opened the message while the reply was still pending; the removed assertion would have failed in that run because the message line shows only its first body line.

Both P3s are fixed and withdrawn.

  • The Chinese link at docs/zh/design/plugins/Recall.md:133 now uses #5-上下文映射, the anchor generated by the heading at docs/zh/design/contracts/session-boundary.md:133, matching the other Chinese cross-links in this PR.
  • /// A turn with one consumed input and one reply. is back above fn simple_turn (crates/dim-agent-capabilities/tests/recall_flow.rs:1902-1903), and the new case keeps its section 3.4 comment (:1846-1848).

Range-diff over the old chain (a570b99b6..b4bc909d against 770f8485..fe06212c) shows the four earlier commits patch-identical; fe06212 adds only the test fix, the comment move and the anchor fix, so the rebase did not change approved content.

Optional, non-blocking:

  • P3: the five read property descriptions are duplicated verbatim in the two schemas (crates/dim-agent-capabilities/src/recall.rs:48-63, crates/dim-app-server/src/collaboration.rs:3110-3116). Problem: a later edit to one copy can leave recall and agent read describing the same field differently to the model. Failure scenario: there is no runtime effect; the descriptions are model-facing text. Fix: build the shared about, tool, before, open and offset properties once in narrative and use them in both definitions, or add a test that compares them.

Verified with the pinned toolchain and isolated HOME, TMPDIR, XDG and target dir: cargo fmt --all -- --check passes; opening_a_call_shows_the_effects_it_declared, the SQLite indexed recall case, a_read_tells_the_line_the_member_is_on and the P2 case pass at this head. Not run locally: clippy, the full workspace suite, xtask check.

CI at fe06212 (run 45933158819) is green: changes, windows-cli, verify (linux), macos-native and ci-ok pass. Merges are clean with origin/main 770f848 and with the heads of #2238 and #2244, and this PR shares no files with them. #1881 conflicts with main on docs/design/plugins/Report.md, a file this PR does not touch.

APPROVE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

抽取叙事投影组件,让 agent read 复用 recall 的分层读法

4 participants