Repository navigation
Conversation
61f70ff to
4172206
Compare
|
评审(head
|
|
已按评审修改,head
BranchLine、BranchTool、TreeTimeline 其余部分未改(BranchLine 与 BranchTool 的示例只按第 1 条换了写法)。 检查: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: five docs (+782/-0): TimelineTree.md, TreeTimeline.md, BranchLine.md, BranchTool.md and the plugin index row. Design part of #2024 under the proposed section 7 of #2029.
Verdict: REQUEST_CHANGES. The owner split and the data-face direction are right, but the contract contradicts the accepted timeline branches design on the final message, the status note, creation cancellation and the open-line cap, the binding appendix is not a compilable data face, and the branch part keeps a strong tree reference without the Weak access the current owner needs for close to settle.
Findings
-
P1: final message writer and order. Problem: TimelineTree.md:160 records branch/ended before the final message, and :191 and :193 assign the write to the opener's BranchLine. Failure: a crash after branch/ended but before the message loses it, because restore treats a parent that holds branch/ended as no longer owed; and end cannot answer final_undelivered or retry a message another owner writes. Evidence: the accepted design says TimelineTree delivers it and branch/ended is written after the delivery (docs/design/timeline-branches.md:395, :718, :781, :807); close_and_record delivers before close (crates/dim-agent-capabilities/src/timeline_tree.rs:2413-2438) and deliver_final writes the parent input (:2499-2516). Fix: keep TimelineTree as the writer, order delivery before close and before branch/ended, or move delivery and retry to BranchLine's contract and remove final_undelivered from end.
-
P1: TreeCommands retirement drops the Weak access that prevents a Session/branch cycle. Problem: BranchLine.md:59 makes BranchLine depend on S:TimelineTree, while the tree holds each line's branch context and the context holds BranchLine. Failure: a strong S:TimelineTree keeps the tree and the line's parts alive in a cycle, so ending a line or closing the Session cannot drop the scope and close cannot settle. Evidence: current TreeCommands holds Weak (crates/dim-agent-capabilities/src/timeline_tree.rs:440-442), BranchLine holds Arc (:3805), and TreeTimeline.md:57 keeps Weak for its own route; issue #2024 states this requirement explicitly. Fix: state the weak handle BranchLine and TreeTimeline receive, where it is built, and how close settles it; a weak view is not the forwarding wrapper that ADR 002 D2 (TimelineTree.md:205) removes.
-
P2: create cancellation is contradictory. Problem: :126 says an admitted creation is not abandoned but a cancelled one is rolled back before the reply; :159 says a built but unpublished line is rolled back and its slot released; :178 says a cancelled create rolls back and writes branch/create-failed, while an admitted create still publishes. Failure: implementers cannot tell whether a caller's cancellation stops the wait, the build, or the slot, so the same cancel can publish a line or roll it back and a slot can leak. Evidence: the code stops the wait but continues the build after the reservation (crates/dim-agent-capabilities/src/timeline_tree.rs:2624) and the accepted design keeps the reservation and slot when a caller stops waiting (docs/design/timeline-branches.md:194). Fix: name what cancellation stops and when branch/create-failed is written; keep the accepted rule unless the code changes.
-
P2: BranchLine cannot be implemented from its declared dependencies. Problem: BranchLine.md:55-59 declares no input owner and no GuideEntries, yet :67 writes through "the line's input entry" and owns the roster, idle notice and ended notice. Failure: an implementer finds no service for the write, and the model-facing markers lose their guide entries in the rewrite. Evidence: current BranchLine registers dim-branch-lines, dim-branch-message, dim-branch-idle and dim-branch-ended (crates/dim-agent-capabilities/src/timeline_tree.rs:3710-3712), writes through TreeCommands.input (:4740, :4828, :4987), and the current page lists S:GuideEntries (docs/architecture/rust-agent/plugins/BranchTool.md:132). Fix: declare the input owner and GuideEntries, name the markers BranchLine registers, and say who owns the status note's text.
-
P2: status note writer stated three ways. Problem: TimelineTree.md:161 has the tree "queue one note per participant"; :171 has the tree write the note into each queue but says the text is BranchLine's; :193 says BranchLine writes it. Failure: an implementer can make the tree write model-facing text owned by BranchLine, or leave BranchLine without the transition it needs. Evidence: the accepted design queues a transition and each line's BranchLine drains it and writes the note (docs/architecture/rust-agent/plugins/TimelineTree.md:15, docs/design/timeline-branches.md:118). Fix: the tree records the transition only; BranchLine writes the keyed note.
-
P2: error contract gaps. Problem: set_default has no ended-target error (TimelineTree.md:128, :149); end's protected next step says move the conversation first (:146), which cannot help the root; LineError is a thiserror enum without serde (:289-323). Failure: a client moving to an ended line gets no documented kind and may treat it as unknown; a root end tells the caller to do something that never helps; a rutis service method cannot serialize the error and a foreign caller gets no codes. Evidence: selectable returns BranchEnded for an ended line (crates/dim-agent-capabilities/src/timeline_tree.rs:2000-2006); the accepted design answers branch_target_protected for an ending chain (docs/design/timeline-branches.md:383); the code answers the root with an input error (:1918-1920); errors are data with codes (docs/design/rutis-usage.md:162, ADR 002 D5) and the existing codes are in crates/dim-agent-runtime/src/error.rs:138-169. Fix: add ended and protected cases, split the root or state that it never ends, derive serde on LineError with wire codes, and map every owner error in BranchTool.md:94-102, including final_undelivered, parent_ended, invalid_cut, beyond_head, not_batch_boundary and closed (the flows at :108-111 already answer closed).
-
P2: line_owner's two families exclude operations the contract sends through it. Problem: TimelineTree.md:96 and :212 allow only writing input and reading a published value, while :41 sends compact, withdraw, approve, adopt and usage reads through line_owner::. Failure: a Session part that needs approval.respond or inputQueue.withdraw on a line is told it may not call it, and adding a forwarding facade would violate section 7. Evidence: the accepted plugin contract still says Session to branch goes through treeCommands and never by injecting a branch service (docs/design/plugin-contract.md:70, :117); #2093's SessionScope contract allows the typed resolution. Fix: allow calling the owner's own operation and reading its published value, update plugin-contract or mark the supersession, and update the PR body, which still describes lineOwner.call({line, operation, request}, cancelled) instead of typed line_owner::(line).
-
P2: rule check counts BranchTool as a branch part. Problem: TimelineTree.md:189 says one Session part and three branch parts (TreeTimeline, BranchLine, BranchTool), while :190 counts only TreeTimeline and BranchLine. Failure: the part list and the scope split disagree, and a reader cannot tell where BranchTool is mounted. Evidence: BranchTool.md:3 and the README row put BranchTool in Session scope. Fix: one Session part (TimelineTree), two branch parts, and BranchTool as a separate Session part.
-
P2: binding appendix does not compile as written. Problem: ReadLines declares scope twice (TimelineTree.md:281-282); LineError lacks serde (finding 6); BranchLine's LineState (BranchLine.md:155-163) collides with TimelineTree's LineState enum (TimelineTree.md:237-243); LineViewError (BranchLine.md:167) is never defined. Failure: duplicate fields, missing serialization and an undefined error type block implementation. Fix: remove the duplicate, name the view type differently, define the error type, and make fields and reply shapes match the operations table (fields is optional there at :131 but required in the struct at :285).
Minor items (optional):
- BranchTool.md:27 sends the kin check to timelineTree.directory with {line}; directory takes {} and line takes {line}.
- BranchLine.md:65 gives state a {line} request while :37 calls state() on a per-line service; :105 says it writes only its own line while :17 writes notices to its opener.
- TimelineTree.md:110 links SessionScope.md, which exists only in #2093; main gets a broken link if this lands first.
- README.md:12 adds the index row but the By scope table at :56-57 is not updated.
- TimelineTree.md:14 makes the tree own the open-line cap while docs/design/timeline-branches.md:192 gives the limit to BranchTool; TreeTimeline.md:72 calls the part not a Capability while docs/design/timeline-branches.md:110 says it is.
- TimelineTree.md:201-203 uses section 7 labels ("callbacks and ids", "one change", "no proxy reads") that are not headings in the proposed #2029 section 7, and #2029 is unmerged.
- The PR body says five data operations; the document has six (create, end, set_default, directory, line, read), and the delivery comment on #2024 repeats the five.
- TimelineTree.md:181 says line answers a reservation, but LineState has no opening state and the record carries a head that a reservation does not have.
Verification: HEAD cf2fec0, base 1bc7d67. node scripts/adr-check.mjs --base origin/main passed (5 changed files). A relative-link check over the five changed files found only SessionScope.md missing. gh pr checks 2092 shows ci-ok pass; docs-only jobs skipped. No full build was run. Every code claim above was checked against the current checkout; the changed docs contain no file:line citations.
| | Operation | Normal path | Caller cancels | Caller unloads | Owner closes or reloads | Settled by | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `create` | Validate parent, cut, opener and cap under one lock, reserve the line, build the scope, write the opening blocks and the first input, publish, reply the id | The admission stops; a built but unpublished line is rolled back and its slot released; the caller sees `cancelled` | The line is built and published for the Session: an admitted creation is not abandoned; a waiter that left does not cancel it | A line still building is rolled back; the reply is `closed` | TimelineTree: the scope, the reservation and the slot | | ||
| | `end` | Check the target, end descendants deepest first, commit `branch/end`, close the scope, write `branch/ended` on the parent, deliver the final message as data | None; the call answers when the end settles | The end continues; the caller's absence changes nothing | An end in flight finishes before the generation closes; the generation's close waits for it and for the store's answer | TimelineTree: the scope's close and the end record | |
There was a problem hiding this comment.
P1 final message. Problem: this row records branch/ended before the final message, and :191 and :193 give the write to the opener's BranchLine. Failure: a crash between the two loses the message, because restore sees the parent holds branch/ended and never delivers; end also cannot return final_undelivered for a write another owner performs. Evidence: docs/design/timeline-branches.md:395, :718, :781 and :807; crates/dim-agent-capabilities/src/timeline_tree.rs:2413-2438 and :2499-2516. Fix: TimelineTree delivers before close and before branch/ended, or move delivery and retry to BranchLine's contract and drop final_undelivered from end.
There was a problem hiding this comment.
Fixed in c5bba3d. TimelineTree.md:16, :162, :171 and :182 now put delivery before the scope close and before branch/ended, and keep TimelineTree as the writer; this matches close_and_record in crates/dim-agent-capabilities/src/timeline_tree.rs:2397-2448.
|
|
||
| | Operation | Intent | Request | Reply | Cancellation | Errors | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `create` | Open a line at a cut of its parent | `{parent, cut, prompt, source, idle_notice?}` | `{line}` | While the line is admitted and built; an admitted creation is not abandoned and a cancelled one is rolled back before the reply | `invalid_parent` (no such line), `parent_ended`, `invalid_cut` (over the parent's head, or not an atomic-batch boundary), `not_opener` (this line may not open one), `limit_reached` (the Session's cap of open tool lines), `closed`, `cancelled` | |
There was a problem hiding this comment.
P2 create cancellation. Problem: the cell says an admitted creation is not abandoned, then says a cancelled creation is rolled back before the reply. Failure: an implementer cannot tell whether a cancel stops the wait or the build, so the line may publish or roll back and a slot may leak. Evidence: crates/dim-agent-capabilities/src/timeline_tree.rs:2624 stops the wait and lets the build continue; docs/design/timeline-branches.md:194 keeps the reservation and slot. Fix: state which one a cancel stops, whether the slot is released, and when branch/create-failed is written.
There was a problem hiding this comment.
Fixed in c5bba3d. TimelineTree.md:127, :154 and :161 state that a cancel stops only the wait: before admission nothing is reserved, and an admitted build publishes and keeps its slot. The code at timeline_tree.rs:2621-2626 matches.
| | --- | --- | --- | --- | --- | --- | | ||
| | `create` | Open a line at a cut of its parent | `{parent, cut, prompt, source, idle_notice?}` | `{line}` | While the line is admitted and built; an admitted creation is not abandoned and a cancelled one is rolled back before the reply | `invalid_parent` (no such line), `parent_ended`, `invalid_cut` (over the parent's head, or not an atomic-batch boundary), `not_opener` (this line may not open one), `limit_reached` (the Session's cap of open tool lines), `closed`, `cancelled` | | ||
| | `end` | End a line and settle it | `{line, source, final?}` | `{}` | None: an admitted end settles even if the caller goes away | `unknown`, `already_ended`, `protected` (the root, the default line, or an ancestor of the default line), `final_undelivered` (the line ended and its final message is still owed; a later end retries delivery only), `closed` | | ||
| | `set_default` | Move the conversation to a line | `{line, source}` | `{default}` | None: the move is one commit | `unknown`, `already_default`, `not_selectable` (a plugin line, a line that is ending, or a line whose chain is ending), `closed` | |
There was a problem hiding this comment.
P2 set_default ended target. Problem: the error list has no kind for an ended line. Failure: a client moves to an ended line from directory and the implementer must invent a kind; returning unknown makes the client treat an existing line as never seen. Evidence: crates/dim-agent-capabilities/src/timeline_tree.rs:2000-2006 answers BranchEnded for an ended target; docs/design/timeline-branches.md:383 keeps branch_target_protected for an ending chain. Fix: add already_ended and protected to set_default, or extend not_selectable to ended lines and say so in the next-action row.
There was a problem hiding this comment.
Fixed in c5bba3d. TimelineTree.md:129 now gives an ended target branch_ended and keeps branch_target_protected for a target or ancestor that is still ending.
| | `limit_reached` | End an open tool line, or open on a line whose chain is protected | | ||
| | `unknown` | `line` or `read` named an id this Session never had; read `directory` for the lines in force | | ||
| | `already_ended` | Nothing happened; read the line with `read` | | ||
| | `protected` | The root, the conversation line and its ancestors cannot end; move the conversation first | |
There was a problem hiding this comment.
P2 protected next action. Problem: the row includes the root and says move the conversation first. Failure: moving the conversation never makes the root endable, so the caller retries and fails again. Evidence: crates/dim-agent-capabilities/src/timeline_tree.rs:1918-1920 answers the root with an input error; docs/design/timeline-branches.md:774 says the end checks only the target. Fix: split the root refusal or state that the root never ends; keep the move advice for the default line and its ancestors.
There was a problem hiding this comment.
Fixed in c5bba3d. TimelineTree.md:128 and :145 split the root (branch_cannot_end, it never ends) from the conversation line and its ancestors, which need the move.
|
|
||
| | Rule | Application | | ||
| | --- | --- | | ||
| | §1 parts and Capabilities | TimelineTree is one Session part and three branch parts (TreeTimeline, BranchLine, BranchTool in their own documents). TimelineTree writes Timeline facts and folds no state from them: not a Capability. | |
There was a problem hiding this comment.
P2 part count. Problem: this row counts BranchTool as a branch part. Failure: the scope split and the part list disagree, and the implementation plan mounts BranchTool in the wrong scope. Evidence: BranchTool.md:3 says Scope: Session; the README row puts it in the Session part column; :190 counts only TreeTimeline and BranchLine. Fix: say one Session part (TimelineTree) and two branch parts, with BranchTool a separate Session part.
There was a problem hiding this comment.
Fixed in c5bba3d. TimelineTree.md:205 and README.md:56-57 now count one Session part (TimelineTree), two branch parts (TreeTimeline and BranchLine), and BranchTool as its own Session part.
|
|
||
| | Operation | Intent | Request | Reply | Cancellation | Errors | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `state` | One line's role, parent, end state and read cursors | `{line}` | `{role, parent?, ending, cursors: [{target, cursor}], blocked}` | None: a read of the owner's folded state | `unknown` (no directory record), `closed` | |
There was a problem hiding this comment.
P3 state request. Problem: the per-line service takes a line argument in the table and binding, while the caller example calls state() with none. Failure: the caller and the operation disagree; a foreign caller must supply a redundant id. Evidence: BranchLine.md:37, :65 and :167. Fix: drop line from state or pass it in the example; keep one shape.
There was a problem hiding this comment.
Partially fixed. BranchLine now publishes view with an empty request (BranchLine.md:68), but BranchTool.md:24, :26 and :54 still call branchLine.state, and LineView has no cursor method for the examples at :55 and BranchLine.md:47.
There was a problem hiding this comment.
Fixed in 6d0162b. BranchTool.md:24, :26 and :54 use view; :55-57 and BranchLine.md:47 look up cursors. The remaining difference is the if line.ending early refusal at BranchLine.md:44-46, reported in the body.
| | --- | --- | | ||
| | §1 parts and Capabilities | BranchLine is one branch part and a Capability: it folds its own committed facts and writes its own keyed blocks. | | ||
| | §2 scopes | Branch scope: role, roster, cursors and notes belong to one line and end with it. | | ||
| | §3 orthogonality | It reads its own facts and the directory record; it writes only its own line. | |
There was a problem hiding this comment.
P3 writes only its own line. Problem: the rule check says BranchLine writes only its own line, but :17 has it write the idle notice and ended notice to its opener. Failure: the orthogonality check misses a cross-line write. Evidence: docs/architecture/rust-agent/plugins/BranchTool.md:169-170 describes the ended notice on the opener; docs/design/timeline-branches.md:417 has the opener's BranchLine write the roster and notice. Fix: say it writes its own line and its opener's input for the notices, and check that relation.
There was a problem hiding this comment.
Fixed in c5bba3d. BranchLine.md:84 and :118 now separate writing its own line from steering its opener: the ended notice is written by the opener's own BranchLine, and the idle notice goes through the opener's input owner.
There was a problem hiding this comment.
Still open in 6d0162b. BranchLine.md:91 still says the idle and ended notices are both written into the opener's line through line_owner, while rule check :119 and timeline-branches.md:417-418 assign the ended notice to the opener's own BranchLine. The code agrees with the latter: the idle notice goes to the parent (crates/dim-agent-capabilities/src/timeline_tree.rs:4663-4677), the ended notice to self.own (:4797-4828). Reported in the body.
There was a problem hiding this comment.
Fixed in c80f8e1. BranchLine.md:19, :87 and :94 now separate the own-line writes from the idle steer: only the idle notice crosses into the opener's input owner, and the ended notice and roster retirement stay on the opener's own line.
| | Read what a line did, continuing where the last read stopped | No: the continuation is the calling line's cursor, owned by BranchLine; the page boundaries and the rendering are the tool's | `branchLine.state`, `timelineTree.read` | | ||
| | End the calling tool line with its last word | No: the end and the last word are one settled operation | `timelineTree.end` | | ||
| | Learn what the calling line may do | No: role and parent are BranchLine's fold | `branchLine.state` | | ||
| | Check that a target belongs to the pair before messaging or reading it | No: the record's parent and source decide it | `timelineTree.directory` with `{line}` | |
There was a problem hiding this comment.
P3 wrong operation. Problem: directory takes {} and line takes {line}; this row names directory with {line}. Failure: an implementer cannot check the target pair from the named call. Evidence: TimelineTree.md:129-130. Fix: timelineTree.line.
There was a problem hiding this comment.
Fixed in c5bba3d. BranchTool.md:27 now names timelineTree.line with {line}.
|
|
||
| ### Errors | ||
|
|
||
| | Code | What the model does next | |
There was a problem hiding this comment.
P2 error mapping. Problem: the table has no code for final_undelivered, parent_ended, invalid_cut, beyond_head, not_batch_boundary or closed, although the flows at :108-111 answer closed. Failure: refusal_from_line_error has no defined mapping; a model gets invalid for a state it can act on, or no code for a delivered state. Evidence: TimelineTree.md:126-131. Fix: add the owner errors with the model's next action, especially final_undelivered.
There was a problem hiding this comment.
Partially fixed. BranchTool.md:98-110 now maps final_undelivered, invalid_cut, beyond_head, not_batch_boundary and closed, but cancelled is still absent although the create flow at :116 answers it. The precedence between final_undelivered and branch_ended is also still undefined; reported separately.
There was a problem hiding this comment.
Partially fixed in 6d0162b. cancelled is now at BranchTool.md:112, and final_undelivered, invalid_cut, beyond_head, not_batch_boundary and closed are mapped. Still missing: branch_target_protected (TimelineTree.md:128), which the current tool returns through kind.code() at crates/dim-agent-capabilities/src/timeline_tree.rs:5558-5561. unknown (TimelineTree.md:131-132) is either converted to branch_not_kin at the pair check or missing; the contract should say which.
| | Plugin | Process part | Session part | Branch part | Phase / issue | | ||
| | --- | --- | --- | --- | --- | | ||
| | [Migration](Migration.md) | on-demand import tasks, source mappings, progress and retry records; unloaded after settlement | — | — | [Delivery plan](../../plan/analysis/legacy-migration.md) | | ||
| | [TimelineTree](TimelineTree.md) (owner contract) | — | the line directory, line lifecycle and default line behind the `timelineTree` operations; the model's `branch` tool ([BranchTool](BranchTool.md)) | one line's own view, roster and notices ([BranchLine](BranchLine.md)); the route from a line's facts to the directory ([TreeTimeline](TreeTimeline.md)) | [#2024](https://github.com/arcships/dim/issues/2024) | |
There was a problem hiding this comment.
P3 scope index. Problem: the new index row is added, but the By scope table at :56-57 is not updated. Failure: the index and the scope summary disagree; a reader looking up Session or branch parts does not find TimelineTree, BranchTool, BranchLine or TreeTimeline. Evidence: README.md:12 and :56-57. Fix: add the parts to the By scope table.
There was a problem hiding this comment.
Fixed in c5bba3d. README.md:56-57 now lists TimelineTree and BranchTool under Session parts and TreeTimeline and BranchLine under branch parts.
|
已按评审修改,head P1
P2
Minor
Supersedes / 现有文档(规则 C)。 四份契约都加了「Supersedes」与「Client-visible changes」。改动只限描述本所有者的段落: 检查: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: the line directory owner contracts for #2024, with the mechanism requirement tracked in #2025 and the owner-redesign rules in #2015; the rule source is section 7 of #2029. Second review at c5bba3d, delta over cf2fec0.
Verdict: REQUEST_CHANGES. Both round-1 P1s are fixed: TimelineTree now owns the final message and orders it before close and before branch/ended, and the branch parts hold a weak handle. Most P2s are fixed too. What remains blocks implementation: the binding appendix still cannot produce the documented data face, BranchTool calls an operation BranchLine no longer has, final_undelivered has no defined precedence, and one changed contract file still specifies the forwarding call it says is removed.
Round 1 status:
- Fixed: final message writer and order (TimelineTree.md:16, :162, :171, :182; the code matches crates/dim-agent-capabilities/src/timeline_tree.rs:2397-2448); weak access (TimelineTree.md:175, BranchLine.md:62, TreeTimeline.md:37); create cancellation (TimelineTree.md:127, :161; code at timeline_tree.rs:2621-2626); input owner and GuideEntries (BranchLine.md:59-61, :19); status note writer (TimelineTree.md:163, :174); line_owner families (TimelineTree.md:94); part count (TimelineTree.md:205, README.md:56-57).
- Fixed round-1 P3s: the README scope row, BranchTool's target lookup (BranchTool.md:27), the cap's ownership (TimelineTree.md:15), TreeTimeline as a Capability (TreeTimeline.md:80), the six-operation count (PR body and TimelineTree.md:125-132), and the reservation state (TimelineTree.md:134).
- Partially fixed: the error contract (LineError serde and the BranchTool mapping), the binding appendix (types and serde), and BranchTool's caller shape (
statevsview). - Still open: SessionScope and ADR 027 are only in #2093 and #2029.
Findings
P1
None.
P2
-
runtime-owner-operations.md still defines the removed call. Problem: :7 says the
timelineTree.calloperation is superseded, but :30-36 still has TimelineTree resolve the live branch and dispatch a tagged union, and says batch input continues to use the tree's methods. Failure: an implementer rebuilds the forwarding facade that section 7 forbids, and a caller uses a request shape the new contract does not have. Evidence: TimelineTree.md:127-132 has neither a call nor an input; #2093 rewrites this same section withline_owner, so whichever lands second must reconcile. Fix: replace :30-42 with theline_ownertext or leave the section to #2093, and change :44 fromdirectory({id:"main"})toline("main")or the new directory read. -
BranchTool names an operation BranchLine retired. Problem: BranchTool.md:24, :26 and :54 call
branchLine.stateand.state(), while BranchLine.md:68 publishes onlyviewwith an empty request and :105 says oneviewreplaces the old reads. The examples also callLineView::cursor(:55, BranchLine.md:47), but the published value hascursorsand defines nocursormethod (:169-179). Failure: the tool cannot compile against the owner, and a foreign caller looks for a removed operation. Fix: callview().await, look the cursor up incursors, and add the helper to the binding or to the example. -
The binding appendix does not compile or serialize. Problem: TimelineTree.md:237 imports
IdleNoticefromdim_agent_types, but it is the private enum at crates/dim-agent-capabilities/src/timeline_tree.rs:3491; :318 usesdim_agent_types::TimelineEvent, which does not exist (the event type isAgentEvent); :324 tagsLineErrorinternally although most kinds are newtype variants over primitives, and serde rejects a tagged newtype variant containing a primitive. BranchLine.md:182 has the same error shape. Failure: the appendix cannot be implemented, and the first refusal fails to serialize, so rutis answers without the documented code. Fix: declare the idle-notice wire enum, useAgentEventorQueryEvent, and give the error variants named fields or use tag plus content. -
final_undeliveredhas no precedence and the tool cannot retry. Problem: TimelineTree.md:128 listsbranch_ended(already ended) andfinal_undelivered(the line ended and its message is owed), and :149 says the line is ended in the second case too, so an ended line answers either code. BranchTool.md:102 maps the calling line's own end tobranch_endedand :119 says an owed message answersfinal_undeliveredand is retried, but the tool returnsbranch_endedas soon asown.endingis true (crates/dim-agent-capabilities/src/timeline_tree.rs:5529-5533) and never calls the tree. Failure: after a failed delivery a later end action reportsbranch_ended, the message stays owed, and only restore delivers it. Fix: define thatfinal_undeliveredwins while an end is recorded and its message is owed, call that state ending rather than ended, and let the tool's end path reach the tree or drop the retry claim.
P3
-
Link defects. Problem: service-faces.md:117 links
../plugins/TimelineTree.md, which resolves to docs/plugins; TimelineTree.md:15 links#61-the-capbut the heading is 6.1 Resources and limits; BranchLine.md:105 points the branchLine section at the TimelineTree plugin page, but the section is in BranchTool.md#branchline. Failure: the changed pages link to a missing file, a missing anchor and the wrong page. Fix: useplugins/TimelineTree.md,#61-resources-and-limits, and the BranchTool page. -
Forward references to unmerged contracts. Problem: plugin-contract.md:70 links docs/adr/027-cross-scope-access-by-id.md, which arrives with #2029; TimelineTree.md:111, :227, :229, BranchLine.md:138 and BranchTool.md:171 depend on SessionScope from #2093. Failure: if this lands first, main has a broken relative link and cites a mechanism that does not exist. Fix: use the PR URLs, or state the owning PR and what main has until it lands.
-
Stale request and reply shapes. Problem: timeline-branches.md:381 writes
timelineTree.end(id, source)while the new request is{line, source, finalMessage?}(TimelineTree.md:128); TimelineTree.md:316-320 requires botheventsandrowswhile :132 says the reply is one or the other. Failure: a reader implements a shape the contract does not define. Fix: use the request object, and make the reply an enum or state that both fields are present with one empty. -
Wrong client method name. Problem: TimelineTree.md:197 and :199 say
session.branch_get; the method issession.branch.get(crates/dim-app-server/src/protocol.rs:1072). Failure: the section that claims no client-visible names change names a method no client has. Fix: usesession.branch.getin both places. -
Incomplete BranchTool error table. Problem: BranchTool.md:94 says every kind the owners answer maps onto a code, but the create flow at :116 answers
cancelledand the table has nocancelledrow. Failure:refusal_from_line_errorhas no defined result for a cancelled admitted create. Fix: add the code and its next action, or state that a cancelled call has no result. -
Cancellation scope in TreeTimeline. Problem: TreeTimeline.md:66 says a child that was never published is cancelled on unload;
cancel_pendingremoves only reservations whose build has not started (crates/dim-agent-capabilities/src/timeline_tree.rs:2683-2685), so an in-flight build is awaited and publishes. Failure: an implementer documents or builds a rollback the code does not perform. Fix: say a reservation that was never dispatched is cancelled; an in-flight build finishes.
Verification: HEAD c5bba3d, merge-base 1bc7d67. node scripts/adr-check.mjs --base 1bc7d67d7e3b357a64fd82c2589f57e4cb4b4bec passed on 10 changed files. A relative link and anchor check over the changed files found the link defects above. gh pr checks 2092 shows ci-ok pass and changes pass, docs-only jobs skipped. No full build was run.
| | Caller → owner | Final API | | ||
| | --- | --- | | ||
| | Branch management, input and history callers → `timelineTree` | `create/end/info/input/list/page/query` retain their existing signatures on the single Session tree face. Creation returns the branch ID. | | ||
| | Line directory, lifecycle and history callers → `timelineTree` | The tree's face is [TimelineTree](../plugins/TimelineTree.md): `create`, `end`, `set_default`, `directory`, `line`, `read`. This table's `timelineTree` rows below, and the `timelineTree.call` operation, are superseded. | |
There was a problem hiding this comment.
P2 stale call section. Problem: this row says the timelineTree.call operation is superseded, but the section at :30-36 still defines that call: TimelineTree resolves the live branch and dispatches a tagged union, and batch input continues to use the tree's methods. Failure: an implementer keeps the forwarding facade section 7 forbids, and a Session caller sends an operation-name request the new contract does not have. Evidence: :30-36, and TimelineTree.md:127-132, which has neither a call nor an input; #2093 rewrites this same section with line_owner, so whichever lands second must reconcile. Fix: replace :30-42 with the line_owner text or defer the section to #2093, and change :44 from directory({id:"main"}) to line("main") or the new directory read.
There was a problem hiding this comment.
Fixed in 6d0162b. runtime-owner-operations.md:30-34 now states line_owner::<T>(line), no timelineTree.call and no tag union; :42 uses line("main").head. The only residue is :7, which still says the rows below and the removed call are superseded (P3).
| | --- | --- | --- | | ||
| | Open a line to work on a part of the task | No: the cut is the calling request's own start, which the tool reads from its execution context | `timelineTree.create` | | ||
| | Send a line a message or a last word | No: the write belongs to the target line's input owner; the tool decides the kin rule | Target line's input owner by id, with the mode the tool chose | | ||
| | Read what a line did, continuing where the last read stopped | No: the continuation is the calling line's cursor, owned by BranchLine; the page boundaries and the rendering are the tool's | `branchLine.state`, `timelineTree.read` | |
There was a problem hiding this comment.
P2 caller shape. Problem: this row and :26 route to branchLine.state, and the example at :54 calls .state(), but BranchLine now publishes only view with an empty request (BranchLine.md:68) and says one view replaces the old reads (:105). The examples also call LineView::cursor (:55, BranchLine.md:47), while the published value exposes cursors and defines no cursor method (:169-179). Failure: BranchTool cannot call the operation it names, and a foreign caller builds against an operation the owner retired. Fix: use view().await and look the cursor up in cursors, and add the helper or the lookup to the example.
There was a problem hiding this comment.
Fixed in 6d0162b. BranchTool.md:24, :26 and :54 use branchLine.view; :55-57 and BranchLine.md:47 look the cursor up in cursors. No branchLine.state or LineView::cursor remains.
|
|
||
| - **The line directory.** Every line's id, parent, cut, source, state (open, ending, ended), head and end event, and the line the Session's conversation is on. One read answers the default together with the whole directory, so a client never pairs a default from before a move with a directory from after one. | ||
| - **A line's beginning.** The cut's validity, the caller's eligibility, building the branch scope, publishing it, and the opening blocks the child starts with — identity, the retired roster, the parent block — written where the child has no owner yet. | ||
| - **The line cap's enforcement.** The cap is BranchTool's configuration ([timeline branches §6.1](../../design/timeline-branches.md#61-the-cap)); this owner charges it, together with the caller's eligibility and the admitted reservations, in the one lock that reserves the line, counting the open tool lines outside the conversation line's chain. |
There was a problem hiding this comment.
P3 broken anchor. Problem: #61-the-cap is not a heading in timeline-branches.md; the heading is ### 6.1 Resources and limits. Failure: the link lands at the top of the page, not the cap rule, so a reviewer cannot check the limit's owner. Fix: link #61-resources-and-limits.
There was a problem hiding this comment.
Fixed in 6d0162b. TimelineTree.md:15 now links #61-resources-and-limits, the heading at timeline-branches.md:174.
| | Operation | Intent | Request | Reply | Cancellation | Errors (codes) | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `create` | Open a line at a cut of its parent | `{parent, cut, prompt, source, idleNotice?}`, `cancelled` | `{line}` | The caller's cancel stops only the wait for admission: a creation that was admitted builds and publishes, keeps its slot, and answers nothing to a caller that left; before admission nothing is reserved and the reply is `cancelled` | `invalid_parent`, `branch_ended` (the parent ended), `invalid_cut` (over the parent's head, or not an atomic-batch boundary), `branch_not_opener`, `branch_limit_reached`, `cancelled`, `closed` | | ||
| | `end` | End a line and settle it | `{line, source, finalMessage?}` | `{}` | None: an admitted end settles even if the caller goes away | `unknown`, `branch_ended` (already ended), `branch_cannot_end` (the root never ends; the conversation line and its ancestors need a move first), `branch_target_protected` (the target or an ancestor is ending), `final_undelivered` (the line ended and its final message is still owed; a later `end` retries delivery only), `closed` | |
There was a problem hiding this comment.
P2 final_undelivered precedence. Problem: the row lists branch_ended (already ended) and final_undelivered (the line ended and its final message is still owed), and :149 says the line is ended in the second case too, so the same state answers either code. BranchTool.md:102 maps the calling line's own end to branch_ended, and :119 says an owed message answers final_undelivered and is retried; the tool's current end path returns branch_ended as soon as own.ending is true (crates/dim-agent-capabilities/src/timeline_tree.rs:5529-5533), before the tree can retry. Failure: after a failed delivery, a later end action reports branch_ended, the message stays owed, and only restore delivers it. Fix: state that final_undelivered wins while delivery is owed, call that state ending rather than ended, and make the tool's end path distinguish the two or drop the retry claim.
There was a problem hiding this comment.
Partially fixed in 6d0162b. The branch_ended versus final_undelivered precedence is explicit at TimelineTree.md:134, :141 and :149, and BranchTool.md:122 calls the tree on an ending line. Still open: (a) TimelineTree.md:128 and :146 still give branch_target_protected for a target that is ending, the same state as an owed message; (b) timeline-branches.md:397 and :460 still say a second end takes branch_ended and restore delivers, and :381 still requires the target to be open; (c) BranchLine.md:44-46 still returns branch_ended as soon as ending, so the tool never reaches the tree. Reported in the body.
|
|
||
| ## Client-visible changes | ||
|
|
||
| None to names, fields or error codes: `session.branches`, `session.branch_create`, `session.branch_end`, `session.branch_set_default`, `session.branch_get`, `session.history` and `session.model.get` keep their method names, request and reply fields, and the `branch_*` codes. The App Server maps the kinds above onto the codes it answers today. |
There was a problem hiding this comment.
P3 method name. Problem: the method is session.branch.get (crates/dim-app-server/src/protocol.rs:1072), not session.branch_get; the same wrong name is at :199. Failure: the section that claims no client-visible names change names a method no client has, so a reader checking the claim finds a mismatch. Fix: use session.branch.get in both places.
There was a problem hiding this comment.
Fixed in 6d0162b. TimelineTree.md:197 and :199 now use session.branch.get, which is in the method table at crates/dim-app-server/src/protocol.rs:976 and dispatched at :1072.
|
|
||
| /// Every kind the owner answers, tagged by the wire code. | ||
| #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, thiserror::Error)] | ||
| #[serde(tag = "code", rename_all = "snake_case")] |
There was a problem hiding this comment.
P2 error wire shape. Problem: the enum is internally tagged, but most kinds are newtype variants over a primitive: InvalidParent(String), Unknown(String), NotBatchBoundary(u64) and the others. Serde rejects a tagged newtype variant containing a primitive, so serialization fails and rutis falls back to no code. BranchLine.md:182 has the same shape for LineViewError. Failure: a caller that should get invalid_parent or unknown gets a framework failure without the documented code. Fix: give every variant named fields, or use #[serde(tag = "code", content = "data")] and keep the message on the display side.
There was a problem hiding this comment.
Fixed in 6d0162b. Every primitive newtype variant now has named fields at TimelineTree.md:334-367, so #[serde(tag = "code")] serializes; BranchLine.md:180-187 has the same shape for LineViewError.
| | `loader` | `rutis/loader` | 插件管理走数据面 | | ||
| | `sessionStore` | `store`、`sessionFiles`、`timelineStore` | 标题与 worktree 关联直接调 store | | ||
| | `treeCommands`、`timelineTreeControl` | `timelineTree` | 分支操作直接调用 Session 的树;不保留别名 | | ||
| | `treeCommands`、`timelineTreeControl` | `timelineTree` | 已按 [TimelineTree](../plugins/TimelineTree.md) 收敛:两个名字删除,`timelineTree` 是树唯一的数据面 | |
There was a problem hiding this comment.
P3 broken link. Problem: from docs/design/service-faces.md, ../plugins/TimelineTree.md resolves to docs/plugins/TimelineTree.md; the page is docs/design/plugins/TimelineTree.md. Failure: the changed row links to a missing file. Fix: plugins/TimelineTree.md.
There was a problem hiding this comment.
Fixed in 6d0162b. service-faces.md:117 now links plugins/TimelineTree.md, which resolves from docs/design/service-faces.md.
| | --- | --- | | ||
| | Up (an enclosing instance, the process) | Inject the service by name | | ||
| | Down (Session to branch) | `treeCommands`: input by branch id, branch creation. Never by injecting a branch service | | ||
| | Down (Session to branch) | `line_owner::<T>(line)`: resolve the line to the branch scope's service and call that owner's own operation ([ADR 027](../adr/027-cross-scope-access-by-id.md)); registration points and the lifecycle services stay out ([TimelineTree](plugins/TimelineTree.md)) | |
There was a problem hiding this comment.
| `ancestor` names the line whose own end started the cascade: the end that carries no `ancestor` of its own. Every descendant the cascade ends carries that line, `source` is copied from that same end, and the pair therefore names one end operation: who asked, and on which line. A line ended at its own request has a `source` and no `ancestor`, and a descendant whose own end was already committed keeps that pair when the cascade reaches it. `branch/ended` copies `source` and `ancestor` from the line's `branch/end`, and is always written on the ending line's own parent, taken from the directory. | ||
|
|
||
| **A general operation.** `TreeCommands.end(id, source)` and `Session::end_branch(id, source)` check only the target: it exists, it is open, it is not the root, it is not the default branch, and it is not an ancestor of the default branch. Ending the root would close the Session, and ending a line ends every line below it, so the default branch's whole chain is protected. These checks are about the target, not the caller. They never check who calls: the user, an opener and a plugin meet the same guards, and ending the default branch always takes a move of the default branch first. | ||
| **A general operation.** `timelineTree.end(id, source)` and `Session::end_branch(id, source)` check only the target: it exists, it is open, it is not the root, it is not the default branch, and it is not an ancestor of the default branch. Ending the root would close the Session, and ending a line ends every line below it, so the default branch's whole chain is protected. These checks are about the target, not the caller. They never check who calls: the user, an opener and a plugin meet the same guards, and ending the default branch always takes a move of the default branch first. |
There was a problem hiding this comment.
P3 stale signature. Problem: the new contract's end request is {line, source, finalMessage?} (TimelineTree.md:128) and the binding takes EndLine; timelineTree.end(id, source) keeps the old positional shape. Failure: a reader implements the line the accepted document names, not the operation this PR defines. Fix: use timelineTree.end({line, source, finalMessage?}) or mark the sentence as the pre-redesign binding like the header does.
There was a problem hiding this comment.
Fixed in 6d0162b. timeline-branches.md:460 now writes timelineTree.end(EndLine { line, source, final_message }). The sentence still carries the branch_ended rule that conflicts with the new retry; reported in the body.
| ## Exceptions with reasons | ||
|
|
||
| - The routing crosses two scopes inside one owner: the subscription must live in the branch scope, while the reservation table and the directory are the Session's. `Weak` access to the tree keeps the branch scope from owning the tree, which the tree already holds through this line's scope. | ||
| - An accepted creation need not survive this line's unload: a child that was never published is cancelled with its waiters, and a published child is the tree's. |
There was a problem hiding this comment.
P3 cancellation scope. Problem: cancel_pending on a line's unload removes only reservations whose build has not started (crates/dim-agent-capabilities/src/timeline_tree.rs:2683-2685); a started build is awaited and publishes. The sentence says a child that was never published is cancelled, which includes an in-flight build. Failure: an implementer cancels a started build, or documents a rollback the code does not perform. Fix: say a reservation that was never dispatched is cancelled; an in-flight build finishes.
There was a problem hiding this comment.
Fixed in 6d0162b. TreeTimeline.md:51 and :66 now say a reservation never dispatched is cancelled and an in-flight build is awaited; this matches cancel_pending at crates/dim-agent-capabilities/src/timeline_tree.rs:2683-2685.
|
已按评审与自查标准修改,head 评审逐条
自查(第 1–3、7 节)
客户端可见变更方法名、请求、回复、错误码、通知名、字段名与取值都不变: 唯一收窄(沿用上一轮的声明):行在发布后才出现在 检查: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: the full main...head of ten design docs (+920/-50) at 6d0162b, merge base 1bc7d67. The delta over c5bba3d is eight files (+102/-94). The PR defines the TimelineTree and line-directory owner contracts and retires treeCommands, the TreeTimeline TreeCommands route and the Branch facade.
Verdict: REQUEST_CHANGES. The owner split and the data-face direction are right, and most of the earlier findings are fixed. Three contract contradictions still block implementation: the end retry rule disagrees with the retained design and with the caller example, the ended notice still has two writers, and BranchTool's error table is not complete.
Round status:
- Fixed in c5bba3d and still fixed: final message writer and order, weak access, create cancellation, input owner and GuideEntries, status note writer, line_owner families, part count, README scope row, BranchTool target lookup, the cap's ownership, TreeTimeline as a Capability, the six-operation count, the reservation state.
- Fixed in 6d0162b: the runtime-owner-operations call section (:30-34 now states
line_owner, :42 usesline("main").head), BranchTool's caller shape (:24, :26 and :54 useview; :55-57 and BranchLine.md:47 look the cursor up incursors), the binding appendix (IdleNotice at :264-271, AgentEvent at :327, ReadReply at :323-329, named error fields at :334-367, onescopefield), the error wire shape and LineError serde, the service-faces link (:117), the §6.1 anchor (:15), the ADR 027 link (:70), the timeline-branches end signature (:460),session.branch.get(:197, :199) and the TreeTimeline cancellation scope (:51, :66). - Partially fixed:
final_undeliveredversusbranch_ended(P2 1) and BranchTool's error mapping (P2 3). - Still open: the ended notice writer (P2 2). The round-2 reply to 4667100958 said this was fixed; the text still routes both notices through the opener's input owner.
- Forward references: SessionScope and ADR 027 are now PR URLs, not broken relative links. The dependency remains: #2093 and #2029 are unmerged.
Findings
P2 1. The end retry rule contradicts the retained design and the caller example.
Problem: TimelineTree.md:128, :134 and :149 say an end on a line whose own branch/end is recorded and whose final message is owed answers final_undelivered and retries the delivery; BranchTool.md:122 says the same. timeline-branches.md:460, which this PR edits, still says such an end takes branch_ended and writes no second message, and :397 says an already ended line answers branch_ended. The guard at :381 still requires the target to be open. BranchLine.md:44-46 returns branch_ended as soon as ending is true, so the tool never reaches the tree. TimelineTree.md:128 and :146 also give branch_target_protected for "the target ... is ending", the same state as an owed message.
Failure scenario: a tool line's end commits branch/end and the delivery to the parent fails. The line is ending and its message is owed. A later end meets four rules: the BranchLine example refuses branch_ended; the timeline-branches guard refuses because the line is not open; TimelineTree.md:149 says final_undelivered and a retry; TimelineTree.md:146 says branch_target_protected and stop. The message is retried or not depending on which paragraph the implementer reads, and the tool's own end path cannot be implemented as written.
Evidence: docs/design/plugins/TimelineTree.md:128, :134, :146, :149, :162, :183; docs/design/plugins/BranchTool.md:110, :122; docs/design/plugins/BranchLine.md:44-46; docs/design/timeline-branches.md:381, :397, :460; the current tool's own-end path at crates/dim-agent-capabilities/src/timeline_tree.rs:5529-5533 returns branch_ended before the tree is called.
Fix: choose one rule. If a later end retries: update timeline-branches.md:397 and :460, add the retry exception to the :381 open check, remove the BranchLine.md:44-46 early return, and state that final_undelivered wins over branch_target_protected when the target's own end is recorded and its message is owed; keep branch_target_protected for another end on the target or an ancestor. If delivery is restore-only: remove final_undelivered and the retry claim from TimelineTree.md and BranchTool.md and keep the accepted rule.
P2 2. The ended notice still has two writers.
Problem: BranchLine.md:17, :84 and :91 make this line's BranchLine write both the idle and the ended notices into the opener's line through line_owner::<InputQueue>(opener). The rule check at :119 and the retained design at timeline-branches.md:417-418 assign the ended notice to the opener's own BranchLine on its own line. The code agrees with the latter.
Failure scenario: a tool line is ended from outside. Its scope closes before its parent handles the branch/ended fact, so the child's BranchLine is gone and the ended notice is never written; or an implementer writes it from the closing child scope and it is dropped. The opener learns of the end only from the roster retirement, not from the model-facing notice.
Evidence: docs/design/plugins/BranchLine.md:17, :84, :91, :117, :118, :119; docs/design/timeline-branches.md:417-418; crates/dim-agent-capabilities/src/timeline_tree.rs:4663-4677 (the idle notice is written to parent), :4797-4828 (the roster and dim-branch-ended are written into self.own).
Fix: split the writers in the operations row, the flow, the exception and the rule checks. The idle notice is the idle line's BranchLine steering the opener's input owner. The ended notice is the opener's BranchLine writing its own line from the branch/ended fact. Remove the ended notice from the child-side line_owner sentence, and make :118 and :119 match that split.
P2 3. BranchTool's error table is not complete.
Problem: BranchTool.md:96 says every kind the owners answer maps onto one code, but the table at :98-113 has no branch_target_protected row. The tool's end path calls the tree, and the tree answers branch_target_protected when the target or an ancestor is ending (TimelineTree.md:128); the current tool already returns that code through kind.code() at crates/dim-agent-capabilities/src/timeline_tree.rs:5558-5561. The model next action for it is undefined. unknown from line/read is either converted by the pair check to branch_not_kin or missing, and the contract does not say which.
Failure scenario: a tool line ends while an ancestor's cascade is in flight. The tree answers branch_target_protected; the model receives a code the contract never explains, and may retry the same end or treat a chain end as a field error. A read of an id that was never published or ended between calls can likewise return unknown with no row.
Evidence: docs/design/plugins/BranchTool.md:96, :98-113; docs/design/plugins/TimelineTree.md:128, :131, :132; crates/dim-agent-capabilities/src/timeline_tree.rs:5558-5561.
Fix: add a branch_target_protected row with "stop, an end on the chain wins", and state whether unknown becomes branch_not_kin at the pair check or gets its own row. Then the "every kind" claim is true.
Optional (P3):
- BranchTool.md:92 and :96 say a refusal writes nothing, but
final_undeliveredis an error result afterbranch/endcommitted, and :122 says the end is accepted. Exempt post-write outcomes from "refusal" or call this one a pending result. - BranchTool.md:130 says the refusal codes are unchanged, but :112 adds
cancelledand :110 givesfinal_undelivereda new retry meaning. State the visible additions. - TimelineTree.md:197 says no error code changes, but
final_undeliveredis new and the App Server mapping is not stated. Say whether it maps tobranch_endedor is a new client code. - TimelineTree.md:161 and :181 rely on a "definitively failed creation" with no error kind. The create errors at :127 and LineError at :334-367 have no build or create-failed variant, while SessionScope's
openBranchanswersbuild(#2093). Add the kind or state that a build failure reaches the caller as a framework error. - Stale wording: runtime-owner-operations.md:7 still names the removed
timelineTree.call; TimelineTree.md:190 lists that operation in Supersedes; branch-typescript.md:204 still labels the link "TimelineTree / TreeCommands"; TimelineTree.md:102 callssubmit(steer_input, cancelled)while the current InputQueue::submit takes one argument (crates/dim-agent-capabilities/src/input_queue.rs:235) and BranchTool.md:49 uses one; BranchLine.md:167 says "Named apart from TimelineTree's LineState" for a type named LineView; BranchLine.md:109 says the face "gains one operation" after the supersession ofresolved,endingandcursorwas removed in this commit; BranchLine.md:60 and plugin-contract.md:62 still namesessionLifecyclewhile #2093 renames it tosessionScope.
Cross-PR: #2103 InputMethods.md:142 still reads timelineTree.query, which this contract removes. #2100 runtime-owner-operations.md:7 and :36 still define timelineTree.call and the old six operations. #2093's runtime-owner-operations.md:7 and :19-27, plugin-contract.md:62, :70 and :117, and service-faces.md:117 still use the old rows. These need rebasing on their side, not changes here; #2092's face is the newer contract.
Verification: HEAD 6d0162b, merge base 1bc7d67, PR open. node scripts/adr-check.mjs --base 1bc7d67d7e3b357a64fd82c2589f57e4cb4b4bec passed on ten changed files. Relative links and anchors in the changed files resolve; the SessionScope and ADR 027 links are PR URLs. gh pr checks 2092 shows ci-ok pass and changes pass; docs-only jobs are skipped. No full build was run. The binding appendix's referenced types exist (AgentEvent at crates/dim-agent-types/src/events.rs:1317, QueryRow at crates/dim-agent-runtime/src/timeline_query/properties.rs:338, PublicService at crates/dim-agent-runtime/src/scope.rs:46, CancelledFn at crates/dim-agent-capabilities/src/host.rs:1169, BranchSource at crates/dim-agent-types/src/events.rs:1004). I did not rebuild the temporary crate the commit message mentions.
| | Operation | Intent | Request | Reply | Cancellation | Errors (codes) | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `create` | Open a line at a cut of its parent | `{parent, cut, prompt, source, idleNotice?}`, `cancelled` | `{line}` | The caller's cancel stops only the wait for admission: a creation that was admitted builds and publishes, keeps its slot, and answers nothing to a caller that left; before admission nothing is reserved and the reply is `cancelled` | `invalid_parent`, `branch_ended` (the parent ended), `invalid_cut` (over the parent's head, or not an atomic-batch boundary), `branch_not_opener`, `branch_limit_reached`, `cancelled`, `closed` | | ||
| | `end` | End a line and settle it | `{line, source, finalMessage?}` | `{}` | None: an admitted end settles even if the caller goes away | `unknown`, `branch_cannot_end` (the root never ends; the conversation line and its ancestors need a move first), `branch_target_protected` (the target or an ancestor is ending), `final_undelivered` (the line's own end is recorded and its final message is still owed; the call retries delivery only and answers this until the message lands), `branch_ended` (the line is ended and owed nothing), `closed` | |
There was a problem hiding this comment.
P2: branch_target_protected is defined here as "the target ... is ending", which is exactly the state where :134 and :149 promise final_undelivered and a retry. The same target therefore has two codes, one saying stop and one saying retry, and the retained design at timeline-branches.md:460 still says a second end is branch_ended and restore delivers. Failure scenario: an end commits branch/end and the delivery fails; a later end is refused as protected before it can retry, or answers final_undelivered and retries, depending on which guard runs first. Fix: keep final_undelivered for the target's own recorded end with an owed message, limit branch_target_protected to another end on the target or an ancestor, and update timeline-branches.md:381, :397 and :460 to the chosen rule.
There was a problem hiding this comment.
Fixed in d968023. The restore-only rule is now the single rule: docs/architecture/rust-agent/plugins/TimelineTree.md:130 and :150 answer branch_ended once the target's own end is recorded, :136 and :163 say an owed final message is delivered by restore, and final_undelivered is gone from the contract, the appendix and BranchTool.md. branch_target_protected is limited to an ancestor ending or a cascade that has not recorded the target's own end. timeline-branches.md:397 and :460 already state the same rule. The earlier retry reading is withdrawn.
| | `read` with an `after` past the target's head | `after A is past line T's head H; a read starts at or below H` | none: an error result with no code | | ||
|
|
||
| These refusals are the tool's own rules. `TreeCommands.end` itself checks only the target (§10). An `end` whose line already committed its own `branch/end` takes the `branch_ended` row and writes no second final message: the first call's message is the line's last word. Because the guards, `branch/end` and the delivery are one operation under the tree lock a move also takes, a move that makes the target the default branch first is refused before any message is written, and the refusal above is the whole effect. An end that commits `branch/end` and stops before the delivery is not a second end to answer: the message is recorded in `branch/end` itself, and restore delivers it once (§10). | ||
| These refusals are the tool's own rules. `timelineTree.end` itself checks only the target (§10). An `end` whose line already committed its own `branch/end` takes the `branch_ended` row and writes no second final message: the first call's message is the line's last word. Because the guards, `branch/end` and the delivery are one operation under the tree lock a move also takes, a move that makes the target the default branch first is refused before any message is written, and the refusal above is the whole effect. An end that commits `branch/end` and stops before the delivery is not a second end to answer: the message is recorded in `branch/end` itself, and restore delivers it once (§10). |
There was a problem hiding this comment.
P2: this sentence still gives a second end branch_ended and leaves delivery to restore, while TimelineTree.md:134 and :149 and BranchTool.md:122 now answer final_undelivered and retry the delivery from a later end. The guard above still requires the target to be open, so the new retry cannot pass it. Failure scenario: an end commits branch/end and the delivery fails; a second end takes this row and never retries, or takes the new row only if the tree special-cases a non-open target that this paragraph and :381 forbid. Fix: choose one rule and update this paragraph, :381, :397 and BranchLine.md:44-46 together.
There was a problem hiding this comment.
Fixed in d968023. This paragraph already stated the chosen restore-only rule, and the contract now matches it: TimelineTree.md:130, :136, :150, :163; BranchTool.md:104, :123; BranchLine.md:45-46. No change to this paragraph is needed.
| LineRole::Main | LineRole::User => { /* opens and reads lines, ends none of them */ } | ||
| } | ||
| if line.ending { | ||
| return refused("branch_ended", &execution.branch_id); |
There was a problem hiding this comment.
P2: this early return refuses branch_ended as soon as ending is true, but ending is also the state where the line's own branch/end is recorded and its final message is still owed (TimelineTree.md:134, :149), which BranchTool.md:122 says must call the tree and retry the delivery. Failure scenario: after a failed delivery, the tool's next end returns branch_ended and the owed message is retried only by restore, the behavior the new contract is trying to replace. Fix: let the end path call the tree and let the tree choose final_undelivered or branch_ended; if the restore-only rule is chosen instead, remove the retry from TimelineTree.md and BranchTool.md.
There was a problem hiding this comment.
Fixed in d968023. With the restore-only rule chosen, the early refusal is correct: BranchLine.md:45-46 returns branch_ended when the line's own end is recorded, and BranchTool.md:123 calls the tree only while that end is not recorded. The tree answers branch_ended for the same state (TimelineTree.md:130, :150).
| - The status note restates the line's birth identity byte for byte: a compaction replays the note, so it must be self-contained; the identity is written by TimelineTree and repeated here only as text. TimelineTree records the move; this owner writes the note. | ||
| - A restored line writes a missing note once and, on the conversation line, replaces a note an older rule set wrote: the note's text is this owner's, and the tree only knows the transition. | ||
| - The parent block is decided from the line's own state rather than from the parent's signal: a signal that arrives while a block is held must not lose the move, so the queue and the block's consumption decide the write. | ||
| - The idle and ended notices are written into the opener's line through the opener's input owner (`line_owner::<InputQueue>`), not by TimelineTree: the notice is this line's statement about itself, and the opener's queue decides its order. |
There was a problem hiding this comment.
P2: this exception makes the child's BranchLine write both notices into the opener's line, while rule check :119 and timeline-branches.md:417-418 assign the ended notice to the opener's own BranchLine, and the code does that. Failure scenario: a tool line is ended from outside; its scope closes before the parent handles branch/ended, so the child-side writer is gone and the ended notice is lost, or an implementer writes it from the closing child scope. The opener learns of the end only from the roster retirement. Evidence: crates/dim-agent-capabilities/src/timeline_tree.rs:4663-4677 writes the idle notice to parent; :4797-4828 writes the roster and dim-branch-ended into self.own. Fix: split the writers; keep the idle notice on line_owner, and state that the ended notice is written by the opener's BranchLine on its own line.
There was a problem hiding this comment.
Partially fixed in d968023. BranchLine.md:17, :92 and :121 now split the writers, and the code agrees: the idle notice goes to the opener (crates/dim-agent-capabilities/src/timeline_tree.rs:4677), while the roster and <dim-branch-ended> are written into self.own (:4791-4828). What remains: the internal-writes flow at BranchLine.md:85 still says the idle and ended notices steer the opener through line_owner::<InputQueue>(opener). Reported in the body.
There was a problem hiding this comment.
Fully fixed in c80f8e1. BranchLine.md:19, :87 and :94 give the ended notice and roster retirement to the opener's own BranchLine; only the idle notice crosses into the opener's input owner. The old split is withdrawn.
|
|
||
| ### Errors | ||
|
|
||
| Every kind the owners answer maps onto one code here; a refusal writes nothing. |
There was a problem hiding this comment.
P2: the claim that every owner kind maps is false. branch_target_protected is reachable from timelineTree.end (TimelineTree.md:128) and the current tool already returns it through kind.code() at crates/dim-agent-capabilities/src/timeline_tree.rs:5558-5561, but the table has no row and no model next action. Failure scenario: a tool line ends while an ancestor's cascade is in flight; the model receives a code the contract never explains and may retry the same end. unknown from line/read (TimelineTree.md:131-132) is either converted to branch_not_kin at the pair check or missing; the contract does not say which. Fix: add the branch_target_protected row, state the unknown conversion or add its row, and keep the completeness claim true.
There was a problem hiding this comment.
Fixed in d968023. BranchTool.md:110 adds branch_target_protected with its next action, :111 adds unknown and says the pair check reports branch_not_kin, and :113 adds cancelled. The raised codes now map. One separate conflict with timeline-branches section 11 is reported in the body: the beyond_head row at :107 contradicts the accepted no-code result at timeline-branches.md:458 and :551, while :131 says the codes are unchanged.
|
已按评审修改,head 台账(各轮全部评论,当前 head 核对)
改成指针的段落
剩余 P2无。 已知未修的 P3
检查
|
zerob13
left a comment
There was a problem hiding this comment.
Use the birth position for line metadata and define reservation visibility. The new createdAt separates the birth fact from the inherited history cut, but the purpose and role lookup still look at cut. For an older start position, those lookups miss the actual create fact. Use createdAt, specify what the building line can read during apply versus what RPC may expose, and keep the failure path explicit. The reserve-before-build order itself is now clear.
The new submitMany requirement names the right owner, but the proposed InputQueue face only offers single input. Track that existing dependency as a delivery gate: align the input and Goal drafts on one atomic batch with ordered committed sequences, rather than replacing the current batch with two independent writes. Exact-head docs checks passed; runtime verification was skipped.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Review: PR #2092, round 6, head 91da0de
Scope: this PR defines the line directory owner contract for #2024 and its tree owners: TimelineTree, TreeTimeline, BranchLine and BranchTool. It moves BranchLine and TreeTimeline into the architecture pages, rewrites the tree's operations, the line_owner route and the branch tool, and updates the runtime owner, plugin contract, service faces, branch TypeScript and timeline branches documents. I reviewed the full origin/main...HEAD of 15 files (+1142/-287) at 91da0de against current main eacc672, not only the commits after c80f8e1. The branch was rebased, so the previous review head is not an ancestor.
Verdict: REQUEST_CHANGES. No P0 or P1 findings.
Prior round
- P2 1, TreeTimeline gave the reservation to the create fact: fixed and withdrawn.
TreeTimeline.md:15and:55now say TimelineTree reserves the child insidecreate's lock and that the committedbranch/createstarts the build; the flow test at:76matches (TimelineTree.md:17,:168). - P2 2, the retained Report paragraph passed
include_publishingto the tree'sread: fixed and withdrawn.runtime-owner-operations.md:7,:21and:32now point at the target contracts, and no target read carries a publishing field. - P2 3, Session dependency names lagged #2093: the disagreement in this PR's owner contracts is fixed, so the P2 is withdrawn.
BranchLine.md:63,TimelineTree.md:121,plugin-contract.md:62and:119now useSessionScopeandsessionScope.runtime-owner-operations.md:11and:26, and the R2 paragraph atplugin-contract.md:361-367, still saysessionLifecycle; #2093 at d4e4284 already replaces those shared rows, so they are not re-raised as a P2 here. - P2 4, the binding page's Open section denied
line_owner: fixed and withdrawn.branch-typescript.md:152-154now says a Session part cannot inject a per-branch service but reads the branch-group data face by line id. - The prior P3s about the README table, the BranchLine route answer count, the own-line input dependency, the
submitsecond argument, thefieldstype, the{line}/{default}reply shapes, the consolidatedviewwording, the missing cursor target and the BranchLine injection list are fixed and withdrawn. - The prior P3s that remain open are the child-read fallback, the ADR 027 links and the
unknownversusunknown_branchspelling. The missing build/error kind and the spelling are part of the existing review's failure-path and reservation-visibility points.
Existing review
I agree with the existing review at this head on its blockers: line metadata must be read at createdAt rather than the inherited cut, reservation visibility needs one rule across line, read, directory, branch.get and end, and the failure path must be explicit. I do not repeat them here; the optional findings below are additional.
P3 findings (optional)
P3 1. The branch tool's first read of a child still falls back to the caller's request start
Problem: BranchTool.md:58 uses cut as the fallback for every target. cut is the current request's start at :38. A first read of the line the caller was cut from starts at the caller's cut, but a first read of a line the caller opened starts at that line's first event (timeline-branches.md:148-151). The current code uses 0 for a child target and the parent's branch point for the parent (crates/dim-agent-capabilities/src/timeline_tree.rs:5533-5546).
Failure scenario: A parent opens a child in an earlier request and later reads it with no after and no cursor. The tool starts after the current request's start, skipping the child's earlier events. A read of after: 0 would work, but the no-after path is the documented continuation.
Evidence: docs/architecture/rust-agent/plugins/BranchTool.md:38, :58; docs/design/timeline-branches.md:148-151; crates/dim-agent-capabilities/src/timeline_tree.rs:5533-5546.
Fix: Use 0 for a line the caller opened and the caller's opening cut for the line it was cut from, or state a different tool rule and implement it.
P3 2. ADR 027 links still point at the #2029 PR
Problem: ADR 027 is merged on main, but several target links still use the PR URL: branch-typescript.md:3, :154, and plugin-contract.md:70. The rest of this PR's target pages link docs/adr/027-cross-scope-access-by-id.md.
Failure scenario: A reader follows a stale PR link instead of the ADR, and the link stops being the canonical decision when the PR page changes or is archived.
Evidence: docs/design/branch-typescript.md:3, :154; docs/design/plugin-contract.md:70; docs/adr/027-cross-scope-access-by-id.md.
Fix: Link the ADR file in all three places.
P3 3. The branch tool lost its branch_target_protected row while the tree still returns it from end
Problem: TimelineTree.md:132 lists branch_target_protected as an end error, and timeline-branches.md:548 says the code is answered by the switch method. The latest BranchTool text removed the row that told the model to read the line and report the state; its coded refusals at BranchTool.md:98-109 do not contain the code, so the general no-code rule at :98 turns it into an uncoded failure. timeline-branches.md:548 and BranchTool.md now imply the tool cannot receive it, while TimelineTree.md:132 says it can.
Failure scenario: A tool line's end races a cascade that is ending an ancestor before the target's own end is recorded. The tree returns branch_target_protected; BranchTool has no mapping or guidance, so the model gets a failed result with no code and cannot tell whether to read the line, retry or stop.
Evidence: docs/architecture/rust-agent/plugins/TimelineTree.md:132; docs/architecture/rust-agent/plugins/BranchTool.md:98-109; docs/design/timeline-branches.md:548.
Fix: Decide whether end can answer branch_target_protected. If it can, restore a BranchTool row and a mapping; if it cannot, remove the code from the end error list and keep it on set_default.
P3 4. The default restore paragraph omits the fork override
Problem: TimelineTree.md:140 says restore keeps the latest branch/default when its line is live and selectable, and names ended, plugin and pre-upgrade host lines as fallbacks. It does not mention a later session/forked on the root. timeline-branches.md:870 and :874 still require a fork to answer the root because every copied branch/default is older than its session/forked.
Failure scenario: A Session forked while a line was the default branch restores from the copied branch/default without considering session/forked; the target contract can put a non-root line back as the default after the fork, contrary to the accepted design.
Evidence: docs/architecture/rust-agent/plugins/TimelineTree.md:140; docs/design/timeline-branches.md:870, :874; TimelineTree.md:430-433 (current implementation already reads the two kinds).
Fix: Add the session/forked override to the default restore paragraph, or point to the dated restore cases and state that §14 remains authoritative.
Cross-PR and main
- The PR is open, not draft, MERGEABLE, and its head is 91da0de. Current main and the merge base are eacc672;
git merge-tree --write-tree origin/main HEADis clean. - #2093 at d4e4284 changes the same
runtime-owner-operations.mdandplugin-contract.mdlines that carry thesessionScoperename and theopenBranchbuild error. #2091 at 05284be also changesplugin-contract.md. All three are open and two edit the same rows, so one of them must rebase after the others; this PR's main merge is clean but does not include those branches. - #2080, #2141 and #2142 change no file in this PR's set. #2002 and #1881 are unrelated to the tree contract.
Verification
- PR state before drafting: head 91da0de, OPEN, not draft, MERGEABLE.
git diff --check origin/main...HEAD: passed.node scripts/adr-check.mjs --base origin/main: passed, 15 changed files.- Relative-link scan over the changed files: 522 links, none missing.
git merge-tree --write-tree origin/main HEAD: clean; no conflict with main.- CI at 91da0de:
changes,static-checksandci-oksucceeded; the other jobs were skipped. I did not wait for CI. - No Rust build or test was run. This is a documentation-only PR; the target-only types and reservation path have no implementation to compile against.
- Worktree clean; all checks used isolated HOME, TMPDIR and XDG directories under the review data directory. No shared home or temporary directory was used, and no residual process remains.
Unverified
- Cross-PR overlap was checked by changed paths and edited rows, not by a full review of every sibling PR.
- The
session/forkedrestore path was not exercised at runtime.
|
|
||
| // read: the cursor is the calling line's, the page is the tool's rendering. | ||
| let own = line_owner::<BranchLine>(&execution.branch_id)?.view(Some(target.clone())).await?; | ||
| let after = input.after.unwrap_or_else(|| own.cursor.unwrap_or(cut)); |
There was a problem hiding this comment.
P3: this falls back to cut for every target. A first read of a line the caller opened starts at that line's first event, not the current request's start (timeline-branches.md:148-151; the current code uses 0 for a child at timeline_tree.rs:5533-5546). Use 0 for a child and the caller's cut for the parent.
There was a problem hiding this comment.
Partly fixed in 43f132d. The child case now starts at 0, but the parent case at BranchTool.md:60 still uses cut from :38, the current request's start, not the caller's opening cut. timeline-branches.md:148 and the current code at timeline_tree.rs:5533-5546 use the caller's cut (its branch_point). BranchLine.md:50 repeats the fallback without defining cut. One more fix remains: derive the parent start from the caller's own record, and keep request_start for create only.
TimelineTree owns a Session's line directory and lifecycle; its public surface becomes five data operations on the owner type. TreeTimeline, BranchLine and BranchTool are documented as their own owners in the same group. Session parts reach a line's owners by line id; the tree provides no entry into another owner's state and writes no live line's timeline.
The template's Caller example was missing: the contract explained how a Session part reaches a line's owners but showed no caller of this owner's five operations. The example covers a client opening, reading the directory and ending a line, and a method reading one page, with no version, wait or id to release.
Cross-cutting decision 2 asks this contract who provides the per-line operations to Session parts. The contract now names it: the Session access surface (#2025) exposes lineOwner.call({line, operation, request}), resolved by the runtime's own index of the instances it constructs, and TimelineTree stays out of the path. Dependencies move to SessionScope's identity and openBranch.
Review of the contract asked for two shapes. A Session part resolves a line's owner by type (line_owner::<T>(line)) and calls that owner's own operation, instead of routing by operation-name strings with json requests; the mechanism requirement now says so and matches #2093. The directory read splits into directory() and line(id), so no caller matches an enum reply or writes unreachable!.
The final message stays with the end that owes it, delivered before the scope closes and before branch/ended; the owner's branch parts hold a weak handle, built with the tree, so close can settle the scope; create's cancellation stops only the wait; BranchLine declares its input owner and its four markers; the status note's text stays with BranchLine; errors carry wire codes and every kind is mapped; a Session part reaches any branch data face with line_owner; the directory splits into directory() and line(); the binding appendix compiles; the parts, flows and counts agree. Existing documents' paragraphs describing this owner are replaced and the contracts list what they supersede.
The line-addressed access follows ADR 027 D1-D3 and links #2127; the runtime routes the call and hands no instance key out. The binding appendix compiles in a temporary crate: the idle-notice wire enum and AgentEvent are declared, ReadReply is one-or-the-other, and every error variant carries named fields so the code tag serializes. An owed final message keeps the line ending and answers final_undelivered until it lands. BranchTool calls BranchLine's view and the tree's end on an ending line. The retained documents' paragraphs describing this owner are updated, and links point at the PRs that add them.
…ool error A repeated end answers branch_ended and an owed final message is delivered by restore only: final_undelivered and the retry wording leave the contract, its appendix and the tool. The ended notice is written by the opener's own BranchLine on its own line; only the idle notice goes through line_owner. The tool's error table covers an ended or protected target, an unknown id and a cancelled create, and the branch-construction dependency names its only caller.
…e tool errors The BranchLine flow now sends only the idle notice through line_owner; the ended notice and the roster retirement are written on the opener's own line when it folds branch/ended. A Session part sees SessionClosing and NoLine, and NoLine means the instance is closing or gone, not an ending line; NoSession belongs to process callers. The tool's errors split into the accepted refusal codes and the endings without a code, so an after past the head stays the accepted no-code error result.
The rebase left the worktree without files that main tracks, and the commit's broad add staged their removal. Restore them unchanged.
BranchTool's contract merges into its architecture page, with the code described under Current implementation; BranchLine and TreeTimeline get their own architecture pages and leave the design tree. The two READMEs, the moved pages' inbound links and the example documents that named them follow.
The paragraphs this contract supersedes in runtime-owner-operations, the branch TypeScript binding and the timeline-branches note now point at the contract instead of restating it. The reservation stays with create: the tree reserves under its own lock and TreeTimeline hands the committed branch/create over to start the build. BranchLine's target dependency is SessionScope, a Session part sees two route answers, and the examples and reply shapes match the binding and the callee signatures.
Create's admission is stated per source: a user or plugin open takes any live parent and spends no slot, and only a tool open is checked against the opener rule and the cap. The tool's refusal surface names structuredContent.error, splits the codes per action, maps the pair check and NoLine, and spells the input field idleNotice. BranchLine's view takes a target and its cursor is rebuilt on load; its client-visible section names the three removed operations and the generated binding and fixture that move with them. TimelineTree's error table gains an operations column, splits the root from the conversation chain, and keeps the root's input error; the input refusal after an end belongs to the line's input owner. ADR 027 is linked in the repository, and the plugin catalog row marks timelineTree as designed.
LineRecord gains createdAt, the sequence of the line's branch/create on its parent, and the record answers from the reservation on, which is what a line's own part reads during apply. Goal's atomic record-and-trigger write becomes a requirement on the line's input owner, submitMany, since the tree performs no input writes. The tool's cursor is the single value its owner publishes, branch_target_protected is set_default's, the default restore and the Create anchor are stated again, the two handles are owner-internal references, the ended notice is one Steer, the feature split and the SessionScope name follow the code and #2093.
…atch gate A read during the reservation now has one table: the record answers from the reservation, read and end answer unknown_branch, the directory and branch.get omit it, and line_owner answers NoLine; a failed build records branch/create-failed, drops the node and leaves the create fact. The error kind is spelled unknown_branch throughout and the App Server keeps answering branch_missing. BranchLine reads a line's role and parent at createdAt, not at the inherited cut. submitMany is a delivery gate and the InputQueue and Goal drafts align on it. BranchTool starts a first child read at 0 and a first parent read at the cut; ADR 027 links point at the ADR; end no longer claims branch_target_protected; the default restore names the session/forked override.
read is TimelineTree's and named in #2092; query and sessionConfig exist only on the store's process face. The catalog row marks openBranch as Rust-only and cites the shared lifecycle design that section 7 requires for an object. The projection's wire types are this contract's; the upper contract aligns its import. Refs #2025
The Session timelineStore face carries no sessionId: the instance identity supplies it. The operations table renders again, a fault is still recorded after close, the tree rows and the plugin-contract cells match #2092, the adopted allowance is repaired at adoption, and the delivery mapping lists the current instance errors. Refs #2025
91da0de to
43f132d
Compare
|
已按评审修改,head 台账第 1–6 轮(12:34 17 条、14:23 13 条、04:05 5 条、06:47 3 条、08:38 11 条 inline,加各轮 review 正文):全部关闭,无回退。 第 7 轮 zerob13(6037323929)
第 7 轮 yyhhyyyyyy(6037661951)
预审一 / 预审二:P1(create 按来源准入; 改成指针的段落
预审摘要
剩余 P2(交维护者判断)
已知未修的 P3
检查
|
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Review: PR #2092, round 7, head 43f132d
Scope: this PR defines the line directory owner contract for #2024 and its tree owners: TimelineTree, TreeTimeline, BranchLine and BranchTool. It moves BranchLine and TreeTimeline into the architecture pages, rewrites the tree's operations, the line_owner route and the branch tool, and updates the runtime owner, plugin contract, service faces, branch TypeScript and timeline branches documents. I reviewed the full origin/main...HEAD of 15 files (+1157/-287) at 43f132d against current main 5930539, not only the delta over 91da0de. The branch is rebased onto current main.
Verdict: REQUEST_CHANGES. One P2 and three optional P3s.
Prior round
- P3 1, the child first-read fallback: partly fixed. BranchTool.md:60 now uses 0 for a line the caller opened, but the parent case still uses cut from :38, the current request's start. The rule at timeline-branches.md:148 and the current code at timeline_tree.rs:5533-5546 use the caller's opening cut. See P3 1 below and the reply on the thread.
- P3 2, ADR 027 links: fixed and withdrawn. branch-typescript.md:3, its Open section, and plugin-contract.md:70 now link ../adr/027-cross-scope-access-by-id.md; no pull/2029 link remains in the 15 files.
- P3 3, branch_target_protected: fixed and withdrawn. TimelineTree.md:132 no longer lists it on end, :164 keeps it on set_default, and timeline-branches.md:548 keeps it on session.branch_set_default.
- P3 4, default restore: fixed and withdrawn. TimelineTree.md:152 now says a later session/forked on the root wins and a Session forked while a line was the default comes back on the root, matching timeline-branches.md:870 and :874.
- The unknown versus unknown_branch spelling is fixed: BranchLine.md:79, :183 and TimelineTree.md:172, :393 use unknown_branch.
- P2 3 from round 5, the shared sessionLifecycle rows: still not changed in this branch. runtime-owner-operations.md:11 and :26 and plugin-contract.md:363, :367 still say sessionLifecycle. #2093 at 4557d0b replaces those rows with sessionScope (checked in its runtime-owner-operations.md:11 and plugin-contract.md:361). Nothing remains for this PR's owner contracts, so it stays withdrawn as a P2 here.
P2 findings
P2 1. A reserved or failed child is reported as ended or not kin
Problem: BranchTool.md:101 maps unknown_branch from the pair check to branch_not_kin and a NoLine after the pair check to branch_ended. TimelineTree.md now says a reserved line answers NoLine from line_owner (:145) while its record is open with head 0 (:140), and a failed creation answers unknown_branch from line, read and end (:150). So a line the caller opened and that is still building, or whose build failed, is reported as not kin or as ended. The same page calls NoLine final (:98, :252), and ADR 027 D2 treats a missing branch as final while the Session lives, so the reservation rule and the route's own semantics disagree.
Failure scenario: A create is cancelled after admission, so the child keeps building and publishes without a waiter (TimelineTree.md:131, :173). The parent's BranchLine writes the roster from the committed branch/create; the current fold inserts the child at timeline_tree.rs:4137-4149 and the roster keeps every child that is not failed or ended at :4756-4762. The parent's next request sees the child id while the build is still running and the model messages or reads it. line(id) answers the reserved record (:140), so the pair check passes. For message, line_owner:: answers NoLine (:145) and the tool answers branch_ended, which the error table calls not retryable, although the line publishes moments later. For read, tree.read answers unknown_branch (:141), which the tool leaves as an uncoded failure with no retry guidance. If the build fails, line(id) answers unknown_branch (:150), the pair check turns it into branch_not_kin, and the model is told to address a line it opened.
Evidence: docs/architecture/rust-agent/plugins/BranchTool.md:101; docs/architecture/rust-agent/plugins/TimelineTree.md:98, :131, :140, :141, :145, :150, :173, :252; docs/architecture/rust-agent/plugins/BranchLine.md:16, :251; crates/dim-agent-capabilities/src/timeline_tree.rs:4137-4149, :4756-4762; docs/adr/027-cross-scope-access-by-id.md:33.
Fix: Pick one rule for a reserved line and state it in all three places. Either the roster lists only published lines and no Session part can reach a reserved id, or line_owner answers a distinct retryable opening outcome and BranchTool tells the model to retry after publication rather than branch_ended. Give a failed creation its own outcome, or say how the tool learns it from branch/create-failed, so it cannot become branch_not_kin. Make TimelineTree.md:98 and :252 agree with the chosen rule.
P3 findings (optional)
P3 1. The parent case of the read fallback still uses the current request start
Problem: BranchTool.md:60 now sets the start to 0 for a line the caller opened, but the else branch uses cut, which :38 defines as the current request's start. A first read of the line the caller was cut from must start at the caller's opening cut (timeline-branches.md:148; the current code reads the caller's branch_point at timeline_tree.rs:5533-5546). The positions are on different lines: the request start is a sequence on the caller's line, while the parent read needs a sequence on the caller's parent. BranchLine.md:50 repeats the fallback with an undefined cut.
Failure scenario: A caller opened on its parent at cut 10 later runs a request that starts at 100 and reads the parent with no after and no cursor. The example starts at 100 and skips the parent events between 10 and 99, which are part of the inherited history the rule says to read.
Evidence: docs/architecture/rust-agent/plugins/BranchTool.md:38, :58-61; docs/architecture/rust-agent/plugins/BranchLine.md:50; docs/design/timeline-branches.md:148; crates/dim-agent-capabilities/src/timeline_tree.rs:5533-5546.
Fix: Derive the parent start from the caller's own record, for example line(execution.branch_id).cut, and keep request_start for create only. Define the same value in BranchLine.md:50.
P3 2. The reservation table does not render
Problem: TimelineTree.md:138 appends the table header to the end of the paragraph line, and :139 is the delimiter row. GitHub's Markdown does not start a table from a header that shares a line with prose, so the seven answer rows render as plain pipe text.
Failure scenario: A reader of the rendered page sees the reservation visibility rule, which is the fix for the pre-review's reservation point, as one long paragraph and cannot scan the per-operation answers.
Evidence: docs/architecture/rust-agent/plugins/TimelineTree.md:138-146.
Fix: Put a blank line after the paragraph and start the table with the header row on its own line.
P3 3. S:TreeHandle labels an internal handle as a Session service
Problem: TreeTimeline.md:41 writes S:TreeHandle in the contract dependency table, and :61 calls it a service. TimelineTree.md:194 and :429 say TreeHandle is an owner-internal weak reference, not a service and not a catalog name, and BranchLine.md:65 lists it without a scope prefix.
Failure scenario: An implementer reading the dependency table adds a TreeHandle service name to the Session catalog or to the injection graph, while the tree is supposed to pass the handle when it constructs the part. The generated assembly has no such service.
Evidence: docs/architecture/rust-agent/plugins/TreeTimeline.md:41, :61; docs/architecture/rust-agent/plugins/TimelineTree.md:194, :429; docs/architecture/rust-agent/plugins/BranchLine.md:65.
Fix: Drop the S: prefix here and in the Supersedes line, and use owner-internal TreeHandle as the other two pages do.
Existing review
I agree with the existing review on its remaining part: the purpose lookup at TimelineTree.md:40 still reads at the cut, but a line can be cut before its creation, and the record's createdAt (:138) is the sequence that finds the parent's branch/create. The current lookup reads from and through the cut (timeline_tree.rs:4845-4864) and finds no create fact for a delayed create.
Cross-PR and main
- The PR is open, not draft, MERGEABLE, head 43f132d. Current main and the merge base are 5930539; git merge-tree --write-tree origin/main HEAD is clean.
- #2093 at 4557d0b changes the same runtime-owner-operations.md and plugin-contract.md rows as this PR. Its SessionScope.md:26 also says NoLine is final for the line, which is the cross-PR side of P2 1. Its runtime-owner-operations.md:25 still writes unknown for line({line}); this PR now uses unknown_branch, so that row needs the same rename.
- #2091 at c6d1dae, #2100, #2103 and #2098 also change plugin-contract.md, runtime-owner-operations.md or service-faces.md. None changes this PR's four owner pages. The PR body's merge order puts #2091/#2092/#2093 together; whichever merges later rebases.
Verification
- PR state before drafting: head 43f132d, OPEN, not draft, MERGEABLE.
- git diff --check origin/main...HEAD: passed.
- node scripts/adr-check.mjs --base origin/main: passed, 15 changed files.
- git merge-tree --write-tree origin/main HEAD: clean; no conflict with main.
- Relative-link scan over the changed files: 538 links. Two anchors are missing, both already on main and not on lines this PR adds: timeline-branches.md:554 (#122-items-for-the-prompt-layer-429) and :570 (appserver/session-deletion-and-fork.md#62-why-main-only).
- CI at 43f132d: changes, static-checks and ci-ok succeeded; the other jobs were skipped. I did not wait for CI.
- No Rust build or test was run. This is a documentation-only PR. The checks used isolated HOME, TMPDIR and XDG directories under the review data directory; no residual process remains.
Unverified
- The unrendered table is judged from the GitHub Markdown rules, not from the rendered PR page.
- Cross-PR overlap was checked by changed paths and the cited rows, not by a full review of every sibling PR.
- The reservation path was not exercised at runtime.
|
|
||
| ### Errors | ||
|
|
||
| The tool's coded refusals are the accepted set ([timeline branches §11](../../../design/timeline-branches.md#11-the-branch-tool)); an argument error and every other ending are failed results without a code, so the model-visible result shape does not change. The pair check reads `line(id)` first: `unknown_branch` there becomes `branch_not_kin`, never a separate code. A `NoLine` after the pair check succeeded means the target's instance closed in between, which each action reports as `branch_ended`. `SessionClosing` is a failed result without a code, and a Session part never receives `NoSession` ([#2127](https://github.com/arcships/dim/issues/2127); [TimelineTree](TimelineTree.md#session-parts-reaching-a-lines-owners)). |
There was a problem hiding this comment.
P2: these mappings are wrong for a child that has not published. TimelineTree.md:145 makes a reserved line answer NoLine from line_owner while its record is open with head 0 (:140), and :150 makes a failed creation answer unknown_branch from line. The pair check here turns the failed case into branch_not_kin, and the next sentence turns NoLine into branch_ended, which the table calls not retryable. A line the caller opened and that is still building is reported as ended, and a failed one as not kin. Say how a reserved line is handled (retry after publication, or keep it out of every Session part's reach until it publishes) and give a failed creation its own outcome. Also reconcile :98 and :252, which call NoLine final.
| | `line` | One line's record | `{line}` | `record` | None | `unknown_branch` (an id this Session never had), `closed` | | ||
| | `read` | A line's facts at a cutoff, or the line and its ancestors at one cut | `{line, scope?, from?, through?, fields?, limit?}` | `{through, events}` or `{through, rows}` | None: one bounded read | `unknown_branch`, `beyond_head` (a cutoff past the line's head), `not_batch_boundary` (a cutoff inside an atomic batch), `continuation_without_cutoff`, `closed` | | ||
|
|
||
| A record is `{line, parent, cut, createdAt, source, state, head, endEvent?}`; `state` is `open`, `ending` or `ended`. `cut` is the point of the parent's history the line starts from; `createdAt` is the sequence of the line's `branch/create` on the parent, which is where the line came into being and what its opener and its own BranchLine read the line's opening by. The two differ: a line cut at an old point is created later than its cut, and a `before` producer's anchor can be either. A record exists from the reservation on. What a read answers while the build is still running, after `create` released its lock and before the scope published: | Read during the reservation | Answer | |
There was a problem hiding this comment.
P3: the table header is appended to this paragraph line, so GitHub's Markdown does not start a table; the seven answer rows render as plain pipe text. Put a blank line after the paragraph and start the table with the header row on its own line.
| | --- | --- | | ||
| | `B:Dispatcher` | The line's committed facts, in order. | | ||
| | `B:Timeline` / `B:TimelineIdentity` | Creation and end settlement location and this line's id. | | ||
| | `S:TreeHandle` | The owner's weak handle to TimelineTree: the internal handover for creation, end and turn end. Weak because the tree holds this line's scope and the scope holds this part. | |
There was a problem hiding this comment.
P3: S: marks a Session service, but this is the owner-internal weak handle. TimelineTree.md:194 and :429 say TreeHandle is not a service and has no catalog name, and BranchLine.md:65 lists it without a prefix. Drop the prefix here and at :61; an assembly reader could otherwise add a TreeHandle service that does not exist.
|
Closing as part of abandoning the owner-split experiment. |
Design part of #2024 (TimelineTree and the branch line), under design rules §7 and the owner-redesign template.
Merge order: #2029 → #2080 → #2091/#2092/#2093 → #2094 → #2096 → the rest.
Four owner contracts in one change, because the plate changes at once:
TimelineTree: the Session's line directory and line lifecycle. Six data operations on the owner type:create,end,set_default,directory,line,read.treeCommands,timelineTreeControland theBranchfacade stop crossing this owner.TreeTimeline: the branch-scope route from a line's facts to the directory; no public face.BranchLine: one line's role, end state, read cursors and held parent block as one read value.BranchTool: the model'sbranchtool; no service.A Session part reaches a line's owners with
line_owner::<T>(line): any data face of the branch group, resolved by the runtime's index of the instances it constructs (ADR 027). TimelineTree provides no entry into another owner and states the requirement in #2025.Delivery part (deletion list, caller migration, implementation task, acceptance): #2024 (comment)
Checks:
node scripts/adr-check.mjs --base origin/main,cargo run --locked -p xtask-check.Refs #2024
Refs #2015