Repository navigation
docs(principles): add owners and operations - #2029
Conversation
Add section 7 of the design rules: a plugin is designed from its own responsibility and maintenance boundary; resources stay with their owner, which offers id-based operations; business state is shared through facts or versioned values; one owner has one public surface, judged by cross-language availability, with no forwarding facades. The section adds the three design questions (resources, lifecycle, external operations), operation and owner granularity, errors as part of the contract, and review checks. Refs #2015
53be2dc to
4635829
Compare
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Review: add section 7, owners and operations
Scope. Docs-only review of docs/architecture/rust-agent/principles.md at head 46358297a4ba7ebf095b63a11ce26c5c30db44dd (branch dim/2015-owner-operations, base main). The PR adds 40 lines: the new ## 7. 所有者与操作, ### 7.1 设计三问 and ### 7.2 评审检查. No other file changes. There are no existing review threads.
Verdict: REQUEST_CHANGES.
The direction is sound: resources stay with their owner, other plugins use id-based operations, and facts or values carry state. That matches docs/design/service-faces.md section 1 and the target shapes in docs/design/resource-faces.md. The problems are precision and consistency. The section is about to become the rule source for the owner scans in #2016-#2028, so these should be fixed first.
Findings
[High] owner is undefined and 一个所有者一套公开面 conflicts with the target designs
Anchors: docs/architecture/rust-agent/principles.md:110, :123.
所有者 is never defined. It is used for the plugin, the part, the service provider and the state owner. Two rules depend on the unit: 同一所有者内部 (:121) and 一个所有者一套公开面 (:123). The repository already has several data faces under one provider:
docs/architecture/rust-agent/generated/catalog.md:53-70: SessionStore providessessionFiles,sessionMetadata,storeandworktreeAssociations.docs/architecture/rust-agent/generated/catalog.md:31,:49,:68: Scheduler providesloops,scheduleJobsandwakeups.docs/architecture/rust-agent/generated/catalog.md:98-99: ToolRegistry providestoolRegistryandtoolSourcesView.docs/design/service-faces.md:102:toolSourcesViewis同一 ToolRegistry owner 的独立只读观察面.docs/design/contracts/resource-owner-operations.md:47: SessionStore publishesstore,sessionFilesandtimelineStore.
docs/design/resource-faces.md:860 already uses the narrower wording the part that owns the resource or the state. If that is the intended unit, say so and say whether one part/owner may publish several distinct data faces. If the unit is the plugin/provider, the rule contradicts the catalog and the target service-faces design. Also say whether a read-only observation face such as toolSourcesView is allowed and how the canonical registration services fit: docs/design/contracts/session-boundary.md:5-11 exposes client methods and tools through sessionMethods, managementMethods and toolRegistry, and docs/adr/002-plugin-scope.md:59-60 requires those mechanisms. Those public operations are not a service annotated on the owner's own type.
[High] The Rust-only method check contradicts rutis-usage section 3.3 and leaves the hot-path exception open
Anchor: principles.md:144 (the same rule appears at :123).
docs/design/rutis-usage.md:167-173 (section 3.3) says a method that cannot cross languages stays Rust-only, the service is still named and grouped, and the catalog marks the method or the whole service Rust-only. The new check says a public service with a Rust-only method must move the method back into the owner or make it a data operation. That is a stricter Dim rule, but the section does not say it overrides rutis-usage or how existing internal(hot-path) services are treated.
The PR body records an open point in #2015: whether hot-path services between different owners on the branch chain get an exception. The generated catalog currently has many internal(hot-path) rows (contextModelHost, historyRenderer, prepareContextHost, prepareModelHost, agentLoop, loopState, contextPreparation, prompt, and others). Until the exception is resolved or the rule is scoped to faces intended to cross languages, reviewers cannot apply the check consistently. Say that the rule applies only to cross-language faces, or add the exception and link the decision.
[Medium] The exhaustive handoff list omits callbacks and over-specifies versions
Anchor: principles.md:121.
The list 可以交出的只有:值..., 只读视图..., 同一所有者内部... is exhaustive by wording, but it omits callbacks, and the later sentence 参数、回复与错误是数据 repeats the same exclusion. The repository explicitly allows callbacks:
docs/design/service-faces.md:14(section 1 rule 4): callbacks may cross languages by reference, but not synchronously inside the commit lock.docs/design/rutis-usage.md:164: callbacks by reference are a service shape.docs/design/contracts/resource-owner-operations.md:23:FileScope.writeStreamuses a rutis callback to supply bytes or EOF.
The version requirement is also broader than the target designs:
docs/design/service-faces.md:305:agentConfig.get()returns an unversioned config snapshot.docs/design/service-faces.md:358:executionSettingsHost.readreturns{sandbox, network}with no version.docs/design/service-faces.md:12(section 1 rule 2): identity is a value and an id; an id has no version.
Say when a version is required, for example only when a later decision depends on the revision, and define 只读视图: is toolSourcesView a view, a value or an operation? Add callbacks to the allowed shapes with the no-commit-lock condition, or state that the list is not exhaustive.
[Medium] Failure facts conflict with section 4 rule 1
Anchor: principles.md:136.
分支上后续决定要依赖的失败写成事实 conflicts with principles.md:63 (section 4 rule 1): 指令没有生效时不写结果事件,由调用方的回复说明。不要为"什么都没发生"新增事件。 If a failed command has later decisions that depend on the failure, rule 1 says not to write a result event; the new bullet says to write a fact. principles.md:84 (section 4 rule 9) allows facts that later decisions need, so the new bullet is directionally consistent with rule 9, but the two rules still read as contradictory. Limit the bullet to failures of operations that are not command events or that did take effect, or add an explicit exception to rule 1.
[Medium] 不冒充别人数据的源头 is not decidable for read services
Anchors: principles.md:121, :143.
Agents' sessions service returns another owner's data:
docs/design/contracts/session-access.md:232:historyreturns aHistoryPageof a branch Timeline.docs/design/contracts/session-access.md:233:pendingreturns InputQueue state.docs/design/contracts/session-access.md:7and:224:sessionsis a process service provided by Agents, not by those data owners.
If the rule bans returning another owner's data, these established services violate it. If it only bans presenting another owner's mutable resource as one's own or handing out its handle, say so. The same paragraph uses 公开事实 without a definition; section 3 uses 公开内容 and 公开事件 (principles.md:57). Define 公开事实 or use the existing term. Also say what 可以发布 means: publishing a service value or writing a Timeline fact. If it means a Timeline fact, section 4 rule 9 applies.
[Low] The D2 citation overstates what D2 says
Anchor: principles.md:137.
总是一起改动、或只是转发的所有者合并(ADR 002 D2) attributes both clauses to D2. docs/adr/002-plugin-scope.md:44-48 says no plugin exists only to connect, aggregate or adapt other plugins (registries, ports, access hosts, aggregation or adapter plugins). That supports 只是转发, but it does not say owners that always change together must be merged. Cite the source for the cohesion criterion or drop that clause. D1 at docs/adr/002-plugin-scope.md:33-42 supports the scope-follows-owner-and-lifecycle part; the rest of the sentence is fine.
[Low] Section 7.1 has no template or AGENTS.md hook yet
Anchor: principles.md:127.
7.1 requires every owner to answer the three questions in a design document or plugin page. The repository has no such section: docs/templates/design.md:27-30 asks the Rule check to answer section 4, section 1 and ADR 002 D1-D5, and AGENTS.md:121 says the same. The PR body records adding section 7 to AGENTS.md and the plugin design template as an open point in #2015. Until that lands, the requirement has no reviewable home. Add the template update here or say in 7.1 that it is pending.
[Medium] Target rule versus the current HostPlatform page
Anchor: principles.md:116.
This rule does not match the current HostPlatform design:
docs/architecture/rust-agent/plugins/HostPlatform.md:3-5: HostPlatform supplies process spawning and tree-supervision primitives to local tools.docs/architecture/rust-agent/plugins/HostPlatform.md:47-54: spawned process lifetime belongs to each caller/supervisor, not the plugin, and callers hold and dropProcessTreehandles.- The target
execHostmoves those handles inside the provider:docs/design/resource-faces.md:830and:272-277.
This is exactly the #2002 motivation, so the rule is probably a target rule and HostPlatform is an expected finding. If that is the intent, say so, or say that current pre-migration faces are accepted and tracked by #2015. Otherwise a reviewer cannot tell whether to report HostPlatform as a violation or treat it as an accepted legacy shape.
Cross-reference verification
| Reference | Result |
|---|---|
Section 4 rule 9 (principles.md:117) |
Exists at principles.md:84, the ninth item in section 4. It says process-level state (title, Provider entries, configuration) does not enter the Timeline and is modified through the owner's typed write operations. It supports the 不进 Timeline half. It does not literally say owners give values (snapshots, configuration); the read side is implicit. The wording is an extension, not a contradiction. |
../../design/rutis-usage.md |
Resolves to docs/design/rutis-usage.md. Section 3.2 (:156-165) allows callbacks by reference; section 3.3 (:167-173) allows Rust-only methods and services; section 3.4 (:175-192) supports the service annotation and generated dispatcher and TypeScript declarations. The cross-language claim is supported; the Rust-only rule is not. |
../../design/service-faces.md |
Resolves to docs/design/service-faces.md. Section 1 rules 1-3 (:11-13) support data parameters, values and id-based operations. Section 1 rule 4 (:14) allows callbacks, which the new list omits. Section 2.5 (:55-61) supports one contract and a typed binding. Section 2.3 (:47) says the target catalog has only data rows. Section 3.2 (:102) has the same-owner toolSourcesView face. |
../../adr/002-plugin-scope.md |
Resolves to docs/adr/002-plugin-scope.md. D1 (:33-42) supports scope following the owner of state and lifecycle. D2 (:44-48) supports no wiring modules, not 总是一起改动. D5 (:84-107) supports language-neutral data contracts. |
docs/design/resource-faces.md |
Section 2 rule 1 (:56-58) says one face per service and no second business logic. Section 3.8 (:272-277) says the provider owns the process, PTY, temporary directory and output file. Section 6 (:826-839) maps hostPlatform to execHost with ProcessTree and PtyProcessTree as internals. This supports the resource rule in its target shape. |
docs/design/contracts/resource-owner-operations.md |
:10 says process handles remain with the platform. :23 uses a rutis callback. Both support the rule except for the callback omission. |
docs/architecture/rust-agent/plugins/HostPlatform.md |
Contradicts the resource rule in its current form; see the target-versus-current finding. |
docs/architecture/rust-agent/generated/catalog.md |
Shows multiple data faces per provider (:31-70, :98-99) and many internal(hot-path) rows. This is the main evidence for the owner/public-surface and Rust-only findings. |
docs/design/contracts/session-boundary.md |
:5-11 shows public client methods and tools registered through sessionMethods, managementMethods and toolRegistry, not a service annotated on the owner type. |
docs/design/contracts/session-access.md |
:7, :224, :232-233: sessions is an Agents-provided access service that returns other owners' data. |
Verification performed
- Worktree detached at
46358297a4ba7ebf095b63a11ce26c5c30db44dd;git status --porcelainempty. - GitHub files API: one file,
docs/architecture/rust-agent/principles.md, +40/-0. The hunk covers new lines 104-146; all inline anchors are on added lines. - Every relative link in
principles.mdresolves. The three new targets exist. The new links do not use anchors; the text names the section, so this is a readability issue only. Existing links in the file do use anchors in several places, so adding#1-规则,#d1-scope-follows-the-owner-of-the-state-and-its-lifecycleand#d2-no-wiring-moduleswould be more consistent. - Markdown structure is valid: headings 7, 7.1, 7.2; both tables have valid separators; no duplicate or missing heading numbers.
git show --checkreports no whitespace errors. - No command name, service name or identifier in the added section is missing. The checks are prose; the section invokes no repository command. The checklist repeats the rules in the table on purpose, which is appropriate for a review list.
- Quote style: the new section uses ASCII double quotes around Chinese prose. The file already mixes ASCII and curly quotes (three curly pairs in sections 1-6), so this is not a regression. If the project prefers curly quotes for Chinese, align it, but it is not a blocker.
- No existing review comments or reviews; the replies file is empty.
Not verified
- I did not run
cargo run --locked -p xtask-check; the repository has no prebuilt target, and this review was docs-only. The PR body reports that check passed. - I did not run any tests or build the workspace.
- I did not verify the current Rust implementation of HostPlatform beyond its design page; the page is enough for the documented inconsistency.
Unverified items for the author
- Whether
owneris intended to mean the part that owns the resource or state, or the plugin/provider. - Whether the hot-path exception in #2015 should be part of this section or a later change.
- Whether
公开事实is meant to be identical to the existing公开事件.
|
|
||
| | 对象 | 规则 | | ||
| | --- | --- | | ||
| | 资源(进程、PTY、文件与锁、连接、订阅等需要收尾的 I/O) | 创建、结算、取消、清理都在所有者内部完成;对外只给以 id 标识资源的操作,句柄不离开所有者 | |
There was a problem hiding this comment.
Medium: This rule is stated as universal, but the current HostPlatform page says the opposite: HostPlatform supplies process spawning and tree supervision to local tools, spawned process lifetime belongs to each caller/supervisor, and callers hold and drop ProcessTree handles (docs/architecture/rust-agent/plugins/HostPlatform.md:3-5, :47-54). The target execHost moves those handles inside the provider (docs/design/resource-faces.md:830, :272-277). If this is a target rule, say so, or say that pre-migration faces are accepted and tracked by #2015. As written, a reviewer cannot tell whether to report HostPlatform as a violation or treat it as legacy.
There was a problem hiding this comment.
Fixed. principles.md:110 states that section 7 is the target rule and that current plugin shapes which differ are gaps, not exceptions. The current HostPlatform shape at docs/architecture/rust-agent/plugins/HostPlatform.md:47-54 is therefore a gap; the target remains docs/design/resource-faces.md:830 and :272-277.
|
|
||
| 判据:交出去之后,所有者还要不要为它负责?要,就只能给操作。副本与投影则问:新鲜度由谁负责?持有者接受过期时可以持有;正确性依赖最新值时,向所有者请求或订阅。 | ||
|
|
||
| 可以交出的只有:值(快照、配置、身份,带版本)、只读视图,以及同一所有者内部、同一实例生命周期内的东西。不转手:不把别人的资源再交出去,不冒充别人数据的源头;从公开事实折叠出的投影是投影者自己的状态,可以发布,发布者即为它的所有者。 |
There was a problem hiding this comment.
Medium: The exhaustive list and the later 参数、回复与错误是数据 both exclude callbacks, but the repository allows them: docs/design/service-faces.md:14 (section 1 rule 4) allows callbacks by reference across languages, docs/design/rutis-usage.md:164 lists callbacks as a service shape, and docs/design/contracts/resource-owner-operations.md:23 uses a rutis callback for writeStream. The version requirement is also too broad: docs/design/service-faces.md:305 (agentConfig.get()) and docs/design/service-faces.md:358 (executionSettingsHost.read) return unversioned values, and identity is an id per section 1 rule 2 at docs/design/service-faces.md:12, so it has no version. Define whether a version is required only when a later decision depends on the revision, and define 只读视图, for example whether toolSourcesView is a view, a value or an operation.
There was a problem hiding this comment.
Fixed. principles.md:123 now allows callbacks by reference with the no-commit-lock condition and links docs/design/service-faces.md:14. It requires a version only when later decisions depend on the revision, and defines a read-only view as an owner-published value plus subscriptions. This matches docs/design/rutis-usage.md:164 and docs/design/contracts/resource-owner-operations.md:23; the unversioned reads at service-faces.md:305 and :358 fit the conditional.
|
|
||
| 可以交出的只有:值(快照、配置、身份,带版本)、只读视图,以及同一所有者内部、同一实例生命周期内的东西。不转手:不把别人的资源再交出去,不冒充别人数据的源头;从公开事实折叠出的投影是投影者自己的状态,可以发布,发布者即为它的所有者。 | ||
|
|
||
| **一个所有者一套公开面,不为调用方额外封装。** 公开面就是所有者自身的操作:服务标注在所有者自己的类型上,Rust 在进程内直接调用这些方法,其他语言经 rutis 生成的派发与声明调用同一组操作([Dim 如何使用 rutis](../../design/rutis-usage.md))。公开面以跨语言可用为准:参数、回复与错误是数据,资源以 id 表示([服务面](../../design/service-faces.md)第 1 节)。不为某个调用方另造只转发所有者的门面、命令、控制或宿主对象,同一组操作也不以两套接口存在。需求要的形状在所有者职责内,就成为所有者的一个操作;不在,就归调用方。公开服务上只有 Rust 能用的方法,要么移回所有者内部,要么改成数据操作。 |
There was a problem hiding this comment.
High: 一个所有者一套公开面 conflicts with the target designs unless owner is defined more narrowly. docs/design/service-faces.md:102 calls toolSourcesView an independent read-only observation face of the same ToolRegistry owner, while toolRegistry is the write and registration face. docs/design/contracts/resource-owner-operations.md:47 says SessionStore publishes store, sessionFiles and timelineStore. The generated catalog has the same pattern for several providers (docs/architecture/rust-agent/generated/catalog.md:31-70, :98-99). Also clarify whether the canonical registration services count as the owner's face: docs/design/contracts/session-boundary.md:5-11 exposes client methods and tools through sessionMethods, managementMethods and toolRegistry, and docs/adr/002-plugin-scope.md:59-60 requires those mechanisms. The rule should ban a second forwarding interface for the same operations, not multiple distinct data faces of one owner, and should say so.
There was a problem hiding this comment.
Narrowed. principles.md:110 defines the owner, and :129 and :156 replace one-owner-one-face with one interface per operation set and a reason for each new interface. The multi-face evidence now fits: docs/design/service-faces.md:102 calls toolSourcesView an independent read-only face of the same ToolRegistry owner, and docs/architecture/rust-agent/generated/catalog.md:31, :49, :53-54, :63, :68, :70, :98-99 list several data faces per provider. Still open: the canonical registration services, as in the reply to 4659011434, and the binding appendix at docs/templates/owner-redesign.md:51.
|
|
||
| ### 7.1 设计三问 | ||
|
|
||
| 每个所有者在设计文档或插件页面中回答: |
There was a problem hiding this comment.
Low: 7.1 requires every owner to answer these questions in a design document or plugin page, but the repository has no such section: docs/templates/design.md:27-30 asks the Rule check to answer section 4, section 1 and ADR 002 D1-D5, and AGENTS.md:121 states the same. The PR body records adding section 7 to AGENTS.md and the template as an open point in #2015. Until that lands, this requirement has no reviewable home. Either add the template update in this PR or say in 7.1 that it is pending.
There was a problem hiding this comment.
Narrowed. The template now exists and is linked from principles.md:139 and docs/templates/README.md:11. Still open: the template is scoped to existing owner redesigns (docs/templates/owner-redesign.md:3-7) while :139 covers every owner; docs/templates/design.md:27-30 and AGENTS.md:121 still omit section 7 from the Rule check; the path docs/design/plugins/<Owner>.md does not define a document for a multi-owner plugin, since docs/design/plugins/README.md indexes plugin designs; and the template's Exceptions with reasons section (:41-43) needs to match principles.md:110 (gaps, not exceptions).
| | 对外业务 | 调用方的意图推出哪些操作与值;每个操作的取消、超时与错误种类 | | ||
|
|
||
| - **操作颗粒度**:一个操作是资源的一次状态迁移或一次一致的读取,所有者能独立完成并收尾。调用方漏调或调错顺序就会破坏所有者状态,说明太细;夹带调用方的决定,或调用方只需要其中一部分,说明太粗。步骤之间以 id 衔接,策略作为数据参数传入。 | ||
| - **错误**:错误是操作契约的一部分。种类按调用方下一步能做什么区分(重试、修正输入、不存在、已取消、所有者已关闭、冲突),来自资源的状态机,不泄漏内部错误。取消与超时写明各自停止的是什么。分支上后续决定要依赖的失败写成事实,不只作为返回值。 |
There was a problem hiding this comment.
Medium: This conflicts with section 4 rule 1 at principles.md:63: 指令没有生效时不写结果事件,由调用方的回复说明. If a failed command has later decisions that depend on the failure, rule 1 says not to write a result event, while this bullet says to write a fact. Reconcile by limiting the bullet to failures of operations that are not command events or that did take effect, or by adding an explicit exception to rule 1. Section 4 rule 9 at principles.md:84 allows facts later decisions need, so the direction is clear, but the two rules still read as contradictory.
There was a problem hiding this comment.
Fixed. principles.md:148 now scopes the rule: a command that did not take effect follows section 4 rule 1 at :63; a failure of an operation that did occur becomes a fact only when a later decision depends on it. One wording issue remains: use 指令 or 指令事件 instead of 命令, because section 4 rule 1 and the command-event vocabulary use 指令, while 命令 means a CLI or configured command (principles.md:100; docs/design/service-faces.md:95 commandRules).
|
|
||
| - **操作颗粒度**:一个操作是资源的一次状态迁移或一次一致的读取,所有者能独立完成并收尾。调用方漏调或调错顺序就会破坏所有者状态,说明太细;夹带调用方的决定,或调用方只需要其中一部分,说明太粗。步骤之间以 id 衔接,策略作为数据参数传入。 | ||
| - **错误**:错误是操作契约的一部分。种类按调用方下一步能做什么区分(重试、修正输入、不存在、已取消、所有者已关闭、冲突),来自资源的状态机,不泄漏内部错误。取消与超时写明各自停止的是什么。分支上后续决定要依赖的失败写成事实,不只作为返回值。 | ||
| - **所有者颗粒度**:在 [ADR 002 D1](../../adr/002-plugin-scope.md) 的作用域划分之内,生命周期不同的资源归不同的所有者;总是一起改动、或只是转发的所有者合并(ADR 002 D2)。上层只通过操作组合下层,不持有下层句柄,也不把下层资源再对外提供。 |
There was a problem hiding this comment.
Low: The D2 citation supports 只是转发 but not 总是一起改动. docs/adr/002-plugin-scope.md:44-48 says no plugin exists only to connect, aggregate or adapt other plugins; it does not say owners that always change together must be merged. Cite the source for the cohesion criterion or drop that clause. D1 at docs/adr/002-plugin-scope.md:33-42 supports scope following the owner of the state and its lifecycle; the rest of the sentence is fine.
There was a problem hiding this comment.
Narrowed. principles.md:149 now cites ADR 002 D2 only for 只是转发的所有者合并, which docs/adr/002-plugin-scope.md:44-48 supports. 总是一起改动的所有者合并 no longer claims D2, but it still has no cited source. If it is a design heuristic, say so; otherwise cite the source or drop the clause.
|
|
||
| - 每个跨插件调用都落到某个所有者的一个操作上。 | ||
| - 交出去的只有值、只读视图,或同一所有者内部的东西。 | ||
| - 没有转手别人的资源,没有冒充别人数据的源头。 |
There was a problem hiding this comment.
Medium: 不冒充别人数据的源头 is not decidable for read services. Agents' sessions service returns another owner's data: history returns a HistoryPage of a branch Timeline and pending returns InputQueue state (docs/design/contracts/session-access.md:232-233); the service is provided by Agents, not by those data owners (docs/design/contracts/session-access.md:7, :224). If this check bans returning another owner's data, these established services violate it. If it only bans presenting another owner's mutable resource as one's own or handing out its handle, say so. 公开事实 later in the section is also undefined; section 3 uses 公开内容 and 公开事件 (principles.md:57). Define the term or use the existing one.
There was a problem hiding this comment.
Still open, now as a conflict rather than an ambiguity. principles.md:127 bans an owner returning another owner's data or receiving writes for it and tells callers to request the data owner directly. Agents' sessions service does exactly that: docs/design/contracts/session-access.md:7 and :224 define it as a process service provided by Agents, and :229-235 lists input, history, pending, withdraw and stop. ADR 002 D2 at docs/adr/002-plugin-scope.md:61 names it as the way to reach other Sessions, and docs/design/service-faces.md:112 targets agentIndex through sessions. Process callers cannot directly inject Session or branch services, which is why session-access.md:7 routes them through Agents. The projection exception at :127 may cover a history page but not the write and command methods. Either exempt a declared cross-scope access service or narrow the rule to forwarding mutable resources; if the intent is to remove sessions, record that in ADR 002 and session-access first. 公开事实 is now 公开事件, which fixes the term; 发布 still needs a definition.
| - 每个跨插件调用都落到某个所有者的一个操作上。 | ||
| - 交出去的只有值、只读视图,或同一所有者内部的东西。 | ||
| - 没有转手别人的资源,没有冒充别人数据的源头。 | ||
| - 所有者只有一套公开面:没有只转发所有者的门面、命令或控制对象,公开服务上没有只供 Rust 调用的方法。 |
There was a problem hiding this comment.
High: This check contradicts docs/design/rutis-usage.md:167-173 (section 3.3), which says a method that cannot cross languages stays Rust-only, the service is still named and grouped, and the catalog marks the method or the whole service Rust-only. It also omits the open decision recorded in #2015 about hot-path services between different owners on the branch chain; the generated catalog currently has many internal(hot-path) rows (docs/architecture/rust-agent/generated/catalog.md, for example contextModelHost, historyRenderer and agentLoop). Either scope the check to faces intended to cross languages, or state that it intentionally overrides rutis-usage section 3.3 and how the hot-path exception is handled.
There was a problem hiding this comment.
Fixed. principles.md:131 acknowledges that docs/design/rutis-usage.md:167-173 allows Rust-only methods and services, then states the Dim rule: public faces do not use that ability, and Rust-only methods stay inside the owner. principles.md:110 makes existing mismatches gaps, and docs/design/service-faces.md:27-32 and :47 classify internal(hot-path) and other internal rows as migration work with a data-only target. The hot-path rows are therefore gaps, not an exception. If #2015 later decides an exception, the rule will need an amendment.
zerob13
left a comment
There was a problem hiding this comment.
[P2] Preserve explicit in-process handoff contracts and don’t use lifetime alone to force an owner split. §7–7.1 restricts handoff to the same owner/lifetime and makes different lifetimes sufficient for different owners. This would direct the owner scans to change two concrete invariants: the Questions claim must exist before the tool call is published and be released if append or execution fails; ContextPreparation consumes or discards a request-local projection at its original cutoff. Handler pinning or an ID alone does not specify those lifecycle guarantees.
Keep the ID-based rule for public resources. For a declared in-process handoff, require the owner, publication order, transfer, and cleanup to be explicit; do not use “hot path” as a blanket exception. Treat lifetime as evidence when deciding ownership, not a sufficient reason to split a cohesive invariant. This is separate from the face and callback wording already covered by the peer review. Docs CI passed; this is a contract review, not a runtime test.
Design rules §7 gains the responsibility split: interfaces use the owner's vocabulary, owner mechanisms such as locks, versions, waits and retries stay inside the owner, and an operation or parameter is added only when callers cannot compose it from existing operations without breaking the owner's invariants. The review checks gain the matching item. docs/templates/owner-redesign.md gives the shape for redesigning an existing owner: a durable design part for docs/design/plugins and a delivery part for the owner's issue. Refs #2015
zerob13
left a comment
There was a problem hiding this comment.
[P2] Scope the owner-redesign acceptance checks to the operations being migrated. The new template requires migrating every caller in one change and removing every internal(reason) entry for the owner. That is broader than the staged migration policy. For example, TimelineTree already exports treeCommands, but Session assembly still requires TimelineTreeControl before publication. The template would block a migration of the public face until it also replaces that separate in-process assembly contract. Require all callers of the operations in scope to migrate, and track separately any retained internal dependency not in scope. If whole-owner migration is intended instead, resolve that policy change explicitly before using the template to gate owner redesigns.
The earlier handoff and ownership-granularity review still applies; this finding is about the new template. Static architecture review. The docs gate passed on an interim base with the same three changed Markdown files.
Define the owner as the part that holds a resource or state, and state that section 7 is the target rule: current shapes that differ are gaps. Resolve the points where section 7 replaces older practice: - interfaces add concepts, so a new one needs a reason from the owner's boundary, and one set of operations has one interface; - rutis supports Rust-only methods, but Dim public surfaces do not use them; - handing out an object is a last resort and requires a lifecycle design shared by the plugins involved; a hot path is not a reason; - an owner does not serve another owner's resources or data; a performance need redefines ownership; - a plugin area is redesigned in one change, without a compatibility period. Also allow callbacks by reference, require versions only when later decisions depend on them, let each owner design its own error kinds, keep section 4 rule 1 for commands that did not take effect, and cite ADR 002 D2 only for merging forwarding owners. Refs #2015
|
Thanks for the reviews. Updated in ce840af. Accepted as written:
Kept, deliberately stricter than existing practice:
|
|
针对 @yyhhyyyyyy 的 review,我在本地基于
热路径:测量结论把 跨语言时整份 prepared request 往返一次的 Rust 侧编解码代价(release,darwin/arm64,临时基准,基线
对照: 逐个看 17 个 修订 diff(相对 4635829)diff --git a/AGENTS.md b/AGENTS.md
index 3f8fcc897..81e810f80 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -119,5 +119,5 @@ Dim's architecture and the way Dim uses rutis are documented apart ([ADR 006](do
A rule is stated once, at its layer. The Rust spelling of a rule is a binding, not the rule. See the [architecture overview](docs/architecture/README.md#design-documents) for the full document index.
-Before designing or changing a plugin, capability or event, read [design rules §4](docs/architecture/rust-agent/principles.md) (extending behavior through the Timeline), [ADR 002](docs/adr/002-plugin-scope.md) (scope, no wiring modules, configuration, language-neutral contracts) the [plugin contract](docs/design/plugin-contract.md) (how Dim's architecture applies to plugins) and [How Dim uses rutis](docs/design/rutis-usage.md) (how parts are mounted, name services and cross languages). Every plugin design document contains a "Rule check" section that says which parts are Capabilities ([principles §1](docs/architecture/rust-agent/principles.md)) and answers each of these rules (§4 rules 1–9, §1 and ADR 002 D1–D5; or states why one does not apply), and a "Requirements raised to mechanism owners" section in the format of §4 rule 8. Pull requests answer the checklist in the pull request template.
+Before designing or changing a plugin, capability or event, read [design rules §4](docs/architecture/rust-agent/principles.md) (extending behavior through the Timeline), [ADR 002](docs/adr/002-plugin-scope.md) (scope, no wiring modules, configuration, language-neutral contracts) the [plugin contract](docs/design/plugin-contract.md) (how Dim's architecture applies to plugins) and [How Dim uses rutis](docs/design/rutis-usage.md) (how parts are mounted, name services and cross languages). Every plugin design document contains a "Rule check" section that says which parts are Capabilities ([principles §1](docs/architecture/rust-agent/principles.md)) and answers each of these rules (§4 rules 1–9, §1, the §7.2 owner checks and ADR 002 D1–D5; or states why one does not apply), and a "Requirements raised to mechanism owners" section in the format of §4 rule 8. Pull requests answer the checklist in the pull request template.
1. A feature is split into parts by the owner of their state, and each part lives in that owner's scope: the process, a Session or a branch ([ADR 002 D1](docs/adr/002-plugin-scope.md)). A part declares every dependency, including those only needed for load order. How a part is mounted and names its dependencies is [How Dim uses rutis](docs/design/rutis-usage.md); the current Rust spelling is below. `apply` acquires resources and registers their cleanup immediately, then registers services and subscriptions. Once `apply` completes, services and subscriptions are available. Input consumption and background work start only after the Session or branch is published (`activated()`); if assembly fails, they never start. They end on `closing()` without waiting for unload, and a Session is closing from the moment its close starts. A process part whose background work depends on the initial process assembly waits for the host-wide `processActivity.activated()` in its own tasks; `apply` does not block on it, and a row reload does not reset it ([plugin contract §7.1](docs/design/plugin-contract.md#71-phases)).
diff --git a/docs/architecture/rust-agent/principles.md b/docs/architecture/rust-agent/principles.md
index f664b20e7..ebb59baf4 100644
--- a/docs/architecture/rust-agent/principles.md
+++ b/docs/architecture/rust-agent/principles.md
@@ -108,4 +108,8 @@ Approval 与 Permission 只管 agent 决策引起的动作(工具调用);
## 7. 所有者与操作
+本节是目标规则:新设计与改动按它评审,迁移前已有的形态由 #2015 跟踪,不作为新违规报告。
+
+**所有者**是拥有某项资源或状态的部件(第 1 节)。一个所有者可以发布多个服务面,只要各自承载不同的操作,例如注册面与只读观察面([服务面](../../design/service-faces.md)第 3.2 节的 `toolSourcesView`)。
+
设计插件先回答"我负责什么、维护到哪里",再回答"别人需要什么"。插件与部件的形状由职责和维护边界决定;外部需求只决定对外提供哪些操作,不决定内部如何组织,也不决定交出什么。需求用来验证职责划分:每个真实需求都应落到某个所有者的某个操作上。落不下去说明划分有缺口;超出职责的需求交给真正的所有者,或新建一个所有者,不在现有插件上开口子。
@@ -119,7 +123,7 @@ Approval 与 Permission 只管 agent 决策引起的动作(工具调用);
判据:交出去之后,所有者还要不要为它负责?要,就只能给操作。副本与投影则问:新鲜度由谁负责?持有者接受过期时可以持有;正确性依赖最新值时,向所有者请求或订阅。
-可以交出的只有:值(快照、配置、身份,带版本)、只读视图,以及同一所有者内部、同一实例生命周期内的东西。不转手:不把别人的资源再交出去,不冒充别人数据的源头;从公开事实折叠出的投影是投影者自己的状态,可以发布,发布者即为它的所有者。
+可以交出的只有:值(快照、配置、身份;后续决定依赖其修订时带版本)、只读视图(只能读、不能改所有者状态的值或观察面)、按引用传递且不在提交锁内同步调用的回调([服务面](../../design/service-faces.md)第 1 节规则 4),以及同一所有者内部、同一实例生命周期内的东西。不转手:不把别人的资源或句柄再交出去,不把别人的可变状态当成自己的来提供;读取服务可以按 id 返回别人的数据,来源仍是原所有者。从公开事件折叠出的投影是投影者自己的状态,可以作为服务值发布,发布者即为它的所有者。
-**一个所有者一套公开面,不为调用方额外封装。** 公开面就是所有者自身的操作:服务标注在所有者自己的类型上,Rust 在进程内直接调用这些方法,其他语言经 rutis 生成的派发与声明调用同一组操作([Dim 如何使用 rutis](../../design/rutis-usage.md))。公开面以跨语言可用为准:参数、回复与错误是数据,资源以 id 表示([服务面](../../design/service-faces.md)第 1 节)。不为某个调用方另造只转发所有者的门面、命令、控制或宿主对象,同一组操作也不以两套接口存在。需求要的形状在所有者职责内,就成为所有者的一个操作;不在,就归调用方。公开服务上只有 Rust 能用的方法,要么移回所有者内部,要么改成数据操作。
+**一个所有者一套公开面,不为调用方额外封装。** 公开面就是所有者自身的操作:服务标注在所有者自己的类型上,Rust 在进程内直接调用这些方法,其他语言经 rutis 生成的派发与声明调用同一组操作([Dim 如何使用 rutis](../../design/rutis-usage.md))。公开面以跨语言可用为准:参数、回复与错误是数据,资源以 id 表示([服务面](../../design/service-faces.md)第 1 节)。不为某个调用方另造只转发所有者的门面、命令、控制或宿主对象,同一组操作也不以两套接口存在。机制提供的登记点(`sessionMethods`、`managementMethods`、`toolRegistry`,[ADR 002](../../adr/002-plugin-scope.md))不是转发门面。需求要的形状在所有者职责内,就成为所有者的一个操作;不在,就归调用方。跨语言的服务上不新增只有 Rust 能用的方法([Dim 如何使用 rutis](../../design/rutis-usage.md)第 3.3 节);只有 Rust 能用的服务在目录中写明原因,原因不能是"调用方便"。数据面不改变 Rust 进程内的直接调用,调用频率本身不是保留非数据面的理由;跨不了语言时按原因处理:参数不是数据就改形状,只服务同一功能内部的移出目录作为私有名字,要求逐项回调或交出对象的改操作颗粒度。
### 7.1 设计三问
@@ -134,13 +138,13 @@ Approval 与 Permission 只管 agent 决策引起的动作(工具调用);
- **操作颗粒度**:一个操作是资源的一次状态迁移或一次一致的读取,所有者能独立完成并收尾。调用方漏调或调错顺序就会破坏所有者状态,说明太细;夹带调用方的决定,或调用方只需要其中一部分,说明太粗。步骤之间以 id 衔接,策略作为数据参数传入。
-- **错误**:错误是操作契约的一部分。种类按调用方下一步能做什么区分(重试、修正输入、不存在、已取消、所有者已关闭、冲突),来自资源的状态机,不泄漏内部错误。取消与超时写明各自停止的是什么。分支上后续决定要依赖的失败写成事实,不只作为返回值。
-- **所有者颗粒度**:在 [ADR 002 D1](../../adr/002-plugin-scope.md) 的作用域划分之内,生命周期不同的资源归不同的所有者;总是一起改动、或只是转发的所有者合并(ADR 002 D2)。上层只通过操作组合下层,不持有下层句柄,也不把下层资源再对外提供。
+- **错误**:错误是操作契约的一部分。种类按调用方下一步能做什么区分(重试、修正输入、不存在、已取消、所有者已关闭、冲突),来自资源的状态机,不泄漏内部错误。取消与超时写明各自停止的是什么。已经生效、且分支上后续决定要依赖的失败写成事实;指令没有生效时仍按第 4 节规则 1 由回复说明。
+- **所有者颗粒度**:在 [ADR 002 D1](../../adr/002-plugin-scope.md) 的作用域划分之内,生命周期不同的资源归不同的所有者;只是转发的所有者合并(ADR 002 D2)。上层只通过操作组合下层,不持有下层句柄,也不把下层资源再对外提供。
### 7.2 评审检查
- 每个跨插件调用都落到某个所有者的一个操作上。
-- 交出去的只有值、只读视图,或同一所有者内部的东西。
-- 没有转手别人的资源,没有冒充别人数据的源头。
-- 所有者只有一套公开面:没有只转发所有者的门面、命令或控制对象,公开服务上没有只供 Rust 调用的方法。
+- 交出去的只有值、只读视图、不在提交锁内调用的回调,或同一所有者内部的东西。
+- 没有转手别人的资源或句柄,没有把别人的可变状态当成自己的提供。
+- 同一组操作只有一套公开面:没有只转发所有者的门面、命令或控制对象;跨语言服务上没有新增的 Rust-only 方法,Rust-only 服务写明原因。
- 跨作用域的生命周期写明结算权与异常收尾。
- 公开面不出现资源句柄;公开服务的数据形状见[服务面](../../design/service-faces.md)第 1 节。
diff --git a/docs/templates/design.md b/docs/templates/design.md
index 2d92b71c4..d9a89ba8c 100644
--- a/docs/templates/design.md
+++ b/docs/templates/design.md
@@ -27,5 +27,5 @@ Run results belong in the issue or PR.
## Rule check
-Answer [design rules §4](../architecture/rust-agent/principles.md), §1 and
+Answer [design rules §4](../architecture/rust-agent/principles.md), §1, the §7.2 owner checks and
[ADR 002](../adr/002-plugin-scope.md) D1–D5 as required by AGENTS.md; explain inapplicable rules.
|
zerob13
left a comment
There was a problem hiding this comment.
这个 PR 在设计规则里新增 §7「所有者与操作」,并新增 owner-redesign 模板:资源归所有者、对外只给 id 操作、公开面以跨语言数据为准、改造一个所有者时一次改完。相对 099df010,ce840afdb 已经修掉回调、版本条件、失败事实、D2 引用范围和 HostPlatform 目标规则等大部分上一轮意见,delta 本身比上一版清楚;但三处上一轮 High 仍未闭环,且新规则的范围单位没有定义,暂时不能合。
阻塞问题
-
机制登记点仍未交代。
docs/architecture/rust-agent/principles.md:129把公开面定义成“服务标注在所有者自己的类型上”,但sessionMethods、managementMethods是 ADR 002 D2 规定的注册机制(docs/design/contracts/session-boundary.md:5-11),不是所有者类型上的服务;principles.md:156的“没有只转发的门面”会把它们读成违规。需要一句话明确:登记点是机制入口,不是转发门面;或者把本节限定为“所有者提供的操作”,并说明登记点不在本节范围内。另,AGENTS.md:119说 Rust 写法是 binding,而:129把#[rutis::service]的位置写成规则,层次不一致。 -
整份 Rust-only 服务没有处理。
principles.md:131只说了 Rust-only 方法,但 catalog 里还有 17 个internal(hot-path)服务(agentLoop、historyRenderer、toolExecutor等);它们不是“方法”,也不可能“留在所有者内部”同时被别的所有者调用。PR body 的 Open points 仍把 hot-path 例外列为未决,与正文的“不使用”矛盾。需要明确:整份 Rust-only 服务是待改差距,还是允许并写清条件;同时更新 PR body。 -
“一个板块”没有定义。
principles.md:135和docs/templates/owner-redesign.md:63-66引入“一个板块一次改完”,但模板 implementation task 写plugin area,acceptance 写owner,正文写“插件板块”,三者关系不明。上一轮要求把验收范围限定到被迁移的操作,或显式解决 whole-owner 迁移;作者选择了 whole-owner,但docs/design/service-faces.md:27-30仍允许internal(reason)迁移标记,文档没有说明本节如何覆盖分批迁移。建议把单位直接写成“所有者”,并引用 service-faces §2.2(或 #1292)说明覆盖关系。
非阻塞问题
principles.md:149:“总是一起改动的所有者合并”仍无出处,D2 只支持“不做接线/转发模块”,不支持这个子句。上一轮 Low 要求给出处或删掉;现在它和“生命周期不同的资源一般归不同的所有者”冲突时也没有优先级。principles.md:129:“一套公开面”和“每多一个接口就多一个概念”对“一个所有者能否发布多个数据面”给出两种读法。作者在评论里说现有多个面是待说明或待合并的差距,正文却只说新增接口要说明理由。建议直接写“一个所有者可以有多个接口,每个都要从职责说明”,或“默认一个,现有多个面是待合并/待说明的差距”。principles.md:139、docs/templates/owner-redesign.md:45-47:7.1 要求每个所有者在设计文档里回答三问,但只链接了 owner-redesign 模板;该模板的 Rule check 又写 “As in the design template”,而docs/templates/design.md:29-30和AGENTS.md:121仍只要求 §4/§1/ADR 002,不含 §7.2。新建所有者没有落点。principles.md:154:检查项写“交出去的只有值、只读视图或回调”,下一句又允许交出对象,字面自相矛盾;应写成“默认只交出…;对象是最后手段”。principles.md:127:“不替它接收写入”比上一轮要求的“不把别人的可变状态当成自己的提供”更宽。按字面,除sessions.history/pending外,sessions.input/withdraw也会被读成待改差距,但回复只点了读路径;而 ADR 002 D2(docs/adr/002-plugin-scope.md:61)还把sessions写成 “Reach other Sessions” 的机制。建议点名写入口方法,或把规则收窄到“可变状态/句柄”。
细节
- 已核对相对链接与锚点:
../../templates/owner-redesign.md、#7-所有者与操作、../../design/service-faces.md、../../design/rutis-usage.md、../../adr/002-plugin-scope.md都能解析;标题层级 7/7.1/7.2 正常,表格分隔行正常。 - 事实核对:
rutis-usage§3.3 确实允许 Rust-only 方法与整份服务;service-faces§1 规则 4 允许按引用回调且禁止提交锁内同步调用;§2.5 支持“同一组操作一套接口”;ADR 002 D2 只支持“不做接线/转发模块”。 - 未运行测试或构建;只做了只读文档与历史 review 检查。
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Review: settle section 7 against existing rules
Scope. Docs-only review of docs/architecture/rust-agent/principles.md, docs/templates/owner-redesign.md and docs/templates/README.md at head ce840afdb6193442229f99b03136108d7981456e (base c347bc34463a178ad3d1e28024a6a1457f8d62ba, main). The PR now changes 3 files, +121/-0: 54 added lines in principles, 66 in the new owner-redesign template, and one row in the template README. This round checks the 9 inline comments from review 6013337122 at 46358297, the two peer reviews 6013412011 and 6015948001, and the new template.
What changed. 099df010 adds the responsibility-split paragraph (principles.md:133, :158) and the owner-redesign template. ce840afb defines the owner and makes section 7 a target rule (:110), fixes callbacks and versions (:123), adds the object-handoff rule (:125), adds the no-proxy rule (:127), replaces one-owner-one-face with one interface per operation set (:129, :156), states the Rust-only rule against rutis section 3.3 (:131), adds the one-change rule (:135), scopes the failure-fact bullet (:148), corrects the D2 citation (:149), and adds the template object-handoff paragraph (docs/templates/owner-redesign.md:37-39). Most of these are correct. The no-proxy rule and the one-change rule overreach, and the template still assumes every owner publishes a service on its own type.
Verdict: REQUEST_CHANGES.
The first review's precision problems are mostly resolved. The remaining blocker is a direct conflict between the new no-proxy rule and the existing cross-scope access design. The new template also carries an over-broad migration acceptance and an incomplete binding model, and the AGENTS hook is still missing.
Findings
[High] The no-proxy rule contradicts ADR 002 D2 and the sessions service
Anchor: docs/architecture/rust-agent/principles.md:127.
principles.md:127 says an owner does not return another owner's resources or data and does not receive writes for it; the caller requests the data owner directly. docs/adr/002-plugin-scope.md:61 (ADR 002 D2, Proposed, but the rule source that AGENTS.md:121 points plugin designs to) names Agents' sessions service as the mechanism to reach other Sessions. docs/design/contracts/session-access.md:7 and :224 define sessions as a process service provided by Agents. Its methods include input, history, pending, withdraw and stop (session-access.md:229 to :235). input, withdraw and stop receive writes or commands for branch owners; history and pending return branch Timeline and InputQueue data (docs/design/appserver/sessions-service.md:33, :43, :96). A process caller cannot directly inject Session or branch services, which is why session-access.md:7 routes it through Agents, so the direct-request instruction has no path. The projection exception at :127 may cover a history page if Agents folds public events, but not pending or the write and command methods.
principles.md:110 declares current mismatches gaps, but AGENTS.md:11 says the corresponding design document is authoritative and a conflict is updated there first. This PR does not update ADR 002 or the session-access contract, and its body states that no other module's design is changed. Recommendation: either exempt a declared cross-scope access service, with its own owner, data-only operations and lifecycle, or narrow the rule to forwarding mutable resources and handles. If the intent is to remove sessions, record that direction in ADR 002 and session-access and link the issue before section 7 becomes authoritative.
[Medium] The one-change rule and template acceptance are broader than the staged migration policy
Anchors: docs/architecture/rust-agent/principles.md:135, docs/templates/owner-redesign.md:60-66.
principles.md:135 makes a whole plugin area one change with no old and new coexistence. docs/templates/owner-redesign.md:60-64 requires every caller and the old surface in one change, and :66 requires the catalog to have no internal(reason) entry for the owner. docs/design/service-faces.md:27-32 treats internal(reason) as migration work, :47 says the target catalog has only data rows, and :108 describes migration batches. The catalog has treeCommands as a data face plus timelineTree and timelineTreeControl as internal(owner-api) for TimelineTree (docs/architecture/rust-agent/generated/catalog.md:95-96, :100), and session assembly still requires TimelineTreeControl before publication (crates/dim-agent-runtime/src/assembly.rs:1879-1881, registered at crates/dim-agent-runtime/src/names.rs:103). The template acceptance would fold that separate in-process contract into the same change. This is also the open point in review 6015948001; ce840afb did not address it and :135 makes it a rule.
板块 and plugin area are new and undefined. If they mean one owner or one operation set, say so. If they mean a whole plugin or migration batch, the rule conflicts with the staged policy. Recommendation: scope the one-change rule and acceptance to the operations being migrated, and list retained internal dependencies and their tracking issues separately, or resolve the whole-owner policy in the migration design (#1292).
[Medium] The template binding appendix assumes a service on the owner's own type
Anchor: docs/templates/owner-redesign.md:51.
The appendix asks for "The #[rutis::service] block on the owner type." That fits data-face owners such as ToolRegistry, but not owners whose public operations are contributions to a mechanism owner. docs/design/contracts/session-boundary.md:5 and :9-11 define sessionMethods, managementMethods and toolRegistry; docs/design/plugins/Questions.md:7 and :50 registers session.question with sessionMethods and ask_user with toolRegistry. The catalog marks sessionMethods and managementMethods as data faces provided by SessionMethods and ManagementMethods (docs/architecture/rust-agent/generated/catalog.md:34, :90), with register operations (session-boundary.md:141-146). The binding for such an owner is the registration call plus the request, reply and error types, not a service block on the contributing owner's type. principles.md:129 still states the public face is a service annotated on the owner's own type. This is the unresolved part of the first review's owner finding. Recommendation: make the appendix conditional, and add one sentence in section 7 that a contribution registered with a mechanism owner is that owner's face, not a second face of the contributing part.
[Medium] The object-handoff exception needs a resource-handle boundary
Anchor: docs/architecture/rust-agent/principles.md:125.
principles.md:118 says resource handles never leave the owner, while :125 allows handing out an object as a last resort if an id, value or callback cannot work, with a higher-level lifecycle design. docs/templates/owner-redesign.md:37-39 repeats the object exception. Read together, :125 can authorize handing out a resource handle, which :118 and the target execHost rule (docs/design/resource-faces.md:830, :272-277; current docs/architecture/rust-agent/plugins/HostPlatform.md:47-54) ban.
The object exception is the right response to review 6013412011's in-process handoff cases, but it needs the boundary. :118 stays absolute for I/O resources, and :125 applies only to non-resource in-process objects, with the owner, publication order, transfer and cleanup design that review asks for. Without that sentence, the two rules read as contradictory.
[Low] The template is scoped to redesigns, but 7.1 covers every owner, and the AGENTS hook is still missing
Anchors: docs/architecture/rust-agent/principles.md:139, docs/templates/owner-redesign.md:3-7.
principles.md:139 says every owner answers in a design document in the shape of the owner-redesign template. docs/templates/owner-redesign.md:3-4 says to use the template when an existing owner's public surface is redesigned. A new owner still starts from docs/templates/design.md, whose Rule check (:27-30) and AGENTS.md:121 list only section 4, section 1 and ADR 002 D1-D5; neither mentions section 7. The template routes the design part to docs/design/plugins/<Owner>.md (:5-6), while section 7 allows several owners per plugin and docs/design/plugins/README.md indexes plugin designs, so the file for a multi-owner plugin is unspecified. The template's Exceptions with reasons section (:41-43) also needs to match principles.md:110 (gaps, not exceptions). Recommendation: broaden the template to every owner or route new owners through design.md with a section 7 section; add section 7 to the design template Rule check and AGENTS.md; define the owner and plugin document mapping and what an exception means.
[Low] The failure-fact fix uses the wrong term
Anchor: docs/architecture/rust-agent/principles.md:148.
The failure-fact conflict is fixed by the scoping: a command that did not take effect follows section 4 rule 1 at principles.md:63, and a failure of an operation that did occur becomes a fact when a later decision depends on it. The wording uses 命令 where rule 1 and the command-event vocabulary use 指令 (:63: 指令事件, 指令没有生效). Elsewhere 命令 means a CLI or configured command (:100; docs/design/service-faces.md:95 commandRules). Change it to 指令 or 指令事件. This is a wording issue only; the substantive conflict is fixed.
[Low] The D2 citation is corrected, but the cohesion clause is still unsourced
Anchor: docs/architecture/rust-agent/principles.md:149.
The sentence now cites D2 only for 只是转发的所有者合并, which docs/adr/002-plugin-scope.md:44-48 supports. 总是一起改动的所有者合并 no longer claims D2, but it still has no cited source. If it is intended as a design heuristic, say so; otherwise cite the source the first review asked for or drop the clause.
Status of the prior review
| Thread | Prior finding | Status | Evidence |
|---|---|---|---|
| 4659011434 | owner undefined |
Narrowed | principles.md:110 defines the owner as the part that holds a resource or state and allows several owners per plugin. :129 and :156 make multiple faces decidable. The canonical registration services remain open; see Finding 3. |
| 4659011441 | HostPlatform target versus current | Fixed | principles.md:110 states that section 7 is the target rule and current mismatches are gaps. docs/architecture/rust-agent/plugins/HostPlatform.md:47-54 is the current caller-held shape; docs/design/resource-faces.md:830 and :272-277 remain the target. |
| 4659011444 | callbacks and versions | Fixed | principles.md:123 allows callbacks by reference with the no-commit-lock condition and links service-faces.md:14; it requires a version only when later decisions depend on the revision; it defines a read-only view as an owner-published value plus subscriptions. This matches rutis-usage.md:164, resource-owner-operations.md:23, and the unversioned reads at service-faces.md:305 and :358. |
| 4659011446 | one owner, one face | Narrowed | principles.md:129 and :156 now require one interface per operation set and a reason for each new interface. The multi-face evidence fits: service-faces.md:102 and catalog.md:31, :49, :53-54, :63, :68, :70, :98-99. The canonical registration services remain open; see Finding 3. |
| 4659011449 | template and AGENTS hook | Narrowed | The template now exists and is linked from principles.md:139 and docs/templates/README.md:11. The template scope, docs/templates/design.md:27-30, AGENTS.md:121 and the multi-owner document path remain open; see Finding 5. |
| 4659011453 | failure facts versus section 4 rule 1 | Fixed | principles.md:148 now scopes the bullet: a command that did not take effect follows :63; a failure of an operation that did occur becomes a fact only when a later decision depends on it. The remaining issue is the word 命令; see Finding 6. |
| 4659011456 | D2 citation | Narrowed | principles.md:149 cites D2 only for 只是转发的所有者合并, which docs/adr/002-plugin-scope.md:44-48 supports. The cohesion clause is still unsourced; see Finding 7. |
| 4659011459 | read services | Regressed | The ambiguous rule is now a direct conflict at principles.md:127 with ADR 002 D2 (docs/adr/002-plugin-scope.md:61), docs/design/contracts/session-access.md:7, :224, :229-235, and docs/design/service-faces.md:112; see Finding 1. |
| 4659011461 | Rust-only methods versus rutis section 3.3 | Fixed | principles.md:131 acknowledges rutis-usage.md:167-173 and states the Dim rule that public faces do not use Rust-only methods or services. principles.md:110 makes existing mismatches gaps, and service-faces.md:27-32 and :47 classify internal(hot-path) and other internal rows as migration work with a data-only target. If #2015 later decides an exception, the rule will need an amendment. |
Peer review 6013412011: the in-process handoff concern is substantially addressed by principles.md:125 and docs/templates/owner-redesign.md:37-39; principles.md:149 now says lifetimes generally, not always, split owners. Finding 4 asks for the remaining resource-handle boundary.
Peer review 6015948001: the staged migration concern remains; see Finding 2.
Verification performed
- Worktree detached at
ce840afdb6193442229f99b03136108d7981456e;git status --porcelainis empty before and after the review. - GitHub API: 3 files, +121/-0 (
principles.md+54,docs/templates/README.md+1,docs/templates/owner-redesign.md+66). Head and base are unchanged during the review; mergeable state is clean. - Parsed the files API patches and confirmed every drafted inline anchor is an added RIGHT line:
principles.mdadded lines 107 to 160;docs/templates/owner-redesign.mdadded lines 1 to 66;docs/templates/README.mdadded line 11. Anchors used:principles.md:125,:127,:135,:148;owner-redesign.md:3,:51. - Every relative link added or changed by this PR resolves; the existing links in
principles.mdare unchanged from the reviewed revision.#7-所有者与操作matches the heading atprinciples.md:108and follows the existing Chinese anchor style indocs/design/capability-design-reference.md:49. - Markdown structure is valid: headings 7, 7.1, 7.2; both section 7 tables and the template table have valid separators; no duplicate headings.
git diff --checkandgit show --checkreport no whitespace errors. - Language split is consistent with the repository: the rule section is Chinese and the template is English.
docs/zhhas no mirror of these paths, so no translation update is required. - Greps verified the catalog provider rows, the
sessionsmethods, ADR 002 D2, the service-faces migration markers, the registration services, and the TimelineTree assembly use cited above. - No broad build or test run was performed; this is a docs-only change.
Not verified
- I did not run
cargo run --locked -p xtask -- check,cargo test, or any build. The PR body reports thatxtask-checkpassed. - I did not verify runtime behavior beyond the cited design documents and the TimelineTree assembly grep.
- I did not verify whether #2015 or #1292 has a decision on
sessions, the hot-path exception, or whole-owner migration. The review is based on the current head documents. - I did not render the GitHub anchor in a browser; the slug matches the existing repository pattern.
- I did not inspect the owner scans #2016 to #2028; the review covers the rule text and the cited designs.
|
|
||
| 可以交出的是:值(快照、配置、身份;后续决定依赖修订时带版本)、只读视图(所有者发布、调用方只能观察的值及其订阅),以及按引用传递的回调(不在提交锁内同步调用,[服务面](../../design/service-faces.md)第 1 节规则 4)。 | ||
|
|
||
| **交对象是最后手段。** id、值与回调都做不到时才交出对象。一旦交出对象,就要在更高一层统一设计相关插件的生命周期与边界:谁创建、谁持有、交接顺序、谁收尾、任何一方关闭或重载时如何处理,写进各方共同引用的设计中。"热路径"本身不是交出对象的理由。 |
There was a problem hiding this comment.
Medium: principles.md:118 says resource handles never leave the owner, while :125 allows handing out an object as a last resort if an id, value or callback cannot work, with a higher-level lifecycle design; docs/templates/owner-redesign.md:37-39 repeats the object exception. Read together, :125 can authorize handing out a resource handle, which :118 and the target execHost rule (docs/design/resource-faces.md:830, :272-277; current docs/architecture/rust-agent/plugins/HostPlatform.md:47-54) ban. The object exception is the right response to review 6013412011's in-process handoff cases, but it needs the boundary: :118 stays absolute for I/O resources; :125 applies only to non-resource in-process objects, with the owner, publication order, transfer and cleanup design.
There was a problem hiding this comment.
Still open. 869ef0d7 does not change principles.md:118 or :125. :118 still says handles do not leave the owner for I/O resources; :125 still allows handing out an object whenever an id, value or callback cannot work, with a higher-level lifecycle design, and does not limit the exception to non-resource objects. The new clause at :131 addresses public cross-language faces, not the internal owner-to-owner boundary, so it does not resolve this. Keep :118 absolute for I/O resources and scope :125 to non-resource in-process objects, with the owner, publication order, transfer and cleanup design; docs/templates/owner-redesign.md:37-39 repeats the exception. The section 7.2 check at :154 also still says 交出去的只有值、只读视图或回调 and then allows objects.
There was a problem hiding this comment.
Still open, and the new commit moves the boundary the wrong way. principles.md:118 now lets resource handles leave the owner under the :125 object-last-resort conditions. The earlier finding asked :118 to stay absolute for I/O resources and :125 to apply only to non-resource in-process objects. The target execHost keeps ProcessTree and PtyProcessTree internal (docs/design/resource-faces.md:830; :272-277), and the current HostPlatform caller-held ProcessTree shape (docs/architecture/rust-agent/plugins/HostPlatform.md:47-54) is the gap, not a permitted handoff. :154 默认只交出... fixes the literal contradiction, not this boundary. See the new inline at :118.
There was a problem hiding this comment.
Fixed in 2fc4f50b by the new principles.md:118 and :125 boundary: owner-responsible handles stay, and a resource handle crosses only as a whole transfer. See the reply on the round-4 inline at principles.md:118.
|
|
||
| **交对象是最后手段。** id、值与回调都做不到时才交出对象。一旦交出对象,就要在更高一层统一设计相关插件的生命周期与边界:谁创建、谁持有、交接顺序、谁收尾、任何一方关闭或重载时如何处理,写进各方共同引用的设计中。"热路径"本身不是交出对象的理由。 | ||
|
|
||
| **不代查别人的资源。** 一个所有者不替别的所有者返回它的资源或数据,也不替它接收写入;调用方直接请求数据的所有者。有性能需求时重新定义归属,而不是增加代查。从公开事件折叠出的投影是投影者自己的状态,发布它的部件就是它的所有者。 |
There was a problem hiding this comment.
High: principles.md:127 now bans an owner returning another owner's data or receiving writes for it and tells callers to request the data owner directly. This contradicts docs/adr/002-plugin-scope.md:61 (ADR 002 D2), which names Agents' sessions service as the way to reach other Sessions, and docs/design/contracts/session-access.md:7, :224, :229-235, which define sessions as a process service provided by Agents with input, history, pending, withdraw and stop. input, withdraw and stop receive writes or commands for branch owners; history and pending return branch Timeline and InputQueue data (docs/design/appserver/sessions-service.md:33, :43, :96). A process caller cannot directly inject Session or branch services, which is why session-access.md:7 routes it through Agents, so the direct-request instruction has no path. The projection exception may cover a history page but not pending or the write methods. Either exempt a declared cross-scope access service or narrow the rule to forwarding mutable resources; if the intent is to remove sessions, record that in ADR 002 and session-access first. principles.md:110 saying current shapes are gaps does not update those documents (AGENTS.md:11).
There was a problem hiding this comment.
Still open, and still a direct conflict. 869ef0d7 does not change principles.md:127. ADR 002 D2 still names Agents' sessions service as the way to reach other Sessions (docs/adr/002-plugin-scope.md:61). docs/design/contracts/session-access.md:7 and :224 define sessions as the process service provided by Agents; :229-235 define input, history, pending, withdraw and stop; docs/design/appserver/sessions-service.md:29-33, :43 and :52 show input writing through Session::input and withdraw forwarding to InputQueue. A process plugin cannot directly inject a Session or branch service (docs/adr/002-plugin-scope.md:66, D3; session-access.md:7, :18), so the instruction to request the data owner directly has no path. The projection exception at :127 may cover history, not pending or the write and command methods. :110 saying current shapes are gaps does not amend ADR 002 or session-access; AGENTS.md:11 says the corresponding design document is authoritative. Either exempt a declared cross-scope access service or narrow the rule to forwarding mutable resources; if sessions is to be removed, record that in ADR 002 and session-access first.
There was a problem hiding this comment.
Direction improved, still open. principles.md:127 now cites ADR 027, and ADR 027 supersedes the Reach other Sessions row of ADR 002 D2 (docs/adr/027-cross-scope-access-by-id.md:45, :59). But ADR 027 is Proposed and requires a new by-name, cross-language service lookup; docs/design/contracts/session-boundary.md:560 says no service lookup by name is added to the Session facade, and docs/design/contracts/session-access.md:166 says sessions is never exported over rutis links. The generic path reaches every Session and branch service, including sessionMethods and toolRegistry registration (docs/architecture/rust-agent/generated/catalog.md:90, :98), with no allowlist; docs/design/service-faces.md:12 says an id is not authorization. The PR body says the session-access contract is changed by #2020, but #2020 is a read-only owner scan (只读:不改代码、不开 PR、不改设计文档). The contract still defines the old methods (session-access.md:7, :224, :229-236). Keep open until the mechanism, authority and contract update are tracked. See the new inline at ADR 027:48.
There was a problem hiding this comment.
Still open. ADR 027 D2 now fixes the resolvable set and the authority, but the mechanism is not named and docs/design/contracts/session-boundary.md:193 says the Session's instance key stays readable only from inside the Session. D1 requires the opposite from the process scope. See the reply on the round-4 inline at ADR 027:15.
There was a problem hiding this comment.
Withdrawn as blocking in da6f4a9. ADR 027 supersedes the ADR 002 D2 Reach other Sessions row, D6:65-66 names the session-access and sessions-service clauses that remain valid until the Agents contract merges, and #2127 tracks the mechanism. The current contract still defines sessions, so keep #2098 as a dependency; it is no longer a contradiction in this PR.
|
|
||
| **职责分界:业务面对更小的复杂度。** 设计接口前先分清所有者的内部职责与调用方的业务职责。接口用所有者自己的词汇表达,不出现调用方的业务概念;锁、版本、等待、重试、结算等所有者的内部机制不推给调用方,调用方只处理有业务含义的结果与异常。业务提出的需求,能用现有操作组合完成且不破坏所有者不变量的,留在业务侧;组合会破坏不变量的,才由所有者提供一个通用操作。每个参数都是复杂度,默认值由所有者决定,只有业务确实需要不同取值时才开放。 | ||
|
|
||
| **一个板块一次改完。** 改造一个插件板块的公开面时,新的操作、全部调用方的迁移与旧公开面的删除在同一个改动中完成,不保留新旧并存的兼容期。 |
There was a problem hiding this comment.
Medium: principles.md:135 makes a whole plugin area one change with no old and new coexistence, and docs/templates/owner-redesign.md:60-66 requires every caller, removal of the old surface, and no internal(reason) entry for the owner. docs/design/service-faces.md:27-32 treats internal(reason) as migration work and :47 says the target catalog has only data rows; :108 describes migration batches. The catalog has treeCommands as a data face plus timelineTree and timelineTreeControl as internal(owner-api) for TimelineTree (docs/architecture/rust-agent/generated/catalog.md:95-96, :100), and session assembly still requires TimelineTreeControl before publication (crates/dim-agent-runtime/src/assembly.rs:1879-1881, registered at crates/dim-agent-runtime/src/names.rs:103). The acceptance would fold that separate in-process contract into the same change. This is also the open point in review 6015948001. 板块 and plugin area are new and undefined; if they mean one owner or one operation set, say so; if they mean a whole plugin or migration batch, the rule conflicts with the staged policy. Scope the rule and acceptance to the operations being migrated, and track retained internal dependencies separately.
There was a problem hiding this comment.
Still open. principles.md:135 and docs/templates/owner-redesign.md:63-66 are unchanged by 869ef0d7. docs/design/service-faces.md:27-32 treats internal(reason) as migration work, :47 sets a data-only target, and :108 describes a migration batch that first checks coverage. The catalog still has timelineTree and timelineTreeControl as internal(owner-api) for TimelineTree (docs/architecture/rust-agent/generated/catalog.md:95-96) alongside the data face treeCommands (:100); session assembly still requires TimelineTreeControl before publication (crates/dim-agent-runtime/src/assembly.rs:1879-1882, registered at crates/dim-agent-runtime/src/names.rs:103). The acceptance at owner-redesign.md:65-66 would fold that separate in-process contract into the same change. This is also the open point in review 6015948001 and blocking item 3 in review 6016709926. Scope the rule and acceptance to the operations being migrated, and define 板块 and plugin area.
There was a problem hiding this comment.
Partially fixed. principles.md:135 now says owner and allows a plugin's owners to change separately. But :160 still says 一个板块的改造在一个改动中完成, and docs/templates/owner-redesign.md:68 still says A plugin area's new operations, so the unit is inconsistent. The TimelineTree case remains: treeCommands is data while timelineTree and timelineTreeControl are internal(owner-api), all for TimelineTree (docs/architecture/rust-agent/generated/catalog.md:95-96, :100), so the owner-scoped acceptance still folds the separate in-process contract into the same change. Scope the rule and acceptance to the operations in scope and update the stale terms. See the new inline at principles.md:160.
There was a problem hiding this comment.
Fixed in 2fc4f50b. principles.md:160 and docs/templates/owner-redesign.md:69 now use the owner unit; the TimelineTree case is consistent under it.
| | 对外业务 | 调用方的意图推出哪些操作与值;每个操作的取消、超时与错误种类 | | ||
|
|
||
| - **操作颗粒度**:一个操作是资源的一次状态迁移或一次一致的读取,所有者能独立完成并收尾。调用方漏调或调错顺序就会破坏所有者状态,说明太细;夹带调用方的决定,或调用方只需要其中一部分,说明太粗。步骤之间以 id 衔接,策略作为数据参数传入。 | ||
| - **错误**:错误是操作契约的一部分,由每个所有者按调用方下一步能做什么自行设计,不套用通用种类;所有者不会出现的情况不写对应错误,也不泄漏内部错误。取消与超时写明各自停止的是什么。命令没有生效时按第 4 节规则 1 不写事件;已经发生的操作,后续决定依赖其失败的,写成事实。 |
There was a problem hiding this comment.
Low: The failure-fact conflict is fixed by the scoping at principles.md:148: a command that did not take effect follows section 4 rule 1 at :63, and a failure of an operation that did occur becomes a fact when a later decision depends on it. The wording uses 命令 where rule 1 and the command-event vocabulary use 指令 (:63: 指令事件, 指令没有生效). Elsewhere 命令 means a CLI or configured command (:100; docs/design/service-faces.md:95 commandRules). Change it to 指令 or 指令事件.
There was a problem hiding this comment.
Still open. principles.md:148 still says 命令没有生效时按第 4 节规则 1 不写事件. Rule 1 at :63 uses 指令事件 and 指令没有生效; elsewhere 命令 means a CLI or configured command (:100; docs/design/service-faces.md:95 commandRules). Change this occurrence to 指令 or 指令事件.
There was a problem hiding this comment.
Fixed. principles.md:148 now says 指令没有生效时按第 4 节规则 1 不写事件; :63 uses 指令 and 指令事件; :100 keeps 命令 for CLI or configured commands, which is correct.
|
|
||
| ### Binding appendix | ||
|
|
||
| The `#[rutis::service]` block on the owner type, and the request, reply and error types. |
There was a problem hiding this comment.
Medium: This appendix asks for the #[rutis::service] block on the owner type. That fits data-face owners such as ToolRegistry, but not owners whose operations are contributions to a mechanism owner. docs/design/contracts/session-boundary.md:5 and :9-11 define sessionMethods, managementMethods and toolRegistry; docs/design/plugins/Questions.md:7 and :50 registers session.question with sessionMethods and ask_user with toolRegistry. The catalog marks sessionMethods and managementMethods as data faces provided by SessionMethods and ManagementMethods (docs/architecture/rust-agent/generated/catalog.md:34, :90), with register operations (session-boundary.md:141-146). The binding is the registration call plus the request, reply and error types, not a service block on the contributing owner's type. principles.md:129 still states the public face is a service annotated on the owner's own type. Make the appendix conditional and add one sentence in section 7 that a contribution registered with a mechanism owner is that owner's face, not a second face of the contributing part.
There was a problem hiding this comment.
Partially fixed, still open on the template side. The new sentence at principles.md:129 says the mechanism-provided registration points (sessionMethods, managementMethods, toolRegistry; ADR 002:59-60, :102-104; docs/architecture/rust-agent/generated/catalog.md:34, :90, :98) are not forwarding facades. That addresses the canonical-registration question from review 6013337122, but it does not state that a contribution registered with a mechanism owner is that owner's face, and docs/templates/owner-redesign.md:51 is unchanged: it still asks unconditionally for the #[rutis::service] block on the owner type. For a contributor such as Questions, which registers ask_user with toolRegistry and session.question with sessionMethods (docs/design/plugins/Questions.md:7, :50), the binding is the registration call plus the request, reply and error types (docs/design/contracts/session-boundary.md:5, :9-11, :141-146), not a service block on the contributing owner's type. principles.md:129 also still says the public face is a service annotated on the owner's own type, although AGENTS.md:119 says that Rust spelling is a binding, not the rule. Make the appendix conditional and state the contribution rule explicitly.
There was a problem hiding this comment.
Fixed. principles.md:129 no longer says the public face is a service annotated on the owner type; it says what the owner registers with a mechanism registration point is its public face through that point. docs/templates/owner-redesign.md:54-56 now makes the binding appendix conditional: the #[rutis::service] block for the owner's own face, the registration call for contributions, then the request, reply and error types.
Calling frequency is no reason to keep a non-data face: a data face leaves Rust's in-process calls unchanged. A name that cannot cross languages is reshaped, made private, or given a coarser operation. Mechanism registration points are not forwarding facades. Owners that only change together are no longer merged by that alone. AGENTS.md and the design template's rule check include the section 7.2 owner checks.
|
@zerob13 谢谢复核和测量。修订 diff 基于 采纳
不采纳
推进方式
上面「采纳」的几处已提交到 #2029: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: This PR adds design rules §7 "所有者与操作" to docs/architecture/rust-agent/principles.md, ADR 027 for cross-scope access by id, the owner-redesign template, and the AGENTS.md, design-template, template-index and ADR-index hooks. Refs #2015 and the owner-contract scans it governs, including #2018. Head 2fc4f50b, 7 files, +203/-2, base c347bc34; the delta since 658e5a46 is 3 files, +41/-28.
Verdict: REQUEST_CHANGES. The new commits fix the resolvable set and authority, the resource-handle boundary, the one-change unit, the owner-document index and the undefined terms, and they remove the incorrect method mapping. One P1 and one P2 remain: the mechanism is still unnamed and conflicts with the Session boundary instance isolation, and the Agents contract that completes ADR 027 exists only in an open, conflicting PR.
What the new commits fix
- Resolvable set and authority: ADR 027 D2 limits by-id access to the target scope's catalog data faces, excludes registration points (
sessionMethods,toolRegistry, etc.) and lifecycle services, and says language runtimes and leaves are trusted local code while RPC clients keep the method table and Session authorization. This addresses the generic-path part of the round-4 High. - Resource-handle boundary:
principles.md:118now keeps owner-responsible handles inside the owner, and:125lets a resource handle cross only as a whole transfer and marks a giver-settled handle as a gap. The earlier:118/:125contradiction is gone. The current caller-heldProcessTreeis a whole transfer (docs/architecture/rust-agent/plugins/HostPlatform.md:47-54), so it remains a difference from theexecHosttarget (docs/design/resource-faces.md:830,:272-277), not a §7 contradiction. - One-change rule:
principles.md:160now uses the owner unit anddocs/templates/owner-redesign.md:69says "The owner's new operations"; the TimelineTree case is consistent under the owner unit (treeCommands,timelineTreeandtimelineTreeControlare one owner;docs/architecture/rust-agent/generated/catalog.md:95-96,:100). - Owner-document index:
docs/templates/owner-redesign.md:7now says the plugin's row indocs/design/plugins/README.mdlinks each owner document, which the index table supports. - Terms: ADR 027 now uses
branchId, defines the hold's lifetime on the caller's row and writesADR 002 D3; the ambiguousD3references are gone. - ADR 002 text is kept unchanged and the supersession is recorded in ADR 027 and
docs/adr/README.md:37; the PR body now points the Session access change at PR 2098 instead of the read-only #2020. - Previously fixed items stay fixed:
principles.md:129,:131,:135,:139,:148;docs/templates/owner-redesign.md:3-8,:41-46,:54-56;docs/templates/design.md:20-21;AGENTS.md:121.
Findings
[P1] The mechanism is still unnamed and contradicts the Session boundary instance isolation
Anchor: docs/adr/027-cross-scope-access-by-id.md:15 (also :23, :25, :59).
Problem: docs/design/contracts/session-boundary.md:193 says the Session's instance key stays readable only from inside the Session and rutis refuses an instance key outside its instance. D1 at :21-22 requires a process caller to resolve a Session-group dispatch entry by sessionId and a Session caller to resolve a branch-group entry by branchId, which is reading an instance key from outside. The Context sentence rutis 已经按实例键提供数据面的派发 describes the per-instance entries, not a cross-scope portal, and the Consequences at :59 still says 机制要按实例键解析, an unnamed requirement. The ADR names no mechanism, owner or issue. The only mechanism requirement near this is in the #2025 comment and PR 2092's TimelineTree contract: the Session access surface resolves a Session part's branch-scope service by line id (line_owner::<T>(line)), with NoInstance for a line that is not live and Closed for a closing Session, from a runtime index of (session, line) to the instance. That covers the Session-to-branch leg only; D1's process-scope leg by sessionId has no named mechanism, and ADR 027 links neither. PR 2098's requirements section points at #2025, whose body is a read-only SessionScope owner scan, so the pointer is not a mechanism contract.
Failure scenario: An implementer follows D1 from a process part, builds Key::of().instance(sessionId) or host_key_in(name, session_instance) (the forms docs/design/rutis-usage.md appendix A describes), and rutis refuses the instance key, or the composition check rejects naming a Session-group service from the process scope. The ADR's rutis 已经... sentence hides that the path is new, and no issue owns it, so the Session access surface that PRs 2092 and 2093 assume has no agreed mechanism.
Fix: Name the mechanism (the Session access surface with line_owner::<T>(line) for Session to branch, and the process-to-Session resolution), its owner and its issue (the #2025 comment), and say it is new. State whether it keeps the instance key inside the target Session and routes by id at the host, which leaves session-boundary.md:193 intact, or supersede that clause explicitly. Replace the rutis 已经... sentence with what exists today and what is required, and add the §4 rule 8 requirement.
[P2] The Agents contract and the Session access replacement are only in an open, conflicting PR
Anchor: docs/adr/027-cross-scope-access-by-id.md:51 (also :57, :60).
Problem: D5 says each method's destination is in the Agents contract at PR 2098, which is open and CONFLICTING; docs/design/contracts/session-access.md on main still lists the old sessions methods (:224-240) and §7 at :166 still says sessions is never exported over RPC entries or rutis links. The ADR says that clause is superseded, but the replacement is not in the tree. ADR 002 is kept unchanged, which is fine, but a reader cannot check D5's mapping for lookup, idle, history, defaultBranchId and stop.
Failure scenario: A reader follows ADR 027 to session-access.md and finds the opposite contract. An implementer of one of the owner contracts (PRs 2092, 2093, 2098) cannot tell whether the sessions removal and the per-method targets are agreed. If PR 2098 changes or closes, D5 has no referent.
Fix: Link an issue for the Agents contract and the Session access change, because status lives in issues. State the per-method mapping in ADR 027 or in a merged contract, and land the contract change before or with this ADR. At minimum, name the exact session-access.md clauses that stay until the replacement lands.
[P3] The resolution error codes are left to an unnamed mechanism
Anchor: docs/adr/027-cross-scope-access-by-id.md:25.
Problem: D1 says the resolution error kinds are defined by the mechanism, but the mechanism is unnamed in the ADR and no codes are given. The mechanism contract already names NoInstance for a line that is not live and Closed for a closing Session (#2025 comment; PR 2092's TimelineTree contract), and the Session boundary uses unknown_method, service_reloading and service_unavailable (docs/design/contracts/session-boundary.md:57, :92). A process-scope caller still has no codes for a missing Session, a loading one and a closing one.
Failure scenario: A caller treats a closing target as retryable or a missing target as reloading, and the owner contract cannot map the resolution error to the caller's next action.
Fix: Name NoInstance and Closed where they apply, add the process-scope equivalents, and say which are retryable, or link the mechanism contract that defines them.
[P3] The registration-point rationale is inaccurate for Session parts of other languages
Anchor: docs/adr/027-cross-scope-access-by-id.md:30.
Problem: docs/design/rutis-usage.md §3.5 says a Session or branch part of another language is a definition copy with no row of its own, and docs/design/contracts/session-boundary.md:560 says the registration belongs to its caller, the bridge's caller row. 登记属于登记方自己的 loader row does not describe a foreign Session part.
Failure scenario: An implementer uses the sentence to bind a foreign Session part's registration to a nonexistent loader row and gets withdrawal and settlement wrong when the part reloads.
Fix: Say the registration belongs to the registering part's generation, and for a foreign Session part to the bridge's caller row. The exclusion is right; the reason is not.
[P3] leaf and 客户端 are not distinguished
Anchor: docs/adr/027-cross-scope-access-by-id.md:33 (also :32).
Problem: D2 says language runtimes and leaves use the path, then says clients do not. docs/design/rutis-usage.md:214 says a language runtime and a UI leaf reach the names alike; a UI leaf is a client-tree node. The two sentences can be read as contradictory.
Failure scenario: A leaf implementer uses the by-id path while a client implementer expects Rpc, so the authority boundary is unclear.
Fix: Say RPC 客户端 for the method-table path and name the UI leaf separately, or state that leaves are trusted local rutis nodes while clients are RPC entries.
[P3] The Rpc consequence contradicts D2's client rule and the registration-point exclusion
Anchor: docs/adr/027-cross-scope-access-by-id.md:58.
Problem: The Consequences say Rpc's cross-Session calls change to D1, but D2 keeps clients on the Rpc method table and Session authorization, and sessionMethods is a registration point excluded from D2. docs/design/contracts/session-boundary.md:565 says Rpc reads SessionMethods with Session::session_service::<SessionMethods>() after index.acquire, and :56 says Appendix F's No service lookup by name is added to the Session facade is unchanged. Rpc's method-table dispatch stays on the facade; only calls to removed sessions methods change.
Failure scenario: An implementer moves Rpc's sessionMethods dispatch to D1, bypassing the facade and the admission path Appendix F describes.
Fix: Remove Rpc from the D1 list or name the Rpc calls that change, for example session.summaries, and keep the method-table dispatch on the facade.
Status of the round-4 findings
| Round-4 finding | Status |
|---|---|
| ADR 027 mechanism (High) | Still open: resolvable set and authority fixed; mechanism unnamed and in conflict with session-boundary.md:193 |
| Method-to-owner mapping (Medium) | Partly fixed: the wrong mapping is gone; the replacement is in open, conflicting PR 2098 |
| Resource-handle boundary (Medium) | Fixed at principles.md:118, :125 |
| One-change unit (Low) | Fixed at principles.md:160 and docs/templates/owner-redesign.md:69 |
| Owner-document index (Low) | Fixed at docs/templates/owner-redesign.md:7 |
| Undefined terms (Low) | Fixed: branchId, hold lifetime, ADR 002 D3 |
Verification
node scripts/adr-check.mjs --base c347bc34: passed for 7 changed files.- 116 relative links and anchors in the changed files resolve; the only external target is the open PR 2098, reported above.
- CI at
2fc4f50b:ci-okandchangespassed; docs-only jobs were skipped. - No Rust commands run; worktree clean.
Notes
- The umbrella issue #2015 still summarizes the old unit (
一个板块一次改完) and the absolute handle rule (句柄不离开所有者); sync it after this lands.
|
|
||
| 对第二类方法,Agents 要先取得 Session,再转述对方的结果、错误和新鲜度。每新增一种跨 Session 的需求,就要在 `sessions` 上加一个方法。Session 部件访问本 Session 内的分支所有者,也有同样的问题。 | ||
|
|
||
| [设计规则 §7](../architecture/rust-agent/principles.md#7-所有者与操作) 要求调用方直接请求数据的所有者,不代查,也不设只转发的门面。这需要一条从外层作用域到内层所有者的路径。rutis 已经按实例键提供数据面的派发:每个 Session 实例和分支实例下,都有该作用域数据面的派发入口([Dim 如何使用 rutis](../design/rutis-usage.md))。 |
There was a problem hiding this comment.
This claims rutis already provides data-face dispatch by instance key, but docs/design/contracts/session-boundary.md:193 says the Session's instance key stays readable only from inside the Session and rutis refuses an instance key outside its instance. D1 at :21-22 requires a process caller to resolve a Session-group entry by sessionId and a Session caller to resolve a branch-group entry by branchId, which is reading an instance key from outside. The Consequences at :59 still says 机制要按实例键解析, so the mechanism is a requirement, not existing rutis behavior. The only mechanism requirement near this is in the #2025 comment and PR 2092's TimelineTree contract: the Session access surface resolves a Session part's branch-scope service by line id (line_owner::<T>(line)), with NoInstance and Closed, from a runtime index of (session, line). That covers the Session-to-branch leg only; D1's process-scope leg by sessionId has no named mechanism, and this ADR links neither. Name the mechanism for both legs and its issue, say it is new, and either state that it keeps the instance key inside the Session and routes by id at the host or supersede session-boundary.md:193 explicitly. As written, D1 cannot be implemented with the rutis dispatch the Context describes.
There was a problem hiding this comment.
Fixed in f91b72b3. D2 now names the runtime index by sessionId and (sessionId, branchId), says callers get no instance key, keeps the instance-key isolation, and adds the §4 rule 8 requirement table with line_owner for the Session-to-branch leg. The remaining issue attribution is in the new inline at :87.
| - Session 作用域的调用方:用 `branchId` 到达本 Session 分支组的数据面。 | ||
| - 机制按实例键解析到目标实例的派发入口,调用方直接调用目标所有者自己的操作。 | ||
| - 中间的所有者不按操作名转发,不包装请求或回复,也不转述目标所有者的错误。 | ||
| - 目标不存在、未加载或正在关闭时,解析以错误结束,错误种类由机制定义。 |
There was a problem hiding this comment.
The resolution errors are left to an unnamed mechanism, so a caller has no codes to handle. The mechanism contract already names NoInstance for a line that is not live and Closed for a closing Session (#2025 comment; PR 2092's TimelineTree contract), and docs/design/contracts/session-boundary.md:57 and :92 use unknown_method, retryable service_reloading and non-retryable service_unavailable for a name. A process-scope caller still has no codes for a missing Session, a loading one and a closing one. Name NoInstance and Closed where they apply, add the process-scope equivalents, say which are retryable, or link the mechanism contract.
There was a problem hiding this comment.
Partly fixed. D2 names NoInstance and Closed, but the Closed bullet says to reacquire a hold and retry the same id; a business-closed Session does not load again (docs/design/appserver/session-deletion-and-fork.md:162), and acquire on it answers closed_session. See the new inline at :35.
There was a problem hiding this comment.
Partly fixed in da6f4a9. NoInstance and Closed are named and the Session business-close versus idle-unload recovery is right. The closing target branch case remains; see the new inline at ADR 027:35.
| ### D2. 可解析的只有目标作用域的数据面,不含登记点 | ||
|
|
||
| - 可解析的是目标作用域在 catalog 中共享的数据面。 | ||
| - 不包括机制登记点:`sessionMethods`、`toolRegistry` 等登记只能在本作用域内进行,因为登记属于登记方自己的 loader row。 |
There was a problem hiding this comment.
loader row does not describe a Session part of another language: docs/design/rutis-usage.md §3.5 says a foreign Session or branch part is a definition copy with no row of its own, and docs/design/contracts/session-boundary.md:560 says the registration belongs to its caller, the bridge's caller row. Say the registration belongs to the registering part's generation, and for a foreign Session part to the bridge's caller row. The exclusion is right; the reason is not.
There was a problem hiding this comment.
Fixed in f91b72b3. D3 says the registration belongs to the registering part's generation and, for a part of another language, to the bridge's caller row.
| - 不包括机制登记点:`sessionMethods`、`toolRegistry` 等登记只能在本作用域内进行,因为登记属于登记方自己的 loader row。 | ||
| - 也不包括作用域的生命周期服务。 | ||
| - 各语言使用同一条路径:Rust 插件在进程内调用;TypeScript、Python 等语言运行时和 leaf 经 rutis 会话调用,与其他数据面相同。它们是宿主运行的可信本地代码,不靠 id 隔离([Dim 如何使用 rutis](../design/rutis-usage.md),AGENTS.md 规则 11)。 | ||
| - 哪些 link 能到达这条路径由部署决定([服务面](../design/service-faces.md) §2.1)。客户端不经这条路径,仍经 Rpc 的方法表与 Session 授权访问。 |
There was a problem hiding this comment.
This says clients do not use the path, but the previous bullet says leaf does, and docs/design/rutis-usage.md:214 includes the UI leaf in the trusted-local-code family. If 客户端 means RPC clients only, write RPC 客户端 and name the UI leaf separately; otherwise the authority boundary contradicts itself.
There was a problem hiding this comment.
Fixed in f91b72b3. D3 names the UI leaf and the RPC 客户端 separately.
|
|
||
| - Agents 拥有 Agent 与 Session 的实例:创建、关闭、删除,准入值,以及保持。 | ||
| - `sessions` 中不属于 Agents 的方法删除,调用方按 D1 直接调用目标所有者。 | ||
| - 每个方法的去向由 [Agents 契约](https://github.com/arcships/dim/pull/2098)给出,目标操作由各所有者的契约定义。 |
There was a problem hiding this comment.
This makes PR 2098 the source of every method's destination, and :57 makes it the replacement for the Session access sessions table. PR 2098 is open and CONFLICTING; docs/design/contracts/session-access.md on main still lists the old methods (:224-240) and §7 at :166 still says sessions is never exported over rutis links. The ADR says that clause is superseded, but the replacement is not in the tree, so D5 cannot be checked. Link an issue for the Agents contract and the Session access change, state the per-method mapping in ADR 027 or a merged contract, or land the replacement first. A target that exists only in another unmerged PR is a forward reference.
There was a problem hiding this comment.
Fixed at the requested minimum. D6 names session-access.md A.1 and §7 as the clauses that stay until the Agents contract merges and links the #2020 delivery comment. The per-method mapping still lives only in open, conflicting PR 2098; the ADR now says so instead of implying it is in the tree.
| - ADR 002 D2 表中「Reach other Sessions」一行由 D1 取代。 | ||
| - [Session 边界契约](../design/contracts/session-boundary.md)附录 F 中「No service lookup by name is added to the Session facade」不变:D1 的路径是机制的派发,不在 Session facade 上加查找。 | ||
| - Session 访问契约中 `sessions` 的方法表由 Agents 契约取代,Session 访问契约随 Agents 的契约改动一起修改。 | ||
| - Collaboration、Scheduler、Workflow、EventHub、Rpc 的跨 Session 调用都改成 D1 的形状。 |
There was a problem hiding this comment.
Rpc's cross-Session calls do not all move to D1. D2 keeps clients on the Rpc method table and excludes registration points, and docs/design/contracts/session-boundary.md:565 says Rpc reads SessionMethods with Session::session_service::<SessionMethods>() after index.acquire; :56 says Appendix F's no-facade-lookup sentence is unchanged. Name the Rpc calls that change, for example session.summaries, and keep the method-table dispatch on the facade.
There was a problem hiding this comment.
Still open. docs/design/appserver/sessions-service.md:148 says Rpc does not use sessions; the new sentence names Rpc calls to deleted sessions methods that do not exist. See the new inline at :77.
There was a problem hiding this comment.
Fixed in da6f4a9. Consequences:77 now says Rpc does not use sessions; the sentence about Rpc calls to deleted sessions methods is gone. Withdraw.
The route is a new dim runtime mechanism that keeps instance keys inside their instance, answers NoInstance or Closed, and is raised as a mechanism requirement. Keep the session-access clauses in force until the Agents contract lands, keep Rpc's method table on the facade, and correct the registration and client wording.
|
@yyhhyyyyyy 谢谢复核。
新增 D2 后,原 D2–D5 顺延为 D3–D6。#2015 中关于改动单位与句柄的摘要,等本 PR 合并后同步。 检查: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: This PR adds design rules §7 "所有者与操作" to docs/architecture/rust-agent/principles.md, ADR 027 for cross-scope access by id, the owner-redesign template, and the AGENTS.md, design-template, template-index and ADR-index hooks. Refs #2018 and #2015. Head f91b72b3, 7 files, +230/-2, base c347bc34; the delta since 2fc4f50b is ADR 027, +45/-18.
Verdict: REQUEST_CHANGES. The new commit fixes the round-5 P1: ADR 027 D2 names the runtime route, keeps instance keys inside the instance, and adds the §4 rule 8 requirement table with an owner and issue for both legs. It also resolves the round-5 P2 at the requested minimum: D6 names session-access.md A.1 and §7 as the clauses that remain until the Agents contract merges and links the delivery comment. Two P2s remain in the new mechanism text: the process-to-Session leg is attributed to #2020 while the Agents contract raises it as a #2025 requirement, and the Closed bullet tells callers to reacquire a hold and retry an id that cannot serve again. The round-5 P3s are mostly fixed; the Rpc consequence is still inaccurate.
Round-5 status
| Finding | Status |
|---|---|
P1 mechanism unnamed and conflicting with session-boundary.md:193 |
Fixed. D2 names the runtime index, callers get no instance key, and the requirement table names line_owner and the process leg. The issue attribution is P2 below. |
| P2 Agents contract and Session access replacement only in open PR 2098 | Fixed at the requested minimum. D6 names A.1 and §7 and links the #2020 delivery comment. The mapping still lives in open, conflicting PR 2098. |
| P3 resolution error codes | Partly fixed. NoInstance and Closed are named, but the Closed retry advice is wrong (P2). |
| P3 loader row wording | Fixed. D3 says the registration belongs to the registering part's generation and, for another language, to the bridge's caller row. |
| P3 leaf vs client | Fixed. D3 names the UI leaf and the RPC 客户端 separately. |
| P3 Rpc all-D1 claim | Partly fixed. The all-D1 claim is gone, but the new sentence still names Rpc calls to deleted sessions methods that do not exist (P3). |
No P1 remains.
Findings
[P2] The process-to-Session leg is attributed to the wrong issue
Anchor: docs/adr/027-cross-scope-access-by-id.md:87.
Problem: The row says the Session-to-branch leg is the line_owner requirement in #2025, but the process-to-Session leg is "随 Agents 契约(#2020)一起提出". The Agents contract raises the process-to-Session part as a #2025 requirement too: PR 2098's "Requirements raised" puts the Session method table and timelineTree.directory by sessionId under #2025, and the #2020 delivery comment says Session 访问面按 sessionId 到达方法表(要求 #2025). #2020 is the Agents owner scan, not the mechanism issue.
Failure scenario: The runtime implements line_owner and closes #2025, while the process-to-Session index is left with no mechanism issue. Provider, Collaboration, Scheduler, Workflow, EventHub and Rpc's Session methods, which PR 2098 lists as blocked on #2025, stay blocked or each caller negotiates its own resolution.
Fix: Link #2025 for both legs and keep #2020 and #2098 as the consuming Agents contract. If the process leg has a separate issue, name it; do not use the owner-scan issue as the mechanism issue.
[P2] Closed is described as retryable, but a closed Session does not load again
Anchor: docs/adr/027-cross-scope-access-by-id.md:35.
Problem: The bullet says Closed means the target is closing, this generation no longer serves, and the caller may reacquire a hold from Agents and call the next generation. The source contract says Closed is the answer when the Session is closed (#2025 comment; docs/design/contracts/session-boundary.md:194), and a business-closed Session does not load again in this process (docs/design/appserver/session-deletion-and-fork.md:162). Agents' acquire on a closed Session answers closed_session, so the retry cannot produce a new generation.
Failure scenario: A process caller receives Closed, follows the ADR, takes a hold on the same sessionId, and retries. The hold fails with closed_session, or the caller loops on a Session that will not serve again. A Session-scope caller has no hold to reacquire at all.
Fix: Say Closed is final for that Session and that a new generation needs a new Session or an owner-driven restore. If a reloading generation needs a retryable answer, name a separate error and say which cases use it. Keep NoInstance for the not-live cases that a hold can resolve.
[P3] The Rpc consequence still names calls that do not exist
Anchor: docs/adr/027-cross-scope-access-by-id.md:77.
Problem: docs/design/appserver/sessions-service.md:148 says Rpc does not use sessions. The sessions callers are Collaboration, Scheduler, Workflow and EventHub, which the previous line lists. The sentence says only Rpc's calls to deleted sessions methods change to D1, but there are no such calls. If the intent is that Rpc's Session method providers move from the Session facade to the by-id path, the sentence does not say which methods or providers.
Failure scenario: A migration implementer finds no Rpc sessions calls and leaves Rpc's Session method providers on the facade, while the Agents contract says Rpc's Session methods use the by-id path; or the implementer moves the sessionMethods dispatch, which D3 excludes.
Fix: Remove the Rpc sentence, or name the Rpc Session methods whose providers change, for example session.input.pending, and say the sessionMethods dispatch stays on the facade.
[P3] The list of session-access clauses that the Agents contract changes is incomplete
Anchor: docs/adr/027-cross-scope-access-by-id.md:65 (also :73-75).
Problem: D6 says A.1 and §7 remain valid and, after the merge, A.1 is replaced and §7 changes. PR 2098's Supersedes section also replaces A.6 errors, the sessions rows of §1 and §6, and Appendix E. A reader can take the ADR's two clauses as the complete set that stays or changes.
Failure scenario: After the Agents contract merges, the sessions error table, the §1/§6 rows and the Rust binding are left as if they were still valid, and the next reader has to reconcile two contracts.
Fix: Say that the Agents contract supersedes all sessions clauses and list A.1, A.6, the §1/§6 rows and Appendix E, or point to the Agents contract's Supersedes section and say these stay valid until then.
[P3] line_owner uses an undefined line id
Anchor: docs/adr/027-cross-scope-access-by-id.md:87 (also :31).
Problem: The requirement row names line_owner and line, but D1 and D2 use branchId and (sessionId, branchId). The ADR never says that a line id is the branch id. docs/design/timeline-branches.md:15 defines a branch as a line, but the mechanism row should not rely on the reader finding that sentence.
Failure scenario: A binding implements line_owner with a separate line identity, or a caller passes a branch id and gets NoInstance, because the two terms were never related.
Fix: Say that the line id is the branch id, or write branchId in the requirement row and keep line_owner as the mechanism name.
[P3] D5 is cited for a one-shot call
Anchor: docs/adr/027-cross-scope-access-by-id.md:34.
Problem: D5 scopes the hold to keeping a Session loaded across multiple calls. The NoInstance bullet tells a process caller with an unloaded Session to take a hold before calling, including a one-shot call. The ADR does not say whether a single call acquires and releases a hold, or whether the route restores the Session.
Failure scenario: A caller takes a long-lived hold for a single call, keeping a Session loaded when it should unload, or assumes the route restores the target and gets NoInstance.
Fix: Say that a one-shot call acquires and releases a hold, or extend D5 to one-shot calls and state that an unloaded target is NoInstance until the caller loads it.
Verification
node scripts/adr-check.mjs --base c347bc34: passed for 7 changed files.- 116 relative links and anchors in the changed files resolve; the external targets are PR 2098 and the two issue comments, both present.
- CI at
f91b72b3:ci-okandchangespassed; docs-only jobs were skipped. - No Rust commands run; worktree clean.
| - 运行时维护从 `sessionId`、`(sessionId, branchId)` 到当前存活实例的索引,把调用路由到目标实例内的派发入口。 | ||
| - 调用方只给 id 和服务名,拿不到实例键。所以「实例键只在实例内部可读」的约定不变。 | ||
| - 解析失败时的错误: | ||
| - `NoInstance`:目标没有存活的实例,可能是分支已结束、分支不属于该 Session,或者 Session 未加载。分支的情况不重试。进程调用方对未加载的 Session,先按 D5 取得保持再调用。 |
There was a problem hiding this comment.
D5 scopes the hold to keeping a Session loaded across multiple calls, but this sentence tells a one-shot caller to take a hold on an unloaded Session. Say whether a single call acquires and releases a hold, or extend D5 to one-shot calls and state that an unloaded target is NoInstance until the caller loads it. Otherwise a caller may keep a Session loaded unnecessarily or expect a restore that does not happen.
There was a problem hiding this comment.
Fixed in da6f4a9. ADR 027 D5:56-57 says a loaded Session needs no hold for a single call, and a process caller that takes one for an unloaded target releases it after the call. Withdraw.
| - 调用方只给 id 和服务名,拿不到实例键。所以「实例键只在实例内部可读」的约定不变。 | ||
| - 解析失败时的错误: | ||
| - `NoInstance`:目标没有存活的实例,可能是分支已结束、分支不属于该 Session,或者 Session 未加载。分支的情况不重试。进程调用方对未加载的 Session,先按 D5 取得保持再调用。 | ||
| - `Closed`:目标正在关闭,这一代不再服务。需要时向 Agents 重新取保持,调用落到下一代。 |
There was a problem hiding this comment.
Closed is described as a transient closing generation: the caller may reacquire a hold and the call lands on the next generation. The source contract uses Closed for a closed Session (docs/design/contracts/session-boundary.md:194), and a business-closed Session does not load again in this process (docs/design/appserver/session-deletion-and-fork.md:162), so the linked Agents contract's acquire on the same id answers closed_session. Following this advice makes a caller retry an id that cannot serve again. Say Closed is final for the Session and a new generation needs a new Session or an owner-driven restore; if a retryable reloading state exists, give it a separate code. A Session-scope caller has no hold to reacquire at all.
There was a problem hiding this comment.
Partly fixed in da6f4a9. The business-close versus idle-unload recovery is now right. What remains: the bullet still defines Closed as the target instance closing and then tells a Session-scope caller that its own Session is closing. A closing target branch is not a closing Session (docs/design/timeline-branches.md:399, :404-413). Keep open as P2; see the new inline at ADR 027:35.
| - Agents 拥有 Agent 与 Session 的实例:创建、关闭、删除,准入值,以及保持。 | ||
| - `sessions` 中不属于 Agents 的方法删除,调用方按 D1 直接调用目标所有者。 | ||
| - 每个方法的去向由 Agents 契约给出,目标操作由各所有者的契约定义。Agents 契约在 [#2098](https://github.com/arcships/dim/pull/2098),交付部分在 [#2020](https://github.com/arcships/dim/issues/2020#issuecomment-7093864713) 跟踪。 | ||
| - Agents 契约合并之前,Session 访问契约的附录 A.1(`sessions` 方法表)与 §7(安全)仍然有效。 |
There was a problem hiding this comment.
This names A.1 and §7, but PR 2098's Supersedes section also replaces A.6 errors, the sessions rows of §1 and §6, and Appendix E. A reader can take these two clauses as the complete set. Say that the Agents contract supersedes all sessions clauses and name the full set, or point to its Supersedes section and say these remain valid until then. As written the sessions error table and Rust binding look unchanged after the merge.
There was a problem hiding this comment.
Fixed in da6f4a9. Consequences:75-76 list A.1, A.6, the section 1 and 6 sessions rows, Appendix E and the sessions-service clauses, and D6:66 points to the Agents contract's Supersedes section. Withdraw.
| - 附录 A.1 由 Agents 契约取代; | ||
| - §7「never exported over RPC entries or rutis links」改为 D3 的可达范围。 | ||
| - Collaboration、Scheduler、Workflow、EventHub 的跨 Session 调用改成 D1 的形状。 | ||
| - Rpc 的方法表派发仍走 Session facade;只有 Rpc 对被删除的 `sessions` 方法的调用改成 D1 的形状。 |
There was a problem hiding this comment.
docs/design/appserver/sessions-service.md:148 says Rpc does not use sessions, so there are no Rpc calls to deleted sessions methods. The sessions callers are Collaboration, Scheduler, Workflow and EventHub. If the intent is that Rpc's Session method providers move to the by-id path, name them (session.input.pending, for example) and keep the sessionMethods dispatch on the facade; otherwise remove the Rpc sentence. As written it leaves Rpc's providers unmigrated or invites moving the excluded registration point.
There was a problem hiding this comment.
Fixed in da6f4a9. Consequences:77 now says Rpc does not use sessions and keeps its method-table dispatch on the Session facade; only Collaboration, Scheduler, Workflow and EventHub migrate. Withdraw.
| | 考虑过的现有机制 | 经 Agents 的 `sessions` 转发:违反 §7。Session facade 按名查找:附录 F 已经排除。把实例键交给调用方:违反 D2 中实例键不离开实例的约定。 | | ||
| | 需要的通用能力 | 按 `sessionId`、`(sessionId, branchId)` 把对目标作用域某个数据面的调用路由到存活实例;失败时返回 `NoInstance` 或 `Closed`。不带业务含义。 | | ||
| | 对序号、批次、中断、重载的影响 | 无:路由不写事件,调用的语义由目标所有者的操作决定。目标重载后,索引指向新的一代。 | | ||
| | 所有者与 issue | dim 运行时。Session 到分支一段就是 SessionScope 契约([#2025](https://github.com/arcships/dim/issues/2025#issuecomment-7093412347))中的 `line_owner` 需求;进程到 Session 一段随 Agents 契约(#2020)一起提出。 | |
There was a problem hiding this comment.
The process-to-Session leg is attributed to #2020, but the Agents contract raises it as a #2025 requirement: PR 2098's "Requirements raised" puts the Session method table and timelineTree.directory by sessionId under #2025, and the #2020 delivery comment says 要求 #2025. #2020 is the Agents owner scan, not the mechanism issue. Link #2025 for both legs and keep #2020 as the consuming contract. Also, line_owner takes a line id that this ADR never defines; D1 uses branchId, so say line id is the branch id or use one term.
Track the by-id route in its own mechanism issue, tell business close from idle unload for Closed, cover one-shot calls, take service names at call time instead of composition, list every superseded sessions clause, and state that Rpc does not use sessions. In section 7, relate owner operations to section 4 rule 1 and add whole-transfer handles to the check. In the template, add Supersedes, the client-visible rule and the binding's wire requirements.
|
@yyhhyyyyyy 谢谢复核。 review 的六条
自查发现的其他问题
另外:#2098 的需求写的是「by instance key」,与 ADR 027 D2「实例键不交给调用方」矛盾,会在 #2098 中修改。 检查: |
zerob13
left a comment
There was a problem hiding this comment.
[P2] Distinguish a closing target branch from a closing Session. ADR 027 D1–D2 permits a Session-scoped caller to reach a branch owner, then says that Closed means the caller's own Session is closing. The accepted branch end flow closes the target branch and subsequently records its end on the still-live parent. A caller following D2 could abandon Session work because a single target is ending; a process caller could also reacquire a live Session without restoring that branch. Please make a closing target branch terminal for that branch call, without implying that the Session closed, and reserve the acquire recovery path for Session idle unload. Capture both cases in #2127's resolver acceptance. The new idle-unload versus business-close distinction for Sessions is useful and should remain. Static contract review; the hosted docs gate passed, and runtime jobs were not selected.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: Docs-only review of PR 2029 at head da6f4a95, 7 files, +239/-2, base c347bc34 (origin/main 6e86d48c). The PR adds design rules §7 "所有者与操作", ADR 027 for cross-scope access by id, the owner-redesign template, and the AGENTS.md, design-template, template-index and ADR-index hooks. The delta since f91b72b3c is 3 files, +28/-19: the §7 self-check wording, ADR 027 D1-D6 and the requirement table, and the owner-redesign template.
Verdict: REQUEST_CHANGES. The delta fixes the round-6 P2 on issue attribution and the P3s on the Rpc consequence, the D6 supersession list, the D5 one-shot wording, and the line id definition. One round-6 P2 remains in a narrower form: the new Closed bullet treats a closing target branch as a closing Session. The other items below are optional P3s or cross-PR notes.
Round status
| Prior item | Status |
|---|---|
| Owner definition, multi-face, registration points (4659011434, 4659011446, 4661977390) | Withdraw. principles.md:110 defines the owner, :129 makes a registration point a face, and owner-redesign.md:63-64 makes the binding conditional. |
| HostPlatform target (4659011441), callbacks and version (4659011444), failure facts (4659011453, 4661977381), cohesion clause (4659011456), Rust-only and hot path (4659011461) | Withdraw. Fixed in ce840afdb and 869ef0d7e; verified at da6f4a95. |
| Object versus handle boundary (4661977365, 4665954318, 4665955057) | Withdraw. principles.md:118, :125 and :154 now allow only a whole transfer; a handle the giver still settles is a gap. |
| Owner unit and template scope (4661977377, 4665955657, 4659011449, 4661977387) | Withdraw. principles.md:135, :160 and owner-redesign.md:3-8 use the owner unit. |
| Owner index (4665954349) | Withdraw. owner-redesign.md:7 says the plugin's row links each owner document. |
| Mechanism unnamed (4665954289, 4666538605) | Withdraw. ADR 027:30-35 names the runtime index, keeps the instance key inside the instance, and #2127 tracks both legs. |
| Removal list and forward reference (4665954304, 4666538645) | Withdraw at the requested minimum. D6:65 delegates every method's destination to the Agents contract (#2098) and links its delivery part (#2020); the contracts in #2098 carry the mapping. |
| Line id, terms and D3 ambiguity (4665954359) | Withdraw. ADR 027:25 defines branchId as the line id, D5:58 defines the hold, and the ADR 002 D3 references are explicit. |
| Loader row and client versus UI leaf (4666538634, 4666538639) | Withdraw. Fixed in f91b72b3c. |
| Issue attribution, Rpc, D6 list, D5 one-shot, line_owner id (4669742633, 4669742649, 4669742662, 4669742670) | Withdraw. Fixed in da6f4a95; see the replies. |
Error codes and Closed (4666538616, 4669742639) |
Keep narrowed. The business close versus idle unload recovery is right; the closing target branch case remains, P2 below. |
| Sessions against ADR 002 and session-access (4661977371, 4665955359) | Withdraw as blocking. ADR 027 supersedes the ADR 002 D2 row and D6 names the clauses that remain valid until the Agents contract merges; #2127 tracks the mechanism. Keep #2098 as a dependency, not a contradiction in this PR. |
Findings
[P2] A closing target branch is not a closing Session
Anchor: docs/adr/027-cross-scope-access-by-id.md:35.
Problem: D1 resolves branch-group data faces by (sessionId, branchId) (line 24) and lets a Session-scope caller reach its own branch group by branchId (line 25). D2 then defines Closed as the target instance closing (line 35) and tells a Session-scope caller that Closed means its own Session is closing and it should end its work. For those callers the target instance is a branch instance, and a branch can close while the Session stays live.
Failure scenario: A Session part calls a sibling branch owner by branchId while that branch is ending, for example a tool line that finishes or a line ended by its ancestor. The route follows D2 and answers Closed because the target instance is closing. The caller follows line 35, concludes its own Session is closing, and stops Session work that is still valid. A process caller that gets Closed for the same branch takes a hold on the live Session and retries; the branch never returns, so the retry either loops to NoInstance or keeps a Session loaded for a branch that is gone.
Evidence: docs/adr/027-cross-scope-access-by-id.md:24-25, :35; docs/design/timeline-branches.md:399 ("Closing the Session is not an end") and :404-413 (the sequence closes and unloads the line, then writes branch/ended on the live parent). The concurrent TimelineTree contract in #2092 also reserves NoInstance for a line that is not live and Closed for a closing Session.
Fix: Define Closed as the target Session closing, not any target instance closing. A branch target that is ending or ended answers NoInstance as final for that branch call, or a separate final code, and the acquire recovery covers Session idle unload and business close only. Add both cases, closing Session and ended branch, to #2127's resolver acceptance.
[P3] acquire answers session_closed here, closed_session in the cited Agents contract
Anchor: docs/adr/027-cross-scope-access-by-id.md:35.
Problem: The sentence says a business-closed Session's acquire answers session_closed. That matches today's sessions service, which maps Closed to session_closed (docs/design/contracts/session-access.md:538; docs/design/appserver/session-deletion-and-fork.md:160-161). The target Agents contract in #2098 exposes acquire with the code closed_session in its operation and error tables.
Failure scenario: A caller implements the Closed recovery against the ADR, matches session_closed, and treats the target acquire reply closed_session as an unknown failure, so it retries or aborts instead of stopping.
Fix: Say that the current acquire answers session_closed and the Agents contract's acquire will answer closed_session, or use one code and list the rename in #2098's Supersedes section.
[P3] NoInstance covers both a final ended branch and a retryable unloaded Session
Anchor: docs/adr/027-cross-scope-access-by-id.md:34.
Problem: The bullet says not to retry when the branch ended or is not this Session's, and to take a hold and retry when the Session is not loaded. Both cases return the same NoInstance, so a process caller cannot choose the branch. D5 says a single call takes and releases a hold, but it does not say how the caller learns that the Session is unloaded rather than the branch ended.
Failure scenario: A process caller targets (sessionId, branchId), gets NoInstance for an idle-unloaded Session, follows "do not retry" for a branch case, and fails a call that a hold would serve. Or it takes a hold for an ended branch, loads the Session, and retries a branch that cannot return.
Fix: Name the discriminator, for example read Agents' session.state and take a hold only for an unloaded Session, or return a distinct final code for an ended branch.
[P3] The owner-redesign template routes every owner to the design-plugin tree
Anchor: docs/templates/owner-redesign.md:5.
Problem: The template says the durable design part goes into docs/design/plugins/<Owner>.md and its row is in docs/design/plugins/README.md. The rule covers every existing owner, and architecture plugin owners have their designs and index under docs/architecture/rust-agent/plugins/; docs/architecture/rust-agent/plugins/README.md:32 and :36 index TimelineTree and ToolRegistry there.
Failure scenario: A redesign of TimelineTree or ToolRegistry follows the template, creates a second document under docs/design/plugins, and leaves the architecture page authoritative. Reviewers and implementers then read two designs for one owner.
Fix: Say the design part goes into the owner's existing design document and index, in either docs/design/plugins or docs/architecture/rust-agent/plugins, or name the two indexes.
Cross-PR notes
These are not defects in this PR, but the concurrent contracts cite ADR 027 by number and should be aligned before they merge.
- PR 2098 now cites
ADR 027 D1, D3andD5at its new head, matching this ADR; keep the#2127requirement link when it rebases again. - PR 2092's
line_ownercontract and#2127's acceptance need the closing branch case from the P2 above.
Checks
- The §7 self-check additions are consistent:
principles.md:127says the owner decides inside its operation and writes the result event per §4 rule 1, which matches rule 1's "the requester does not write the result" and ADR 027's "the route writes no event";:148uses the rule 1 term "结果事件";:154matches the whole-transfer rule at:125. ADR 002 D3 and the ADR 027 body do not conflict with them. - The template self-check matches what principles requires:
AGENTS.md:121,docs/templates/design.md:20-21and:31-32now ask the §7.1 questions and the §7.2 checks, andowner-redesign.md:57-59defers to the design template. node scripts/adr-check.mjs --base c347bc34: passed for 7 changed files.- 117 relative links and anchors in the changed files resolve;
#2127,#2025,#2024and#2020exist. - CI at
da6f4a95:ci-okandchangespassed; docs-only jobs were skipped. Head is unchanged. - No Rust commands run; worktree clean.
Resolve the Session before the line: NoSession, SessionClosing and NoLine, each with the caller's next step. A closing line no longer reads as a closing Session. The owner-redesign template keeps an owner's design in its existing document in either plugin tree.
|
@yyhhyyyyyy @zerob13 谢谢复核。
自查补充了三项:结局按调用方 × 目标种类 × 结局逐格检查;修改时新写的句子重新检查;ADR 定义的内容与每个实现它的契约 PR 核对。按第三项发现 #2092 的 检查: |
D2 states only that a failed resolution distinguishes a missing Session, a closing Session and a missing line. Error names, caller steps and acceptance belong to the mechanism owner in #2127; the superseded sessions clauses are listed by the Agents contract.
|
@yyhhyyyyyy @zerob13 ADR 被接受后就不能再改(ADR 008 D1),设计文档也不描述别的模块怎样路由、重试(ADR 008 D3)。所以 ADR 027 只写决定和理由,错误码和重试步骤放在机制所有者那里:
决定本身没有改变:D1–D6 和上一轮一致。 检查: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope. Docs-only review of PR 2029 at head 9e629e9a, 7 files, +236/-2, base c347bc34 (origin/main 6e86d48c). The PR adds design rules §7 "所有者与操作", ADR 027 for cross-scope access by id, the owner-redesign template, and the AGENTS.md, design-template, template-index and ADR-index hooks. Since round 7 the head added two commits: a3c7c4d8 split the ADR 027 route errors and moved the template's design-document location, and 9e629e9a kept ADR 027 at the decision layer by moving the error names, next steps and acceptance to #2127.
Verdict: APPROVE. The round-7 P2 is fixed. ADR 027:33 requires the caller to distinguish Session missing, Session closing and branch missing, and states that a branch end is not a Session close: with the Session alive, branch-missing is final for that branch and does not affect other calls in the Session. #2127 defines the names NoSession, SessionClosing and NoLine, each caller's next step, the branch/end-to-close routing guarantee, and the acceptance. That matches the TimelineTree state model in #2092: an ending line keeps its scope until close. The round-7 P3 on NoInstance is fixed at the decision layer, and the P3 on the acquire code is moot. Two optional P3s remain: the template's tree rule (inline) and the stale PR description. Plus cross-PR alignment notes.
Round status
| Prior item | Status |
|---|---|
| P2 closing target branch is not a closing Session (4675261657, 4669742639, 4666538616) | Fixed. ADR 027:33; #2127 defines NoSession, SessionClosing, NoLine and the acceptance for idle unload, business close, closing Session and closed branch. |
P3 NoInstance cannot distinguish an ended branch from an unloaded Session (4675261671) |
Fixed. ADR 027:33 and :80 separate the three cases; #2127 names them and gives the next step for each. |
| P3 owner-redesign template routes every owner to the design tree (4675261684) | Partially fixed. TimelineTree and ToolRegistry now route to the architecture tree; dual-indexed plugins still route to the wrong document. Inline at docs/templates/owner-redesign.md:6. |
P3 session_closed versus closed_session (4669742639 follow-up) |
Moot. ADR 027 no longer names the acquire code. |
| All other round-7 items | Withdrawn; no change. |
Findings
[P3] The PR description still names the two old route errors
Problem: The summary says the route "answers NoInstance or Closed". ADR 027:33 delegates the names to #2127, which defines NoSession, SessionClosing and NoLine.
Failure scenario: A reader of the PR summary implements or reviews the old two-error protocol, which is the closing-branch ambiguity the round-7 P2 fixed.
Evidence: PR description; docs/adr/027-cross-scope-access-by-id.md:33; #2127.
Fix: replace the sentence with the three names or with "distinguishes Session missing, Session closing and line missing".
Cross-PR notes
- #2092
line_ownerstill namesNoInstanceandClosed(docs/design/plugins/TimelineTree.md:96,:226at head e1c2335). The semantics match #2127's cases; only the names differ. Align it before it merges. - #2098
acquirestill answersclosed_session(docs/design/plugins/Agents.md:155,:192at head 3d5ade8). The author's plan is to change it back tosession_closed. - #2127 now defines the three names and includes the branch/end-to-close guarantee in
NoLine. ItsNoLinestill omits a branch reservation that has not been published, and its acceptance tests only the closing branch, not the branch/end-to-close window. Both are worth tightening there.
Checks
node scripts/adr-check.mjs --base c347bc34: passed for 7 changed files.- Relative links and anchors in the changed files resolve;
#7-所有者与操作and#71-设计三问match the new headings. - CI at
9e629e9a:changesandci-okpassed; docs-only jobs were skipped. - Worktree clean; no Rust commands run.
| Use this shape when an existing owner's public surface is redesigned under | ||
| [design rules §7](../architecture/rust-agent/principles.md#7-所有者与操作). It has two parts. The design | ||
| part is durable and goes into the owner's existing design document: under | ||
| `docs/architecture/rust-agent/plugins/` for a plugin indexed in that tree's README, otherwise under |
There was a problem hiding this comment.
P3: the tree rule misroutes owners of plugins indexed in both trees. Problem: this sentence keys the destination on whether the plugin is indexed in docs/architecture/rust-agent/plugins/README.md, but nine plugins are indexed in both READMEs and several architecture pages are assembly pages that link design content in the other tree. Failure scenario: a Questions owner redesign writes the durable design into docs/architecture/rust-agent/plugins/Questions.md, while docs/design/plugins/Questions.md remains the design, so one owner has two designs. Evidence: docs/architecture/rust-agent/plugins/Questions.md:8-9 links docs/design/plugins/Questions.md; docs/architecture/rust-agent/plugins/README.md:41 and docs/design/plugins/README.md:13 both index Questions; the same pattern holds for Attachments, Hooks, Prompt, PromptSources, PromptSuggestion, Recall, ShellInput and Skills. Fix: route to the owner's existing design document wherever it is, and say the plugin's row in either index links it. For a new owner, say which tree its plugin's index is in and add the new document to that index.
…design A plugin whose architecture page links a design under docs/design/plugins keeps its design there.
问题与 yyhhyyyyyy 的 P2 相同,已在 a3c7c4d/9e629e9a6 修复并获批准
Refs #2015 · Refs #1292 · Refs #1984 · Refs #2002
Summary
Adds §7 "所有者与操作" to the design rules and ADR 027. §7 is the rule source for the owner contracts in #2015 (#2016–#2033).
sessionMethods,managementMethods,toolRegistry) are not facades; what an owner registers there is its public surface. A data face does not change in-process Rust calls, so call frequency is no reason to keep a non-data face.internal(reason)entries record such gaps.docs/templates/design.md, and redesigned owners throughdocs/templates/owner-redesign.md. §7.2 lists the review checks, which AGENTS.md and the design template's Rule check now include.sessionIdor(sessionId, branchId)through a new dim runtime route that keeps instance keys inside their instance. A failed resolution distinguishes a missing Session, a closing Session and a missing line; a line ending is not the Session closing. Error names, caller steps and acceptance are in 按 id 调用:由持有实例的一方选目标(base-1) #2127. Registration points and lifecycle services are excluded. Language runtimes and leaves reach these faces over rutis sessions; clients still go through Rpc. Agents keeps only its own operations.§7 is appended so existing links to §1–§6 keep their anchors. Existing rules are linked, not restated.
Design rule checklist
beforecallbacks: n/a, documentation only.Documentation
Verification
node scripts/adr-check.mjs --base origin/mainandcargo run --locked -p xtask-checkpassed.