Repository navigation
Conversation
|
评审(head
|
|
已按评审修改,head
向其他所有者的需求更新:#2025 增补「按 line id 读 Permission 的发布值」并要求 typed |
|
已按 ADR 027 修改 Session 访问契约,head
检查: |
|
已按 A–G 自查修改,head
检查: |
|
已按 A–G 自查修改,head
检查: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Review: Agents and Collaboration owner contracts
Scope: refs #2020 and #2015. This PR is the Agents and Collaboration part of the design owner series: it adds Agents.md, CollaborationSession.md and CollaborationTimeline.md, rewrites Collaboration.md, and replaces the sessions service with access by id in sessions-service.md and session-access.md.
Verdict: REQUEST_CHANGES
P1
None.
P2
1. The sessions-service rewrite breaks references across the docs tree
Problem: the rewrite keeps only five short sections; all anchors for the removed sections 2, 3, 6.x, 8.x, 11 and 17 are gone. 36 English and 32 Chinese links now target missing anchors, for example docs/design/plugins/Scheduler.md:266,270,290, docs/design/plugins/Workflow.md:276,286,538, docs/design/appserver/idle-unload.md:12,48 and docs/design/appserver/native-storage-format.md:810. This PR also adds two broken links itself: docs/design/plugins/Agents.md:241 (#3-decisions) and docs/design/contracts/session-access.md:62 (#where-the-submission-identity-lives).
Failure scenario: after merge, navigation fails across the docs tree and none of the "where each old decision lives" claims can be followed. The self-check commit did not cover links, and scripts/adr-check.mjs only checks ADR freezes.
Fix: keep the old headings as anchor stubs, or update every inbound link. Add a docs link check to the repository scripts.
2. The CONFLICTING merge drops a main-side contract
Problem: origin/main added a normative session.attach.expectedConfig paragraph to docs/design/contracts/session-access.md after the merge base, and this PR deletes the section that holds it. git merge-tree origin/main HEAD reports docs/design/contracts/session-access.md as the only conflict.
Failure scenario: resolving the conflict by taking this side silently removes the session_config_mismatch and -32602 contract added on main.
Fix: move that paragraph to the owner that keeps attach expectations (for example session-boundary.md or cold-attach-profile.md) before deleting the section, then re-run the merge.
3. Lease lifetime is contradictory
Problem: docs/design/appserver/sessions-service.md:8 says a lease "is held only while a call runs", while docs/design/contracts/session-access.md:13 and the acquire/release rows in Agents.md keep a lease on the caller's row across calls until release or row unload.
Failure scenario: a caller that follows sessions-service.md drops its pin between calls; idle unload can then end the generation and the next call addresses another instance.
Fix: state the row-owned lease rule once, citing ADR 027 D5.
4. ADR 027 decision numbers are shifted
Problem: in ADR 027 (#2029), D2 is runtime routing, D3 is the data-faces-only rule (registration and lifecycle excluded, language runtimes, Rpc for clients), D4 is "call by id is not a dependency", and D5 is the lease. The new pages cite D2 for the exclusion and D4 for the lease at docs/design/plugins/Agents.md:236,272, docs/design/contracts/session-access.md:11,13,28, docs/design/plugins/Collaboration.md:123, docs/design/plugins/CollaborationSession.md:73,128 and docs/design/plugins/CollaborationTimeline.md:60,93.
Failure scenario: implementers apply the wrong decisions and either miss the exclusion of registration and lifecycle services or treat the lease as a dependency rule.
Fix: cite D3 for the exclusions and D5 for the lease.
5. Request-less reads disagree with the binding
Problem: the operation table gives agents, sessions, defaults, instance and permissionDefaults a {} request and a closed error, while the appendix methods at docs/design/plugins/Agents.md:506,560,562,564,571 take no request and return a value.
Failure scenario: the face is specified both as zero-argument and infallible, and as one-empty-object and fallible; the generated wire and error contract cannot match both.
Fix: mark these requests as none and drop closed, or make each method return Result and take an empty request.
6. delete_session has two in-use shapes
Problem: the reply is {removed} or {inUse}, and in_use is also an error kind. Current code returns DeleteOutcome::InUse as a normal outcome, and the RPC maps it to the session_active error (crates/dim-app-server/src/connection.rs:1390-1397).
Failure scenario: a caller cannot tell whether to inspect Ok(DeleteReply.in_use) or Err(AgentsError::InUse), and two implementations will diverge.
Fix: keep one shape and state how Rpc maps it back to session_active.
7. observe cannot produce its documented "none" reply
Problem: the table says {agentId, generation} or none, while the appendix returns Result<Observed, AgentsError> at docs/design/plugins/Agents.md:556.
Failure scenario: the no-loaded-generation case has no wire representation.
Fix: return Option<Observed>.
8. process-owner-operations still keeps sessions.permission
Problem: docs/design/contracts/process-owner-operations.md:25 still defines both sessions.permission({sessionId,branchId}) and sessions.permissionDefaults({}), while docs/design/plugins/Agents.md:173 says this face does not return a line's policy and docs/design/contracts/session-access.md:21 assigns that read to Permission.
Failure scenario: two target contracts disagree, and keeping sessions.permission reintroduces the forwarding method that rule 7 forbids.
Fix: update that row to permissionDefaults only and fix its line 12 pointer to this contract.
9. The delete-notice replacement removes two events with live consumers
Problem: docs/design/plugins/Agents.md:232 deletes agent/session-restored and agent/unloaded-session-deleted, but docs/design/contracts/process-owner-operations.md:39 says to keep both, and observe is one shot per loaded generation. Provider reattaches startup ownership on restore (crates/dim-app-server/src/provider.rs:3524) and releases it on an unloaded delete (crates/dim-app-server/src/provider.rs:3532); Collaboration re-arms its watch on restore and ends relations on an unloaded delete (crates/dim-app-server/src/collaboration.rs:706,728).
Failure scenario: a restored member is never observed again, and an unloaded Session deleted after an unload leaves a startup binding and a Team relation behind.
Fix: keep both events, or define a persistent watch plus a delete notice for these owners, and update the peer row.
10. The binding appendix does not compile
Problem: SessionConfig is dim_agent_runtime::SessionConfig (crates/dim-agent-runtime/src/config.rs:39), not a dim_agent_types item; crate::protocol::AgentProfile at docs/design/plugins/Agents.md:306,320 does not exist (dim_agent_types::AgentProfile is re-exported at crates/dim-app-server/src/agents.rs:15); CreatedWorktreeReply derives only Serialize (crates/dim-app-server/src/worktrees.rs:1165), so deriving Deserialize for CreatedSession fails.
Failure scenario: an implementer cannot copy the appendix, and the contract's Rust binding does not build.
Fix: correct the import paths and the derive, or exclude the worktree reply from the deserialized shape.
11. The observe callback type is not a valid routed callback
Problem: EndListener at docs/design/plugins/Agents.md:424 returns BoxFuture<'static, ()>. The rutis service macro decodes a callback parameter only as Arc or Box of Fn(..) -> BoxFuture<'static, Result<X, E>> with E: From<rutis::host::CallError>; this alias falls through to the data path and fails the Deserialize bound.
Failure scenario: the appendix does not compile and other languages cannot pass onEnd.
Fix: return Result<(), rutis::Error> and use Arc, matching the caller example at line 100.
P3
- Permalinks:
docs/design/plugins/Agents.md:13points atAgentDirectory(crates/dim-app-server/src/agents.rs:330-384) instead ofSessionSlot(agents.rs:168-183);docs/design/plugins/CollaborationSession.md:12points at plugin key wiring (crates/dim-app-server/src/collaboration.rs:3535-3560) instead of the guide registration (collaboration.rs:3582-3598);docs/design/plugins/CollaborationTimeline.md:12points at theCollaborationSessionstruct (collaboration.rs:972-1080) instead of the fact writes. Re-anchor them. - Forward links:
docs/design/contracts/session-access.md:18-21anddocs/design/appserver/sessions-service.md:15,31,38use relative links toplugins/InputQueue.mdandplugins/Loop.md(#2102),plugins/TimelineTree.md(#2092),plugins/Permission.md(#2100) and../../adr/027-cross-scope-access-by-id.md(#2029). These targets are not on main. Use PR-file URLs, or merge after the owners. docs/design/contracts/session-access.md:189repeats the TimelineTree paragraph twice and still cites the removed section 9.2. Keep one copy and link TimelineTree.docs/design/plugins/Agents.md:223-224namespublishedCutoff?andwindow; #2102 definesthroughplusincludeBlockPresence, and #2092 defineslimit. Use the owners' field names, and reconcile requirement 2 at line 273 with the same shape.docs/design/plugins/Collaboration.md:158saysretain_startuptakes an admission id only. The current method takes(&Session, &ModelSelection)(crates/dim-app-server/src/provider/startup.rs:537), and #2096's target row isretain_startup({session, model}). Remove or restate the requirement.docs/design/plugins/CollaborationTimeline.md:167renames variants only; the field encodes asmember_session_id. Addrename_all_fields = "camelCase".docs/design/plugins/Agents.md:57,101usesdefaults.policy(SessionConfighaspermission_policy) andObserve(the appendix definesObserveRequest).docs/design/plugins/Agents.md:226maps onlydeleted,closedandloaded;unknownis a state in the same table, and an id never seen answers it.docs/design/plugins/Agents.md:149has no error for an Agent that exists but is unavailable, althoughagentscarriesunavailable?and the current launch reports that reason.docs/design/plugins/Agents.md:478always serializespausedandrunning, while the table says{paused}or{running};settleis listed as errorless but returnsResult.- Supersedes is incomplete:
docs/design/plugins/Scheduler.md:62,251,290,435,docs/design/plugins/Workflow.md:208,269,286,546,docs/design/worktree-management.md:39anddocs/design/p6-p7-bindings.md:22still teachsessions.launch,sessions.input,sessions.stopandsessions.delete, and the Scheduler edits in #2097 keepsessions.launch. Update them in this series or record the follow-ups, so the merged tree does not name removed methods.
Verification: node scripts/adr-check.mjs --base 5a279d6988c80692a77f3438fff4d26f7875e4c9 passes. GitHub reports no checks for this head. The local checkout is at 053b2d4a8cf139edd84199ab544282ff5ac46db3, with merge base 5a279d6988c80692a77f3438fff4d26f7875e4c9.
| [Appendix B.2](../overview.md#b2-app-server-process-plugins), Agents row. Scope: [ADR 002](../../adr/002-plugin-scope.md) | ||
| process scope, inside the existing Agents plugin. Consumers: [Scheduler](../plugins/Scheduler.md) (P6) and | ||
| [Workflow](../plugins/Workflow.md) (P7), both TypeScript. | ||
| Status: replaced by [ADR 027](../../adr/027-cross-scope-access-by-id.md) and the [Agents contract](../plugins/Agents.md). This page keeps the lifecycle, submission-identity and authority facts that outlive the `sessions` methods, and lists where each old decision now lives. |
There was a problem hiding this comment.
P2: This rewrite removes the headings for sections 2, 3, 6.x, 8.x, 11 and 17. 36 English and 32 Chinese pages link to those anchors, for example docs/design/plugins/Scheduler.md:266,270,290, docs/design/plugins/Workflow.md:276,286,538 and docs/design/appserver/idle-unload.md:12,48; this PR also adds two broken links, docs/design/plugins/Agents.md:241 (#3-decisions) and docs/design/contracts/session-access.md:62 (#where-the-submission-identity-lives). Failure: the links 404 after merge and the stated decision mapping cannot be followed. Fix: keep the old headings as anchor stubs or update every inbound link, and add a docs link check because scripts/adr-check.mjs only checks ADR freezes.
There was a problem hiding this comment.
Fixed in 88e76b6 for the sessions-service anchors: the Superseded anchors block restores sections 1 to 17, and the links in Scheduler, Workflow, idle-unload and native-storage-format now resolve. The same defect remains in session-access.md and Collaboration.md; the new review covers that separately.
There was a problem hiding this comment.
Fixed in 3d5ade8 for the remaining pages. session-access.md and Collaboration.md now keep the old headings under Superseded anchors, and a docs link check over 335 files finds 0 new broken relative links against main. One stub still misdirects: see the note on 4675478948 about #3-flows.
| Those calls return values or throw generated `RustError`, while `sessions` | ||
| retains its existing envelope. See [native access §2](../p6-p7-bindings.md#2-read-only-permission-access). | ||
| - **Ownership.** Agents owns a launched Session's instance and record like any other Session: clients list it, a user can attach to it, answer its approvals, stop, close or delete it. The caller owns only its own records that name the Session and the inputs it wrote ([Agents](../plugins/Agents.md)). Closing or deleting the starter does not touch a launched Session. | ||
| - **Loading.** A Session stays loaded while a lease holds it or its work runs; Agents unloads it once no lease has held it for `idle_unload_after` and it is idle ([idle unload](idle-unload.md), [lifecycle §5](../../architecture/rust-agent/lifecycle.md#5-stop-与-close)). The next call restores it. A lease is held only while a call runs ([Agents: `acquire`](../plugins/Agents.md#operations)). |
There was a problem hiding this comment.
P2: "A lease is held only while a call runs" contradicts docs/design/contracts/session-access.md:13 and the acquire/release rows in Agents.md, where the caller's row holds the lease across calls until release or row unload. Failure: a caller following this line drops its pin between calls and idle unload can end the generation, so the next call addresses another instance. Fix: state the row-owned lease rule once, citing ADR 027 D5.
There was a problem hiding this comment.
Fixed in 88e76b6. sessions-service.md:8 now states that the lease belongs to the calling row and is settled on release or row unload, citing ADR 027 D5, which matches session-access.md:13 and the acquire/release rows.
| ``` | ||
|
|
||
| `input/withdraw { input_id, reason? }` is a command event, and `input/deleted { input_id }` is InputQueue's result fact. Legitimate producers write the command: clients through `session.input.withdraw`, which InputQueue provides through `sessionMethods` ([session-boundary](session-boundary.md#a1-method-contributions)), and process callers through `sessions.withdraw`. InputQueue consumes commands in sequence order and decides from its own decision state only ([time bus §4](../../architecture/rust-agent/time-bus.md#4-写入前的复核归各状态机)): the command takes effect only if InputQueue still holds that `input/message` unapplied. Once InputQueue has written `input/applied` for an input, the input belongs to Loop and cannot be withdrawn; Loop needs no change. For one input, at most one of `input/applied` and `input/deleted` exists. | ||
| A process-scope caller reaches any Session-group data face with `sessionId` and any branch-group data face with `(sessionId, branchId)`; a Session-scope caller reaches its own line's owners with `branchId`. The address is not limited to input writes or published-value reads. The mechanism resolves the instance key to the target scope's data-face dispatch and the caller calls the owner's own operation ([ADR 027](../../adr/027-cross-scope-access-by-id.md) D1). Nothing forwards by operation name, wraps a request or reply, or restates the owner's error. An unknown, unloaded or closing target ends resolution with the mechanism's own error. |
There was a problem hiding this comment.
P2: This rewrite deletes the section holding main's session.attach.expectedConfig paragraph, which origin/main added after the merge base; git merge-tree origin/main HEAD reports this file as the only conflict. Failure: resolving the conflict by taking this side silently drops the expectedConfig and session_config_mismatch contract. Fix: move that paragraph to the owner that keeps attach expectations (for example session-boundary.md or cold-attach-profile.md) before deleting the section.
There was a problem hiding this comment.
Fixed in 88e76b6 for expectedConfig: section 2 Attach expectations keeps the paragraph with session_config_mismatch and -32602. The sibling expectedCwd paragraph from origin/main:docs/design/contracts/session-access.md:73 is still missing; the new review covers it.
There was a problem hiding this comment.
Fixed in 3d5ade8. docs/design/contracts/session-access.md:26 restores main's session.attach.expectedCwd paragraph byte for byte (origin/main:docs/design/contracts/session-access.md:73), and docs/design/acp-gateway-implementation.md:452 now links #2-attach-expectations.
| A process-scope caller reaches any Session-group data face with `sessionId` and any branch-group data face with `(sessionId, branchId)`; a Session-scope caller reaches its own line's owners with `branchId`. The address is not limited to input writes or published-value reads. The mechanism resolves the instance key to the target scope's data-face dispatch and the caller calls the owner's own operation ([ADR 027](../../adr/027-cross-scope-access-by-id.md) D1). Nothing forwards by operation name, wraps a request or reply, or restates the owner's error. An unknown, unloaded or closing target ends resolution with the mechanism's own error. | ||
|
|
||
| ## 4. Timing and conflicts | ||
| Resolution reaches the target scope's shared data faces only. Registration points (`sessionMethods`, `toolRegistry`) and lifecycle services are not reachable this way (ADR 027 D2). The path is available to Rust parts, language runtimes and leaves through rutis sessions; clients keep using Rpc's method tables and Session authorization. Which links reach it is the deployment's ([service faces §2.1](../service-faces.md#21-目标)). |
There was a problem hiding this comment.
P2: The ADR 027 numbers do not match #2029. D2 is runtime routing; D3 is the data-faces-only rule, including the exclusion of registration and lifecycle services and the language and Rpc paths; D4 is "call by id is not a dependency"; D5 is the lease. This line cites D2 for the exclusion, and the same shift appears at Agents.md:236,272, session-access.md:13,28, Collaboration.md:123, CollaborationSession.md:73,128 and CollaborationTimeline.md:60,93. Failure: implementers apply the wrong decisions. Fix: D3 for the exclusions and D5 for the lease.
There was a problem hiding this comment.
The original shift is fixed, but c3acab3 regressed the citation in the other direction: session-access.md:9 and Agents.md:275 now cite D1 for routing and the instance key, which are D2 (docs/adr/027-cross-scope-access-by-id.md:28-33). See the new inline comments on those lines.
| | Block | Owner | | ||
| | --- | --- | | ||
| | Session creation, close, delete, fork, admission values and leases | [Agents](../plugins/Agents.md) | | ||
| | Input submission, its receipt, pending state and withdrawal | [InputQueue](../plugins/InputQueue.md) | |
There was a problem hiding this comment.
P3: The block table uses relative links to files that are not on main: plugins/InputQueue.md and plugins/Loop.md exist only in #2102, plugins/TimelineTree.md in #2092, plugins/Permission.md in #2100, and ../../adr/027-cross-scope-access-by-id.md in #2029. Failure: the rendered page 404s until every sibling PR merges. Fix: use the PR-file URLs as Collaboration.md does, or merge this page after the owners.
There was a problem hiding this comment.
Partially fixed in 88e76b6. session-access.md and process-owner-operations.md now use PR-file URLs for the sibling-PR targets, but sessions-service.md:3,15,31,38,39 and Agents.md:239,275 still link relative to ../../adr/027-cross-scope-access-by-id.md and ../plugins/InputQueue.md, Loop.md and TimelineTree.md, which are not on main. Use PR-file URLs there too.
|
|
||
| ```rust | ||
| use dim_agent_capabilities::host::CancelledFn; | ||
| use dim_agent_types::{PermissionPolicy, SessionConfig}; |
There was a problem hiding this comment.
P2: The appendix does not compile. SessionConfig is dim_agent_runtime::SessionConfig (crates/dim-agent-runtime/src/config.rs:39), not a dim_agent_types item; crate::protocol::AgentProfile at lines 306 and 320 does not exist (dim_agent_types::AgentProfile is re-exported at crates/dim-app-server/src/agents.rs:15); CreatedWorktreeReply derives only Serialize (crates/dim-app-server/src/worktrees.rs:1165), so CreatedSession's Deserialize fails. Failure: an implementer cannot copy the binding. Fix: correct the paths and the derive, or exclude the worktree reply from the deserialized shape.
There was a problem hiding this comment.
Partially fixed in 88e76b6. SessionConfig, AgentProfile and the worktree reply are fixed. The appendix still does not compile: PublicService is imported twice (lines 301 and 304), and CreateAgent.profile at line 328 still uses crate::protocol::AgentProfile. The new review covers it.
There was a problem hiding this comment.
Fixed in 3d5ade8 for the Agents appendix. The duplicate PublicService import is gone, CreateAgent.profile uses the imported AgentProfile, and the derives match the crate types (CreateWorktree is Deserialize-only, CreatedSession Serialize-only). The same wrong path remains in Collaboration.md:173; the new review covers it.
There was a problem hiding this comment.
The Agents appendix is fixed. Collaboration.md:173 still does not compile: crate::protocol::AgentProfile does not exist, and the untagged enum needs rename_all_fields = "camelCase". See the thread on that line.
| Unloaded, | ||
| } | ||
|
|
||
| pub type EndListener = Box<dyn Fn(EndNotice) -> BoxFuture<'static, ()> + Send + Sync>; |
There was a problem hiding this comment.
P2: EndListener is not a valid routed callback. The rutis service macro accepts a callback only as Arc or Box of Fn(..) -> BoxFuture<'static, Result<X, E>> with E: From<rutis::host::CallError>; this alias returns BoxFuture<'static, ()>, so it falls through to the data path and fails the Deserialize bound. Failure: the appendix does not compile and other languages cannot pass onEnd. Fix: return Result<(), rutis::Error> and use Arc, matching the caller example at line 100.
There was a problem hiding this comment.
Fixed in 88e76b6. EndListener is now Arc<dyn Fn(EndNotice) -> BoxFuture<'static, Result<(), rutis::Error>> + Send + Sync>, matching rutis 0.23's FromFunction impl, and the caller example returns Ok(()).
|
|
||
| ## Requirements raised to other owners | ||
|
|
||
| 1. **Provider retains a startup connection by source id for a member.** A member inherits the leader's adopted model; when that model carries a startup connection, retention needs the connection the leader's creator admitted, and Provider's `retain_startup` takes an admission id only. Either `retain_startup` accepts `{source, session}` for a source another Session already admitted, or Provider states that an inherited startup connection is not retained for a member. Raised with [#2019](https://github.com/arcships/dim/issues/2019). |
There was a problem hiding this comment.
P3: The premise is stale. retain_startup already takes (&Session, &ModelSelection) (crates/dim-app-server/src/provider/startup.rs:537) and resolves the source id that the creating Session admitted; the current Collaboration path already calls it for a member (crates/dim-app-server/src/collaboration.rs:406), and #2096's target row is retain_startup({session, model}). Failure: the requirement asks for work that is already done. Fix: remove the requirement or restate the remaining gap.
| pub struct DelegationState { pub open: Vec<OpenDelegation>, pub closing: bool } | ||
|
|
||
| #[derive(serde::Serialize, serde::Deserialize)] | ||
| #[serde(tag = "status", rename_all = "camelCase")] |
There was a problem hiding this comment.
P3: rename_all = "camelCase" on an internally tagged enum renames variants only, so Delivered::Ok encodes as {"status":"ok","member_session_id":"..."}, not the documented memberSessionId. Failure: the wire shape differs from the contract. Fix: add rename_all_fields = "camelCase" or rename the field.
There was a problem hiding this comment.
Fixed in 88e76b6. Delivered now has rename_all_fields = "camelCase", so member_session_id encodes as memberSessionId.
| Rpc creating a client Session from a request naming an Agent, a cwd and a policy: | ||
|
|
||
| ```rust | ||
| let policy = request.policy.unwrap_or_else(|| defaults.policy.clone()); // business default |
There was a problem hiding this comment.
P3: The caller example reads defaults.policy, but the defaults operation returns SessionConfig, whose field is permission_policy (crates/dim-agent-runtime/src/config.rs:41); the observe example at line 101 also uses Observe while the appendix defines ObserveRequest. Failure: copied examples do not compile. Fix: use defaults.permission_policy and ObserveRequest.
There was a problem hiding this comment.
Fixed in 88e76b6. The caller example uses defaults.permission_policy and ObserveRequest, and the observe closure returns Ok(()).
Keep the sessions-service anchors and main's attach-expectation paragraph, route by id with #2127, cite ADR 027 D3/D5, keep the restore and unloaded-delete events, and make the binding appendix compile.
053b2d4 to
88e76b6
Compare
|
已按评审与自查标准修改,head 评审逐条处理:
自查额外修改(P3 及 A–G):
请评审人复看。 |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Review: Agents and Collaboration owner contracts (round 2)
Scope: refs #2020 and #2015. This PR adds Agents.md, CollaborationSession.md and CollaborationTimeline.md, rewrites Collaboration.md, and replaces the sessions supplement in sessions-service.md and session-access.md with access by id under ADR 027. This round reviews the full main...head at 88e76b6 and the delta over 5582af4.
Verdict: REQUEST_CHANGES
Round-1 status
Fixed in 88e76b6:
- Lease lifetime:
sessions-service.md:8now states the row-owned lease and cites ADR 027 D5. - ADR 027 decision numbers: D3 for the data-face exclusions, D5 for the lease. Verified against ADR 027 at
da6f4a950. delete_session: one reply shape, thein_useerror kind removed, and the Rpc mapping tosession_activestated.observe: the table says null and the appendix returnsResult<Option<Observed>, AgentsError>.process-owner-operations.md:sessions.permissionis gone and the lease row is row-owned.- Delete notices:
agent/session-restored,agent/unloaded-session-deletedandagent/session-deletedare all kept; the current consumers still exist. EndListener: the alias now returnsResult<(), rutis::Error>and usesArc, matching rutis 0.23.- P3 items: duplicate TimelineTree paragraph, retain_startup requirement,
rename_all_fieldsforDelivered, caller examples,unavailableforcreate_session,settleerror column, and the Supersedes follow-up list.
Partially fixed:
- Link set: the
sessions-service.mdanchors are restored, but the other two rewrites still break links. See P2-1. expectedConfig: the paragraph is kept, but its siblingexpectedCwdparagraph is still dropped. See P2-2.- Request-less reads: fixed in the Agents table and appendix, but the same class remains in
CollaborationTimelineand in thepermissionDefaults({})row. See P3. - Binding appendix: the import and worktree issues are fixed, but the appendix still does not compile. See P2-4.
- Permalinks:
Agents.md:13is fixed;CollaborationSession.md:12andCollaborationTimeline.md:12still point at the wrong code. - Forward links: some now use PR-file URLs;
sessions-service.mdand the ADR 027 links inAgents.mdremain relative. sessions.existsstill does not define theunknownanswer, andQuiesceReplystill always serializesrunning.
P2
P2-1. The link fix covers only sessions-service.md; the other two rewrites add 42 broken links
Problem: sessions-service.md now keeps its old headings as stubs, which restores the round-1 link set for that page. The session-access.md and Collaboration.md rewrites have no stubs and no inbound link updates. Round 1 checked this class on sessions-service.md only and the fix commit applied stubs only there, so this is the first check of the other two pages. Compared with origin/main, the head adds 42 broken link occurrences in 18 files: 33 missing anchors in 17 files and 9 links to files that exist only in sibling PRs.
Failure scenario: after merge, acp-gateway-implementation.md:452 and session-deletion-and-fork.md:303 send the reader to a missing session-access.md#3-flows; Notifications.md:41, EventHub.md:58,278, Questions.md:52, Modality.md:280 and single-tree.md:108 send the reader to removed session-access.md sections; idle-unload.md:7, native-storage-format.md:110,977, session-classification.md:80 and session-deletion-and-fork.md:179 send the reader to removed Collaboration.md sections. The checked-attach and delegation contracts cannot be followed from their consumers.
Evidence: docs/design/contracts/session-access.md:7-58 has no #3-flows, #7-security, #9-requirements-raised-to-mechanism-owners, #94-optional-parts-per-enabled-plugin or #a1-the-sessions-service. docs/design/plugins/Collaboration.md:61-158 has no #6-delegation-ownership-and-lifetime, #67-stopping-a-member-from-the-client, #7-the-models-a-member-can-run or #task-title. Examples: docs/design/overview.md:104,555, docs/design/plugins/Notifications.md:41, docs/design/plugins/EventHub.md:58,278, docs/design/plugins/Questions.md:52, docs/design/appserver/session-deletion-and-fork.md:179,303, docs/design/appserver/provider-management.md:1151, docs/design/subagent-model-policy.md:34.
Fix: add the same anchor stubs to session-access.md and Collaboration.md, or update every inbound link. The self-link at sessions-service.md:22 should be #3-security. Replace the remaining relative links to ../../adr/027-cross-scope-access-by-id.md, ../plugins/InputQueue.md, ../plugins/Loop.md and ../plugins/TimelineTree.md with PR-file URLs as done elsewhere.
P2-2. session-access.md still drops the expectedCwd contract
Problem: round 1 flagged the deletion of the section that held main's expectedConfig paragraph. The fix keeps expectedConfig in §2 but deletes its sibling expectedCwd paragraph from main. No other document now defines the check.
Failure scenario: an implementer following the target contract has no statement that attach canonicalizes the expected cwd, checks it under the acquire gate before project authorization, restore and plugin activation, and fails without attaching. AcpGateway.md still says load and resume validate expectedCwd through checked attach, but the target contract no longer defines checked attach for cwd, so a reimplementation can attach to a Session whose cwd changed.
Evidence: origin/main:docs/design/contracts/session-access.md:73 has the paragraph; the head docs/design/contracts/session-access.md:24-26 has expectedConfig only. After the PR, expectedCwd remains only in docs/design/plugins/AcpGateway.md:178 and docs/design/acp-gateway-implementation.md:27,452, both as consumers.
Fix: restore the expectedCwd paragraph under §2 Attach expectations and retarget the inbound checked-attach links to #2-attach-expectations.
P2-3. The InputQueue.pending request is stale against the rebased #2102
Problem: Agents.md:226 now says pending({inputId, through?, includeBlockPresence?}), but #2102 at 851f531 defines pending({inputId, publishedCutoff?}) -> {pending}. The same page contradicts itself at line 276, which still says the owner accepts a published-cutoff default.
Failure scenario: a caller that follows this row sends fields the owner does not define, while a caller that follows #2102 sends a different request. Scheduler and Workflow cannot rely on one documented shape to verify a lost input receipt.
Evidence: docs/design/plugins/Agents.md:226,276; docs/design/plugins/InputQueue.md:83,64 at #2102 head 851f531. Round 1 asked for the then-current #2102 shape; that owner PR has since changed to publishedCutoff.
Fix: use pending({inputId, publishedCutoff?}) -> {pending} and align requirement 2. In the same table, sessions.lookup maps to submit with {inputData} while the owner takes {input}; use {input}.
P2-4. The binding appendix still does not compile
Problem: round 1's compile finding is only partly fixed. docs/design/plugins/Agents.md:301 and :304 import PublicService twice, which is E0252, and CreateAgent.profile at :328 still uses crate::protocol::AgentProfile, which the app-server protocol module does not export.
Failure scenario: an implementer cannot copy the binding; the snippet fails before the interface is exercised.
Evidence: docs/design/plugins/Agents.md:301,304,328. crates/dim-app-server/src/agents.rs:15 re-exports dim_agent_types::AgentProfile; crates/dim-app-server/src/protocol.rs has no AgentProfile re-export. The duplicate import fails with error[E0252], reproduced with rustc.
Fix: delete the duplicate import and use the already imported AgentProfile at line 328.
P3
- Appendix and table shape mismatches.
Agents.md:162saysmembersreplies a bare array, while the appendix at:479returnsMembersReply { members: Vec<MemberLink> }.Agents.md:229definessessions.existsfordeleted,closedandloadedonly, althoughsession.statecan answerunknown(line 158).Agents.md:487always serializesrunning, while the table says{paused: true}or{paused: false, running}.Collaboration.md:173is externally tagged, soTarget::Agentencodes as{"agent":{"agentId":...}}, not the{agentId}or{profile}shape at line 79, and the caller example at line 46 uses a tuple variant that does not match the struct variant. - Request-less reads remain in
docs/design/plugins/CollaborationTimeline.md:71(stateis shown with a{}request and aclosederror, while the appendixstate(&self) -> DelegationStatetakes no request and cannot fail) anddocs/design/plugins/CollaborationSession.md:88(approvalDestinationlistsinvalid_request, while the appendix returnsOption).docs/design/contracts/process-owner-operations.md:25still writespermissionDefaults({})whileAgents.md:144says it takes no request. - Remaining permalinks:
docs/design/plugins/CollaborationSession.md:12still points at plugin key wiring (crates/dim-app-server/src/collaboration.rs:3535-3560); the guide entries register atcollaboration.rs:3582.docs/design/plugins/CollaborationTimeline.md:12still points at theCollaborationSessionstruct (collaboration.rs:972), not the fact writes. docs/design/appserver/sessions-service.md:87is a leftover sentence fragment from the section that was stubbed:#32 described the field as client-protocol data that no runtime capability uses. It asked for an idempotency record. It has no terminal punctuation and is followed by another Superseded line. Delete it or finish the sentence.- The PR description is stale: it still says one
agent/session-deletednotice for EventHub and that both permission reads move tosessions.permission*, while the head keeps three notices and removessessions.permission. Update it so the merge notes match the contract.
Verification
git merge-base origin/main HEADis6e86d48c8;git merge-tree origin/main HEADis clean; GitHub reportsmergeable: true.node scripts/adr-check.mjs --base 6e86d48c8361e95575cf8e4425e77f4ec048fc41passes (12 changed files), run with an isolated HOME/TMPDIR/XDG.- CI on 88e76b6:
ci-oksuccess; the docs-only jobs are skipped; the commit status is pending with no external statuses. - Link check: 335 Markdown files under
docs/, relative links plus GitHub-style heading anchors, compared withorigin/main. The head adds 42 broken link occurrences in 18 files. The round-1sessions-service.mdanchors now resolve. - Cross-PR merge checks: merge-tree conflicts with #2080, #2094 and #2099 on
docs/design/plugins/README.md, with #2091 onresource-owner-operations.md, with #2096 onprocess-owner-operations.md, with #2097 onsessions-service.md, and with #2102 onsession-access.md. The #2102 pending shape is a content conflict, not only a merge conflict; #2096 still carries the oldsessions.permissionrow and must not overwrite the new one when it rebases.
Withdraw or keep
Withdraw as fixed: the round-1 lease, ADR-number, delete-shape, observe-none, sessions.permission, delete-notice and EndListener findings, plus the duplicate paragraph, retain_startup, Delivered casing, examples, unavailable, settle and Supersedes findings.
Keep as partially open: the link set (only sessions-service.md fixed), expectedConfig (fixed, expectedCwd still dropped), request-less reads (Agents fixed, two pages remain), binding appendix (still does not compile), permalinks, forward links, sessions.exists unknown, and quiesce serialization.
| | 6 | What does a loaded Session cost? | `xtask measure`, release build, mock model, Apple M4 | About 300 KB of Rust allocations and 43 Tokio tasks per loaded idle Session. Mean creation time is 1.5 ms with 10 Sessions loaded, 4.0 ms with 100 and 57 ms with 1000. The App Server never unloads idle Sessions ([#57](https://github.com/arcships/dim/issues/57)) | Launched Sessions accumulate until restart; idle unload is raised as a follow-up (§8.6) | | ||
| | 7 | When can readers see an input? | Code: `Session::input` returns at commit, before publication; protocol v3+ `session.submit` waits for publication | A caller that reads right after `Session::input` can miss its own input | `input` replies after publication, and `lookup` waits for pending publication first (§6.2, §6.3) | | ||
| | 8 | Where does lookup by `submissionId` live? | Code | Only in Rpc: `session.input_lookup` scans the published pages, O(n) | Agents owns one lookup and Rpc calls it (§6.3) | | ||
| ## Superseded anchors |
There was a problem hiding this comment.
P2: This stub block restores the sessions-service anchors, but the same fix was not applied to the other two rewritten pages. session-access.md no longer has #3-flows, #7-security, #9-requirements-raised-to-mechanism-owners, #94-optional-parts-per-enabled-plugin or #a1-the-sessions-service, and Collaboration.md no longer has #6-delegation-ownership-and-lifetime, #67-stopping-a-member-from-the-client, #7-the-models-a-member-can-run or #task-title. Against origin/main the head adds 42 broken link occurrences in 18 files, for example overview.md:104,555, plugins/Notifications.md:41, EventHub.md:58,278, session-deletion-and-fork.md:179,303. Failure: those links 404 after merge and the checked-attach and delegation references cannot be followed. Fix: add the same anchor stubs to session-access.md and Collaboration.md, or update every inbound link; the self-link at sessions-service.md:22 should be #3-security.
There was a problem hiding this comment.
Partially fixed in 3d5ade8. The session-access.md and Collaboration.md headings are back and a docs link check over 335 files finds 0 new broken relative links against main. One stub misdirects: session-access.md:215 (## 3. Flows) says the section is superseded by owners, but main's expectedConfig paragraph stayed in this page at #2-attach-expectations, and session-deletion-and-fork.md:303 still links here. Point the stub at #2-attach-expectations.
| | Input source conventions, `SessionConfig` fields, withdrawal and the fixed-prefix read | this document, Appendix A | | ||
|
|
||
| The native `session.attach.expectedCwd` capability permits an optional `expectedCwd` on `session.attach`. The boundary canonicalizes that one path and checks the target Session's stored or live cwd by Session ID under its acquire gate, before project authorization, Session restore or plugin activation. A mismatch fails without attaching or running that project's configuration. Omitting it preserves existing callers. Attach already returns cwd and title metadata; a checked attach never lists all Sessions to find its target. | ||
| ## 2. Attach expectations |
There was a problem hiding this comment.
P2: This section keeps main's expectedConfig paragraph but drops its sibling expectedCwd paragraph (origin/main:docs/design/contracts/session-access.md:73). The head has no document that defines canonicalizing the expected cwd, checking it under the acquire gate before project authorization, restore and activation, and failing without attaching; plugins/AcpGateway.md:178 and acp-gateway-implementation.md:452 still refer to checked attach for expectedCwd. Failure: an implementation can attach to a Session whose cwd changed, or order the check after restore, and no target contract forbids it. Fix: restore the expectedCwd paragraph here and point the inbound checked-attach links at #2-attach-expectations.
There was a problem hiding this comment.
Fixed in 3d5ade8. session-access.md:26 is byte-identical to origin/main:docs/design/contracts/session-access.md:73, and the checked-attach links now point at #2-attach-expectations.
| | `sessions.lookup` | [InputQueue](https://github.com/arcships/dim/pull/2102/files)'s submit re-sent with the caller's `submissionId`: a duplicate answers the existing `{inputId, sequence}` (requirement below); no separate lookup exists | | ||
| | `sessions.stop` | [Loop](https://github.com/arcships/dim/pull/2102/files)'s `stop_turn({turnId, reason})` by `(session, line)` id, after reading its published running state for the current turn id; a turn that already ended writes nothing | | ||
| | `sessions.withdraw` | [InputQueue](https://github.com/arcships/dim/pull/2102/files)'s `withdraw({inputId, reason})` by `(session, line)` id | | ||
| | `sessions.pending` | [InputQueue](https://github.com/arcships/dim/pull/2102/files)'s `pending({inputId, through?, includeBlockPresence?})` by `(session, line)` id; the owner's published head applies when the caller names no `through` | |
There was a problem hiding this comment.
P2: These fields are stale against #2102 at 851f531: docs/design/plugins/InputQueue.md:83 defines pending({inputId, publishedCutoff?}) -> {pending}, not {inputId, through?, includeBlockPresence?}. This page also contradicts itself at line 276, which still says the owner accepts a published-cutoff default. Failure: an implementer following this row and one following #2102 send different requests, so a lost input receipt cannot be verified reliably. Fix: use pending({inputId, publishedCutoff?}) -> {pending} and align requirement 2; the submit row should name {input} rather than {inputData}.
| use dim_agent_runtime::{PublicService, SessionConfig}; | ||
| use dim_agent_types::{AgentProfile, PermissionPolicy, ModelSelection}; | ||
| use rutis::Ctx; | ||
| use dim_agent_runtime::PublicService; |
There was a problem hiding this comment.
P2: The appendix still does not compile. This line imports PublicService a second time (line 301 already imports it), which is E0252, and CreateAgent.profile at line 328 still uses crate::protocol::AgentProfile, which the app-server protocol module does not export (crates/dim-app-server/src/agents.rs:15 re-exports dim_agent_types::AgentProfile). Failure: copying the binding fails before any caller can use it. Fix: delete the duplicate import and use the imported AgentProfile at line 328.
There was a problem hiding this comment.
Partially fixed in 3d5ade8. The Agents appendix fixes are in: the duplicate import is removed and CreateAgent.profile uses AgentProfile. Collaboration.md:173 still uses crate::protocol::AgentProfile, which does not exist; the new review covers it.
| ```rust | ||
| #[derive(serde::Serialize, serde::Deserialize)] | ||
| #[serde(rename_all = "camelCase", rename_all_fields = "camelCase", deny_unknown_fields)] | ||
| pub enum Target { Agent { agent_id: String }, Profile { profile: crate::protocol::AgentProfile } } |
There was a problem hiding this comment.
P3: Target is externally tagged, so Target::Agent encodes as {"agent":{"agentId":...}} and Profile as {"profile":{"profile":...}}, not the {agentId} or {profile} shapes in the operations table at line 79; the caller example at line 46 also uses a tuple variant Target::Agent(agent_id) that does not match this struct variant. Failure: the binding and the documented request cannot both be implemented. Fix: make the enum #[serde(untagged)] and use Target::Agent { agent_id } in the example, or document the tagged shape.
There was a problem hiding this comment.
Partially fixed in 3d5ade8. #[serde(untagged)] fixes the tagged encoding, but removing rename_all_fields makes the variant field encode as agent_id instead of the table's agentId, and Profile { profile: crate::protocol::AgentProfile } has a nonexistent path. Use #[serde(untagged, rename_all_fields = "camelCase")] and dim_agent_types::AgentProfile.
There was a problem hiding this comment.
Partly fixed: untagged is right, but the path and the field casing remain. Collaboration.md:173 still uses crate::protocol::AgentProfile and has no rename_all_fields, so Target::Agent encodes agent_id instead of agentId. See the thread on the same line.
| | Caller → owner | Methods and replies | | ||
| | --- | --- | | ||
| | Permission consumers → Agent directory | `sessions.permission({sessionId,branchId})` and `sessions.permissionDefaults({})` retain the existing policy replies. The first holds the Session lease; the second reads the current default without creating a Session. | | ||
| | Permission consumers → Permission and Agents | A line's current policy is Permission's published value, read by `(sessionId, branchId)` id ([ADR 027](https://github.com/arcships/dim/pull/2029/files) D1); there is no `sessions.permission`. `sessions.permissionDefaults({})` reads the current creation default without creating a Session. | |
There was a problem hiding this comment.
P3: This row writes sessions.permissionDefaults({}), but the Agents contract at docs/design/plugins/Agents.md:144 and its appendix define permissionDefaults as a value read with no request. Failure: the same request-less read is specified in two shapes again, the class round 1 raised for the Agents table. Fix: write permissionDefaults with no request, or make the Agents binding take an empty request and return Result.
There was a problem hiding this comment.
Fixed in 3d5ade8. process-owner-operations.md:25 now writes sessions.permissionDefaults with no request, matching Agents.md:163.
| | `sessions.pending` | [InputQueue](https://github.com/arcships/dim/pull/2102/files)'s `pending({inputId, through?, includeBlockPresence?})` by `(session, line)` id; the owner's published head applies when the caller names no `through` | | ||
| | `sessions.history` | [TimelineTree](https://github.com/arcships/dim/pull/2092/files)'s `read(line, from, through, limit)` by `(session, line)` id | | ||
| | `sessions.defaultBranchId` | [TimelineTree](https://github.com/arcships/dim/pull/2092/files)'s `directory` for the Session; the default line is in the reply | | ||
| | `sessions.exists` | `session.state`: `deleted` answers false, `closed` and `loaded` answer true | |
There was a problem hiding this comment.
P3: session.state can answer unknown for an id this process never saw (line 158), but this mapping defines only deleted, closed and loaded. Failure: an implementation has no target answer for sessions.exists on an unknown id. Fix: state that unknown answers false, or answer session.state as an error.
There was a problem hiding this comment.
Partially fixed in 3d5ade8. unknown now has an answer, but false is wrong for an idle-unloaded Session with rows: session has no state for it (line 158), and EventHub treats false as deleted and removes its subscriptions (EventHub.md:224-229). The new review covers the missing state and acquire path.
There was a problem hiding this comment.
Partly fixed and unchanged since: unknown now answers false, but an idle-unloaded Session with rows is not unknown (Agents.md:158 defines unknown as an id this process never saw), so it must answer true. EventHub.md:227-228 treats false as deleted and removes subscriptions. This is covered by the open P2 on the missing unloaded state and acquire path.
|
|
||
| #[derive(serde::Serialize, serde::Deserialize)] | ||
| #[serde(rename_all = "camelCase", deny_unknown_fields)] | ||
| pub struct QuiesceReply { pub paused: bool, #[serde(default)] pub running: u32 } |
There was a problem hiding this comment.
P3: running has no skip_serializing_if, so this reply always serializes it, while the table at line 164 says {paused: true} or {paused: false, running}. Failure: the wire shape differs from the contract for the paused case. Fix: add #[serde(skip_serializing_if = "is_zero")] or change the table.
There was a problem hiding this comment.
Fixed in 3d5ade8. QuiesceReply.running now uses skip_serializing_if = "is_zero", matching the {paused: true} shape.
Restore the attach expectations from main, keep the removed anchors on the two rewritten pages, use InputQueue's publishedCutoff shape, and fix the appendix imports, quiesce reply and permalinks.
|
已按评审修改,head 逐条处理(本轮新评审):
自查额外发现并修: 绑定附录编译:临时 example(未提交) 留给第二步(跨 PR): 客户端可见变更:无。请评审人复看。 |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Review: Agents and Collaboration owner contracts (round 3)
Scope: refs #2020 and #2015. This PR adds Agents.md, CollaborationSession.md and CollaborationTimeline.md, rewrites Collaboration.md, and replaces the sessions supplement in sessions-service.md and session-access.md with access by id under ADR 027. This round reviews the full main...head at 3d5ade8 and the delta over 88e76b6.
Verdict: REQUEST_CHANGES
Round-2 status
Fixed in 3d5ade8:
expectedCwd:docs/design/contracts/session-access.md:26is byte-identical toorigin/main:docs/design/contracts/session-access.md:73; theexpectedConfigparagraph is unchanged;docs/design/acp-gateway-implementation.md:452points at#2-attach-expectations.pending:docs/design/plugins/Agents.md:226,276match #2102 at 44e6419:pending({inputId, publishedCutoff?}) -> {pending}, andsessions.inputuses{input}.Agents.mdappendix: the duplicatePublicServiceimport is gone andCreateAgent.profileuses the importedAgentProfile. I found no remaining compile error in that appendix.QuiesceReplyskips the zerorunning;permissionDefaultstakes no request;sessions.existsdefinesunknown.- Anchors: the stubs on
session-access.mdandCollaboration.mdresolve. A link check over 335 docs finds 0 new broken relative links against main (the round-2 set of 42 is gone). The remaining links to ADR 027, InputQueue, Loop and TimelineTree are PR-file URLs. - ADR 027 citations D1-D5, the row-owned lease, the three delete notices and the
EndListenertype remain correct.
Partially fixed or still open:
- The 3d5ade8 comment says the CollaborationSession and CollaborationTimeline permalinks were re-anchored to
collaboration.rs:3580-3600and3695-3710, but neither file is in that commit and the head still has the 5a279d6 links (P3). closed_sessionagainstsession_closed, the request-lessstaterow and theapprovalDestinationerror row remain (P3).- The PR body still says one
agent/session-deletednotice and both permission reads moving tosessions.permission*(P3).
P2
P2-1. Collaboration's cross-Session calls sit outside ADR 027's caller scopes
Problem: docs/design/contracts/session-access.md:9 states the two caller scopes: a process caller uses sessionId and (sessionId, branchId); a Session caller uses branchId for its own line's owners. ADR 027 D1 (PR #2029 at 9e629e9) and #2127 define exactly those two segments, and #2127's Session-to-branch segment is for this Session only. But CollaborationTimeline is a branch part and CollaborationSession is a Session part, and they call another Session's branch faces by (memberSession, line) and read the leader's collaborationSession value by sessionId (CollaborationTimeline.md:60,93,128; CollaborationSession.md:73,128,174; Agents.md:239). #2127's acceptance covers process-to-Session and Session-to-own-branch only; it has no cross-Session case.
Failure scenario: the leader line cannot write the request input, stop the member's turn or withdraw an unqueued input, and the member's Session part cannot resolve the leader's approval destination. An implementer either invents a route the mechanism does not define or moves these calls to the process Collaboration owner, which contradicts the stated ownership of the writes.
Fix: either state that all cross-Session calls are made by the process owner Collaboration, and give the member part an operation on it, or extend ADR 027 D1 and #2127 to let Session and branch callers address another Session by id, including the visibility rule for which Session a caller may address.
P2-2. An idle-unloaded Session has no state, no exists answer and no acquire path
Problem: Agents.md:158 makes state one of loaded, closed, deleted or unknown, with unknown described as an id this process never saw. An idle-unloaded Session with rows is none of these. Agents.md:229 then maps unknown to false; Agents.md:155 says acquire pins a loaded Session and :191 defines its unknown error as no loaded Session having the id, while ADR 027 D5 and #2127 say a target that is not loaded takes a hold and Agents loads the next generation, and sessions-service.md:8 says the next call restores it.
Failure scenario: a scheduled or event input finds an idle-unloaded target, gets the mechanism's NoSession, takes a lease as #2127 says, and acquire refuses it, so the input is never delivered. Separately, EventHub's reconciliation reads sessions.exists; docs/design/plugins/EventHub.md:224-229 says false means the Session was deleted, a closed restorable Session is true, and false removes its subscriptions. An idle-unloaded Session is restorable, so the new mapping can remove every subscription while the rows remain. Current code answers true for an unloaded Session because the rows remain (crates/dim-app-server/src/agents/sessions.rs:606; crates/dim-app-server/src/agents/sessions/tests.rs:189,207).
Fix: add an unloaded state, or define unknown with stored: true as restorable; answer exists true when rows exist; state that acquire restores an idle-unloaded Session and returns its new generation; keep closed_session for a business close, and reserve unknown for no rows and observe's null for no live generation.
P2-3. delete_session does not state the requireInactive default and would change client deletes
Problem: Agents.md:153 takes requireInactive and :171 says an in-use Session answers {removed:false, inUse:reason}, with no statement about requireInactive: false. Main's client contract says the field defaults to false, and without it the delete closes and removes an in-use Session; only true refuses session_active (docs/design/appserver/session-deletion-and-fork.md:78; crates/dim-app-server/src/connection.rs:1418-1431 calls delete_if_inactive only for true and delete otherwise).
Failure scenario: a client or dimcode session delete ID with no requireInactive that hits a running Session would now receive session_active and remove nothing, contrary to "Client-visible changes: None". The reply for an unknown or already-deleted id (main answers deleted false) is also unstated.
Fix: state that true answers removed:false with inUse, false deletes regardless of use, and an unknown or already-deleted id answers removed:false without inUse; give Rpc's mapping for each.
P2-4. The Collaboration binding appendix still does not compile and lost the camelCase field
Problem: Collaboration.md:173 uses crate::protocol::AgentProfile, which does not exist; crates/dim-app-server/src/protocol.rs exports no AgentProfile, and crates/dim-app-server/src/agents.rs:15 re-exports dim_agent_types::AgentProfile. The same line also lost rename_all_fields = "camelCase" when it became untagged, so Target::Agent { agent_id } encodes as agent_id, not the {agentId} shape in the operations table at line 79 and the page's "camelCase fields" sentence at line 168.
Failure scenario: an implementer copying the enum gets a compile error; one following the table and one following the binding disagree on the wire field, so the member target cannot be decoded.
Fix: use dim_agent_types::AgentProfile and #[serde(untagged, rename_all_fields = "camelCase")], or rename the field explicitly.
P3
- PR body: it still says one
agent/session-deletednotice for EventHub and both permission reads moving tosessions.permission*; the head keeps three delete notices and removessessions.permission. Update the merge notes. docs/design/appserver/sessions-service.md:87keeps a body fragment ("#32 described the field as client-protocol data...") after the anchors intro at line 44 says the bodies are deleted. Finish or delete it.docs/design/contracts/session-access.md:215: the## 3. Flowsstub says the section is superseded by owners, but main'sexpectedConfigparagraph stayed in this page at#2-attach-expectations, anddocs/design/appserver/session-deletion-and-fork.md:303still links#3-flowsfor the checked fork. Point the stub at#2-attach-expectations.docs/design/contracts/session-access.md:265: the "#5, used by the offline rows" paragraph from main now sits inside the anchors block between two stubs; move it to a kept section or delete it.- Permalinks:
CollaborationSession.md:12still points atcollaboration.rs:3535-3560at 5a279d6 (plugin key wiring; the guide registration is at 3585-3598), andCollaborationTimeline.md:12at 972-1080 (struct andop_turn; the fact writes are elsewhere). The 3d5ade8 comment claims 3580-3600 and 3695-3710, but those files are not in the commit; 3695-3710 is the dispatcher subscription list. closed_session(Agents.md:155,192) is the only closed-session spelling in the docs tree;sessions-service.md:10, the session-access consumers andsession-boundary.mdusesession_closed, and #2127 defines NoSession/SessionClosing. State the Rpc mapping or use the final spelling. The author defers this to step 2.CollaborationTimeline.md:71givesstatea{}request and aclosederror while the appendixstate(&self) -> DelegationStatetakes no request and cannot fail; the same class as the Agents value reads fixed in round 2.Agents.md:162replies a bare array formembers, while the appendix returnsMembersReply {members}and line 144 says every operation answers one reply object. Make the row{members: [...]}.Agents.md:203says a caller whosecreate_sessionreply is lost finds the Session "by the id it chose", butCreateSessionhas no caller id, and main's launch contract says a lost reply can leave a Session no caller knows about and no lookup is added (origin/main:docs/design/appserver/sessions-service.mdsection 6.1). State the accepted limit or add a creation identity.Collaboration.md:100says forking a member is refused, but the Agentsfork_sessioncontract does not list this refusal or raise it in Requirements; an Agents implementer can allow it and produce a member role with no leader. Current code refuses it (crates/dim-app-server/src/agents.rs:1954-1956). Add it to the Agentsinvalidrow or to Collaboration's requirements.- Supersedes:
Agents.md:288andCollaboration.md:163citeservice-faces.md§3.1 for thecollaborationDirectoryremoval, but the edited text is in §4.9 (docs/design/service-faces.md:339). Fix the section number.
Verification
git merge-base origin/main HEADis 6e86d48;git merge-treeon origin/main and HEAD is clean; GitHub reports mergeable true.node scripts/adr-check.mjs --base 6e86d48c8passes (13 changed files), run with an isolated HOME/TMPDIR/XDG.- CI on 3d5ade8:
ci-oksuccess; the docs jobs are skipped. - Link check: 335 docs, 0 new broken relative links or anchors against main; the round-2 set is resolved. External PR-file URLs are not checked; #2029, #2091-#2097, #2100 and #2102 are open.
- Cross-PR: #2102's pending shape now matches. #2096 at 7cc7e87 still carries the
sessions.permission/permissionDefaults({})row inprocess-owner-operations.md:25, and #2097 at 9b87ef9 still has EventHub consumesessions.input,lookup,existsanddefaultBranchId(EventHub.md:106,161,220); #2097'ssessions-service.mdis the old pre-#2098 content. Coordinate the rebase so these rows are not restored. - Not run: Rust compilation. The Agents appendix was checked statically against the current exports and derives; the Collaboration appendix has the path error above.
Withdraw or keep
Withdraw as fixed: expectedCwd, the pending shape, the duplicate import and AgentProfile in the Agents appendix, QuiesceReply, request-less permissionDefaults, the Target tagged shape, the anchors across the two pages and the forward relative links, plus the round-2 lease, ADR-number, delete-shape, notice and EndListener items.
Keep as open: the cross-Session caller scope, the idle-unloaded state and acquire path, the requireInactive behavior, the Collaboration appendix, and the P3 list above.
|
|
||
| ### Session access | ||
|
|
||
| This owner holds no line or Session object. A member line's owner is resolved by id and called directly: `(session, line)` reaches any branch-group data face except registration points and lifecycle services, `sessionId` any Session-group data face ([ADR 027](https://github.com/arcships/dim/pull/2029/files) D1, D3). Registering a tool, a method or a guide entry stays in this Session's own scope. An answer it needs from another Session — the leader's destination from the member's part — is the other Session's `collaborationSession` value read by session id. It does not read a line's Timeline to re-derive state another owner folds. |
There was a problem hiding this comment.
P2: This is not a route ADR 027 D1 or #2127 defines. docs/design/contracts/session-access.md:9 says a Session-scope caller reaches its own line's owners with branchId; ADR 027 D1 (PR #2029 at 9e629e9) and #2127 define only process-to-Session by sessionId and (sessionId, branchId), and Session-to-own-branch by branchId. CollaborationSession and CollaborationTimeline are Session and branch parts, yet they call another Session's branch faces by (memberSession, line) and read the leader's collaborationSession value by sessionId (also CollaborationTimeline.md:60,93,128 and Agents.md:239). Failure: the leader line cannot write, stop or withdraw on the member line, and the member cannot resolve the leader's approval destination; an implementer must invent a route or move the calls to the process owner. Fix: either state that cross-Session calls are made by the process Collaboration owner and give the member part an operation on it, or extend ADR 027 D1 and #2127 to let Session and branch callers address another Session by id, with the visibility rule.
There was a problem hiding this comment.
Still open in c3acab3. docs/design/contracts/session-access.md:9 still limits a Session-scope caller to its own line, and docs/design/plugins/Agents.md:239 still says a Session-scope owner reaches another Session's collaborationSession value by sessionId; CollaborationSession.md:128,174 and CollaborationTimeline.md:60,93,128 rely on that path. ADR 027 D1 (docs/adr/027-cross-scope-access-by-id.md:24-25) defines only process-to-Session and Session-to-own-branch, and #2093's SessionScope contract states NoSession never reaches a Session part. The new wording and the D1 citation do not add a caller scope. The fix is unchanged: move cross-Session calls to the process Collaboration owner with an operation for the member part, or extend ADR 027 D1 and #2127 with a cross-Session segment and its visibility rule.
| | `sessions.pending` | [InputQueue](https://github.com/arcships/dim/pull/2102/files)'s `pending({inputId, publishedCutoff?}) → {pending}` by `(session, line)` id; the owner's published head applies when the caller names no `publishedCutoff` | | ||
| | `sessions.history` | [TimelineTree](https://github.com/arcships/dim/pull/2092/files)'s `read(line, from, through, limit)` by `(session, line)` id | | ||
| | `sessions.defaultBranchId` | [TimelineTree](https://github.com/arcships/dim/pull/2092/files)'s `directory` for the Session; the default line is in the reply | | ||
| | `sessions.exists` | `session.state`: `deleted` and `unknown` answer false, `closed` and `loaded` answer true | |
There was a problem hiding this comment.
P2: An idle-unloaded Session has no state here, and mapping unknown to false is wrong for it. state is loaded, closed, deleted or unknown, and unknown is an id this process never saw (line 158), so an idle-unloaded Session with rows is none of them. EventHub reads sessions.exists and treats false as deleted, removing the Session's subscriptions (docs/design/plugins/EventHub.md:224-229); an idle-unloaded Session is restorable and must answer true. acquire also says it pins a loaded Session and its unknown error is "No loaded Session has the id" (lines 155,191), while ADR 027 D5 and #2127 say a target that is not loaded takes a hold and Agents loads the next generation; sessions-service.md:8 says the next call restores it. Current code answers true for an unloaded Session (crates/dim-app-server/src/agents/sessions.rs:606; crates/dim-app-server/src/agents/sessions/tests.rs:189,207). Failure: a scheduled or event input cannot recover an idle-unloaded target through a lease, and EventHub can drop subscriptions of a live restorable Session. Fix: add an unloaded state or treat unknown with stored:true as restorable, answer exists true when rows exist, and state that acquire restores an idle-unloaded Session.
There was a problem hiding this comment.
Partly addressed: 59e4316 renamed the error to session_closed. The rest is unchanged. Agents.md:155 still says acquire pins a loaded Session, :191 still says unknown means no loaded Session, :158 has no state for an idle-unloaded Session, and :229 still maps unknown to exists false. docs/design/appserver/idle-unload.md:26,210,342 says acquire restores an unloaded Session; origin/main crates/dim-app-server/src/agents.rs:929-984 does restore, and agents/sessions.rs:606 with agents/sessions/tests.rs:149-208 answers exists true for an unloaded Session with rows. EventHub.md:227-228 removes subscriptions on false. Add an unloaded state or treat unknown with stored:true as restorable, answer exists true when rows exist, and state that acquire restores an idle-unloaded Session.
|
|
||
| `create_session.model` is a resolved `ModelSelection`. Absent, the owner asks Provider's `resolve` for the Agent profile's model and cwd. The reply carries the policy and model the Session was created with, so a caller records the authority a run got without a second read. | ||
|
|
||
| `delete_session` answers an in-use Session as a normal reply, not an error: `{removed: false, inUse: reason}`, which Rpc maps back to its `session_active` error; a delete that removed the Session answers `{removed: true}`. |
There was a problem hiding this comment.
P2: requireInactive has no stated behavior. The operation takes it (line 153), and this paragraph says an in-use Session answers {removed:false, inUse} without saying whether that depends on the flag. Main's client contract says it defaults to false and without it the delete closes and removes an in-use Session; only true refuses session_active (docs/design/appserver/session-deletion-and-fork.md:78; crates/dim-app-server/src/connection.rs:1418-1431 calls delete_if_inactive only for true). Failure: implementing this literally makes dimcode session delete ID on a busy Session return session_active and remove nothing, contrary to the PR's "Client-visible changes: None". The unknown or already-deleted reply is also unstated. Fix: state true answers removed false with inUse, false deletes regardless of use, and an unknown id answers removed false without inUse, with Rpc's mapping for each.
There was a problem hiding this comment.
Still open in c3acab3; the delete section is unchanged. Agents.md:153 takes requireInactive, but :171 states only the in-use reply. origin/main:docs/design/appserver/session-deletion-and-fork.md:78 says the field defaults to false and without it the delete closes and removes an in-use Session; crates/dim-app-server/src/connection.rs:1418-1435 calls delete_if_inactive only for true. State true answers removed:false with inUse, false deletes regardless of use, and an unknown or already-deleted id answers removed:false without inUse, with Rpc's mapping to session_active and deleted: true/false.
| ```rust | ||
| #[derive(serde::Serialize, serde::Deserialize)] | ||
| #[serde(untagged)] | ||
| pub enum Target { Agent { agent_id: String }, Profile { profile: crate::protocol::AgentProfile } } |
There was a problem hiding this comment.
P2: This still does not compile and the untagged change dropped the field casing. crate::protocol::AgentProfile does not exist (crates/dim-app-server/src/protocol.rs has no AgentProfile; crates/dim-app-server/src/agents.rs:15 re-exports dim_agent_types::AgentProfile). With #[serde(untagged)] and no rename_all_fields, Target::Agent { agent_id } encodes as agent_id, not the {agentId} shape in the operations table at line 79 or the page's "camelCase fields" sentence at line 168. Failure: the copied enum fails to compile, and the table and binding disagree on the wire. Fix: use dim_agent_types::AgentProfile and #[serde(untagged, rename_all_fields = "camelCase")], or rename the field.
There was a problem hiding this comment.
Still open in c3acab3; Collaboration.md is unchanged. Line 173 still uses crate::protocol::AgentProfile, which does not exist (crates/dim-app-server/src/agents.rs:15 re-exports dim_agent_types::AgentProfile), and the untagged enum still has no rename_all_fields, so Target::Agent encodes agent_id instead of the agentId in the table at line 79 and the camelCase rule at line 168.
|
|
||
| ## 3. Flows | ||
|
|
||
| Superseded by the owners in the block table of [§1](#1-cross-scope-access-by-id). |
There was a problem hiding this comment.
P3: This stub says old section 3 is superseded by owners, but main's expectedConfig paragraph stayed in this page at section 2 (session-access.md:28), and docs/design/appserver/session-deletion-and-fork.md:303 still links #3-flows for the checked fork. Failure: the fork requirement lands on a stub that points away from its definition. Fix: make this stub link #2-attach-expectations.
There was a problem hiding this comment.
Still open in c3acab3: session-access.md:215 still says section 3 is superseded by the owners, while expectedConfig remains in section 2 and session-deletion-and-fork.md:303 links #3-flows for the checked fork. Point the stub at #2-attach-expectations.
|
已按评审修改,head 跨 PR 对齐:
验证: |
|
补充说明,head
验证: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Review: Agents and Collaboration owner contracts (round 4)
Scope: refs #2020 and #2015. This PR adds Agents.md, CollaborationSession.md and CollaborationTimeline.md, rewrites Collaboration.md, and replaces the sessions supplement in sessions-service.md and session-access.md with access by id under ADR 027. This round reviews the full main...head at c3acab3 and the delta over 3d5ade8.
Verdict: REQUEST_CHANGES
Round-3 status
Fixed in c3acab3: the closed_session spelling is now session_closed; SessionTitle's creation entry names create_session and links this contract; the two Supersedes clauses for session-access.md section 7 and the sessions-service Exposure row are recorded.
All four prior P2s remain open. The session_closed change is a rename only: docs/design/plugins/Agents.md:155,158,191,229 still define acquire only for a loaded Session and map an id this process never saw to no state and no existence answer. The new c3acab3 citations introduce P2-5, and the full-document read adds P2-6.
P2
P2-1. Collaboration's cross-Session calls still sit outside ADR 027's caller scopes
Problem: docs/design/contracts/session-access.md:9 still gives a Session-scope caller only branchId for its own line's owners. docs/design/plugins/Agents.md:239 says a Session-scope owner reached across Sessions is reached by sessionId, and docs/design/plugins/CollaborationSession.md:128,174 and docs/design/plugins/CollaborationTimeline.md:60,93,128 rely on that path for the leader's collaborationSession value and the member's branch faces. ADR 027 D1 (docs/adr/027-cross-scope-access-by-id.md:24-25) defines process-to-Session with sessionId and (sessionId, branchId), and Session-to-own-branch with branchId; it has no Session-to-other-Session or branch-to-other-Session segment. #2127's acceptance covers the same two segments, and #2093's SessionScope contract states NoSession never reaches a Session part (SessionScope.md:26 at 53961a1).
Failure scenario: the member's Session part cannot resolve the leader's approval destination, and the leader's branch part cannot write, stop or withdraw on the member line. An implementer either invents a route the mechanism does not define or moves the writes to the process Collaboration owner, which contradicts the ownership the three pages state.
Evidence: docs/design/contracts/session-access.md:9; docs/design/plugins/Agents.md:239; docs/design/plugins/CollaborationSession.md:128,174; docs/design/plugins/CollaborationTimeline.md:60,93,128; docs/adr/027-cross-scope-access-by-id.md:24-25; docs/design/plugins/SessionScope.md:26 at 53961a1.
Fix: state that all cross-Session calls are made by the process Collaboration owner and give the member part an operation on it, or extend ADR 027 D1 and #2127 with a cross-Session segment and the visibility rule for which Session a caller may address. The c3acab3 link to D1 does not add that scope.
P2-2. An idle-unloaded Session has no state, no exists answer and no acquire path
Problem: docs/design/plugins/Agents.md:158 defines state as loaded, closed, deleted or unknown, and unknown as an id this process never saw. An idle-unloaded Session with rows is none of these. Agents.md:191 says unknown means no loaded Session has the id, :155 says acquire pins a loaded Session, and :229 maps unknown to sessions.exists false. docs/design/appserver/sessions-service.md:8 says the next call restores an idle Session, and docs/design/appserver/idle-unload.md:26,210,342 says acquire restores it.
Failure scenario: EventHub's reconciliation reads sessions.exists for each stored subscription (docs/design/plugins/EventHub.md:227-228); false means deleted and removes the subscriptions. After a process restart, a durable subscription to a Session with rows but no live instance answers unknown and is removed. Separately, a scheduled or event input that finds NoSession takes a hold as #2127 says, and acquire refuses it, so the input is never delivered.
Evidence: origin/main already implements both behaviors: crates/dim-app-server/src/agents.rs:929-984 restores an unloaded Session in acquire, and crates/dim-app-server/src/agents/sessions.rs:606 with crates/dim-app-server/src/agents/sessions/tests.rs:149-208 answers exists true for an unloaded Session with rows.
Fix: add an unloaded state, or define unknown with stored: true as restorable; answer sessions.exists true when rows exist; state that acquire restores an idle-unloaded Session and returns its new generation; keep session_closed for a business close. This also needs store.sessionConfig in the dependency row at Agents.md:134, which a restore reads today (agents.rs:978-984; #2091 SessionStore defines it at SessionStore.md:114).
P2-3. delete_session still does not state requireInactive's behavior
Problem: docs/design/plugins/Agents.md:153 takes requireInactive, and :171 says an in-use Session answers {removed:false, inUse} without saying whether that depends on the flag. Main's client contract says the field defaults to false, and without it the delete closes and removes an in-use Session; only true refuses session_active (docs/design/appserver/session-deletion-and-fork.md:78; crates/dim-app-server/src/connection.rs:1418-1435 calls delete_if_inactive only for true). An unknown or already-deleted id answers {deleted:false} on main, which the Agents reply does not state.
Failure scenario: a client or dimcode session delete ID with no requireInactive that hits a running Session receives session_active and removes nothing, contrary to the PR's "Client-visible changes: None".
Evidence: docs/design/plugins/Agents.md:153,171; docs/design/appserver/session-deletion-and-fork.md:78 at origin/main; crates/dim-app-server/src/connection.rs:1418-1435.
Fix: state true answers removed:false with inUse, false deletes regardless of use, and an unknown or already-deleted id answers removed:false without inUse; give Rpc's mapping to session_active and to deleted: true/false.
P2-4. The Collaboration binding appendix still does not compile and loses the camelCase field
Problem: docs/design/plugins/Collaboration.md:173 still uses crate::protocol::AgentProfile. crates/dim-app-server/src/protocol.rs exports no AgentProfile; crates/dim-app-server/src/agents.rs:15 re-exports dim_agent_types::AgentProfile. The same line lost rename_all_fields = "camelCase" when it became untagged, so Target::Agent { agent_id } encodes as agent_id, not the {agentId} shape in the operations table at :79 and the camelCase rule at :168.
Failure scenario: a copied enum fails with E0433, and an implementation following the table and one following the binding disagree on the wire field.
Evidence: docs/design/plugins/Collaboration.md:79,168,173; crates/dim-app-server/src/agents.rs:15; crates/dim-app-server/src/protocol.rs exports no AgentProfile.
Fix: use dim_agent_types::AgentProfile and #[serde(untagged, rename_all_fields = "camelCase")], or rename the field explicitly.
P2-5. c3acab3 drops ADR 027 D2 from both routing citations
Problem: docs/design/contracts/session-access.md:9 now cites only D1 for the sentence "The mechanism routes the id ... the instance key never reaches the caller". D1 defines caller scopes; D2 (docs/adr/027-cross-scope-access-by-id.md:28-33) is the runtime routing and instance-key decision. docs/design/plugins/Agents.md:275 changed D2, D4 to D1, D4 for a requirement that says "The mechanism must route ..." and "the instance key never goes to the caller". D1 does not state the instance-key rule.
Failure scenario: an implementer who follows the citations omits D2's runtime index and instance-key constraints, or reads D1 as covering the cross-Session sentence at Agents.md:239, which D1 does not.
Evidence: ADR 027 D2 was not reduced to the three-case rule; the three cases are its last bullet. The prior fix in 88e76b6 cited D1, D2 for this sentence.
Fix: cite D1, D2, and D4 where the requirement also says the call is not a dependency.
P2-6. Collaboration's Team status contradicts the idle-unload contract
Problem: docs/design/plugins/Collaboration.md:91 says "a member that is not loaded is closed". docs/design/appserver/idle-unload.md:355 says the Team status of an unloaded member is idle, "as for any available Session". Collaboration.md:84 defines the status values as working, idle or closed.
Failure scenario: a client or the leader sees an idle-unloaded member as closed, which reads as a business close, while the idle-unload contract says the member is available and restorable. The same missing state as P2-2 makes the implementation unable to produce idle for an unloaded member.
Evidence: docs/design/plugins/Collaboration.md:84,91; docs/design/appserver/idle-unload.md:355.
Fix: report idle for a restorable unloaded member and closed only for a business close, and state how the read distinguishes them.
P3
- Delete notice contract:
docs/design/plugins/Agents.md:235emitsagent/session-deleted"after any other delete", which reads as excluding the unloaded case, while origin/main emits it for every delete that removed rows (crates/dim-app-server/src/agents.rs:1749-1774) and EventHub consumes only that event (docs/design/plugins/EventHub.md:226-227;crates/dim-event-hub/src/lib.rs:225). #2097's EventHub contract at ed43cd9 states the notice is emitted "loaded or unloaded" and uses it for the deletion path (EventHub.md:161), so the Agents sentence would break that consumer. State that an unloaded delete emits both notices. The dependency row atAgents.md:134also omitsstore.owner, which fillsagentIdfor a Session this process never loaded (#2091SessionStore.md:35,112; currentagents.rs:1730-1731). - Permalinks:
CollaborationSession.md:12still points atcrates/dim-app-server/src/collaboration.rs:3535-3560at 5a279d6, which is the plugin constructor and injections; the guide registration is at 3582-3610.CollaborationTimeline.md:12points at 972-1080, theCollaborationSessionstruct andop_turn; the fact writes are elsewhere. - Request-less read:
CollaborationTimeline.md:71givesstatea{}request and aclosederror while the appendixstate(&self) -> DelegationStatetakes no request and cannot fail. - Reply shape:
Agents.md:162replies a bare array formembers, whileAgents.md:144says every operation answers one reply object and the appendix returnsMembersReply { members }at:479. - Lost reply:
Agents.md:203says the caller finds a lostcreate_sessionreply "by the id it chose", butCreateSessionhas no caller id. Main's contract accepts that a lost launch reply can leave a Session no caller knows (origin/main:docs/design/appserver/sessions-service.md:232). State the accepted limit. - Fork refusal:
Collaboration.md:100refuses forking a member, but the Agentsfork_sessionrow atAgents.md:154does not list that refusal; origin/main refuses it atagents.rs:1956. Add it to theinvalidrow or to Collaboration's requirements. - Section number:
Agents.md:289andCollaboration.md:163citeservice-faces.md§3.1 for thecollaborationDirectory.relationsremoval, which is in §4.9 (service-faces.md:324-343). - Duplicate Supersedes bullet:
Agents.md:281and:283both coverdocs/design/appserver/sessions-service.md; merge them. sessions-service.md:87keeps the body fragment "#32 described the field as client-protocol data..."; it has no terminal punctuation and sits between two stubs. Finish or delete it.session-access.md:215says section 3 is superseded by the owners, but expectedConfig stayed in section 2 andsession-deletion-and-fork.md:303still links#3-flowsfor the checked fork; point the stub at#2-attach-expectations.session-access.md:265keeps the "#5, used by the offline rows" paragraph inside the anchors block; move it to a kept section or delete it.- Examples:
Agents.md:121matches aQuiesceenum while the appendix definesQuiesceReply;Agents.md:79callscollaboration.create_agentandcreate_session, but those are Agents operations, and no such methods are on the Collaboration interface. - PR-file anchors:
session-access.md:199links.../files#errorsfor the Agents, InputQueue and TimelineTree error tables; GitHub's PR files view has no heading anchors, so the links do not reach the tables. Use file paths once the owner pages land. - PR body: still says one
agent/session-deletednotice and that both permission reads move tosessions.permission*; the head keeps three notices and removessessions.permission. It also cites #2091 f7425d5, #2092 d968023 and #2093 4209c44, which are no longer the heads, and says #2093 states no requirement, while #2093 at 53961a1 raises #2127 at line 218.
Cross-PR
- #2095 at fa2eea2 and #2096 at 9ca30e0 modify
docs/design/contracts/process-owner-operations.mdbut still carry the oldsessionsrows at lines 12, 25 and 36-40. They must rebase on this contract or resolve by taking the new rows, not by taking the sibling file wholesale. - #2102 at 3b48e12 modifies
docs/design/contracts/session-access.mdand its head still deletes main'ssession.attach.expectedConfigparagraph and keeps the oldsessions.withdrawrow in A.4. This PR keeps expectedConfig, so #2102 must rebase; its head is not aligned with the file this PR produces. - #2091 at 8f9f5e1 still edits
plugins/SessionTitle.mdwithsessions.launch, and #2099 at 8f440bd replaces the same page with launch wording. Thecreate_sessionchange here is consistent on its own, but the merged result needs one term and one owner for the paragraph. - #2097 at ed43cd9 still describes EventHub consuming
sessions.input,lookup,existsanddefaultBranchId(EventHub.md:106,161), while this PR deletes those names and mapsexiststosession.state. Either #2097 updates its rows or this PR records the follow-up; the Supersedes list only names Scheduler, Workflow, worktree-management and p6-p7-bindings. process-owner-operations.md:40assigns Provider a per-line "published adopted startup connection" read, but neither #2096's Provider contract nor #2102's PromptAdoption names the publisher or the value. Confirm with the Provider owner which operation or value is read.
Verification
node scripts/adr-check.mjs --base origin/mainpasses (13 changed files), run with an isolated HOME/TMPDIR/XDG under the review data directory.- Docs link check over the full tree: no new broken relative links or heading anchors against origin/main. The only difference is a pre-existing line anchor to a crate README.
- CI on c3acab3:
ci-oksuccess andchangessuccess; the build, platform and scripts jobs are skipped for this docs change; the commit status is pending with no external statuses. - Not run: Rust compilation. The Collaboration appendix failures are verified against the current exports and serde attributes.
Withdraw or keep
Withdraw the round-3 approvalDestination invalid_request P3: the Rust method returns Option, and the HostDispatch layer can answer invalid_request for a malformed request, so the table and appendix are compatible. Withdraw the round-2 tagged Target shape P3: untagged is now right; only the path and the field casing remain in P2-4. Keep the earlier fixed-item withdrawals for expectedCwd, pending, the Agents appendix imports, delete shape, observe, notices, EndListener, Delivered casing, permissionDefaults and QuiesceReply serialization.
Keep as open: P2-1 to P2-6 and the P3 list.
| | `SessionConfig` field `interactive` | Session record | Supplement | | ||
| | Session facade ([agent.rs](../../../crates/dim-agent-runtime/src/agent.rs), [branch.rs](../../../crates/dim-agent-runtime/src/branch.rs)) | Session, branch | Existing | | ||
| | InputQueue | Branch | Change: consumes `input/withdraw`, writes `input/deleted`; withdrawal service | | ||
| A process-scope caller reaches any Session-group data face with `sessionId` and any branch-group data face with `(sessionId, branchId)`; a Session-scope caller reaches its own line's owners with `branchId`. The address is not limited to input writes or published-value reads. The mechanism routes the id to the target instance's data-face dispatch; the instance key never reaches the caller, and the caller calls the owner's own operation ([ADR 027](https://github.com/arcships/dim/pull/2029/files) D1; [#2127](https://github.com/arcships/dim/issues/2127)). Nothing forwards by operation name, wraps a request or reply, or restates the owner's error. An unknown, unloaded or closing target ends resolution with the mechanism's own error. |
There was a problem hiding this comment.
P2: This sentence now cites only D1 for the routing and instance-key rule. ADR 027 D1 defines the caller scopes; D2 (docs/adr/027-cross-scope-access-by-id.md:28-33) is the runtime routing and instance-key decision, and the three-case rule is its last bullet. Failure: a caller that follows D1 alone misses the runtime index and the rule that the instance key never reaches the caller. The same sentence gives a Session-scope caller only its own line, so it also does not cover the cross-Session reads at CollaborationSession.md:128 and CollaborationTimeline.md:60,93. Fix: cite D1 and D2, and state which caller scope may address another Session.
|
|
||
| ## Requirements raised to mechanism owners | ||
|
|
||
| 1. **Route by id; the instance key never goes to the caller.** The mechanism must route a call to the Session group's data faces by `sessionId` and to the branch group's data faces by `(sessionId, line)`, so a caller reaches the owner's own operation without a facade, a forwarding object or an instance key ([ADR 027](https://github.com/arcships/dim/pull/2029/files) D1, D4; [#2127](https://github.com/arcships/dim/issues/2127)). Registration points (`sessionMethods`, `toolRegistry`) and lifecycle services are excluded (D3). The path must be available through rutis sessions to language runtimes and leaves, as other data faces are (D3); clients keep using Rpc. This is the same requirement TimelineTree records ([TimelineTree](https://github.com/arcships/dim/pull/2092/files)); Rpc, Provider, Collaboration, Scheduler, Workflow and EventHub depend on it. |
There was a problem hiding this comment.
P2: D2, D4 became D1, D4, but the requirement's first sentence is D2: the mechanism routes the call and the instance key never goes to the caller. ADR 027 D1 is the caller scopes and D4 is "call by id is not a dependency"; neither states runtime routing or instance-key non-disclosure (docs/adr/027-cross-scope-access-by-id.md:28-33), and D2 was not reduced to the three-case bullet. Failure: an implementer reads the requirement without the index and key rule. Fix: cite D1, D2 and D4.
| `close` closes the member Session through Agents' `close_session` and removes the relation. It does not close the leader, delete rows, or stop a turn: the branch part settles the request and stops the member's turn first, so ordering a close against a live turn is the branch's concern. | ||
|
|
||
| ## 2. The guide entries | ||
| `team` reads each member's running state from Agents' `session` value; a member that is not loaded is `closed`, and a loaded member with a running turn is `working`. |
There was a problem hiding this comment.
P2: This conflicts with docs/design/appserver/idle-unload.md:355, which says the Team status of an unloaded member is idle, "as for any available Session". An idle-unloaded member is not loaded but is restorable, so reporting it closed reads as a business close. The same missing state as the Agents session enum (P2-2) prevents the implementation from telling them apart. Fix: report idle for a restorable unloaded member and closed only after a business close, and state the read that distinguishes them.
| | Service | Purpose | | ||
| | --- | --- | | ||
| | The storage engine's private transactions | This owner's Agent and member records: write, delete and the startup sweep of owned Agents. The engine executes the transaction; it answers no business read or write for these rows on any face. | | ||
| | `store.create`, `delete`, `fork`, `title`, `hasRecords`, `creationRecord` | Session rows, titles, creation records and the row write of a creation, delete or fork. | |
There was a problem hiding this comment.
P3: The row omits two store reads the target needs. store.owner fills the agentId of agent/session-deleted and agent/unloaded-session-deleted for a Session this process never loaded (#2091 SessionStore.md:35,112; origin/main crates/dim-app-server/src/agents.rs:1730-1731). store.sessionConfig is what an idle-unloaded restore reads today (agents.rs:978-984; #2091 SessionStore.md:114). Failure: the delete notice cannot name the owner, and acquire cannot rebuild a stored Session. Fix: add owner and sessionConfig to the row and name their uses in delete_session and acquire.
|
|
||
| ### Execution notices | ||
|
|
||
| Three process events stay, because their consumers see state `observe` cannot report: `agent/session-restored {agentId, sessionId, generation}` when a Session is restored for this process, `agent/unloaded-session-deleted {agentId, sessionId}` when a delete removed an unloaded Session's rows, and `agent/session-deleted {agentId, sessionId}` after any other delete removed the rows. Provider reattaches a retained startup connection on the restore event and releases it on the unloaded-delete event; Collaboration re-arms its member watch on the restore event and ends the relation on the unloaded-delete event; EventHub removes the Session's subscriptions on either delete event. They are rutis process events, not Timeline facts, and carry no state a caller folds (`observe` remains the per-generation end notification for callers that need the close/unload distinction). |
There was a problem hiding this comment.
P3: "after any other delete" reads as excluding the unloaded case, but origin/main emits agent/session-deleted for every delete that removed rows and also emits agent/unloaded-session-deleted for the unloaded case (crates/dim-app-server/src/agents.rs:1749-1774). EventHub listens only to agent/session-deleted (docs/design/plugins/EventHub.md:226-227; crates/dim-event-hub/src/lib.rs:225), and #2097's EventHub contract at ed43cd9 requires it for loaded and unloaded deletes (EventHub.md:161). Failure: an unloaded delete misses EventHub's notice and its subscriptions stay until a reconciliation read. Fix: state that an unloaded delete emits both notices, or change EventHub's contract to consume the unloaded event too.
|
|
||
| | Operation | Intent | Request | Reply | Cancellation | Errors | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `state` | This line's delegations as a value | `{}` | `{open: [{member, delegationId, requestEvent, delivered}], closing}` | None | `closed` | |
There was a problem hiding this comment.
P3: The request is {} and the error is closed, while the appendix state(&self) -> DelegationState takes no request and cannot fail. This is the same shape mismatch the Agents value reads had in round 1. Failure: the wire and error contract cannot match the binding. Fix: mark the request as none and drop closed, or make the method return Result.
| - **Restart.** A restart restores owned Agents as owned and members with their leader. It also recovers requests that have no `collaboration/result` yet: each recovered request is stopped on the line that holds the member input its `collaboration/delivered` fact names, never on the member's current default line; without that evidence recovery stops nothing and logs the skip. | ||
| - **Close.** `close` ends the member Session for this process, keeps its records, and ends its relation. A restart loads the member again as an ordinary Session its leader may address; closed is process state and is not stored. | ||
| - **Delete.** Deleting a leader ends its Team through Agents' `delete_session`: each member's own delete runs first, then each owned Agent closes and its record goes, then the leader. There is no transaction across the Team: a failure midway leaves the leader with part of its Team gone, and a retry finishes. | ||
| - **Fork.** Forking a member is refused: the fork would carry the member's role and Agent but no leader. |
There was a problem hiding this comment.
P3: Forking a member is refused here, but the Agents fork_session row (Agents.md:154) does not list the refusal, and origin/main refuses it (crates/dim-app-server/src/agents.rs:1956). Failure: an Agents implementer can allow a fork that carries a member role with no leader. Fix: add the refusal to fork_session's invalid row or to this page's requirements.
| | `sessions` | The loaded Sessions' value | — | `{sessions: [{sessionId, agentId, generation, closed, running}]}` | None | — | | ||
| | `defaults` | The process Session defaults | — | `SessionConfig` | None | — | | ||
| | `instance` | The protocol instance of this generation | — | `{instanceId}` | None | — | | ||
| | `members` | The member links this owner recorded | `{leaderSessionId?}` | `[{memberSessionId, leaderSessionId, memberAgentId}]` | None | `closed` | |
There was a problem hiding this comment.
P3: This reply is a bare array, while line 144 says every operation answers one reply object and the appendix returns MembersReply { members } at line 479. Failure: the wire reply and the binding disagree. Fix: make the row {members: [...]}.
|
|
||
| | Operation | Normal path | Caller cancels | Caller unloads | Owner closes or reloads | Settled by | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `create_session` | Take the process hold, resolve the model, cap the policy, create the worktree, write the rows through SessionStore, build the instance, record the version, answer the ids | Before the rows commit: rows removed, worktree discarded, nothing published | The creation runs as the owner's admitted work and reaches its end; the reply may be lost, and the caller finds the Session by the id it chose or by `sessions` | Admission stops; an admitted creation finishes or is rolled back; a reloaded directory logic serves the next call | Rows by SessionStore; worktree by ManagedWorktrees; instance, slot and version by Agents | |
There was a problem hiding this comment.
P3: The caller cannot find a lost create_session reply "by the id it chose": CreateSession has no caller-supplied id. Main's contract accepts that a lost launch reply can leave a Session no caller knows (origin/main:docs/design/appserver/sessions-service.md:232). Failure: the contract promises a recovery the request cannot perform. Fix: state the accepted limit, or add a caller creation identity.
|
|
||
| - `docs/design/appserver/sessions-service.md`: the `sessions` service, its methods and its decisions D1–D14; the page keeps only the lifecycle, submission-identity and authority facts. | ||
| - `docs/design/contracts/session-access.md`: the `sessions` method table (A.1), its errors (A.6), the `sessions` rows of §1 and §6, and the Rust binding (Appendix E). Section 7's "never exported over RPC entries or rutis links" becomes [ADR 027](https://github.com/arcships/dim/pull/2029/files) D3's reach. | ||
| - `docs/design/appserver/sessions-service.md`: the "Exposure" row becomes [ADR 027](https://github.com/arcships/dim/pull/2029/files) D3's reach. |
There was a problem hiding this comment.
P3: This duplicates the sessions-service.md bullet at line 281. Failure: the Supersedes list names the same document twice and reads as two removals. Fix: merge the Exposure clause into the line 281 bullet.
|
Closing as part of abandoning the owner-split experiment. |
Refs #2020 · Refs #2015
Summary
Cross-scope access follows ADR 027:
docs/design/contracts/session-access.mdanddocs/design/appserver/sessions-service.mddefer to ADR 027 and this contract, and keep only the input-source, configuration, withdrawal, fixed-prefix, lifecycle, submission-identity and authority facts that outlivesessions.Target contracts for the Agent directory and Collaboration board, after the §7 review of #2029 (
869ef0d7e):Agents.md: one process owner for Agent and Session instances and admission, one facesessionsmarked onAgents.agentIndex,sessionPermissionsand theAgentDirectory/AgentIndexsplit are deleted. Operations are ids and values (18):agents,create_agent,close_agent,create_session,close_session,delete_session,fork_session,acquire,release,observe,session,sessions,defaults,instance,members,permissionDefaults,quiesce,settle. Agent and member records are Agents' own; the storage engine carries no face for them.sessionPermissionsretires:permissionDefaultsmoves ontosessions.permissionDefaults, and a line's current permission state is Permission's published value read by line id (no proxy operation). Model resolution uses Provider'sresolve/preferences. The removedsessions.lookup/pending/stopname their actual owners (idempotentinputQueue.submit,inputQueue.pending, Loop'sstop_turn), and those receipts are raised with 所有者扫描:分支轮次链路 #2027. A delete publishes oneagent/session-deletednotice for EventHub. The removedsessions.*directory calls are mapped to their targets inAgents.md. NoAgentHost,SessionorSessionUsecrosses.Collaboration.md(process): Team relations, establishment, close, observation, the address space, and the delegation lifetime carried over from the current page.CollaborationSession.md(Session): theagenttool and its texts, the two guide entries, the threesession.collaboration.*methods, the approval route, the routing index and thecollaborationSessionface. Per cross-cutting decision 2 the part writes a line's input and reads a line's published value by id; it holds noBranch, noservice::<T>(branch)and folds no line state.CollaborationTimeline.md(branch): one line's delegations, itscollaboration/*facts, the approval route of that line, the published delegation value the Session part reads, and settlement on rebuild and close.sessionPermissions.*followsprocess-owner-operations.md: the two reads move tosessions.permission*, they are not deleted.Client-visible changes
None: the client protocol, its error codes and the
agenttool's texts and results are unchanged. The removedsessionsmethods are plugin-facing only.Requirements raised
(session, line)addressing — the mechanism resolves a line's branch-group service by line id and callers writeline_owner::<T>(line)?.op(..); it also serves Permission's published value by line id and a Session's method table andtimelineTree.directoryby session id. Rpc, Provider, Collaboration, Scheduler, Workflow and EventHub are blocked on it; docs(design): target contracts for the Session scope and its host ports #2093 currently states no requirement.store.queryanswers for a loaded Session, for Rpc'ssession.summariespreview.Delivery part: comment.
Verification
node scripts/adr-check.mjs --base origin/maincargo run --locked -p xtask-checkMerge order
#2029 → #2080 → #2091/#2092/#2093 → #2094 → #2096 → the rest.
Sibling heads this change is aligned with: #2091
f7425d55c, #2092d96802349, #20934209c4464, #21023b48e1248, #210359a77a3d1. A paragraph that depends on a sibling names that PR; its head is the one above.