Skip to content

design(settings): owner contracts for Settings and the settings sections - #2094

Closed
eric8810 wants to merge 8 commits into
mainfrom
dim/2017-settings-contract
Closed

eric8810 wants to merge 8 commits into
mainfrom
dim/2017-settings-contract

Conversation

@eric8810

@eric8810 eric8810 commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Target contracts for the Settings board (#2017) under design rules §7 (#2029) and ADR 027.

Design part, docs/design/plugins/:

  • Settings: the source registry, documents and revisions, change application, authorized projects and change facts behind one settings service. register takes the declaration with its user-only members and answers a source id bound to the registering row; a Rust document type registers through the same operation with the type as its codec. Owners read a value by source id and change a document through a positional callback the owner runs under its exclusion; the user path takes the draft revision and keeps the {revision, document} reply; the agent path serves declared sources only and withholds writeOnly members. Settings registers each authorized cwd with FileStorage's add_root and reads the home directory as an assembly value; a document is read and updated by absolute path (#2080 head 7224c0cd4). The user-document rows are Settings' own: readUser, importUserIfAbsent, changeUser and replaceUser are crate-private operations executed by the storage engine, and sqliteStorage publishes only storageReport and the offline operations (#2091).
  • SettingsMethods: the local client's settings.* methods keep their request and reply shapes and serve declared sources only; typed request structs in the examples; the Web entry is served for its allowlisted sources; settings.sources and settings.projects are removed.
  • PromptSettings, ExecutionSettings, PromptSuggestionSettings, ProviderSettings, ModelLog, PermissionRules, CollaborationModelPolicy: each section owner's document, value read and client methods, with the capability-side port trait named for consumers outside the App Server.

workflowFiles, commandRules and the three prompt host names are removed. Workflow definition files come from FileStorage with the project resolved from authorized_projects; permissionRules.rules replaces commandRules.read; the prompt texts come from one promptSettings service. Error enums carry {code, message} with snake_case codes; a refusal is the rejected code with the change's own code in reason; declarations expose a writeOnlyHint, the agent path its writeOnly pointer list.

Each contract has a Supersedes section, and the paragraphs describing this board in settings-service.md (§1, §1.1, §2, §3.1, §4.1, §4.2, §4.3, §4.5, §5, §6, §8, §9, §10, §11), prompt-overrides.md (§3, §3.1, §7), permission-command-rules.md §4.1, service-faces.md, resource-owner-operations.md §Settings, management-methods.md, subagent-model-policy.md, model-log.md, provider-management.md, PluginManager.md, AgentSettings.md, ContextCompaction.md and overview.md link to the contracts.

The binding appendices compile in a temporary crate (workspace crates + rutis 0.23, rust 1.100); the wire shapes asserted there match the error table. Requirements raised to Provider (#2019) and Workflow (#2033) are stated in the Settings contract.

Delivery part (deletion list, caller migration, implementation task, acceptance, client-visible changes): #2017 (comment)

Refs #2017
Refs #2015

Merge order

#2029 → #2080 → #2091/#2092/#2093 → #2094 → #2096 → the rest.

Sibling heads this change is aligned with: #2096 9ca30e0f8. A paragraph that depends on a sibling names that PR; its head is the one above.

Add the target contracts for Settings, its client namespace and the settings
section owners under design rules §7. The Settings contract replaces the
settingsService owner API and the settings facade with one service: register
returns a source id, owners read a document as a value and change it through a
callback that the owner runs under its exclusion, user edits carry the draft
revision, the agent reads a redacted document and sets one member, and the
authorized-project table is a value plus one admission operation.

workflowFiles, commandRules and the three prompt host names are removed; the
workflow definition files, the command rules value and the prompt texts are
requested from their owners. Requirements raised to SessionStore, Provider and
Workflow are stated in the Settings contract.

Refs #2017
Refs #2015
eric8810 added a commit that referenced this pull request Nov 23, 2026
Write the owner contracts for the model and provider board under design
rules §7: the responsibility split, the caller compositions, the
operations with their cancellation and error kinds, the flows that
settle each resource, the exceptions, the rule check and the Rust
bindings.

Provider becomes the single model owner of the product profile:
resolution, preference application, selection listing, temporary
startup admissions, request execution, media routes and one-call leases.
It owns the driver, so credentials never leave the owner and no
connection crosses. ConfiguredModels answers the same `providerService`
operations from the model file.

Account owners share one contract: availability and its subscription,
the account catalog, one-request leases with an id, one controlled
recovery and settlement, plus the Dim relay's search and title. The
ChatGPT account remains; the ManagedProviders host binding and the
`managedSearch` face are retired, so no owner returns another owner's
data. ModelLog and the provider document stay with the Settings board
(#2094); the driver reads ModelLog's recording value.

Refs #2019 · Refs #2015
eric8810 added a commit that referenced this pull request Nov 23, 2026
Write the owner contracts for the model and provider board under design
rules §7: the responsibility split, the caller compositions, the
operations with their cancellation and error kinds, the flows that
settle each resource, the exceptions, the rule check and the Rust
bindings.

Provider becomes the single model owner of the product profile:
resolution, preference application, selection listing, temporary
startup admissions, request execution, media routes and one-call leases.
It owns the driver, so credentials never leave the owner and no
connection crosses. ConfiguredModels answers the same `providerService`
operations from the model file.

Account owners share one contract: availability and its subscription,
the account catalog, one-request leases with an id, one controlled
recovery and settlement, plus the Dim relay's search and title. The
ChatGPT account remains; the ManagedProviders host binding and the
`managedSearch` face are retired, so no owner returns another owner's
data. ModelLog and the provider document stay with the Settings board
(#2094); the driver reads ModelLog's recording value.

Refs #2019 · Refs #2015
eric8810 added a commit that referenced this pull request Nov 23, 2026
Write the owner contracts for the model and provider board under design
rules §7: the responsibility split, the caller compositions, the
operations with their cancellation and error kinds, the flows that
settle each resource, the exceptions, the rule check and the Rust
bindings.

Provider becomes the single model owner of the product profile:
resolution, preference application, selection listing, temporary
startup admissions, request execution, media routes and one-call leases.
It owns the driver, so credentials never leave the owner and no
connection crosses. ConfiguredModels answers the same `providerService`
operations from the model file.

Account owners share one contract: availability and its subscription,
the account catalog, one-request leases with an id, one controlled
recovery and settlement, plus the Dim relay's search and title. The
ChatGPT account remains; the ManagedProviders host binding and the
`managedSearch` face are retired, so no owner returns another owner's
data. ModelLog and the provider document stay with the Settings board
(#2094); the driver reads ModelLog's recording value.

Refs #2019 · Refs #2015
eric8810 added a commit that referenced this pull request Nov 23, 2026
Write the owner contracts for the model and provider board under design
rules §7: the responsibility split, the caller compositions, the
operations with their cancellation and error kinds, the flows that
settle each resource, the exceptions, the rule check and the Rust
bindings.

Provider becomes the single model owner of the product profile:
resolution, preference application, selection listing, temporary
startup admissions, request execution, media routes and one-call leases.
It owns the driver, so credentials never leave the owner and no
connection crosses. ConfiguredModels answers the same `providerService`
operations from the model file.

Account owners share one contract: availability and its subscription,
the account catalog, one-request leases with an id, one controlled
recovery and settlement, plus the Dim relay's search and title. The
ChatGPT account remains; the ManagedProviders host binding and the
`managedSearch` face are retired, so no owner returns another owner's
data. ModelLog and the provider document stay with the Settings board
(#2094); the driver reads ModelLog's recording value.

Refs #2019 · Refs #2015
The user's revision is the draft base the client holds, business concurrency
control between the user's read and write. State that in the responsibility
split, keep it out of the owner-path caller examples, and point the client
example at SettingsMethods.
eric8810 added a commit that referenced this pull request Nov 23, 2026
Write the owner contracts for the model and provider board under design
rules §7: the responsibility split, the caller compositions, the
operations with their cancellation and error kinds, the flows that
settle each resource, the exceptions, the rule check and the Rust
bindings.

Provider becomes the single model owner of the product profile:
resolution, preference application, selection listing, temporary
startup admissions, request execution, media routes and one-attempt
credentials. It owns the driver, so credentials never leave the owner
and no connection crosses. ConfiguredModels answers the same
`providerService` operations from the model file.

Account owners share one contract: availability and its subscription,
the account catalog, and one `with_lease` operation that hands the lease
to the caller's attempt, recovers once and settles the lease itself, so
no caller holds a lease id. DimOAuth adds relay search and title. The
ChatGPT account remains; the ManagedProviders host binding and the
`managedSearch` face are retired, so no owner returns another owner's
data. ModelLog and the provider document stay with the Settings board
(#2094); the driver reads ModelLog's recording value.

Refs #2019 · Refs #2015
Consumers that read commandRules call permissionRules.rules; the delivery
migration names the register operation, not its Rust helper.
eric8810 added a commit that referenced this pull request Nov 23, 2026
Write the owner contracts for the model and provider board under design
rules §7: the responsibility split, the caller compositions, the
operations with their cancellation and error kinds, the flows that
settle each resource, the exceptions, the rule check and the Rust
bindings.

Provider becomes the single model owner of the product profile:
resolution, preference application, selection listing, temporary
startup admissions, request execution, media routes and one-attempt
credentials. It owns the driver, so credentials never leave the owner
and no connection crosses. ConfiguredModels answers the same
`providerService` operations from the model file.

Account owners share one contract: availability and its subscription,
the account catalog, and one `with_lease` operation that hands the lease
to the caller's attempt, recovers once and settles the lease itself, so
no caller holds a lease id. DimOAuth adds relay search and title. The
ChatGPT account remains; the ManagedProviders host binding and the
`managedSearch` face are retired, so no owner returns another owner's
data. ModelLog and the provider document stay with the Settings board
(#2094); the driver reads ModelLog's recording value.

Refs #2019 · Refs #2015
eric8810 added a commit that referenced this pull request Nov 23, 2026
Write the owner contracts for the model and provider board under design
rules §7: the responsibility split, the caller compositions, the
operations with their cancellation and error kinds, the flows that
settle each resource, the exceptions, the rule check and the Rust
bindings.

Provider becomes the single model owner of the product profile:
resolution, preference application, selection listing, temporary
startup admissions, request execution, media routes and one-attempt
credentials. It owns the driver, so credentials never leave the owner
and no connection crosses. ConfiguredModels answers the same
`providerService` operations from the model file.

Account owners share one contract: availability and its subscription,
the account catalog, and one `with_lease` operation that hands the lease
to the caller's attempt, recovers once and settles the lease itself, so
no caller holds a lease id. DimOAuth adds relay search and title. The
ChatGPT account remains; the ManagedProviders host binding and the
`managedSearch` face are retired, so no owner returns another owner's
data. ModelLog and the provider document stay with the Settings board
(#2094); the driver reads ModelLog's recording value.

Refs #2019 · Refs #2015
@eric8810

Copy link
Copy Markdown
Collaborator Author

评审(head cfaa2b272):符合。Settings 的 change 回调、只在用户路径上带 revision、各设置所有者拆分都对。

The native profile's row operations (readUser, importUserIfAbsent, changeUser,
replaceUser) belong to the Settings contract; the storage engine executes them
as crate-private transactions and its public face keeps only storageReport and
the offline operations. The client examples use typed requests instead of
inline JSON literals.
@eric8810

Copy link
Copy Markdown
Collaborator Author

已按评审修改,head 187d20bc3be893832d72a566161764348d53e40c。

  1. 存储引擎不代查:user 文档的行归 Settings 自己拥有。Settings 契约的 Own contract 新增「Native-profile row operations」:readUser、importUserIfAbsent、changeUser、replaceUser(含 expectedVersion 与 conflict),作为本所有者的 crate-private 行操作,由存储引擎以事务执行;Dependencies 改成「存储引擎作为 native 档的 crate-private 实现,不在公开面回答 Settings 的读写」,Requirements 里原来的 所有者扫描:会话存储 #2018 需求改成「无需求:引擎执行本所有者的私有事务,docs(storage): define the session storage owners' target contracts #2091 不再把 Settings 组发布在 sqliteStorage 上」;Rule check 与 ADR 002 D3 同步。交付评论的摘要、删除清单(sqliteStorage 的 Settings 组)、迁移表(新增 SqliteStorage 行)、实现任务与验收同步。
  2. SettingsMethods 示例用类型化请求:CLI 示例改成 ReadRequest/UpdateRequest 两个 serde 结构,不再用 json! 组请求,并注明请求在客户端边界序列化;PermissionRules 的 CLI 示例同样改成 SetRulesRequest。
  3. 其余评审项不动:change 回调、只在用户路径上的草稿 revision、各设置所有者拆分保持原样。

node scripts/adr-check.mjs --base origin/main 与 cargo run --locked -p xtask-check 重跑通过;交付评论首行 head 已更新为 187d20bc3。

@eric8810
eric8810 marked this pull request as ready for review November 23, 2026 12:13

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Scope: this PR adds nine owner contracts under docs/design/plugins/ for Settings and the settings sections (SettingsMethods, PromptSettings, ExecutionSettings, PromptSuggestionSettings, ProviderSettings, ModelLog, PermissionRules, CollaborationModelPolicy) and adds their rows to the plugin README, as part of the owner scan for #2017 and #2015 under the section 7 owner rules tracked by #2029.

Verdict: REQUEST_CHANGES

P1

1. Settings.md:120: register cannot declare user-only members.
Problem: the request is {source, userFile, projectFile?, schema}; neither it nor the Data section names a user-only pointer list, yet the Authority rule, the user_only error of change, and the refusal in agent_set all depend on one. Every current declaration carries userOnly (docs/design/appserver/settings-service.md section 3.1; docs/design/plugins/PluginManager.md:370; crates/dim-app-server/src/settings/declared.rs:19-21), including /userAgent in crates/dim-app-server/src/provider_settings.rs:43, /base, /summary and /skills in crates/dim-app-server/src/prompt_settings.rs:123, and /projectEnabled in runtime/plugins/workflow/settings.ts:6-8.
Failure scenario: an implementation of the new register cannot distinguish user-only members, so an owner or agent write changes them, or the user_only error is never produced; the existing sources would have to drop their declared rule.
Fix: add userOnly to the operation, the Data section, the wire declaration and both Rust bindings (register and the typed registration), and keep the check that each pointer names a reachable member.

2. SettingsMethods.md:12 and SettingsMethods.md:76: existing client callers break and are missing from the delivery.
Problem: the new methods drop scope from the requests, return only {revision} from settings.update, and say they are never served to a remote entry. Production callers outside the CLI use the old shape: the Web settings pages send scope: "user" and parse {revision, document} from the update reply (web/src/features/settings/DiagnosticsSettings.vue:33,46; web/src/features/settings/PermissionsSettings.vue:62,101; web/src/rpc/general-settings.ts:287-297), and the Web entry is allowlisted for model-log and execution (crates/dim-app-server/src/protocol.rs:313; crates/dim-app-server/tests/transport_flow/settings_methods.rs:503-506). The CLI does the same (crates/dim-cli/src/recording.rs:56-73; crates/dim-cli/src/prompt_command.rs:55-85). The delivery caller table lists only the CLI.
Failure scenario: the Web Diagnostics and Permissions pages fail on an unknown scope field or a missing document in the update reply; if the local-only sentence is read literally, both pages get unknown_method. The CLI update callers also lose the document they print.
Fix: keep {revision, document} or state the re-read and migrate the Web and CLI callers; state which entries are admitted (paired devices no, the authenticated loopback Web entry for its allowlisted sources yes); add the Web row to the delivery migration.

3. Settings.md:123: read_user and replace_user erase the declared-only boundary.
Problem: both operations address a document by source name and the contract does not restrict the client path to declared sources. docs/design/appserver/settings-service.md sections 4.3 and 8.1 say the opposite: settings.* serves declared sources only, and a Rust source such as mcp is settings_unknown_source (crates/dim-app-server/src/settings/declared.rs:185-208; crates/dim-app-server/src/settings_methods.rs:158). The target also needs read_user for Rust owners (PermissionRules, CollaborationModelPolicy, SkillsCatalog), so the operation itself serves them.
Failure scenario: a local client calls settings.read for mcp-secrets or mcp and receives documents the old contract withheld; replacing one bypasses the owner's namespace and validation. The SettingsMethods claim that the client never learns another owner's document is false.
Fix: bind these operations to a registered source id, or enforce the declared-only rule in SettingsMethods and give Rust owners a source-id path; state the rule in SettingsMethods.

4. Settings.md:135 and Settings.md:158: the project id type and the settings/projects fact contradict the current event and contract.
Problem: the Data section makes ProjectId a string and the Facts table emits {project, cwd}, while the current event is ProjectAuthorized { root: usize, cwd } on the same channel (crates/dim-app-server/src/settings.rs:109-127) and the scope is SettingsScope::Project(usize) (crates/dim-agent-capabilities/src/settings.rs:11-18). Line 5 says the events stay as settings-service.md describes, which is {root: number, cwd} and {"project": <root>} (sections 4.1 and 4.4).
Failure scenario: a listener that reads root receives no value, and a project scope sent as a number no longer decodes; the document claims no event change while changing the payload and the id type.
Fix: either keep the process-local number, or state explicitly that this also replaces sections 4.1 and 4.4, name the new string id, and update every listener and the delivery migration. FileStorage's target RootId is a string in #2080, so the string choice can be right, but the settings event and the old contract still say otherwise.

P2

5. Settings.md:173 and Settings.md:191: unsynced does not make a repeated change idempotent.
Problem: ChangeFn is an arbitrary Fn(Option<Document>) with no idempotence requirement; a change that appends or increments applies twice. The old contract says read before retrying (docs/design/appserver/settings-service.md section 6).
Failure scenario: a change that appends a command rule commits but reports unsynced; the caller repeats it as documented and the rule is added twice.
Fix: say the caller must read after unsynced and must not repeat a change without reading; remove the idempotence claim.

6. Settings.md:166: the public error list has no storage or persistence kind.
Problem: read, change, replace_user and authorize_project call FileStorage and the native rows; the row operations list storage (lines 146-149), and today SettingsError has Storage, Persistence and Worker (crates/dim-app-server/src/settings.rs:30-66). FileStorage's read and update can also return invalid, missing_parent, too_large, rejected, unsynced, closed and cancelled.
Failure scenario: an unreadable file or a failed SQLite transaction has no documented kind or next action; a client cannot tell a repair from a retry.
Fix: add a failed or storage kind and the FileStorage kinds the public operations propagate, and map the row and FileStorage errors.

7. Settings.md:184 and Settings.md:193: the project table cannot survive the next generation as written.
Problem: the flows and exceptions say the table survives and a project id stays valid, but the delivery plan deletes the project_roots seed loop (crates/dim-app-server/src/settings.rs:606-611), and FileStorage has no operation that enumerates the root table: add_root and root_path address one root (PR #2080).
Failure scenario: after Settings reloads, authorized_projects is empty, retained project ids do not resolve, and project-scoped reads fail until every cwd is authorized again. The delivery acceptance requires the same project id after a reload.
Fix: keep a seed source, add a FileStorage roots read, or persist the table; or state that Settings does not reload independently and remove the flow row.

8. Settings.md:151: FileStorage's update does not compare the revision.
Problem: the line says replace_user is FileStorage's update, "which compares the revision Settings carries". FileStorage's update has no version or digest parameter; its own target contract says the document revision is checked inside the caller's change helper (PR #2080, FileStorage.md caller example).
Failure scenario: an implementer relies on FileStorage for the expected revision and a stale user draft overwrites a concurrent write; no conflict is reported.
Fix: say that Settings reads the current revision and compares expectedRevision inside the update callback; FileStorage only holds the file key.

9. All service appendices: error enums do not derive Serialize, so the documented codes are not produced.
Problem: under rutis 0.23 an error that is not Serialize gets its code from the Debug identifier, so Invalid stays Invalid and Rejected { code, message } becomes Rejected, losing the change's own code. The current faces derive Serialize with #[serde(tag = "code", rename_all = "snake_case")] (crates/dim-agent-capabilities/src/execution_settings.rs:26-33; crates/dim-agent-capabilities/src/prompt_suggestion.rs:78-84).
Failure scenario: every documented lowercase kind (failed, invalid, unknown_source, cancelled, rejected) reaches the wire in a different case, and a rejected change's business code is lost.
Fix: derive Serialize with the same tag on every error enum in these appendices (Settings, PromptSettings, ExecutionSettings, PromptSuggestionSettings, ProviderSettings, ModelLog, PermissionRules, CollaborationModelPolicy).

10. Settings.md:268 and Settings.md:301: the change callback cannot cross languages as written.
Problem: the callback sits inside the Change request struct. A rutis method parameter must be DeserializeOwned, and a struct containing ChangeFn cannot be deserialized; a callback crosses as a top-level function parameter. Rejected also lacks From<rutis::host::CallError>, which FromFunction requires for the callback error (rutis 0.23 service.rs).
Failure scenario: the appendix does not compile, or change is not reachable from TypeScript or Python callers while the contract claims every operation is cross-language.
Fix: pass the callback as a positional ChangeFn parameter, as FileStorage's update does, and add impl From<rutis::host::CallError> for Rejected.

11. Settings.md:256: the Scope serde shape does not match the documented wire shape.
Problem: an externally tagged struct variant Project { project: ProjectId } serializes as {"project":{"project":"..."}}, not {"project": ProjectId} as the Data section says. The current SettingsScope::Project(usize) is a newtype variant and produces {"project":1}.
Failure scenario: a project scope built from the table does not decode, and the wire shape differs from the contract.
Fix: use Project(ProjectId) or a custom serde representation.

12. Settings.md:125: agent_read says it withholds user-only secrets.
Problem: the Authority line and the Data section say only writeOnly members are withheld from the agent; user-only is a write rule. ExecutionSettings makes the switches user-only and its Session tool reads them through the same path (docs/design/plugins/ExecutionSettings.md:23).
Failure scenario: an implementation that hides user-only members removes non-secret values such as sandbox and network from the agent's settings tool, contradicting ExecutionSettings and AgentSettings.
Fix: say "writeOnly members withheld" in the intent.

13. PromptSettings.md:5: the one-service contract contradicts the linked feature design.
Problem: docs/design/appserver/prompt-overrides.md section 3.1 still defines three data services with different operation names and bare string or null replies (basePromptSettingsHost.base, skillsInstructionsSettingsHost.instructions, summaryPromptSettingsHost.systemPrompt). The one-service {text} wrapper is a different wire shape.
Failure scenario: a TypeScript consumer or an implementation following the feature design calls names and shapes that the new contract deletes; readers cannot tell which document is authoritative.
Fix: mark that section superseded or update it in this PR, and add it to the delivery list.

14. ExecutionSettings.md:86, PromptSettings.md:87, PromptSuggestionSettings.md:86: no port type is defined for consumers outside the App Server.
Problem: the rule checks say consumers depend on the port type, not the App Server, but the appendices mark the service on the owner type that depends on Settings and define no port type. HostPlatform, PromptSources, Skills, ContextCompaction, Provider and aimux's recorder live outside dim-app-server (crates/dim-agent-capabilities/src/host_platform.rs:7; crates/dim-agent-capabilities/src/execution_settings.rs:43-87; crates/dim-agent-capabilities/src/prompt_sources.rs:381-390; crates/dim-agent-capabilities/src/prompt_suggestion.rs:97-137).
Failure scenario: the typed calls in the caller examples require a dependency on the App Server owner, violating ADR 002 D3, or the implementation needs an undeclared shared type.
Fix: name the crate and type of each service or keep a capability-side port type; state how a consumer outside the App Server reaches the operation.

15. SettingsMethods.md:84: invalid params omits a schema-invalid draft.
Problem: the table names only "a document that is not an object". A schema violation is also a caller error: settings-service.md section 6 maps invalid_document to invalid params on the client path, and the current wire maps Document and DocumentShape to invalid (crates/dim-app-server/src/settings_methods.rs:98-104).
Failure scenario: an out-of-range maxChars or an unknown member falls into settings_failed, whose guidance is read again, not fix the draft; the client cannot show the validator message as an input error.
Fix: list invalid_document under invalid params, with the message.

16. Settings.md:112 and Settings.md:193: the FileStorage links are forward references.
Problem: both links point at docs/design/plugins/FileStorage.md, which does not exist at this head; it is added by open PR #2080.
Failure scenario: after this PR merges before #2080, both links are 404 and the dependency cannot be read.
Fix: link PR #2080 or merge after it.

17. Settings.md:299 and Settings.md:320: the binding appendix is not self-contained and does not compile.
Problem: Register, Read, Change, ReadUser, ReplaceUser, SetMember, ByInstance, Declarations, AuthorizeProject, Authorized, AuthorizedProjects, Snapshot, UserSnapshot and AgentSnapshot are used but not defined. register returns Registered while the caller example at line 48 uses the result as a SourceId. authorized_projects is declared sync returning AuthorizedProjects while the operations table gives it a closed error.
Failure scenario: the appendix cannot compile and an implementer must invent the request and reply shapes; the closed error has no return path.
Fix: define each type, make register return SourceId or use .id in the example, and return a Result from authorized_projects or drop its closed error.

P3

18. ExecutionSettings.md:11 and ExecutionSettings.md:92: the user-only change is presented as a rename.
Problem: the contract makes both switches user-only, but line 92 says only the service name changes and the delivery table lists only the rename. The current source declares user_only: Vec::new() (crates/dim-app-server/src/execution_settings.rs:45-60).
Failure scenario: an implementation following the delivery leaves owner and agent writes allowed, so the stated authority rule is false; or a write that used to succeed returns user_only without a migration entry.
Fix: state the authority change and add userOnly to the declaration and the delivery list, or drop the claim.

19. PermissionRules.md:71 and CollaborationModelPolicy.md:54: the client paths omit operation_interrupted.
Problem: the current owners map SettingsError::Cancelled to operation_interrupted (crates/dim-app-server/src/permission_rules.rs:129-134; crates/dim-app-server/src/collaboration_model_policy.rs:85-92), and the linked designs say cancellation is operation_interrupted (docs/design/appserver/permission-command-rules.md:282; docs/design/subagent-model-policy.md:143).
Failure scenario: a call interrupted by owner unload returns an undocumented code.
Fix: add the kind, or state that cancellation has no reply and remove the server mapping.

20. SettingsMethods.md:23 and SettingsMethods.md:117: the caller counts and the migration scope are understated.
Problem: the CLI reads five settings sources, not four (crates/dim-cli/src/prompt_command.rs:13; crates/dim-cli/src/recording.rs:8; crates/dim-cli/src/session_host.rs:1719,1828,1861; crates/dim-cli/src/management/workflow.rs:26); the Web pages call settings.read and settings.update; and the Workflow TypeScript plugin calls settings.projects (runtime/plugins/workflow/catalog.ts:35), which the delivery table already includes.
Failure scenario: the justification for deleting settings.sources and the migration scope are both incomplete.
Fix: state the real source count and list every caller, including the Web entry and Workflow.

21. SettingsMethods.md:96: the update flow contradicts its own cancellation rule.
Problem: the method table says a cancelled call is dropped (line 76), but the flow says a cancelled call ends settings_failed or reloading; Settings replace_user lists cancelled separately.
Failure scenario: clients cannot tell whether a cancelled write produced a reply.
Fix: use one cancellation rule for the namespace.

Comment thread docs/design/plugins/Settings.md Outdated

| Operation | Intent | Request | Reply | Cancellation | Errors |
| --- | --- | --- | --- | --- | --- |
| `register` | Make a document addressable under the calling row, checked once | `{source, userFile, projectFile?, schema}` | `{id}` | None; a refusal fails the row's `apply` | `invalid` |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

register cannot express user-only members: the request is {source, userFile, projectFile?, schema}, yet change must return user_only and agent_set must refuse those members. Every current declaration carries a user-only pointer list (docs/design/appserver/settings-service.md section 3.1; docs/design/plugins/PluginManager.md:370; crates/dim-app-server/src/settings/declared.rs:19-21), for example /userAgent in crates/dim-app-server/src/provider_settings.rs:43 and /base, /summary, /skills in crates/dim-app-server/src/prompt_settings.rs:123. Without the field the authority rule and the user_only error are unreachable. Add userOnly to the operation, the Data section and both Rust bindings.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in be0b517: userOnly is in the register request, the Data section, the wire declaration and both bindings (Settings.md:125,141,273,537).

Comment thread docs/design/plugins/Settings.md Outdated
| `register` | Make a document addressable under the calling row, checked once | `{source, userFile, projectFile?, schema}` | `{id}` | None; a refusal fails the row's `apply` | `invalid` |
| `read` | The document a source id names, as stored now | `{id, scope}` | `{document}` | While the document is read | `invalid`, `invalid_document`, `too_large`, `closed`, `cancelled` |
| `change` | Apply one change to a document under the owner's exclusion | `{id, scope, change}` | `{}` | Before the write; the change's future is dropped | `invalid`, `invalid_document`, `user_only`, `rejected`, `too_large`, `unsynced`, `closed`, `cancelled` |
| `read_user` | The user's draft base for a document | `{source}` | `{revision, document}` | While the document is read | `unknown_source`, `invalid_document`, `too_large`, `closed`, `cancelled` |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

read_user and replace_user address a document by source name and no longer restrict the client path to declared sources. docs/design/appserver/settings-service.md sections 4.3 and 8.1 say the opposite: settings.* serves declared sources only and a Rust source such as mcp is settings_unknown_source (crates/dim-app-server/src/settings/declared.rs:185-208). The target also needs these operations for Rust owners, so a local client could read mcp-secrets directly through settings.read. Bind the operations to a registered source id, or enforce the declared-only rule in SettingsMethods and state it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Partially fixed in be0b517: read_user and replace_user take a source id and SettingsMethods enforces declared-only, but the new row binding says a cross-row id is invalid while SettingsMethods calls these operations across rows. Still open; see the new review.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in fcf1dd5 (head 8ef2691). read_user and replace_user take a source id; the row check is scoped to read and change, and the user path is explicitly exempt (Settings.md:119, :138). SettingsMethods resolves a declared name to the id.

Comment thread docs/design/plugins/Settings.md Outdated
| `change` | Apply one change to a document under the owner's exclusion | `{id, scope, change}` | `{}` | Before the write; the change's future is dropped | `invalid`, `invalid_document`, `user_only`, `rejected`, `too_large`, `unsynced`, `closed`, `cancelled` |
| `read_user` | The user's draft base for a document | `{source}` | `{revision, document}` | While the document is read | `unknown_source`, `invalid_document`, `too_large`, `closed`, `cancelled` |
| `replace_user` | Replace a document with the draft the user edited at the revision read | `{source, expectedRevision, document}` | `{revision}` | Before the write | `unknown_source`, `invalid_document`, `conflict`, `too_large`, `unsynced`, `closed`, `cancelled` |
| `agent_read` | A document for the agent, user-only secrets withheld | `{source}` | `{document, writeOnly}` | While the document is read | `unknown_source`, `invalid_document`, `too_large`, `closed`, `cancelled` |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The intent says "user-only secrets withheld", but the Authority line and the Data section say only writeOnly members are withheld from the agent; user-only is a write rule. docs/design/plugins/ExecutionSettings.md:11,23 makes the execution switches user-only and exposes them to the agent's settings tool through this path. If agent_read hides user-only members, the tool loses sandbox and network. Say "writeOnly members withheld".

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in be0b517: agent_read withholds writeOnly members and the intent says so (Settings.md:130).

Comment thread docs/design/plugins/Settings.md Outdated

- `SourceId` is the id `register` assigns; it is bound to the row that registered it, and a caller from another row is `invalid`.
- `Document` is one JSON object; a missing user document reads as its default document.
- `Scope` is `"user"` or `{"project": ProjectId}`. `ProjectId` is this process's project id; a project id from another process is not accepted.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ProjectId is a string here, while the current scope is SettingsScope::Project(usize) (crates/dim-agent-capabilities/src/settings.rs:11-18) and settings-service.md section 4.1 defines {"project": <root>} as a process-local number. Line 5 says this document replaces only sections 4.2-4.5, so section 4.1 remains authoritative. If the string id is intended, say that this also replaces section 4.1 and the event payloads; otherwise keep the number.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in be0b517: the project id is a number and Scope::Project(ProjectId) serializes as {"project": number} (Settings.md:140,263,282-285).

Comment thread docs/design/plugins/Settings.md Outdated
| `changeUser` | Apply one change under the row's exclusion | `{source, change}` | `{version, document}` | `rejected`, `storage` |
| `replaceUser` | Replace a user document at an expected version | `{source, expectedVersion, document}` | `{version}` | `conflict`, `missing`, `overflow`, `storage` |

`change` in the public operations is `changeUser` on the native profile and FileStorage's `update` on the file profile; `replace_user` is `replaceUser` and FileStorage's `update`, which compares the revision Settings carries. `importUserIfAbsent` runs on the first read of a source whose file exists and whose row does not; a version is a positive integer that increases on every committed write, and the revision Settings publishes is derived from it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

FileStorage's update has no version or digest parameter; its own target contract says the document revision is checked inside the caller's change helper (PR #2080, FileStorage.md caller example). As written, an implementer may expect FileStorage to compare expectedRevision and a stale user draft can overwrite a concurrent write without a conflict. Say that Settings reads and compares the revision inside the update callback.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in be0b517: the file-profile revision is compared inside the FileStorage update callback (Settings.md:157).

Comment thread docs/design/plugins/SettingsMethods.md Outdated

| Kind | What the caller does next |
| --- | --- |
| invalid params | Fix the request: an unknown field, a missing revision, or a document that is not an object |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

invalid params names only a non-object document, but a schema violation on a client write is also a caller error: settings-service.md section 6 maps invalid_document to invalid params on the client path, and crates/dim-app-server/src/settings_methods.rs:98-104 maps Document and DocumentShape to invalid. Under the new mapping an out-of-range maxChars falls into settings_failed, whose guidance is read again, not fix the draft. List invalid_document under invalid params with the validator message.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in be0b517: a schema refusal is invalid params with the validator message (SettingsMethods.md:88,96).


Scope: process. Issue: [#2017](https://github.com/arcships/dim/issues/2017). Feature design: [Prompt overrides](../appserver/prompt-overrides.md).

PromptSettings owns the `prompts` document and the three model-facing texts it carries: the base identity and rules, the compaction summary prompt, and the Skills instructions. This document is the owner's target contract; it replaces the three `*PromptSettingsHost` services with one service.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This replaces the three ports, but the linked feature design still defines three services with different operation names and bare string or null replies (docs/design/appserver/prompt-overrides.md section 3.1: basePromptSettingsHost.base, skillsInstructionsSettingsHost.instructions, summaryPromptSettingsHost.systemPrompt). The one-service {text} wrapper is a different wire shape. Mark that section superseded or update it in this PR and add it to the delivery list.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in be0b517: prompt-overrides.md §3.1 is superseded. Its §4 sentence about settings.sources is still stale; see the new review.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in fcf1dd5 (head 8ef2691). prompt-overrides.md §4 now says settings.sources is deleted (prompt-overrides.md:104-106), and §3.1 is superseded by the one promptSettings service (PromptSettings.md:76).

Comment thread docs/design/plugins/PromptSettings.md Outdated
PromptSources reads the base text once, while its Session part applies.

```rust
let base = prompt_settings.base().await.ok().flatten();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

With the appendix, base() returns Result<Text, _>; .ok() gives Option<Text>, which has no flatten(), and factory.base.or(base) does not type-check against Option<Text>. The same pattern appears in ProviderSettings.md:32 and ModelLog.md:31-32. Make the examples unwrap Text.text or return the optional value directly.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Still open in be0b517: the appendix returns PromptText, so .ok().flatten() does not type-check; ProviderSettings.md:32 and ModelLog.md:31 have the same pattern.

| §7 caller complexity | Nothing of the source, its file or the user-only rule reaches the caller. |
| §7 one change | The name change and its callers migrate in the same change. |
| ADR 002 D1 | Process scope: the switch applies to the process, not a Session. |
| ADR 002 D3 | HostPlatform depends on the port; the port has no Settings or file dependency. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The rule check says HostPlatform depends on the port type, but the appendix marks the service on the owner type that depends on Settings (line 42) and defines no port type. HostPlatform and the other consumers live in dim-agent-capabilities or aimux (crates/dim-agent-capabilities/src/host_platform.rs:7; crates/dim-agent-capabilities/src/execution_settings.rs:43-87), so a typed call to an App Server owner would violate ADR 002 D3. Name the crate and type of the service or keep a capability-side port. The same applies to PromptSettings.md:87 and PromptSuggestionSettings.md:86.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Partially fixed in be0b517: the consumer ports are named, but ExecutionSettings.md:43 names ExecutionSettings while its appendix returns Switches. Still open.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in fcf1dd5 (head 8ef2691). ExecutionSettings.md:43 names the port trait ExecutionSettingsRead and the reply type Switches, and the appendix defines both (ExecutionSettings.md:111-135). PromptSettings.md:45 names its three capability-side traits and PromptSuggestionSettings.md:43 names SuggestionSettings/PromptSuggestionSettingsRead.


## Requirements raised to mechanism owners

None new. HostPlatform's read at process preparation is unchanged in shape; only the service name changes.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The requirements say only the service name changes, but lines 11, 22 and 83 make the switches user-only. The current registration declares user_only: Vec::new() (crates/dim-app-server/src/execution_settings.rs:45-60), and the delivery table lists only the rename. State the authority change and add userOnly to the execution declaration and the delivery list, or drop the user-only claim.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in be0b517: the execution authority change and its delivery entry are stated (ExecutionSettings.md:11).

Declare user-only members in the registration, keep the client methods' request
and reply shapes, serve declared sources only and resolve their ids, keep the
process-local project number and the {root, cwd} fact, and state the project
table's generation lifetime. Errors carry {code, message} with snake_case codes;
the change callback is a positional parameter and keeps the callback's code.
Name the capability-side ports, link FileStorage through its PR, and supersede
the paragraphs this board replaces in the existing design documents.
@eric8810

eric8810 commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

已按评审修改,head be0b5171fde56b7cfbe978042deef635984e0034。

P1

  1. register 的 userOnly:register 的请求、Data 节与两个 Rust 绑定都加 userOnly(不可达的成员让 register 为 invalid);Rust 类型走 BusinessDocument::USER_ONLY,附录写明。
  2. 客户端调用方:保留客户端协议——settings.read/settings.update 仍收 {source, scope}、仍回 {revision, document};写明准入(配对设备不服务,已认证的 loopback Web 入口按白名单服务 model-log 与 execution);迁移表加 Web 行(DiagnosticsSettings、PermissionsSettings),CLI 行改为五个来源且形状不变;Client-visible changes 只列被删的 settings.sources/settings.projects。
  3. 声明式来源边界:read_user/replace_user 改按 source id 寻址;SettingsMethods 用不带 instance 的 declared_sources 把客户端 source 名解析成声明式来源 id,Rust 来源为 settings_unknown_source;Rust 所有者用自己的 id;规则写在 SettingsMethods。
  4. 项目号与事件:保留进程本地的数字(ProjectId = u64,Scope::Project(ProjectId) 为 newtype,序列化仍是 {"project": <number>}),事件保持 {root, cwd},§4.1/§4.4 不变;契约写明这个号码是 Settings 自己的、不是 FileStorage 的 root id。

P2

  1. unsynced:删掉“重复 change 幂等”的说法,错误表与例外改成“读后再做,不要不读就重复”。
  2. 错误种类:公开错误表加 failed(FileStorage 读写、行事务、worker),并写明 FileStorage 的种类如何映射;各操作的错误列同步。
  3. 项目表重载:契约与流程改成“进程代次状态,重载后由准入重新建立”,去掉“重载后同一 project id 仍有效”的说法与对应验收。
  4. FileStorage update:改成 Settings 在 update 回调内读当前 revision 并比较 expectedRevision,FileStorage 只持文件键、不懂版本。
  5. 错误枚举序列化:八个附录的错误枚举都带 Serialize 与 {code, message}(Settings 手写 impl,其余 #[serde(tag = "code", rename_all = "snake_case")]),wire code 与错误表一致。
  6. change 回调:改为方法的按引用参数(不在请求结构里),ChangeRefused: From<CallError> 从 wire 错误取回 code 与 message。
  7. Scope 形状:Project(ProjectId) newtype,wire 为 {"project": <number>}。
  8. agent_read 意图:改为“withheld writeOnly 成员”,user-only 只是写规则。
  9. prompt-overrides §3.1:已在本 PR 改成指向 PromptSettings 的链接,并列入 Supersedes 与交付清单。
  10. 跨 crate 端口:ExecutionSettings、PromptSettings、PromptSuggestionSettings、ProviderSettings、ModelLog 各写明 capability 侧的 trait 所在 crate(ExecutionSettingsRead、三个 prompt trait、PromptSuggestionSettingsRead、ProviderUserAgent、RecordingDestination),App Server 的所有者实现同一操作;PermissionRules 的 ReadCommandRules 绑到所有者;Collaboration 与所有者同 crate,直接调用。
  11. invalid params:列入 schema 不合法的草稿(消息是校验器的),并给出对应的下一步。
  12. FileStorage 前向链接:Settings 的依赖改为 design(fileStorage): target contract #2080 的 PR 链接;其余文档不再出现 FileStorage.md 链接。
  13. 附录自包含:所有请求、回复、错误类型都在附录定义;register 直接回 SourceId;authorized_projects 为同步、无错误。
  14. execution 的权限变更:ExecutionSettings 契约写明两开关改为 userOnly(现在声明为空),交付迁移与实现任务列入该变更。
  15. operation_interrupted:PermissionRules 与 CollaborationModelPolicy 的客户端方法错误加 operation_interrupted,permission-command-rules.md 的方法表同步。
  16. 调用方计数:SettingsMethods 写明 CLI 的五个来源、Web 两个页面与白名单、Workflow 插件;删除 settings.sources/settings.projects 的理由按真实调用方写。
  17. 取消规则:SettingsMethods 的读与写各一条规则,写是“准入后提交或回 settings_unsynced,丢弃等待不撤销”,与流表一致。

规则 A–G 的自查:错误序列化与回调参数按 A;错误表覆盖各流程的结束按 B;九份契约都加 Supersedes,被取代的段落已在本 PR 改成链接(settings-service §4.2/§4.5、§4.3→SettingsMethods、prompt-overrides §3.1、permission-command-rules §4.1、service-faces、resource-owner-operations §Settings、management-methods、subagent-model-policy、model-log、provider-management)按 C;客户端协议与用户可见行为不变,只有两个管理方法删除,单列 Client-visible changes 按 D;本板没有分页读,E 不适用;#2080 的链接用 PR URL、§7 链接指向 #2029 的标题、README By scope 随索引行更新、没有列出已关闭 issue 按 F;进程所有者不涉及按 id 直达内层,Rule check 里写明 ADR 027 不适用按 G。

node scripts/adr-check.mjs --base origin/main 与 cargo run --locked -p xtask-check 重跑通过;交付评论首行 head 已更新为 be0b5171f。

@eric8810
eric8810 requested a review from yyhhyyyyyy November 23, 2026 13:37

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Scope: this PR adds nine owner contracts under docs/design/plugins/ for Settings and the settings sections, updates the linked feature designs, and states the delivery for #2017 under the section 7 owner rules tracked by #2029 (refs #2017, #2015).

Verdict: REQUEST_CHANGES

Round-1 status

P1:

  1. Fixed. userOnly is in the register request, the Data section, the wire declaration and both bindings (Settings.md:125,141,273,537).
  2. Fixed. The Web entry is admitted for model-log and execution, the request and reply shapes are kept, and the delivery lists the Web pages (SettingsMethods.md:13,28,71,118-120).
  3. Partially fixed. read_user and replace_user now take a source id and SettingsMethods enforces the declared-only rule (Settings.md:128-129, SettingsMethods.md:5,12,77). The new row binding contradicts the client path (P2 4 below).
  4. Fixed. ProjectId is a number, Scope::Project(ProjectId) is a newtype variant, and the facts carry {root, cwd} (Settings.md:140,164,263,282-285,204).

P2:

  1. Fixed. unsynced now says to read before repeating (Settings.md:179,197).
  2. Fixed. failed covers storage, persistence and worker failures (Settings.md:180, and the operation columns).
  3. Fixed. The project table is generation state and the delivery acceptance was updated to match (Settings.md:199, delivery acceptance). The root-opening dependency is still broken (P1 1).
  4. Fixed. The file-profile revision is compared inside the update callback (Settings.md:157).
  5. Partially fixed. Static error enums now serialize with the documented tags, but a callback refusal still loses its code on the wire (P2 3).
  6. Fixed. The callback is a positional parameter and ChangeRefused has From<rutis::host::CallError> (Settings.md:305,486-493).
  7. Fixed. Scope is a newtype variant and serializes as {"project": number} (Settings.md:280-285).
  8. Fixed. agent_read withholds writeOnly members and the intent says so (Settings.md:130). The absolute "never returned" wording remains a P3.
  9. Fixed. prompt-overrides.md §3.1 is superseded. Its §4 still names settings.sources (P2 6).
  10. Partially fixed. The consumer ports are named. ExecutionSettings names the wrong reply type and the appendix does not define the port (P3 9).
  11. Fixed. A schema refusal is invalid params with the validator message (SettingsMethods.md:88,96).
  12. Partially fixed. The link points at #2080. The operations it names are absent from that contract (P1 1).
  13. Partially fixed. The request and reply types are defined, register returns SourceId, and authorized_projects is sync. Two compile errors remain (P2 2).

P3:

  1. Fixed. The execution authority change and the delivery entry are stated (ExecutionSettings.md:11, delivery).
  2. Fixed. operation_interrupted is in both owner contracts (PermissionRules.md:71-72,83, CollaborationModelPolicy.md:54-55,66).
  3. Fixed. Five CLI sources, the Web pages, and the Workflow plugin-face read are listed (SettingsMethods.md:24,28,118; verified against the CLI, Web and runtime/plugins/workflow/catalog.ts).
  4. Partially fixed. The cancellation and error wording still conflict with the dropped-call rule (P3 17).

P1

1. The FileStorage dependency names operations that #2080 does not define.

Problem: Settings.md:117 and Settings.md:191 depend on FileStorage's add_root; ModelLog.md:43 depends on root_path; the delivery caller table repeats both. At #2080's current head (e951536e), FileStorage.md says roots are host-registered values, "the public face exposes neither registration nor root lookup", and its Supersedes paragraph removes the register_root/root_path paragraph. Its operations table has read, write, import, update, create_directory, list and remove.

Failure scenario: an implementation of authorize_project has no operation that opens or registers the project root, so project scopes, authorized_projects, and the Workflow definition path cannot be implemented as written. ModelLog cannot build the recorder's destination from the home root. If this contract lands first, both dependencies are forward references to operations that will not exist.

Fix: name the host root registration and the value that carries the home root, or agree with #2080 on the operation and update this contract, its flows and the delivery in the same change.

P2

2. The binding appendix does not compile.

Problem: Settings.md:406-411 derives Copy for Project, which contains cwd: String (E0204). Settings.md:429-430 uses #[error("{code}: {message}")] on Refused(ChangeRefused), a tuple variant with one unnamed field; thiserror resolves {code} and {message} against the variant's own fields and fails (E0425). Both were confirmed with a minimal compile of the appendix text.

Failure scenario: an implementer copying the appendix gets a crate that does not build, and the delivery's graph and types checks start from this binding.

Fix: drop Copy from Project; use positional field access in the attribute (#[error("{}: {}", .0.code, .0.message)]) or make Refused a named-field variant.

3. A refused change does not keep its own code on the wire.

Problem: the appendix claims "a refused change keeps the callback's own code" (Settings.md:446) and the error table says rejected carries the change's code and message (Settings.md:176). Under rutis 0.23 the service error's code is computed by serde_code (service.rs). The manual Serialize is a struct serializer, which captures Tag from the first field (conflict), while debug_ident is Refused; same_ident("conflict", "Refused") is false, so the wire code falls back to Refused. The callback's code reaches the caller only in the error's data.code. The delivery acceptance for this claim has the same gap.

Failure scenario: a TypeScript or Python owner that branches on error.code sees Refused for every refusal and cannot act on the change's own code, although the contract says it can.

Fix: state that the refusal code is in data.code and update the acceptance, or give the refusal a fixed wire code and carry the dynamic code in data.

4. The source-id row binding contradicts the client path.

Problem: Settings.md:119, Settings.md:138 and the invalid row at Settings.md:172 say a source id from another row is invalid. SettingsMethods.md:77 resolves a declared source name to an id and calls read_user/replace_user with it from another row, and the delivery acceptance says a cross-row id is invalid. The appendix gives read_user and replace_user no caller parameter, unlike read and change (Settings.md:494-503).

Failure scenario: if the binding is enforced as written on the user operations, every settings.read and settings.update returns invalid; if it is not, the contract's stated invariant is false for the user path. An implementer has to guess which rule wins.

Fix: scope the binding to the owner operations read and change, or state the exception that admits SettingsMethods and how the user path crosses rows.

5. declared_sources and agent_read give writeOnly two wire types.

Problem: the declared_sources reply lists writeOnly in each item (Settings.md:132) and the appendix declares write_only: bool (Settings.md:385), while the Data section defines writeOnly as the JSON Pointer list that agent_read returns (Settings.md:144). The retained Sources shape in settings-service.md §4.1 also defines the declaration field as a bool hint.

Failure scenario: a generated TypeScript declaration cannot be both boolean and string[]; a client reading declarations and an agent reading a document disagree about the same field name.

Fix: rename one of the two, for example writeOnlyHint in declarations or withheld in the agent reply, and state both shapes.

6. The sibling contracts still describe the old face, and the Supersedes claims do not cover them.

Problem: PluginManager.md:315-316 still says config returns the user document, revision, schema and user-only fields, lists writeOnlySet, performs an owner update with the revision read, and points at the deleted settings.sources. The new agent path returns {document, writeOnly} and carries no revision, so the PluginManager contract cannot be satisfied by agent_read/agent_set. The service-faces sections the owner contracts claim to supersede remain: service-faces.md:212-216 still defines the three prompt ports and links to the superseded prompt-overrides.md §3.1; service-faces.md:358 and :362 still say executionSettingsHost.read and promptSuggestionSettingsHost.read; service-faces.md:95 still lists the commandRules row; AgentSettings.md:120 still names executionSettingsHost. prompt-overrides.md:108 still says settings.sources publishes the schema, while PromptSettings.md:72 says §4 stays in force. overview.md:103,334,509 still lists settings.sources and settings.projects.

Failure scenario: an implementation that follows the old sibling text keeps a deleted method, adds a revision to the agent path, or removes a value the tool contract promises. A reader cannot tell which document is authoritative.

Fix: update these paragraphs and catalog rows in this change, or list each owning PR and remove the Supersedes claims that are not true. At minimum correct the three prompt port sentence, the §4.10 host names, the commandRules row, AgentSettings.md:120 and prompt-overrides.md §4.

7. The Supersedes retention of §4.1, §6 and §11 is false.

Problem: Settings.md:204 keeps settings-service.md §4.1 shapes, §6 error state meanings and §11 acceptance in force. §4.1's Snapshot is {revision, document} while the new read returns {document}; its Sources shape describes the deleted settings.sources. §6 still documents user_only_field and invalid_scope, while this contract's codes are user_only and invalid. §11 items 1-2 test the revision on the owner read/update path and items 7-10 test settings.sources and settings.projects, all changed here.

Failure scenario: an implementation that satisfies §11 fails the new contract, and the flow tests keep testing removed calls and old codes.

Fix: supersede the changed parts of §4.1, §6 and §11 explicitly and point at the delivery tests, or remove them from the retention list.

8. The consumer examples still do not type-check.

Problem: PromptSettings.md:32 calls prompt_settings.base(...).await.ok().flatten(), but the appendix returns Result<PromptText, _>, so .ok() is Option<PromptText>, which has no flatten(), and factory.base.or(base) expects the factory's Option<Arc<str>>. ProviderSettings.md:32 (Option<UserAgent>) and ModelLog.md:31 (Option<Recording>) have the same pattern, and Provider.md:118 in #2096 copies it. This is the round-1 inline on PromptSettings.md:32.

Failure scenario: the examples cannot be copied into a consumer, so the port migration has no working reference.

Fix: use .await.ok().and_then(|view| view.text) or return the optional value directly; update the #2096 copy and report the owning PR.

P3

  1. ExecutionSettings.md:43 names the reply type ExecutionSettings and the trait ExecutionSettingsRead, but the appendix returns Switches and defines no trait (ExecutionSettings.md:128). Name one type and show the port.
  2. Settings.md:132,134 declares declared_sources and authorized_projects with no cancellation and no errors, but the flow row at Settings.md:190 gives them cancelled and closed outcomes. Give the sync operations their own row.
  3. Settings.md:234 says the caller handles conflict, user_only, rejected and unsynced only, while the Errors table also exposes invalid, unknown_source, invalid_document, too_large, failed, closed and cancelled.
  4. Settings.md:91 uses view.writeOnly in a Rust comment; the appendix field is write_only.
  5. subagent-model-policy.md:56 links ../plugins/CollaborationModelPolicy.md, which resolves to docs/plugins; the target is plugins/CollaborationModelPolicy.md.
  6. agent_set has no code for a writeOnly member: Settings.md:131,172,175 define invalid for a pointer that names no member and user_only for a member only the user changes, but a writeOnly member is neither. Name the code or state which one covers it.
  7. Settings.md:14 and Settings.md:144 say writeOnly members are never returned, while the retained settings-service.md §4.1 says neither rule scans items, $defs or anyOf, so a member under items is returned. Keep the properties-only scope in this contract.
  8. ExecutionSettings.md:71 names the port executionSettingsHost, but ADR 011 D1's type is ExecutionSettingsHost; the delivery deletes that type. Name the type as superseded.
  9. SettingsMethods.md:86,90,101,108 still mix "the call is dropped" with operation_interrupted: a caller-cancelled call has no reply, so only owner unload can answer it. Separate the two.
  10. service-faces.md:217 keeps the heading "settingsService: keep call cancellation" while its body says the row is replaced. Rename the heading with the paragraph.

Comment thread docs/design/plugins/Settings.md Outdated

### Dependencies

- [FileStorage](https://github.com/arcships/dim/pull/2080): `add_root` for an authorized project, `read` and `update` for a document stored as a file, and `create_directory` for the project's directory under `.dimcode`. Settings passes no path outside an authorized root.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add_root is not on #2080's FileStorage face at its current head: that contract makes roots host-registered values and says the public face exposes neither registration nor root lookup (its Roots paragraph and Supersedes paragraph). Its operations are read, write, import, update, create_directory, list and remove. The authorize_project flow at line 191 and the delivery both call add_root, so the authorized-project flow has no operation that opens the directory. Fix: name the host root registration and the value that carries the home root, or coordinate with #2080 before this contract lands.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 8ef2691. #2080 at head 7224c0c defines add_root and says an existing root answers its id (FileStorage.md:159, :192); its sibling list names #2094 as using add_root, read and update (FileStorage.md:226). Settings.md:117, :192 and :200 now use it.

Comment thread docs/design/plugins/ModelLog.md Outdated

- [Settings](Settings.md): `register` for the `model-log` source and `read` for its value.
- The Rust port, for the consumer outside the App Server: the trait `RecordingDestination` lives in `dim-agent-aimux` where the recorder is, and the App Server's `ModelLog` implements it and serves the same read on the wire.
- FileStorage: `root_path` for the home root, once, to build the destination directory.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

root_path is not on #2080's FileStorage face: that contract moves root registration to the host and removes root lookup from the face. The recorder has no documented way to learn the home root. Fix: receive the home root as an assembly value, as the host hands root paths to callers, or name the host operation that answers it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 8ef2691. #2080 at head 7224c0c defines root_path (FileStorage.md:160) and names #2094's ModelLog as using it (FileStorage.md:226). ModelLog.md:47 now names root_path and the home root id.

Comment thread docs/design/plugins/Settings.md Outdated
pub root: ProjectId,
}

#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Project derives Copy with a String field (cwd), which does not compile (E0204). Drop Copy; Clone is enough for every use in the appendix.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in fcf1dd5 (head 8ef2691). Project derives Debug, Clone with cwd: String and no Copy (Settings.md:408-413); Authorized keeps Copy with the numeric ProjectId only (Settings.md:402-406).

Comment thread docs/design/plugins/Settings.md Outdated
#[error("{0}")]
UserOnly(String),
#[error("{code}: {message}")]
Refused(ChangeRefused),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thiserror resolves {code} and {message} against the variant's own fields. Refused(ChangeRefused) is a tuple variant with one unnamed field, so the attribute at line 429 does not compile (E0425, cannot find value code). Use #[error("{}: {}", .0.code, .0.message)] or make the variant Refused { code, message }.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Partially fixed in fcf1dd5 (head 8ef2691). The Refused(ChangeRefused) tuple variant is gone, but ChangeRefused still has #[error("{code}: {message}")] with fields reason and message (Settings.md:299-303), so thiserror still fails with E0425. Change {code} to {reason}; that clears the two round-2 compile errors together with the Project fix.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 0677c71. Refused(ChangeRefused) is gone; ChangeRefused is a named-field struct with #[error("{reason}: {message}")] (Settings.md:298-304), so both thiserror placeholders resolve.

Comment thread docs/design/plugins/Settings.md Outdated
}

impl SettingsError {
/// The wire `code`; a refused change keeps the callback's own code.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Under rutis 0.23 this claim does not hold for a refusal. The error code is computed by serde_code (service.rs): the manual struct serializer captures Tag from the first field, debug_ident is Refused, and same_ident("conflict", "Refused") is false, so the wire code falls back to Refused, not the callback's code. The callback's code reaches the caller only in the error's data.code. Fix: document the data path, or give the refusal a fixed code and carry the dynamic code in data; update the delivery acceptance in the same change.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Partially fixed in fcf1dd5 (head 8ef2691). The contract fixes the wire code to rejected and carries the callback code in reason (Settings.md:176, :432-433; PR body). The delivery acceptance still has one bullet saying the refusal keeps the callback's code while a later bullet says the code is in reason; delete the stale bullet.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 0677c71. The delivery acceptance (issue comment 7093439923, lines 66 and 71) now has one rule: the wire code is rejected, the callback's code is reason. The old bullet that kept the callback's code on the wire is gone.

Comment thread docs/design/plugins/Settings.md Outdated

## Supersedes

- [Settings service](../appserver/settings-service.md) §4.2 (the `settings` service) and §4.5 (the Rust binding); §4.3 is [SettingsMethods](SettingsMethods.md)'s. The document's §3 state, §4.1 shapes, §4.4 events, §6 errors' state meanings, §7 security and §11 acceptance stay in force; §4.1's `Scope` is the `Scope` below and §4.4's `project_authorized` payload keeps `{root, cwd}`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The retained sections do not stay in force unchanged. settings-service.md §4.1's Snapshot is {revision, document} while the new read returns {document}, and its Sources shape describes the deleted settings.sources. §6 still documents user_only_field and invalid_scope, while this contract's codes are user_only and invalid. §11 items 1-2 test a revision on the owner read/update path and items 7-10 test settings.sources and settings.projects, all changed here. Fix: supersede the changed parts of §4.1, §6 and §11 explicitly and point at the delivery tests, or remove them from the retention list.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Partially fixed in fcf1dd5 (head 8ef2691). §4.1, §6 and §11 now say superseded, but the same Supersedes bullet keeps §9 and §10 in force, and they still say discovery is settings.sources (settings-service.md:310, :333-336); §1, §1.1 and §2 also still list settings.sources/settings.projects and SettingsService. See the round-3 body.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Partially fixed in 0677c71. Sections 4.1, 4.2, 4.3, 4.5, 5, 6 and 11 now point at the contracts, and sections 1, 1.1, 2, 3.1, 9 and 10 were updated in this head. Remaining: settings-service.md:284-286 says three methods and :319 says sections 4.1 to 4.4 are the contract; section 8 is unchanged. P3; see the new review.

Comment thread docs/design/plugins/Settings.md Outdated
- [Settings service](../appserver/settings-service.md) §4.2 (the `settings` service) and §4.5 (the Rust binding); §4.3 is [SettingsMethods](SettingsMethods.md)'s. The document's §3 state, §4.1 shapes, §4.4 events, §6 errors' state meanings, §7 security and §11 acceptance stay in force; §4.1's `Scope` is the `Scope` below and §4.4's `project_authorized` payload keeps `{root, cwd}`.
- [Settings service](../appserver/settings-service.md) §8.1's note that Rust owners keep their own methods stays; the methods' shapes are in each owner's contract.
- [Resource owner operations](../contracts/resource-owner-operations.md) §Settings.
- [Service faces](../service-faces.md) §3.3's `settingsService` row, §3.2's host-port sentence for the three prompt ports, and §4.1's `settingsService` paragraph.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The sentence this claims to supersede is not in service-faces §3.2. §3.2 line 104 is the executionSettings/promptSuggestionSettings port sentence; the three prompt ports are in §4 at lines 212-216 and remain, still linking to the superseded prompt-overrides §3.1. ExecutionSettings.md:72 and PromptSuggestionSettings.md:71 make the same claim for §4.10, whose lines 358 and 362 still say executionSettingsHost.read and promptSuggestionSettingsHost.read. Fix: update those sentences, the commandRules row at line 95, and AgentSettings.md:120, or correct the Supersedes claims.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Partially fixed. The three-prompt-port paragraph in service-faces §4 is now the one promptSettings sentence (service-faces.md:212-216), but Settings.md:209 still points at "§3.2's host-port sentence for the three prompt ports". §3.2's sentence is the executionSettings/toolchainSourceHost/promptSuggestionSettings one (service-faces.md:104). Point at §4.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 0677c71. Settings.md:209 now names section 3.2's host-port sentence for executionSettings and promptSuggestionSettings and section 4's prompt-ports paragraph, which is the paragraph at service-faces.md:212. One precision issue remains at service-faces.md:104 (the sentence pairs the first two names with the first and third contracts); see the new review.

Comment thread docs/design/plugins/SettingsMethods.md Outdated
| Method | Intent | Request | Reply | Cancellation | Errors |
| --- | --- | --- | --- | --- | --- |
| `settings.read` | The user's draft base for one declared document | `{source, scope}` | `{revision, document}` | The call is dropped; nothing changes | invalid params, `settings_unknown_source`, `settings_failed`, `operation_interrupted`, reloading |
| `settings.update` | Replace a declared document with the draft at the revision read | `{source, scope, expectedRevision, document}` | `{revision, document}` | An admitted write commits or ends `settings_unsynced`; a wait dropped before admission changes nothing | invalid params, `settings_unknown_source`, `settings_conflict`, `settings_unsynced`, `settings_failed`, `operation_interrupted`, reloading |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The cancellation column says an admitted write commits or ends settings_unsynced, but the errors column lists operation_interrupted, and line 90 says it means the call was cancelled or the part is unloading. A call the caller cancels is dropped and has no reply; only unloading can answer it. The read row at line 85 has the same pair. Separate the two: caller cancellation drops the call, owner unload answers operation_interrupted.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in fcf1dd5 (head 8ef2691). SettingsMethods separates caller cancellation (no reply) from operation_interrupted (owner unload) in the rows and the error paragraph (SettingsMethods.md:85-86, :90, :101).

PromptSources reads the base text once, while its Session part applies.

```rust
let base = prompt_settings.base(cancelled.child_token()).await.ok().flatten();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This still does not type-check. The appendix returns Result<PromptText, _>, so .ok() is Option<PromptText>, which has no flatten(), and factory.base.or(base) expects the factory's Option<Arc<str>>. Use .await.ok().and_then(|view| view.text) or return the optional text directly. ProviderSettings.md:32 and ModelLog.md:31 have the same pattern; Provider.md:118 in #2096 copies it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 0677c71. PromptSettings.md:32-34 uses the trait's Option<Arc<str>> reply; ProviderSettings.md:32-37 and ModelLog.md:31-38 use and_then on the service reply's optional member. The PromptSettings note to #2096 can be withdrawn: #2096's Provider.md at 05c7515 now uses .ok().flatten() on the port, and no .ok().flatten() remains on a service reply.

Comment thread docs/design/subagent-model-policy.md Outdated
| Read the adopted leader model | `Session::get<PromptSnapshot>(branch_id)` while consuming `collaboration/request`, before starting its delivery task |
| Resolve an explicit model | The existing `AgentIndex` model-selection host and configured/non-catalog profile paths |
| Persist and edit policy | Native `BusinessDocument`, `SettingsService::read/update`, source CAS and owner management methods, as used by `permission_rules.rs` |
| Persist and edit policy | [CollaborationModelPolicy](../plugins/CollaborationModelPolicy.md): the `collaboration` source, its `policy` value read and the `collaboration.*` methods |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The link resolves to docs/plugins/CollaborationModelPolicy.md, which does not exist. From docs/design/subagent-model-policy.md the target is plugins/CollaborationModelPolicy.md.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in fcf1dd5 (head 8ef2691). The row links plugins/CollaborationModelPolicy.md (subagent-model-policy.md:56).

Depend on FileStorage operations that exist in #2080: the host registers roots
and hands their paths as values, so Settings and ModelLog take the home
directory from the assembly and Settings reads and updates documents by
absolute path. The refusal is a Rejected variant whose wire code is rejected
and whose callback code is reason; the appendix compiles in a temporary crate.
Scope the source-id row binding to read and change, rename the declaration hint
to writeOnlyHint, split the sync operations from the cancelled ones, and correct
the examples and retained documents the review named.
@eric8810

eric8810 commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

已按评审与自查标准修改,head 8ef2691ce3aff905c1ddeb8805cf453ab6de529a(FileStorage 对齐提交)。

评审逐条处理

P1

  1. FileStorage 依赖:按 design(fileStorage): target contract #2080 最新 head 7224c0cd4 对齐。Settings 用 add_root(项目授权;已有根回答同一 id)、read、update(绝对路径);authorize_project 先 add_root 再记录 cwd → 号码并发布事实(异步,错误 invalid/closed/cancelled)。home 目录用装配给的宿主值:root_path/stat 在 design(fileStorage): target contract #2080 存在,Settings 不需要,这是选择,契约里写明。ModelLog 用 root_path 取 home 目录,目的地是 <path>/model-log。交付迁移表与验收同步。

P2

  1. 附录编译:临时 crate(workspace crates + rutis 0.23 / rust 1.100)逐份放九份附录跑 cargo check,通过。修掉两处:Project 去掉 Copy;Refused(ChangeRefused) 改成 Rejected { reason, message } 命名变体。
  2. 拒绝的 wire code:按 rutis serde_code 的规则改为固定 rejected,回调自己的 code 进 reason(ChangeRefused{reason, message},From<CallError> 把 wire code 读进 reason);错误表、Data、验收同步。临时 crate 的断言:Rejected → {code:"rejected", reason, message},UserOnly/Unsynced → snake_case。
  3. source id 行绑定:把绑定限定在 read/change(它们有 caller: &Ctx);read_user/replace_user 不查行,供 SettingsMethods 与各所有者命名空间使用,Data 与 Dependencies 写明。
  4. writeOnly 两个 wire 类型:声明里改名为 writeOnlyHint: bool,agent 路径保留 writeOnly 指针列表;Data、Declaration、PluginManager 的 config 行同步。
  5. 兄弟契约:更新 PluginManager.md 的 config 两行(declared_sources + agent_read/agent_set,无 revision)、service-faces.md §4 开头的三端口段、§4.10 的 executionSettings/promptSuggestionSettings 名字、§3.2 的 commandRules 行、AgentSettings.md 的 executionSettingsHost、prompt-overrides.md §3/§3.1/§4/§7、overview.md 的三处方法列表。
  6. Supersedes 的真实性:settings-service.md §4.1、§5、§6、§11 已在本 PR 改成指向 Settings 的链接(保留 §3、§4.4、§7、§8.1、§9、§10);Supersedes 列表同步。
  7. 调用方示例可编译:PromptSettings/ProviderSettings/ModelLog 改成 .ok().and_then(|view| view.text / user_agent / directory);design(provider): target contracts for the model and provider owners #2096 的 Provider.md 同一段已在 design(provider): target contracts for the model and provider owners #2096 留评论请其所有者改。

P3

  1. ExecutionSettings 类型与端口:统一用 Switches 作为回复类型,附录补上 ExecutionSettingsRead trait(dim-agent-capabilities)。
  2. 同步操作单列:declared_sources/authorized_projects 单独一行流程,写明无取消、无错误、无资源释放。
  3. caller complexity:改为业务结果加普通失败,覆盖全部错误种类。
  4. Rust 注释:view.writeOnly → view.write_only。
  5. 链接:subagent-model-policy.md 的 ../plugins/... → plugins/...。
  6. agent_set 的 writeOnly 成员:user_only 行明确覆盖 writeOnly 成员。
  7. properties-only 范围:契约写明两条规则只扫 properties,不扫 items/$defs/anyOf。
  8. ADR 011 D1 的类型名:Supersedes 写明 ExecutionSettingsHost 类型与 executionSettingsHost 服务名被替换,决定不变。
  9. 取消与回复:SettingsMethods 分开读与写:被调用方取消的调用没有回复;operation_interrupted 只表示部件卸载。
  10. service-faces 标题:§4.1 settingsService:已被 Settings 取代。

自查(第 1–3 节)

  1. 引用核对:FileStorage 操作按 design(fileStorage): target contract #2080 head 7224c0cd4 的 operations 表核对(add_root、root_path、stat、read 带 size 都在);CLI/Web/Workflow 调用方按代码核对;错误 code 按 rutis 0.23 serde_code 核对。
  2. 与现有文档的冲突:在本 PR 解决,不只列清单(见 P2-6/P2-7)。
  3. Supersedes 逐条改动:settings-service.md §4.1/§4.2/§4.3/§4.5/§5/§6/§11、prompt-overrides.md §3/§3.1/§7、permission-command-rules.md §4.1、service-faces.md 相关行、resource-owner-operations.md §Settings、management-methods.md 列表、subagent-model-policy.md、model-log.md、provider-management.md、PluginManager.md、AgentSettings.md、ContextCompaction.md、overview.md——都改成了链接或被删。
  4. 评审点名的保留文档:本所有者段落已改;resource-faces.md、runtime-owner-operations.md、process-owner-operations.md、auxiliary-model.md、mcp-management.md、mcp-apps.md、TemporaryMcp.md、Hooks A.6.2 里没有本所有者的端口、操作或错误码(已 grep),未动其他所有者段落;已接受的 ADR(011)未改。
  5. 一词一义:writeOnlyHint/writeOnly、rejected/reason、permissionRules.rules、promptSettings、executionSettings 等名字与 Callee 契约的最新 head 一致。
  6. 内部一致:职责分界、示例、操作表、错误表、流程、例外、Rule check、附录互相一致;示例签名与附录一致;同步操作单独成行;每种错误都写了下一次动作、重试与两侧关闭/重载。
  7. 重命名/删除的引用:全仓 grep executionSettingsHost、promptSuggestionSettingsHost、三个 prompt 主机名、settingsService、commandRules、settings.sources、settings.projects、add_root、root_path、writeOnlySet;英文设计文档内已无残留(docs/zh/ 译文随既有惯例滞后,catalog 由实现时重新生成)。被引用的标题保留为锚点段落。

绑定附录临时 crate

/tmp/binding-check-2094(不提交):rutis 0.23、rutis-bridge 0.23、dim-agent-runtime、dim-agent-capabilities、dim-agent-types,rust 1.100(workspace 的 rust-toolchain.toml)。cargo check 通过;cargo test 的 wire 断言通过(Scope::Project(5) → {"project":5};Rejected → {code:"rejected",reason,message};UserOnly/Unsynced 为 snake_case)。

Client-visible changes

  • 管理方法 settings.sources 与 settings.projects 删除:仓内无调用方(CLI 五个来源按名读、Web 两个页面按白名单读、没有声明 projectFile 的来源);仓外客户端改为按名读已知来源。请维护者确认这一删除。
  • 其余客户端协议不变:settings.read/settings.update 的方法名、请求 {source, scope}、回复 {revision, document}、错误码、通知名与字段名逐项不变;断连不取消已接纳的写、调用返回后仍可发通知、进度等行为不变。

node scripts/adr-check.mjs --base origin/main(ADR freeze passed,23 changed files)与 cargo run --locked -p xtask-check(全部 passed)重跑通过;交付评论首行 head 已更新为 fcf1dd550。

@eric8810
eric8810 requested a review from yyhhyyyyyy November 24, 2026 03:26
Settings uses add_root for a project authorization, read and update for a
document; ModelLog uses root_path for the home root. The home directory arrives
as an assembly value, which is a choice: root_path and stat exist and are not
needed here.

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Scope: nine owner contracts under docs/design/plugins/ for Settings and the settings sections, plus the linked feature designs. Refs #2017 and #2015, under design rules §7 (#2029).

Verdict: REQUEST_CHANGES

Round-2 status

Round-2 item Status
P1 1 FileStorage operations Fixed in 8ef2691. #2080 at head 7224c0c defines add_root, root_path and stat (FileStorage.md:159-161) and names #2094 as using add_root, read and update, with ModelLog using root_path (FileStorage.md:226). Settings.md:117,192,200 and ModelLog.md:47 cite them. The round-2 P1 is withdrawn.
P2 2 appendix compile Partially fixed. Project no longer derives Copy (Settings.md:408-413). ChangeRefused still fails, see P2 1 below.
P2 3 refusal wire code Partially fixed. The contract fixes the wire code to rejected and carries the callback code in reason (Settings.md:176,432-433). The delivery acceptance still has the old "keeps the callback's own code" bullet, see P2 7 below.
P2 4 cross-row id Fixed. The row check is scoped to read and change; read_user, replace_user, agent_read and agent_set are exempt (Settings.md:119,138).
P2 5 writeOnly types Fixed. writeOnlyHint is the declaration bool and writeOnly the agent pointer list (Settings.md:132,144,362,387).
P2 6 sibling old faces Partially fixed. service-faces, AgentSettings, prompt-overrides §4 and overview are updated; permission-command-rules §2/§8, subagent-model-policy §3 and EnvironmentSettings.md:109 remain, see P2 4 below.
P2 7 retention Partially fixed. §4.1, §6 and §11 now say superseded, but §1, §1.1, §2, §3.1:122, §8, §9 and §10 still describe the old face, and §9/§10 are explicitly kept in force, see P2 3 below.
P2 8 examples Partially fixed. ProviderSettings and ModelLog use and_then; PromptSettings still does not type-check, see P2 6 below.
P3 9-16, 18 Fixed.
P3 17 Partially fixed. SettingsMethods separates the two rules; PermissionRules and CollaborationModelPolicy still say the call is dropped while listing operation_interrupted.

Round-1 items not carried above are fixed as the round-2 body reported.

Withdraw the round-2 P1 (FileStorage operations missing): #2080 at 7224c0c restores add_root, root_path and stat, and its sibling list names #2094 as using them. Withdraw round-2 P2 4 (cross-row id) and P2 5 (writeOnly types): both are fixed. Round-2 P2 2, P2 3, P2 6, P2 7 and P2 8 remain partially fixed; P3 17 remains partial; the new P2 items below remain open.

P2

1. The binding appendix still does not compile

Problem: ChangeRefused has fields reason and message, but its thiserror attribute names {code} (Settings.md:299-303). thiserror resolves {code} against the struct's fields and fails.

Failure scenario: an implementer copies the appendix and cargo check fails with E0425, as does the delivery's "appendix compiles" acceptance. The PR body's claim that the appendices compile is false.

Evidence: docs/design/plugins/Settings.md:300; fields at :302-303. Rechecked with the workspace's thiserror 2.0.20: error[E0425]: cannot find value 'code' in this scope.

Fix: #[error("{reason}: {message}")] and re-run the appendix compile.

2. The project root has two owners

Problem: The responsibility split says the project root is host-registered (Settings.md:15), while the Dependencies, the authorize_project flow and the exceptions say Settings calls add_root (Settings.md:117,192,200). One owner must be named.

Failure scenario: a process part authorizes a cwd that is not a Session workspace (Hooks catalog, a management call). If the host is expected to register it, no call opens the directory; the cwd stays outside every FileStorage root, and a project-scope read or write returns invalid. If Settings calls add_root, the summary is false and a reader cannot tell which part owns the root.

Evidence: docs/design/plugins/Settings.md:15 vs :117, :192, :200; #2080 FileStorage.md:159,209.

Fix: say "the FileStorage root Settings registers with add_root for each authorized cwd" and align the PR body paragraph, which still says the project root is registered when the Session is created.

3. The retained settings-service sections still describe the removed face

Problem: The Supersedes bullet keeps §3, §4.4, §7, §8.1, §9 and §10 in force (Settings.md:206). §9:310 and §10:333-336 still say clients discover sources through settings.sources; §1:20-23 lists four management methods and read/update/projects; §1.1:52 says discovery is settings.sources; §2:98-108 diagrams SettingsService and settings.sources/settings.projects; §3.1:122 names SettingsService::register::<D>; §8:272 says CAS and the service are unchanged. SettingsMethods and the delivery delete settings.sources, settings.projects and SettingsService.

Failure scenario: an implementer follows §9 or §10, which the contract says stay in force, and keeps settings.sources as the discovery method; a test or client then expects a method the delivery deletes. §1 and §2 give a second, conflicting description of the service.

Evidence: docs/design/plugins/Settings.md:206; docs/design/appserver/settings-service.md:20-23,41,52,98-108,122,272,310,333-336.

Fix: update §1, §1.1, §2, §3.1:122, §8, §9 and §10 to the new operation and method names, or add them to the Supersedes list with a pointer and stop saying they stay in force.

4. The sibling texts still name the old face

Problem: permission-command-rules.md says in §4.1 that commandRules is deleted (line 112), but §2's structure still shows the CommandRules Session part providing commandRules (line 59), and §8 still lists the Session port commandRules as a public addition (line 307). subagent-model-policy.md:129,151-152 still says the owner depends on Keyed<SettingsService> and CAS, which the owner contract replaces with Settings' register/read/change. EnvironmentSettings.md:109 still names executionSettingsHost, which the delivery deletes.

Failure scenario: a reader implements the CommandRules Session part or the SettingsService dependency from these sections; the target assembly has neither, so the part fails to compose or a second read path remains. The EnvironmentSettings branch binds a service name that no longer exists.

Evidence: docs/design/appserver/permission-command-rules.md:59,307; docs/design/subagent-model-policy.md:129,151-152; docs/design/plugins/EnvironmentSettings.md:109; docs/design/plugins/PermissionRules.md:5,99; docs/design/plugins/ExecutionSettings.md:5,71.

Fix: update those paragraphs in this PR, or name the owning PR in the Supersedes section and remove the claim that the surrounding text stays in force. At minimum change permission-command-rules.md §2/§8, subagent-model-policy.md §3 and EnvironmentSettings.md:109.

5. PromptSettings contradicts itself on the port traits

Problem: Dependencies says the three traits BasePromptSettings, SkillsInstructionsSettings and SummaryPromptSettings stay in dim-agent-capabilities and the App Server implements them (PromptSettings.md:45). The appendix says the three *Host types "and their traits are deleted" (PromptSettings.md:109).

Failure scenario: an implementer deletes the three traits; PromptSources, Skills and ContextCompaction lose their port, and the same document says they depend on it. Or the traits stay and the appendix's deletion statement is false.

Evidence: docs/design/plugins/PromptSettings.md:45,109; the traits exist at crates/dim-agent-capabilities/src/prompt_sources.rs:377, crates/dim-agent-capabilities/src/skills/mod.rs:61, crates/dim-agent-capabilities/src/summary_strategy.rs:126.

Fix: delete only the three *Host wrapper types; say the three traits stay.

6. The PromptSettings consumer example still does not type-check

Problem: The example uses the service reply (view.text, an optional string) and then factory.base.or(base) (PromptSettings.md:32-37). PromptSourcesConfig.base is Option<Arc<str>> (crates/dim-agent-capabilities/src/prompt_sources.rs:368), so or has two different item types. The document also says a consumer outside the App Server depends on the trait, whose base returns Option<Arc<str>> (:377-379), not PromptText, so .text does not exist there.

Failure scenario: the example cannot be copied; the port migration has no working reference. ProviderSettings.md:35 and ModelLog.md:35 now use and_then, but the PromptSettings one remains.

Evidence: docs/design/plugins/PromptSettings.md:32-37; crates/dim-agent-capabilities/src/prompt_sources.rs:368,377-379.

Fix: show the trait call and its Option<Arc<str>> reply, for example let base = prompt_settings.base(cancelled.child_token()).await.ok().flatten();, or make the service reply's text Option<Arc<str>> and use the service. Report the same to #2096's Provider.md:118, which still has .ok().flatten() on the service reply.

7. The delivery acceptance still asserts the callback's code on the wire

Problem: The delivery acceptance has one bullet saying the refusal keeps the callback's own code and message, while a later bullet says the rejected wire code is fixed and the callback's code is in reason. The contract is the second shape (Settings.md:176,432-433).

Failure scenario: a test author implements the first bullet, expects error.code to be the callback's code, and either fails the acceptance or reintroduces the dynamic wire code that round 2 asked to remove.

Evidence: delivery comment #2017 (comment), the acceptance bullet starting "每个附录的错误枚举"; docs/design/plugins/Settings.md:176,432-433.

Fix: delete the stale bullet and keep one assertion: the wire code is rejected, and the callback's own code is reason.

P3 (optional)

  • Settings.md:110 calls storage.read(definitions, cancelled), but FileStorage's binding is read(path, offset: Option<u64>, length: Option<u32>, cancelled) (#2080 FileStorage.md:448-456). Use storage.read(definitions, None, None, cancelled).
  • Settings.md:209 says the Supersedes covers "§3.2's host-port sentence for the three prompt ports". §3.2 is the executionSettings/toolchainSourceHost/promptSuggestionSettings sentence (service-faces.md:104); the prompt ports paragraph is in §4 (212-216), which this PR already rewrote. Point at §4.
  • PermissionRules.md:71-72,83 and CollaborationModelPolicy.md:54-55,66 still say "the call is dropped" while listing operation_interrupted; SettingsMethods now separates caller cancellation (no reply) from owner unload. Use the same rule.
  • The PR body's FileStorage paragraph still says "the host registers roots and hands their paths as values" and "the project root is registered when the Session is created"; the delivery and Settings.md:117 now say Settings calls add_root for authorize_project.
  • Cross-PR: #2096's Provider.md:118 still has .ok().flatten() on Result<Recording>. #2101's PluginManager.md head still carries the old settings.sources/writeOnlySet config rows that this PR replaces. Report both to their owners; neither is changed here.
  • ADR 027 is proposed in #2029 and is not on main; the Rule check rows reference it without a link. Link it or label it proposed, as FileStorage does for §7.

Verification and CI

node scripts/adr-check.mjs --base 1bc7d67d: "ADR freeze passed: 23 changed files". CI for 8ef2691: changes and ci-ok succeeded; the other jobs were skipped by the path filter. The appendix compile check with thiserror 2.0.20 fails as shown in P2 1.

Comment thread docs/design/plugins/Settings.md Outdated
- **Documents and revisions.** The user document (a file, or a row in the native store) and the project document (a file under an authorized project); the opaque revision that changes on every committed write; one writer at a time per document.
- **Change application.** Running a caller's change against the current document under the owner's exclusion, checking the result, writing it, publishing the fact, and reporting whether durability is confirmed.
- **Authority.** An owner change and an agent change may not alter a user-only member; a user edit may. Every member marked `writeOnly` that is reachable through `properties` is withheld from the agent, and the agent may not set it; the rule does not scan `items`, `$defs` or `anyOf`.
- **Authorized projects.** The cwd → project table, the host-registered project root each authorized cwd denotes, and the fact announcing a new one.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: The responsibility split says the project root is host-registered, but Dependencies, the authorize_project flow and the exceptions say Settings calls add_root (117, 192, 200). Failure scenario: a cwd authorized without a Session workspace (Hooks catalog, a management call) is never opened as a FileStorage root if the host is expected to do it; a project-scope read or write then returns invalid. Evidence: this line vs 117, 192, 200; #2080 FileStorage.md:159,209. Fix: say "the FileStorage root Settings registers with add_root for each authorized cwd" and align the PR body paragraph.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 0677c71. Settings.md:15 now says Settings registers the FileStorage root with add_root for each authorized cwd; :117, :192 and :200 agree, and the PR body says the same. One owner, Settings.


## Supersedes

- [Settings service](../appserver/settings-service.md) §4.1 (common shapes: `Snapshot`, `Sources`, `SettingsScope`), §4.2 (the `settings` service), §4.5 (the Rust binding), §5 (the operations' flows), §6 (the error codes) and §11 (acceptance). §4.3 is [SettingsMethods](SettingsMethods.md)'s. The document's §3 state, §4.4 events, §7 security, §8.1, §9 and §10 stay in force; §4.4's `project_authorized` payload keeps `{root, cwd}`, and the new acceptance is the delivery's flow tests.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: This bullet keeps §9 and §10 in force, but they still say discovery is settings.sources (settings-service.md:310,333-336); §1, §1.1, §2, §3.1:122 and §8 also still list settings.sources, settings.projects, workflowFiles and SettingsService. Failure scenario: an implementer following the retained sections keeps a method the delivery deletes, or rebuilds the removed service. Evidence: this line; settings-service.md:20-23,41,52,98-108,122,272,310,333-336. Fix: update those sections or add them to the Supersedes list and remove them from the retained set.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Partially fixed in 0677c71. Section 1, 1.1, 2, 3.1, 9's rule 7 row and 10's question 5 now describe discovery by name. Remaining: settings-service.md:319 still says sections 4.1 to 4.4 are the contract while 4.1, 4.2, 4.3 and 4.5 are pointers or superseded, and :284-286 still says three methods (today four, target two). Section 8 is neither retained nor superseded, and the PR body says it links to the contracts. Both are P3; see the new review.

Comment thread docs/design/plugins/Settings.md Outdated

/// One document's replacement from the change callback: its own `reason` and `message`.
#[derive(Debug, thiserror::Error)]
#[error("{code}: {message}")]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: ChangeRefused has fields reason and message (302-303), but the attribute names {code}; thiserror resolves it against the struct's fields. Failure scenario: the appendix fails with E0425, and the delivery's compile acceptance fails. Evidence: this line; rechecked with thiserror 2.0.20. Fix: #[error("{reason}: {message}")].

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 0677c71. Settings.md:300 is #[error("{reason}: {message}")] with fields reason and message; thiserror resolves named fields, so the E0425 is gone.

.await
.ok()
.and_then(|view| view.text);
let text = factory.base.or(base).unwrap_or_else(|| BUILT_IN.into());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: The service reply's text is an optional string, while factory.base is Option<Arc<str>> (crates/dim-agent-capabilities/src/prompt_sources.rs:368); or cannot mix the two. A consumer also depends on the trait BasePromptSettings, whose base returns Option<Arc<str>> (:377-379), not PromptText, so .text does not exist there. Failure scenario: the example cannot be copied. Evidence: PromptSettings.md:32-37; prompt_sources.rs:368,377-379. Fix: use the trait call, for example let base = prompt_settings.base(cancelled.child_token()).await.ok().flatten();, or make the service reply's text Option<Arc<str>>. Report the same to #2096 Provider.md:118.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 0677c71. PromptSettings.md:32-34 now calls the BasePromptSettings trait and uses .ok().flatten(); prompt_sources.rs:368,377-379 shows base returning Option<Arc<str>>, so the example type-checks and factory.base.or(base) has two Option<Arc<str>> operands.

Comment thread docs/design/plugins/PromptSettings.md Outdated

## Binding appendix

The three reads are one service on the owner type; the old `BasePromptSettingsHost`, `SkillsInstructionsSettingsHost` and `SummaryPromptSettingsHost` types and their traits are deleted.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: This deletes "their traits", but Dependencies (line 45) says the three traits BasePromptSettings, SkillsInstructionsSettings and SummaryPromptSettings stay in dim-agent-capabilities and the App Server implements them. Failure scenario: an implementer deletes the traits, breaking PromptSources, Skills and ContextCompaction, which the same document says depend on them. Evidence: this line; PromptSettings.md:45; crates/dim-agent-capabilities/src/prompt_sources.rs:377, src/skills/mod.rs:61, src/summary_strategy.rs:126. Fix: delete only the three *Host wrapper types; keep the traits.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 0677c71. PromptSettings.md:106 now deletes only the three *SettingsHost wrapper types and keeps BasePromptSettings, SkillsInstructionsSettings and SummaryPromptSettings; line 42 says the same. The delivery deletion list (issue comment 7093439923, line 10) still says the host types' traits are deleted too, which contradicts this line and delivery line 29; the new review covers it.

Comment thread docs/design/plugins/Settings.md Outdated
.find(|project| project.cwd == cwd)
.ok_or(WorkflowError::WorkspaceNotAuthorized)?;
let definitions = format!("{}/.dimcode/workflows/{}", project.cwd, name);
let bytes = storage.read(definitions, cancelled).await?; // FileStorage's operation

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: storage.read(definitions, cancelled) omits offset and length; FileStorage's binding is read(path, Option<u64>, Option<u32>, CancelledFn) (#2080 FileStorage.md:448-456). Failure scenario: the example does not compile against the contract it cites. Fix: storage.read(definitions, None, None, cancelled).await?.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in 0677c71. Settings.md:110 is storage.read(definitions, None, None, cancelled), matching #2080 FileStorage.md:448-456.

Settings says it registers each authorized cwd with add_root; the Workflow
example passes the offset and length arguments; ChangeRefused names its reason
field. PromptSettings keeps the three capability traits and uses the port's
optional read in its example. The retained settings-service sections no longer
list settings.sources, settings.projects, workflowFiles or SettingsService, and
the service-faces Supersedes points at the paragraph it changes.
@eric8810

Copy link
Copy Markdown
Collaborator Author

已按评审修改,head 0677c7155079284b8a60f682d9ee8da5458c2188。

评审逐条

  1. Settings.md:15(add_root 与职责分界不一致):职责分界改成「Settings 为每个授权的 cwd 用 add_root 登记 FileStorage 根」;Dependencies、authorize_project 流程与例外三处已一致;PR 描述同步。
  2. Settings.md:110(示例签名):Workflow 示例按 design(fileStorage): target contract #2080 的绑定改为 storage.read(definitions, None, None, cancelled)。
  3. Settings.md:300(thiserror 字段):ChangeRefused 的 #[error] 改为 {reason}: {message};临时 crate 编译通过。
  4. Settings.md:206(保留段落仍列已删名字):settings-service.md §1、§1.1、§2、§3.1、§8、§9、§10 已更新——§1 的服务/方法列表改为目标操作,workflowFiles 段改成 Workflow 用 authorized_projects + FileStorage,§1.1 的来源发现改成按名读写,§2 图里 SettingsService/settings.sources/settings.projects 改成一个服务与两个客户端方法,§3.1 的 SettingsService::register::<D> 改成 Settings::register_typed::<D>,§9 的公开接口一行与 §10 问题 5 改成按名读取、settings.sources 已删。
  5. Settings.md:209(Supersedes 指错段落):改为「§3.3 的 settingsService 行、§3.2 的宿主端口句(executionSettings、promptSuggestionSettings)、§4 的 prompt 端口段、§4.1 的 settingsService 段」。
  6. PromptSettings.md:37(示例类型不匹配):示例改用 capability 侧 trait 的签名——prompt_settings 是 BasePromptSettings 端口,base() 回 Option<Arc<str>>,所以 .ok().flatten() 成立,factory.base.or(base) 也对;并注明 wire 侧同一读取回 {text}。
  7. PromptSettings.md:109(删 trait 与依赖矛盾):改为只删三个 *Host wrapper,三个 trait 留在 dim-agent-capabilities、由所有者实现。
  8. Settings.md:446(交付里过期的拒绝 code 说法):交付验收改成「拒绝的 wire code 固定 rejected,回调自己的 code 在 reason」。
  9. §7 链接:九份契约的 §7 链接统一改成 PR URL(未合并目标按 docs(principles): add owners and operations #2029 的 PR URL)。

自查 1–9

  1. 当前状态引用:本次核对并补了路径——CLI 五个来源(crates/dim-cli/src/prompt_command.rs、recording.rs、session_host.rs、management/workflow.rs)、Web 两页与 WEB_SETTINGS_SOURCES(crates/dim-app-server/src/protocol.rs)、workflow/settings.ts 的 userOnly: ["/projectEnabled"] 且无 projectFile、model_log.rs/web.rs 的 project_file: None、execution_settings.rs 的 user_only: Vec::new()。
  2. 与现有文档的冲突:settings-service.md 上述六节、prompt-overrides.md §3/§3.1/§4/§7、service-faces.md、PluginManager.md、AgentSettings.md、ContextCompaction.md、overview.md、subagent-model-policy.md、model-log.md 都已在本 PR 改掉;逐条列在上一条与交付评论。
  3. 一词一义:add_root/root_path、rejected/reason、writeOnlyHint/writeOnly、permissionRules.rules、promptSettings、executionSettings 全 PR 一致。
  4. 内部一致:本轮自查发现并修掉三处——Workflow 示例的 read 少参数、ChangeRefused 的 {code} 字段名、PromptSettings 示例的 trait/服务类型混用;表格、流程、例外、Rule check 与附录一致。
  5. 每个结束都有下一步:authorize_project 的 invalid/closed/cancelled 与流程一致;同步操作(declared_sources、authorized_projects)单列、无取消无错误;读与 agent 路径的结束都在错误表。
  6. 重命名/删除的 grep:英文设计文档中 settings.sources/settings.projects/SettingsService/workflowFiles/add_root 缺失引用已清零(只剩 superseded 说明与 §12 历史记录);§7 链接改为 PR URL。
  7. 规则不带 Rust 拼写:规则自查表不带 Rust;附录是绑定。未合并目标用 PR URL(docs(principles): add owners and operations #2029 §7、design(fileStorage): target contract #2080)。
  8. 新句复查:新增的 add_root 句、§2 图、§10 问题 5 已按 1–5 复查。
  9. 兄弟 PR 最新 head:design(fileStorage): target contract #2080 用 7224c0cd4(add_root/root_path/stat、read 带 size);docs(principles): add owners and operations #2029 §7 用 PR URL。

留给第二步(left for step 2)

绑定附录

临时 crate /tmp/binding-check-2094(不提交,rutis 0.23 + workspace crates,rust 1.100)重跑 cargo check 通过;wire 断言 Scope::Project(5) → {"project":5}、Rejected → {code:"rejected",reason,message}、UserOnly/Unsynced 为 snake_case 通过。

Client-visible changes

与上一轮相同:settings.sources 与 settings.projects 删除(仓内无调用方),其余客户端协议逐项不变;请维护者确认。

node scripts/adr-check.mjs --base origin/main 与 cargo run --locked -p xtask-check 重跑通过;交付评论首行 head 已更新为 0677c7155。

@eric8810

Copy link
Copy Markdown
Collaborator Author

head 0677c7155(本步无新提交)。

跨 PR 对齐结论:#2094 是 provider-management.md 第 53 行 provider Settings 源那一行的定义方(ProviderSettings 拥有该源与 userAgent)。#2096 已把同一行改为本 PR 的措辞并链接本 PR(05c751541),因此本分支无需改动。合并顺序已写进描述:#2029 → #2080 → #2091/#2092/#2093 → #2094 → #2096 → 其余。

@yyhhyyyyyy yyhhyyyyyy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Scope: nine owner contracts under docs/design/plugins/ for Settings and the settings sections, plus the linked feature designs. Refs #2017 and #2015, under design rules §7 (#2029).

Verdict: REQUEST_CHANGES

Round-3 status

Round-3 item Status
P2 1 ChangeRefused compile Fixed in 0677c71. Settings.md:300 is #[error("{reason}: {message}")] with fields reason and message; the E0425 is gone.
P2 2 project-root owner Fixed. Settings.md:15 says Settings registers the FileStorage root with add_root for each authorized cwd; :117, :192, :200 and the PR body agree.
P2 3 retained settings-service sections Partially fixed. §1, §1.1, §2, §3.1, §9's rule 7 row and §10 question 5 now describe discovery by name. §8 (settings-service.md:284-286, "three methods") and §9's ADR 002 D5 row (:319, "§4.1 to §4.4 are the contract") remain; see P3.
P2 4 sibling old faces Not fixed. permission-command-rules.md §2 and §4.2, subagent-model-policy.md §3 and EnvironmentSettings.md:109 still name the deleted faces; see P2 1.
P2 5 PromptSettings traits Fixed in the contract (PromptSettings.md:42, :106). The delivery deletion list still says the host types' traits are deleted too; see P2 2.
P2 6 PromptSettings example Fixed. PromptSettings.md:32-34 calls the trait and uses .ok().flatten(); prompt_sources.rs:368,377-379 has the Option<Arc<str>> reply.
P2 7 delivery acceptance Fixed. The delivery comment, updated 05:31, now says the wire code is rejected and the callback's code is reason (lines 66 and 71).
P2 8 examples Fixed for ProviderSettings and ModelLog; PromptSettings now type-checks.
P3 9-16, 18 Fixed earlier or not reopened. P3 17 remains partial for PermissionRules and CollaborationModelPolicy.

Withdraw round-3 P2 1, P2 2, P2 6 and P2 7: verified fixed. P2 3 is partly fixed and the remainder is P3. P2 4 remains. P2 5 is fixed in the owner contract but open in the delivery.

P2

1. The sibling designs still define the deleted faces

Problem: This PR deletes the commandRules Session service, SettingsService, executionSettingsHost and BasePromptSettingsHost, but the linked designs still define them: permission-command-rules.md:58-59 shows the CommandRules Session part providing commandRules and reading Settings, :163-165 says the dispatcher serves read({}), :176 declares Keyed<SettingsService> for the feature and the owner row, and :307 lists the port as a public addition. subagent-model-policy.md:129 says the owner depends on Keyed<SettingsService>, :151-152 declares the dependency as When<Keyed<SettingsService>>, and :306, :313 and :321 still describe Settings CAS methods. EnvironmentSettings.md:109 names executionSettingsHost. PromptSources.md:55 names BasePromptSettingsHost. resource-owner-operations.md:14 still lists settings.register/read/update/projects, and :24 names SettingsService.declared_by and settings.sources. management-methods.md:65 still names SettingsService.

Failure scenario: an implementer follows permission-command-rules.md §2 or §4.2 and builds a Session part that reads SettingsService::read::<PermissionSettings>; the delivery removes SettingsService and the commandRules wire service, so the part fails to compose or leaves a second read path. Following subagent-model-policy.md §3 injects a service the target deletes. Binding executionSettingsHost or BasePromptSettingsHost binds names that no longer exist.

Evidence: docs/design/appserver/permission-command-rules.md:58-59,163-165,176,307; docs/design/subagent-model-policy.md:129,151-152,306,313,321; docs/design/plugins/EnvironmentSettings.md:109; docs/design/plugins/PromptSources.md:55; docs/design/contracts/resource-owner-operations.md:14,24; docs/design/appserver/management-methods.md:65; target at docs/design/plugins/PermissionRules.md:5,64,115, ExecutionSettings.md:71, PromptSettings.md:42,106.

Fix: update those paragraphs to the owner contracts, or mark them superseded in Settings.md and link. At minimum change permission-command-rules.md §2, §4.2 and §8, subagent-model-policy.md §3, EnvironmentSettings.md:109 and PromptSources.md:55. The subagent table row at line 56 was updated in this head, but §3 was not. PromptSources.md:55 and resource-owner-operations.md:14,24 are the same class and were missed in earlier rounds; this head fixed the identical port sentence in ContextCompaction.md:1983, which makes the omission visible.

2. The delivery deletion list still deletes the port traits

Problem: The delivery deletion list (https://github.com/arcships/dim/issues/2017#issuecomment-7093439923, line 10) lists the five *Host types and then says their traits are deleted too. The owner contracts keep BasePromptSettings, SkillsInstructionsSettings and SummaryPromptSettings (PromptSettings.md:42, :106), ExecutionSettingsRead (ExecutionSettings.md:43) and PromptSuggestionSettingsRead (PromptSuggestionSettings.md:43) as the Rust ports. Delivery line 29 itself says the consumers migrate through the three prompt traits.

Failure scenario: an implementer follows the deletion list and removes the traits. PromptSources, Skills, ContextCompaction, HostPlatform and PromptSuggestion lose their ports and fail to compile, and the migration in delivery line 29 has no target. If the traits stay, the deletion acceptance fails.

Evidence: delivery comment line 10 versus line 29; docs/design/plugins/PromptSettings.md:42,106; docs/design/plugins/ExecutionSettings.md:43; docs/design/plugins/PromptSuggestionSettings.md:43; the traits exist at crates/dim-agent-capabilities/src/prompt_sources.rs:377, src/skills/mod.rs:61, src/summary_strategy.rs:126.

Fix: delete only the *Host wrapper types; keep the traits. Align the delivery deletion list and line 29 with PromptSettings.md:106.

P3 (optional)

  • docs/design/service-faces.md:104: the Chinese sentence says "the former two" (前两者), which names the first two entries (executionSettings, toolchainSourceHost), but the cited contracts are ExecutionSettings and PromptSuggestionSettings, the first and third names. Settings.md:209 also calls this "§3.2's host-port sentence" and lists only the two changed names, so as written the Supersedes would also cover toolchainSourceHost, which this PR does not change. Name the two entries explicitly.
  • docs/design/appserver/settings-service.md:54: "no method lists every declaration" is false for the service operation declared_sources, which lists all declared sources or one instance's (Settings.md:132). The sentence means the client path; say "no client method".
  • docs/design/plugins/PermissionRules.md:71-72,83 and CollaborationModelPolicy.md:54-55,66 still say the call is dropped while listing operation_interrupted. Use SettingsMethods.md:90: a caller-cancelled call has no reply; only owner unload answers operation_interrupted.
  • docs/design/appserver/settings-service.md:284-286 says "three methods" (today four, target two), and :319 says "§4.1 to §4.4 are the contract" while §4.1, §4.2, §4.3 and §4.5 are now pointers or superseded. §8 is neither retained nor superseded, and the PR body says it links to the contracts.
  • The delivery cross-row acceptance bullet (line 64) says a cross-row source id is invalid without the read_user/replace_user exception stated at line 72. Say "for read and change".
  • Settings.md:117 and ModelLog.md:47 pin #2080 at head 7224c0cd4; #2080's current head is 08d29c84. add_root, read and root_path are unchanged there and update only gained an optional claim_id, so the calls still match, but update the pin or say "reviewed head".

Cross-PR

  • #2093 at a4f23773: SummaryStrategy.md:64 names S:summaryPromptSettingsHost, which this PR deletes; ask it to use the SummaryPromptSettings trait or the promptSettings service. Its service-faces.md hunk at line 94 also overlaps this PR's commandRules row, so expect a conflict.
  • #2101 at 18d5e4f0: PluginManager.md:338 still carries settings.sources and writeOnlySet; this PR updates the same rows at :315-316. Ask #2101 to rebase.
  • #2096 at 05c75154: Provider.md:118,141 now read ModelLog's recording through the port, so the round-3 cross-PR note is withdrawn.
  • #2102 at 44e64199: its PromptAdoption configure does not touch the renamed prompt ports; its service-faces hunks do not overlap this PR's. No conflict.

Verification and CI

node scripts/adr-check.mjs --base 1bc7d67d: "ADR freeze passed: 23 changed files". Relative links in the changed docs resolve. The ChangeRefused attribute now names a struct field, and CallError::raw (rutis 0.23 service.rs:607) and session::Error::code (rutis-bridge 0.23 session/mod.rs:244) exist, so the refusal conversion compiles. CI for 0677c715: changes and ci-ok succeeded; the other jobs were skipped by the docs path filter.

`CommandRule = {command: string, match: "exact" | "prefix", decision: "allow" | "deny"}`. Errors
are data: `unavailable` (the source could not be read, including an invalid persisted file),
`cancelled` (the caller dropped the call or the provider is unloading).
**Session service `commandRules`** is deleted. Rule consumers call [PermissionRules](../plugins/PermissionRules.md)'s `permissionRules.rules` (`{}` → `{rules}`); `CommandRule = {command: string, match: "exact" | "prefix", decision: "allow" | "deny"}`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: This deletes the Session service, but the same file still builds it. Section 2 (58-59) shows the CommandRules Session part providing commandRules and reading Settings; 4.2 (163-165) says the dispatcher serves read({}); 4.2 (176) declares Keyed<SettingsService>; and section 8 (307) lists the port as a public addition.

Failure scenario: an implementer follows section 2 or 4.2 and builds a Session part that reads SettingsService::read::<PermissionSettings>; the delivery removes SettingsService and the commandRules wire service, so the part fails to compose or leaves a second read path.

Evidence: those lines; docs/design/plugins/PermissionRules.md:5,64,115.

Fix: update sections 2, 4.2 and 8 to the owner's permissionRules.rules and the ReadCommandRules port binding, as 4.1 already does.

| Read the adopted leader model | `Session::get<PromptSnapshot>(branch_id)` while consuming `collaboration/request`, before starting its delivery task |
| Resolve an explicit model | The existing `AgentIndex` model-selection host and configured/non-catalog profile paths |
| Persist and edit policy | Native `BusinessDocument`, `SettingsService::read/update`, source CAS and owner management methods, as used by `permission_rules.rs` |
| Persist and edit policy | [CollaborationModelPolicy](plugins/CollaborationModelPolicy.md): the `collaboration` source, its `policy` value read and the `collaboration.*` methods |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: This row moved to the new contract, but section 3 still declares the old dependency: line 129 says the owner depends on Keyed<SettingsService>, 151-152 uses When<Keyed<SettingsService>>, and 306, 313 and 321 still describe Settings CAS methods.

Failure scenario: the implementation adds a SettingsService dependency the delivery deletes, and the owner reads the store instead of the new policy value.

Evidence: docs/design/subagent-model-policy.md:129,151-152,306,313,321; docs/design/plugins/CollaborationModelPolicy.md:45,82.

Fix: update section 3 to the settings service and collaborationPolicy.policy; keep this row's link.

replacement. Settings performs serialization, version checks and persistence. Both calls
propagate the original Settings error and end with the registration generation. Foreign codec
calls occur outside SQLite transactions. Declared-schema sources reuse their existing codec.
The Settings operations, the authorized-project table and each source's own contract are defined by [Settings](../plugins/Settings.md) and [SettingsMethods](../plugins/SettingsMethods.md). The `settingsService` owner API and the `registerDocument` operation are replaced by the one `settings` service: a source id per registration, a value read, a change callback, the user draft path and the agent path.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: This paragraph replaces the section, but the same file still names the old API: the settingsService row at line 14 says settings.register/read/update/projects and links to the superseded settings-service.md 4.2, and the binding at line 24 names SettingsService.declared_by and settings.sources.

Failure scenario: PluginManager or SettingsMethods is implemented from lines 14 or 24, keeping update, projects or declaredBy; the target uses register/read/change and declared_sources, and the delivery deletes declared_by and settings.sources.

Evidence: docs/design/contracts/resource-owner-operations.md:14,24; docs/design/plugins/Settings.md:119-134; delivery deletion list lines 11-14.

Fix: update the settingsService row and the declaredBy binding to the new operations, or mark them superseded by this paragraph.


## Supersedes

- [Settings service](../appserver/settings-service.md) §4.1 (common shapes: `Snapshot`, `Sources`, `SettingsScope`), §4.2 (the `settings` service), §4.5 (the Rust binding), §5 (the operations' flows), §6 (the error codes) and §11 (acceptance). §4.3 is [SettingsMethods](SettingsMethods.md)'s. The document's §3 state, §4.4 events, §7 security, §8.1, §9 and §10 stay in force; §4.4's `project_authorized` payload keeps `{root, cwd}`, and the new acceptance is the delivery's flow tests.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: This keeps section 9 and section 10 in force, and they now agree on discovery. Two retained pieces are stale: settings-service.md:319 says sections 4.1 to 4.4 are the contract while 4.1, 4.2, 4.3 and 4.5 are pointers or superseded, and settings-service.md:284-286 says three methods (today four, target two). Section 8 is neither retained nor superseded, and the PR body says it links to the contracts.

Failure scenario: a reader takes section 9's ADR 002 D5 row as the contract map and looks for the user draft and agent paths in 4.1 to 4.4, or takes the three-method count as the client surface.

Evidence: docs/design/appserver/settings-service.md:284-286,319; the PR body paragraph that lists section 8.

Fix: optional. Point section 8 and 9's D5 row at Settings and SettingsMethods, or add section 8 to the Supersedes list.

| `toolSourcesView` | `toolSourcesView.get/observe` | 同一 ToolRegistry owner 的独立只读观察面;贡献注册仍由 `toolRegistry` 负责,见 [工具贡献 §7.5](../architecture/rust-agent/tool-contributions.md#75-服务接口)。 |

宿主读取端口的数据面(§4.10)包括 `executionSettingsHost`、`toolchainSourceHost`、`promptSuggestionSettingsHost`。模型选择与列表统一由 `providerService` 提供;调用方和配置见[进程操作](contracts/process-owner-operations.md);其余读取端口沿用现名。
宿主读取端口的数据面(§4.10)包括 `executionSettings`、`toolchainSourceHost`、`promptSuggestionSettings`;前两者的操作由 [ExecutionSettings](plugins/ExecutionSettings.md) 与 [PromptSuggestionSettings](plugins/PromptSuggestionSettings.md) 定义。模型选择与列表统一由 `providerService` 提供;调用方和配置见[进程操作](contracts/process-owner-operations.md);其余读取端口沿用现名。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: 前两者 refers to the first two names in the list (executionSettings, toolchainSourceHost), but the two cited contracts are ExecutionSettings and PromptSuggestionSettings, the first and third names. Settings.md:209 also calls this the section 3.2 host-port sentence and lists only the two changed entries, so as written the Supersedes would also cover toolchainSourceHost, which this PR does not change.

Failure scenario: a reader pairs toolchainSourceHost with PromptSuggestionSettings, or treats the whole sentence as superseded and leaves toolchainSourceHost without its entry.

Evidence: this line; docs/design/plugins/Settings.md:209; docs/design/plugins/ExecutionSettings.md:72; docs/design/plugins/PromptSuggestionSettings.md:71.

Fix: name the two entries explicitly, for example the executionSettings and promptSuggestionSettings host-port entries.

- Source discovery is `settings.sources` (§4.3): local connections can list the declared
sources and their schemas, never their documents. There is still no settings UI.
- Source discovery is by name: a local client reads and writes the declared sources it knows
through `settings.read`/`settings.update`; no method lists every declaration (`settings.sources`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: declared_sources lists every declaration (Settings.md:132), so the claim that no method lists every declaration is false for the service. The sentence means the client path.

Failure scenario: a reader concludes declared_sources should not exist, but PluginManager's config command needs it (PluginManager.md:315).

Evidence: this line; docs/design/plugins/Settings.md:132; docs/design/plugins/SettingsMethods.md:24; docs/design/plugins/PluginManager.md:315.

Fix: say no client method lists every declaration.

| invalid params | Fix the request: a rule without a command word, or with a shell separator |
| `permission_rules_conflict` | Read again; the user's draft is stale |
| `permission_rules_failed` | Read again before retrying |
| `operation_interrupted` | The call was cancelled or the owner is unloading; read again before retrying |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Problem: This says a cancelled call answers operation_interrupted, while the cancellation column at 71-72 says the call is dropped. SettingsMethods.md:90 fixes the rule: a caller-cancelled call has no reply; only owner unload answers operation_interrupted.

Failure scenario: a client waits for a reply on a call it cancelled, or treats an unload as a cancellation and retries a write.

Evidence: docs/design/plugins/PermissionRules.md:71-72,83; docs/design/plugins/CollaborationModelPolicy.md:54-55,66 has the same pair; docs/design/plugins/SettingsMethods.md:90.

Fix: use the SettingsMethods rule in both tables.

@eric8810

Copy link
Copy Markdown
Collaborator Author

补充说明(ADR 027 收回到决定层后):本 PR 的契约没有 ADR 027 D2、也没有 NoSession/SessionClosing/NoLine 的写法,ADR 027 引用均在 D1–D6 内,因此本轮无改动,head 不变。

@eric8810

Copy link
Copy Markdown
Collaborator Author

Closing as part of abandoning the owner-split experiment.

@eric8810 eric8810 closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants