Repository navigation
Conversation
|
评审(head
|
|
已按评审修改,head
|
Review of the contract asked for two shapes. A Session part resolves a line's owner by type (line_owner::<T>(line)) and calls that owner's own operation, instead of routing by operation-name strings with json requests; the mechanism requirement now says so and matches #2093. The directory read splits into directory() and line(id), so no caller matches an enum reply or writes unreachable!.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: this PR adds six owner contracts (SessionScope, RequestSettings, ContextFacts, ContextProjection, SummaryStrategy, FileAccessFacts) and their README rows for #2025, and raises requirements to #2018 and #2024. I checked them against the proposed section 7 and ADR 027 (pr2029 at 658e5a4), ADR 002 and ADR 014, the current code, and the existing design contracts. Verdict: REQUEST_CHANGES. The direction is right: one owner face, data replies, callback and id exceptions, and one settlement owner. The blockers below are contract defects, not wording. The prior round's two findings are addressed: lineOwner.call is gone and the handover section states who creates, holds and closes the branch context. Nothing to withdraw.
Blockers
P1 1. ShellInput is assigned to withHold although its run outlives the call
- Problem:
SessionScope.md:34assigns ShellInput's command towithHoldfor "the extent of the call", and the example atSessionScope.md:66-78runs the command as the callback. ShellInput's own design says a cancelledshell.runreturns at once and leaves the run untouched (docs/design/plugins/ShellInput.md:336), and the run keeps a hold in its registry until it leaves the registry (ShellInput.md:334;crates/dim-agent-capabilities/src/shell_input.rs:5-12,263,283,290-295). The work outlives the call on the normal client-disconnect and reload paths. - Failure: if
withHoldreleases the lease when the call returns or is dropped (SessionScope.md:127,156), an idle unload can end the Session while the command is still running, or the implementation must change ShellInput's documented two-cancellation behavior. If the owner keeps the work running, the callback no longer covers "the extent of the call" and thecancelledanswer is wrong. - Fix: classify ShellInput's run as
hold, notwithHold, and show the id kept in ShellInput's registry. If no caller remains whose work ends with the call, removewithHoldinstead of adding an unused operation.
P1 2. FileAccessFacts.check cannot express the effective access preset and invents GrantMode values
- Problem: the request is
{access, mode, path}, whereaccessis read or write andmodeisGrantMode { Ask, Session, Once }(FileAccessFacts.md:53,56,124-137). The owner currently takesFileAccess { ReadOnly, WorkspaceReadWrite, Unrestricted }andGrantMode { Read, Write }(crates/dim-agent-types/src/permission.rs:14-19;crates/dim-agent-types/src/grant.rs:13-18). Permission uses theFileAccessvalue to make a write grant inert under read-only and active under workspace-write (crates/dim-agent-capabilities/src/file_access.rs:182-194;crates/dim-agent-capabilities/src/permission.rs:374-424). ADR 014 says the branch preset is a query argument and the query isfacts(session_id, preset, path, mode)(docs/adr/014-file-access-facts.md:28,36-41,129). - Failure: a two-valued
accesscollapses read-only and workspace-write, so the owner cannot apply the grant rule;FileAccess::WriteandGrantMode::Askin the example do not exist, so the binding does not compile. A caller following it either denies a permitted workspace write or allows a read-only write. - Fix: use
dim_agent_types::FileAccessanddim_agent_types::GrantModeinCheck, or define a new data enum that names all three preset values and both grant modes; update the example, verification and the ADR 014 reference.
P1 3. The lease operations do not carry the caller row in the binding
- Problem:
SessionScopebinds every lease to the calling row, settles it at the row's unload, and makesreleasereject another row's id (SessionScope.md:14,130,137,157-159). The Rust binding has nocaller: &CtxonwithHold,hold,observeFaultorrelease(SessionScope.md:347-356), while the document sayscaller: &Ctxis the binding's caller row (SessionScope.md:368). The current implementation takesctxforholdandobserve_fault(crates/dim-agent-runtime/src/config.rs:501,506-510), andreleasehas no row check (config.rs:531-539). - Failure: a part or another language calls
hold(); the owner has no row to register the lease under, so the row unload does not release it andunload_if_idlerefuses permanently.releasecannot returninvalidfor another row's id, contrary to the error table. A Rust caller cannot pass its row either, because the appendix has no parameter. - Fix: add
caller: &Ctx(or an explicit row id from the bridge) to every lease-taking and lease-releasing operation and show it in the appendix; alternatively state that the bridge supplies the caller row without a parameter and show that binding for Rust direct calls too.
P2 4. The new faces contradict the retained owner-operation and service-face contracts
- Problem:
SessionScope.md:116,229-235,RequestSettings.md:95,ContextProjection.md:129andSummaryStrategy.md:127state one new face and the removal of the old names. The repository's target contracts still define the old surface:timelineTree.call({branchId,operation})for Session callers (docs/design/contracts/runtime-owner-operations.md:35-36),sessionLifecycle/sessionIdentity/sessionConfig/agentConfig(docs/design/plugin-contract.md:118-121;runtime-owner-operations.md:11,29),sessionLoader(runtime-owner-operations.md:20),PrepareModelHost(line 69),HistoryRenderer(line 73), andtimelineStorewithquery,sessionConfig,createSession,releaseSession,rollbackSessionandappend(docs/design/resource-faces.md:607-617;docs/design/service-faces.md:129). The generated catalog lists the same old names (docs/architecture/rust-agent/generated/catalog.md:75-94). - Failure: an implementer following the retained contract keeps
timelineTree.call, the exact forwarding facade section 7 forbids and the previous review removed from SessionScope, and keeps the old services; or the Session scope has bothqueryandsessionConfigspellings, contradicting "one spelling per operation". - Fix: update those contracts in this change, or state in this PR that #2025 and #2018 supersede their rows and link the delivery. Remove
timelineTree.callfrom the target if the no-facade rule stands.
P2 5. RequestSettings cannot publish the aimux request-id extension
- Problem: the value is derived once at assembly (
RequestSettings.md:11) and the exception says the owner publishes profile metadata extensions such as a request-id extension while Loop only adds the turn's ids (RequestSettings.md:71). The example adds only session and turn ids (RequestSettings.md:39-43). The aimux profile setsrequestIdfrom the per-requestrequest_idon every prepare (crates/dim-agent-aimux/src/plugin.rs:346-348,356-379), and the request log reads it (crates/dim-agent-aimux/src/request.rs:366-372;crates/dim-agent-aimux/tests/model_flow.rs:465-468). - Failure: implementing the target drops
requestId; the aimux request log no longer associates the recorded exchange with the request, and the existing test fails. - Fix: keep the request id in the per-request data Loop adds (with the turn and session ids), or pass it to
settingsand have the owner include it; align the exception and the example.
P2 6. contributions and estimate do not fit together
- Problem: the binding says
ContributionsReply.fixedand.messagesare token counts (ContextFacts.md:188-192,228), but the example reads.estimatedfrom them (ContextFacts.md:48-49) and the verification sayscountequals the components summed throughestimate(ContextFacts.md:97).estimatetakes aContribution(ContextFacts.md:65,196-200) that no operation returns. The current counter returnsContextContributionand hasfixed,messageandestimate(crates/dim-agent-capabilities/src/host.rs:1332-1358), and ContextUsage adds and subtracts those facts (crates/dim-agent-capabilities/src/context_usage.rs:343-378,532-608). - Failure: if the reply carries token counts, ContextUsage cannot persist and re-estimate contributions and
estimateis unreachable; if the reply should carry contribution facts, the binding and the note are wrong. The caller example does not compile either way. - Fix: return
{algorithm, fixed?: Contribution, messages: [Contribution]}fromcontributionsand let callers callestimate, or dropestimateand makecontributionsreturn token counts; align the example, note and verification.
P2 7. The streamed reply loses the fields the callers use and holds the whole event list
- Problem: the reply is
{context, history, configuration?, prompt?}(ContextProjection.md:67,155-162). The currentStreamedContextcarriesancestry,compaction,branchesandcompaction_cutand deliberately does not retain events (crates/dim-agent-capabilities/src/history.rs:728-740);PolicyContext::from_streamreads those fields (crates/dim-agent-capabilities/src/context_policy.rs:156-169).ContextHistoryholdsevents: Vec<Arc<AgentEvent>>(crates/dim-agent-runtime/src/core/timeline.rs:82-88). The document also says the streamed form releases history page by page (ContextProjection.md:13) and keeps only the current projection (ContextProjection.md:106), while the code accumulates the rendered history and the new reply would add all events. - Failure: ContextPreparation cannot choose the compaction cut, rank branches or save a snapshot, or the streamed read holds the whole event list and defeats the memory bound.
- Fix: keep the streamed fields (or define a streamed context type that carries them without events); do not put
ContextHistoryin the streamed reply; correct the memory claim.
P2 8. The no-cut case and the diagnostics do not match the strategy
- Problem: the contract says
invalidfor "no legal cut" (SummaryStrategy.md:83,103), but the implementation returnsSkipped { reason: "nothing_to_compact" }(crates/dim-agent-capabilities/src/summary_strategy.rs:273-278), and the contract itself defines askippedoutcome (SummaryStrategy.md:75). The contract says diagnostics hold the duration (SummaryStrategy.md:75), butStrategyDiagnosticshas call count, usage and record only (crates/dim-agent-capabilities/src/host.rs:1361-1366), and the caller measures duration (crates/dim-agent-capabilities/src/context_policy.rs:1415). - Failure: the normal no-cut automatic compaction changes from a skipped fact to an error, so the compaction record and callers' reservation logic differ; a caller waiting for a duration the strategy cannot report has no data path.
- Fix: state that no legal cut is
skippedwithnothing_to_compact(or a distinct reason), and either move duration to the caller'sCompactionDiagnosticsRecordor add it to the strategy's data form.
P2 9. "The record never changes" and "the model methods write the record" cannot both hold
- Problem:
SessionScope.md:11says the creation record never changes, butSessionConfig.languageis updated in place while the Session runs (crates/dim-agent-runtime/src/config.rs:72-78) andconfigreturns the whole record (config.rs:178-184).RequestSettings.md:25says the Session's model methods "write the record", while its own exception says a model change is acontext/configuredTimeline record (RequestSettings.md:70;crates/dim-agent-capabilities/src/context_preparation.rs:215-225). - Failure: a caller caches
configas immutable and misses a language change, or an implementer writes the creation record on a model change. - Fix: say which member can change (language) and point to
sessionLanguage, or exclude it fromconfig; change the RequestSettings row to say Prompt writescontext/configured, not the creation record.
P2 10. workspaceRoots describes grant roots but the owner returns worktree roots
- Problem: the intent and requirement say "the workspace and confirmed grant roots" (
FileAccessFacts.md:13,24), while the dependency isP:worktrees(FileAccessFacts.md:47) and the implementation returns the workspace plus confirmed worktree subtrees and never reads the Session's grants (crates/dim-agent-capabilities/src/file_access.rs:112-129,454-482). Grants are a separate fact in ADR 014 (docs/adr/014-file-access-facts.md:25-26). - Failure: a caller believes the process boundary includes grants and starts a command with the wrong boundary, or a caller that needs a grant root gets none.
- Fix: say "workspace and managed worktree roots" and keep grants out of this operation, or add grants and their validation; make the requirement row match.
P2 11. Several binding appendices are not data or do not match their own errors
- Problem:
WithHoldRequestderivesSerialize, DeserializearoundWorkFn(SessionScope.md:316-320), a callback, while section 7 allows callbacks only by reference.SessionScopeErrorhas noCancelledvariant (SessionScope.md:322-336) althoughwithHoldanswerscancelled(SessionScope.md:127), andBuild(String)cannot carry thecleanupmember the error table givesbuild(SessionScope.md:148).PhaseReplyusesSessionPhasewithout serde or lowercase names (SessionScope.md:253-256;crates/dim-agent-runtime/src/config.rs:263-273).ContextProjectionusesPromptData(ContextProjection.md:161; the existing type isPromptReference,crates/dim-agent-capabilities/src/history.rs:733) and serde replies withHistoryEntryandContextHistory, which do not derive serde (history.rs:230;crates/dim-agent-runtime/src/core/timeline.rs:81).SummaryStrategyserde types includeCompactionCutandStrategyDiagnostics, which do not derive serde (crates/dim-agent-capabilities/src/host.rs:1283,1361).RequestSettings' example callssettings()?althoughsettingsreturns the value with no error (RequestSettings.md:31,131,135). - Failure: an implementer copying the appendix cannot compile the data face, or the wire error has no
cancelledorcleanupmember. - Fix: define serde data forms or add the derives and lowercase mapping, add the
Cancelledvariant and a cleanup field, keep callback parameters outside the serde request, usePromptReference, and fix the example's?.
Optional
docs/design/plugins/README.md:29still listsContextModelHostandCompactionStrategyHostafter these docs say those names leave the catalog; update the row or mark it superseded.- SummaryStrategy's dependency list omits
GuideEntries, which the current strategy uses to registerdim-summary(crates/dim-agent-capabilities/src/summary_strategy.rs:164-213). - ContextFacts'
counttakes bothmodelandrequest, whileModelRequestalready carries provider, model, snapshot, config and metadata (ContextFacts.md:63,67;crates/dim-agent-types/src/model.rs:887-920); the selection is redundant and can disagree with the request. - ContextProjection's error table says
invalidfor all operations, but therenderedContextrow does not list it (ContextProjection.md:68,80). - SessionScope's
unmountsaysinvalidwhen the id belongs to another Session; a Session-scoped owner has only its own instance ids and cannot distinguish another Session's id from an unknown one (SessionScope.md:134,145). withHold'sWorkFnreturnsResult<(), rutis::Error>while the prose says "work returns nothing" (SessionScope.md:137,313-314); say whether the work's error fails the call.- SessionScope says SessionScope provides "the five host ports" (
SessionScope.md:114), butprepareModelHostis provided by PrepareModelHost andcompactionStrategyHostby ProductSummaryStrategy (docs/architecture/rust-agent/generated/catalog.md:75,82). Say those names leave the catalog rather than that this owner provides them. - The PR description links
docs/templates/owner-redesign.md, which is not in this head; it exists only on the pr2029 branch. Link the file at that branch or state the dependency.
Verification
node scripts/adr-check.mjs --base 1bc7d67d7e3b357a64fd82c2589f57e4cb4b4becpassed (ADR freeze, 7 changed files).- Relative links in the seven changed files resolve;
#关闭exists insingle-tree.md. The PR description'sdocs/templates/owner-redesign.mdlink is the only broken link found. - Every code and doc line cited above was checked in the worktree at f669e43; no full build was run.
- PR state before drafting: head f669e43, OPEN, MERGEABLE, not draft. CI:
ci-okandchangespass; the other jobs are skipped. Head rechecked before writing the drafts; unchanged. - Diff: 7 files, +1419, -0.
| | `check` | Resolve a call's target and answer the facts under one access mode | `{access, mode, path}` | `{target, workspace, system, owned, grant, discoveryError?}` | The caller drops the call; the reads stop | `invalid`, `unavailable`, `cancelled`, `closed` | | ||
| | `workspaceRoots` | The workspace and confirmed grant roots a command may use | `{cwd}` | `{roots}` | The caller drops the call | `invalid`, `unavailable`, `cancelled`, `closed` | | ||
|
|
||
| `access` is read or write; `mode` is the grant mode the call asks for; `path` is the path the call named. `target` is the resolved path, and it is what the caller passes to the file operation. |
There was a problem hiding this comment.
P1: access as read or write and mode as GrantMode { Ask, Session, Once } do not match the owner's data. The current check takes FileAccess { ReadOnly, WorkspaceReadWrite, Unrestricted } and GrantMode { Read, Write } (crates/dim-agent-types/src/permission.rs:14-19, crates/dim-agent-types/src/grant.rs:13-18); Permission uses the preset to make write grants inert under read-only and active under workspace-write (crates/dim-agent-capabilities/src/file_access.rs:182-194, crates/dim-agent-capabilities/src/permission.rs:374-424). A two-valued access cannot express that rule, and FileAccess::Write and GrantMode::Ask in the example do not exist. Use the existing types or define a data enum with all three preset values and both grant modes; ADR 014 says the preset is a query argument (docs/adr/014-file-access-facts.md:28,36-41).
There was a problem hiding this comment.
Fixed in 5e5dd00: check now takes dim_agent_types::FileAccess and GrantMode, states the three preset values and the write-grant rule (FileAccessFacts.md:55-58,82). One leftover: the appendix imports the pair twice (FileAccessFacts.md:135,137), so it still does not compile; noted inline.
| | Read identity: Attachments' ownership check, Permission and tool-source attribution, the store key | No | `identity` | | ||
| | Wait for publication or for close to start: BranchLine's writer, Skills' replacement, ShellInput's refusal, FileAccess' gate | No: polling a value makes every caller write the wait | `activated`, `closing` | | ||
| | Read the phase now: Goal's state read, MCP's admission, ShellInput's refusal | No | `phase` | | ||
| | Run accepted work under a hold for the extent of the call: ShellInput's command | No: the idle-release decision is the owner's, and composing it makes the caller hold a counter or a token across every error path | `withHold` | |
There was a problem hiding this comment.
P1: this row assigns ShellInput's run to withHold as work for the extent of the call, but ShellInput's run outlives the call: a cancelled shell.run returns at once and leaves the run untouched (docs/design/plugins/ShellInput.md:336), and the run keeps a hold in its registry until it ends (ShellInput.md:334, crates/dim-agent-capabilities/src/shell_input.rs:5-12,263,283,290-295). If withHold releases the lease when the call returns or drops, an idle unload can end the Session under the running command. Use hold for the run, or state the lease transfer and keep the work running; if no work ends with the call, remove withHold.
There was a problem hiding this comment.
Fixed in 5e5dd00: withHold is removed from the operations, errors, flows and appendix; the requirement and the example now use hold and keep the id in ShellInput's registry (SessionScope.md:34,65-77).
| request: WithHoldRequest, | ||
| cancelled: dim_agent_capabilities::host::CancelledFn, | ||
| ) -> Result<(), SessionScopeError> { /* ... */ } | ||
| pub async fn hold(&self) -> Result<LeaseReply, SessionScopeError> { /* ... */ } |
There was a problem hiding this comment.
P1: the binding gives hold, observeFault and release no caller row, yet the contract binds every lease and subscription to the calling row and settles it at row unload (SessionScope.md:14,130,137,157-159). The current implementation takes ctx: &rutis::Ctx for hold and observe_fault (crates/dim-agent-runtime/src/config.rs:501,506-510), and release cannot reject another row's id without the row (config.rs:531-539). Add caller: &Ctx or an explicit row id to these operations and show it in the appendix, or state how the bridge supplies the row for Rust direct callers too.
There was a problem hiding this comment.
Fixed in 5e5dd00: hold, observeFault and release take caller: &Ctx, and the appendix says the dispatch fills it (SessionScope.md:346-358,370). A Rust example still omits the argument (SessionScope.md:75,92); noted inline.
|
|
||
| SessionScope injects nothing. The assembly gives the owner its creation record and the Session anchor; the trusted host installs the content definitions the Session may mount. SessionScope no longer provides the Agent's configuration, the Skills or Collaboration factory texts, or the five host ports; those names leave the catalog (delivery). | ||
|
|
||
| The Session store constructs the Timeline engine and its Session-scope binding; SessionScope installs that binding in the Session instance and never hands it to a process caller. The operations are the engine's (#2018): the Session face publishes the per-line reads and the completion subscriptions, while `query` and `sessionConfig` stay on the process face `store` because an unloaded Session has no Session instance to host them. One engine, one operation set, one spelling per operation. |
There was a problem hiding this comment.
P2: this sentence claims one spelling with query and sessionConfig on the process store, but the retained target contracts still put both on the Session-scoped timelineStore together with createSession, releaseSession, rollbackSession and append (docs/design/resource-faces.md:607-617, docs/design/service-faces.md:129). The same conflict exists for the old sessionLifecycle, sessionLoader, PrepareModelHost and HistoryRenderer names (docs/design/contracts/runtime-owner-operations.md:11,20,69,73; docs/design/plugin-contract.md:118-121). Update those contracts or mark them superseded by #2018 and #2025; otherwise implementers still have two target spellings.
There was a problem hiding this comment.
Still open. The named-services table, runtime-owner-operations.md and the §3.5/§3.6 rows are updated, but service-faces.md:129 (§3.4) and resource-faces.md:616 (§5) still put createSession, sessionConfig, releaseSession, rollbackSession, append and query on the Session-scoped timelineStore; plugin-contract.md:62,362-366 still name the old services; and SessionScope.md:223,225 point at paths under docs/design/contracts/ that do not exist. SessionScope.md:215,216 also disagree on whether query is TimelineTree's or store's.
There was a problem hiding this comment.
Partially fixed in a4f2377. The Supersedes paths now resolve (SessionScope.md:226-229), and service-faces.md:129 (§3.4), resource-faces.md:616 (§5) and the plugin-contract.md:62,118,362-366 rows now name sessionScope and leave query and sessionConfig on the process store. Remaining: SessionScope.md:219 still calls query TimelineTree's while SessionScope.md:108,220 and the retained rows put it on store; runtime-owner-operations.md:7,25,44 still use the Session tree's query, and :27 names an undefined timelineTree.read. Noted in the body.
There was a problem hiding this comment.
The query and read spelling is fixed in c8f1812: runtime-owner-operations.md:47 and SessionScope.md:219 now match #2092's timelineTree.read, and query stays on store. Remaining: resource-faces.md §5.1 still lists sessionConfig among the Timeline methods (:672) and query in §5.1 (:669) as well as in the process table (§5.2, :728 for sessionConfig and :739 for query), so the changed file still gives both operations two owners. Noted in the body.
|
|
||
| - `config` may already be the adopted allowance repair: the owner repairs the stored allowance against the declared limits, so a request started from this value cannot exceed the model's capacity. | ||
| - The value is fixed at creation: a model change during the run is a Timeline record (`context/configured`), and Loop reads that record; the value is never stale for its one use. | ||
| - `metadata` carries the profile's extensions (for example a request-id extension); the owner publishes them and Loop only adds the turn's ids. |
There was a problem hiding this comment.
P2: the owner cannot publish the aimux request-id extension from a value fixed at assembly. Aimux inserts requestId from the per-request request_id on every prepare (crates/dim-agent-aimux/src/plugin.rs:346-348,356-379), and the request log reads it (crates/dim-agent-aimux/src/request.rs:366-372; test crates/dim-agent-aimux/tests/model_flow.rs:465-468). The example adds only session and turn ids (RequestSettings.md:39-43), so the extension is lost. Add the request id to the per-request data Loop writes, or pass it to settings; align this exception and the example.
There was a problem hiding this comment.
Fixed in 5e5dd00: the per-request id is Loop's, the example inserts requestId, and the exception says the value cannot carry it (RequestSettings.md:18,42,72). The insert passes a String to a serde_json::Map, which takes a Value (RequestSettings.md:42); noted inline.
|
|
||
| | Operation | Intent | Request | Reply | Cancellation | Errors | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `renderedStream` | The context and rendered entries at a cutoff, folded page by page | `{through, batch}` | `{context, history, configuration?, prompt?}` | The caller drops the call; the fold stops at its last page | `future_sequence`, `invalid`, `storage`, `closed` | |
There was a problem hiding this comment.
P2: the streamed reply carries context: ContextHistory plus history but drops ancestry, compaction, branches and compaction_cut, which PolicyContext::from_stream uses (crates/dim-agent-capabilities/src/context_policy.rs:156-169). Current StreamedContext deliberately does not retain events (crates/dim-agent-capabilities/src/history.rs:728-740), while ContextHistory holds events: Vec<Arc<AgentEvent>> (crates/dim-agent-runtime/src/core/timeline.rs:82-88). This loses the cut data ContextPreparation needs and holds the whole event list, contradicting the page-by-page claim at line 13. Keep the needed streamed fields without events, or define a streamed type that carries them.
There was a problem hiding this comment.
Fixed in 5e5dd00: the streamed reply carries ancestry, compaction, branches and compactionCut, carries no ContextHistory, and the memory claim is corrected (ContextProjection.md:13,67,162-180,266). The HistoryEntry import is from the wrong crate (ContextProjection.md:153); noted inline.
| | --- | --- | --- | | ||
| | `cancelled` | `compact` | The call was stopped before any model work or by the caller's cancellation; the history is unchanged | | ||
| | `closed` | both | The owner is unloading; the compaction did not run | | ||
| | `invalid` | `compact` | Fix the input: no legal cut, a cut outside the history, a request without an adopted model | |
There was a problem hiding this comment.
P2: no legal cut is Skipped { reason: "nothing_to_compact" } in the implementation (crates/dim-agent-capabilities/src/summary_strategy.rs:273-278), and this document itself defines a skipped outcome (line 75). Making it invalid changes the normal automatic-compaction fact and makes the skipped outcome unreachable for this case. Also, diagnostics cannot hold the duration: StrategyDiagnostics has only call count, usage and record (crates/dim-agent-capabilities/src/host.rs:1361-1366), and the caller measures duration (crates/dim-agent-capabilities/src/context_policy.rs:1415). State skipped here and move duration to the caller's record, or add it to the strategy data.
There was a problem hiding this comment.
Fixed in 5e5dd00: no legal cut is skipped { reason: "nothing_to_compact" }, and duration is the caller's (SummaryStrategy.md:76,84,104).
|
|
||
| SessionScope owns: | ||
|
|
||
| - **The creation record.** The Session's mount list, working directory, model selection, system prompt, permission preset, collaboration role, interactive flag, language seed and initial title, fixed when the Session is built. The record never changes while the Session runs. |
There was a problem hiding this comment.
P2: "the record never changes" conflicts with SessionConfig.language, which the native store updates in place while the Session runs (crates/dim-agent-runtime/src/config.rs:72-78), and config returns the whole record (config.rs:178-184). It also conflicts with RequestSettings.md:25, which says the Session's model methods "write the record", while its own exception says a model change is context/configured (RequestSettings.md:70; crates/dim-agent-capabilities/src/context_preparation.rs:215-225). Say which member can change and which operation writes it, or exclude language from config; reword the RequestSettings row to context/configured.
There was a problem hiding this comment.
Still open. Line 11 now says language is updated in place, but the verification at line 183 still says config, identity and phase do not change while the Session runs; phase transitions and config.language changes (crates/dim-agent-runtime/src/config.rs:72-78). SessionScope.md:180 also still says unmount answers invalid while the table says unknown.
There was a problem hiding this comment.
Fixed in a4f2377. SessionScope.md:187 says identity is fixed, phase only moves forward and config is fixed except config.language; SessionScope.md:184 answers unknown for an id this Session never issued, matching SessionScope.md:125,136. RequestSettings.md:25,71-72 now says the creation record does not change on a model change and points to context/configured.
| | Requirement (caller) | Compose from the operations below without breaking the owner's invariants? | Handling | | ||
| | --- | --- | --- | | ||
| | Permission resolves a file call's target and decides with the facts | No: `~`, cwd, `..` and link resolution are the workspace's knowledge, and the owned and grant facts come from two owners the caller would otherwise each hold | `check` | | ||
| | A command's preparation needs the confirmed workspace roots | No: the roots are validated against the Session's workspace and grants; a caller that composed them could start a process with an expired grant | `workspaceRoots` | |
There was a problem hiding this comment.
P2: this row and the intent at line 13 say "confirmed grant roots", but the dependency at line 47 is P:worktrees and the implementation returns the workspace plus confirmed worktree subtrees, never the Session's grants (crates/dim-agent-capabilities/src/file_access.rs:112-129,454-482). Grants are a separate fact (docs/adr/014-file-access-facts.md:25-26). Say "workspace and managed worktree roots" and keep grants out, or add grants and their validation; make this row match.
There was a problem hiding this comment.
Fixed in 5e5dd00: workspaceRoots answers the managed worktree roots and the requirement row matches (FileAccessFacts.md:13,24,56,90).
| pub type WorkFn = | ||
| Arc<dyn Fn() -> rutis::host::BoxFuture<'static, Result<(), rutis::Error>> + Send + Sync>; | ||
|
|
||
| #[derive(serde::Serialize, serde::Deserialize)] |
There was a problem hiding this comment.
P2: the binding appendix is not a data face as written. WithHoldRequest derives Serialize and Deserialize around WorkFn, a callback (SessionScope.md:316-320), while section 7 allows callbacks only by reference. SessionScopeError has no Cancelled variant (SessionScope.md:322-336) although withHold answers cancelled (SessionScope.md:127), and Build(String) cannot carry the cleanup member the error table gives build (SessionScope.md:148). PhaseReply uses SessionPhase without serde or lowercase names (SessionScope.md:253-256; crates/dim-agent-runtime/src/config.rs:263-273). The same problem appears in ContextProjection (PromptData does not exist; HistoryEntry and ContextHistory do not derive serde) and SummaryStrategy (CompactionCut and StrategyDiagnostics do not derive serde). Define the data forms or add the derives and the missing variants.
There was a problem hiding this comment.
Still open. WithHoldRequest, Cancelled, Build.cleanup, the Phase enum, PromptReference and the settings()? are fixed, but the appendices still import ModelSelection from dim_agent_runtime (not re-exported), HistoryEntry and CompactionCut from dim_agent_types (they live in dim_agent_capabilities), and FileAccessFacts imports its types twice; no error enum derives serde, so the codes and Build.cleanup still do not match the text. Noted inline and in the body.
There was a problem hiding this comment.
Fixed in a4f2377 for the listed items. All five error enums derive serde with #[serde(tag = "code", rename_all = "snake_case")] and struct message variants (SessionScope.md:322-340, FileAccessFacts.md:171-182, ContextFacts.md:228-239, ContextProjection.md:260-271, SummaryStrategy.md:245-256); WithHoldRequest is gone; Build.cleanup travels (SessionScope.md:334-337,378); Phase is a serde enum (SessionScope.md:258-266); PromptReference is used (ContextProjection.md:173); settings() has no ? (RequestSettings.md:31,143). The HistoryEntry, CompactionCut and StrategyDiagnostics problems are resolved by the wire forms (ContextProjection.md:186-210,297; SummaryStrategy.md:172-202,271). One leftover: SessionScope.md:374 uses TimelineContext without importing it; noted in the body.
|
已按评审修改,head
Re-request review: @yyhhyyyyyy. |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: six owner contracts and the Session-scope rows for #2025, with the Timeline split and the branch context handover tied to #2018 and #2024. I checked them at 5e5dd00 against section 7 (PR #2029), ADR 002 and ADR 014, the retained contracts, and the current code. Verdict: REQUEST_CHANGES.
Round 1 status. The three P1s are fixed: ShellInput now uses hold (SessionScope.md:34,65-77) and withHold is gone; FileAccessFacts takes dim_agent_types::FileAccess and GrantMode (FileAccessFacts.md:55-58); and hold, observeFault and release take caller: &Ctx (SessionScope.md:346-358). Round-1 P2 5, P2 6, P2 7, P2 8 and P2 10 are fixed; round-1 P2 4, P2 9 and P2 11 are partial. Among the optionals, the README row, the guideEntries dependency, the count request schema change, the renderedContext invalid row, the unmount error table, the withHold prose, the five-port wording and the PR body's template link are addressed; the unmount verification and the count example still disagree with their contracts.
P1
None.
P2
P2 1. openBranch returns an object from a marked service face and cannot be served
- Problem:
SessionScope.md:361-366returnsArc<TimelineContext>from the#[rutis::service(name = "sessionScope")]impl. rutis 0.23 requires a marked method's reply to beSerialize(Returnable), andTimelineContext(crates/dim-agent-runtime/src/timeline_context.rs:29-49) has no serde form. The rule check atSessionScope.md:204says every operation is data, a callback by reference or an id, and no method exists only for Rust;openBranchis an object, so the wire cannot call it.SessionScope.md:203also says the Rust binding and the wire call the same methods. - Failure: an implementer copying the appendix gets a
Returnableerror. Adding#[rutis::service(skip)]removesopenBranchfrom the wire face, which leaves the operation table, the rule check and the "wire call the same methods" sentence inaccurate, and gives another language no documented path to a branch context. TimelineTree is Rust, so a Rust-only handover is feasible, but the contract does not say so. - Fix: mark
open_branchwith#[rutis::service(skip)], state that it is the one Rust-only handover method for TimelineTree, and correct the rule check and the binding note; or replace the reply with an id and a take operation.
P2 2. The retained contracts still state the old spelling, and two Supersedes paths do not exist
- Problem:
service-faces.md:129(§3.4) still putscreateSession,sessionConfig,releaseSession,rollbackSession,appendandqueryon the Session-scopedtimelineStore;resource-faces.md:616(§5) states the same.plugin-contract.md:62still listssessionIdentityandsessionLifecycleas the Session mechanism services, and its R2 atplugin-contract.md:362-366still says the needed names aresessionLifecycle,sessionIdentityandsessionConfig.SessionScope.md:215callsqueryTimelineTree's whileSessionScope.md:105,216putqueryandsessionConfigon the process facestore;runtime-owner-operations.md:27still usestimelineTree.query.SessionScope.md:223,225point atdocs/design/contracts/service-faces.mdanddocs/design/contracts/resource-faces.md, which do not exist; the files aredocs/design/service-faces.mdanddocs/design/resource-faces.md.SessionScope.md:223also claims §3.4 is superseded, but the §3.4 row was not changed. - Failure: an implementer following the retained rows recreates the second spelling and the forwarding surface section 7 forbids, and a reader cannot follow the Supersedes path to the contract that changes them. The one-spelling claim in the PR description is not true of the target files.
- Fix: update the §3.4 and §5 rows to the new spelling in this change, or add them to the Supersedes lists with the correct paths and state which owner has
query; update or explicitly supersede theplugin-contract.mdscope table and R2 lines.
P2 3. The SessionScope verification contradicts its record and error table
- Problem:
SessionScope.md:183saysconfig,identityandphasedo not change while the Session runs.SessionScope.md:11sayslanguageis updated in place, the native store does update it (crates/dim-agent-runtime/src/config.rs:72-78), andphasemoves through loading, active, closing and closed.SessionScope.md:180saysunmountanswersinvalidfor another Session's id;SessionScope.md:122,132sayunknown, andinvalidis not an unmount error. - Failure: a caller caches
configas immutable and misses a language change; an implementer returnsinvalidfor an unknown instance id, so a caller branches on the wrong code or retries a no-op. - Fix: say
identityis fixed andphaseis monotonic, sayconfig.languagemay change, and change line 180 tounknown.
P2 4. The error enums do not produce the documented wire codes and lose Build.cleanup
- Problem:
SessionScopeError(SessionScope.md:318-335),FactsError(FileAccessFacts.md:171-181),ContextFactsError(ContextFacts.md:228-238),ProjectionError(ContextProjection.md:230-240) andStrategyError(SummaryStrategy.md:224-234) derive onlyDebugandthiserror::Error. rutis 0.23 falls back toFailDebugfor an error withoutSerialize, so the code is the Debug identifier (Closed,NotReady), not the lowercase kind in the tables;FailDebugpasses no data, so thebuild.cleanupmember promised atSessionScope.md:370cannot travel. The project's lowercase codes come from error enums that derive serde with#[serde(tag = "code", rename_all = "snake_case")]and structmessagevariants (crates/dim-agent-capabilities/src/file_access.rs:59-63,crates/dim-agent-capabilities/src/host.rs:768-771). - Failure: a client matches
closedornot_readyand receivesClosedorNotReady; a branch tree cannot read the shutdown failure thebuilderror claims to carry. - Fix: add the serde form with the code tag and struct
messagevariants to each error enum, or state the CamelCase codes and drop the cleanup claim.
P2 5. The ContextFacts count example contradicts the request and shadows the owner
- Problem:
ContextFacts.md:33passesmodeltoCountRequest, but the appendix declares onlyrequest(ContextFacts.md:179-181), and the operation table at line 80 and the note at line 84 saycounttakes the request.ContextFacts.md:32also shadows the ownerfactswith thedescribereply, so line 33'sfacts.countwould callcountonLimits. - Failure: the example does not compile; a reader believes
countstill takes a model and can pass a selection that disagrees with the request. - Fix: name the owner and the reply separately, and call
count(CountRequest { request }).
P2 6. The binding appendices still do not compile
- Problem:
ContextFacts.md:158,RequestSettings.md:119andSummaryStrategy.md:153importModelSelectionfromdim_agent_runtime, which re-exports onlyModelIdfromdim_agent_types(crates/dim-agent-runtime/src/config.rs:1).ModelSelectionis indim_agent_types(crates/dim-agent-types/src/prompt.rs:88).ContextProjection.md:153andSummaryStrategy.md:155importHistoryEntryfromdim_agent_types, but it isdim_agent_capabilities::history::HistoryEntry(crates/dim-agent-capabilities/src/history.rs:231).SummaryStrategy.md:155also importsCompactionCutfromdim_agent_types; it is incrates/dim-agent-capabilities/src/host.rs:1284.FileAccessFacts.md:135,137importsFileAccessandGrantModetwice, which is E0252.RequestSettings.md:119imports an unusedModelIdandSummaryStrategy.md:155an unusedAgentEvent. - Failure: copying any appendix fails at an unresolved import or E0252; the data faces cannot be built as written.
- Fix: import
ModelSelectionfromdim_agent_types(or re-export it), importHistoryEntryandCompactionCutfromdim_agent_capabilities, remove the duplicate and unused imports, and add the serde derives the footnotes promise to the capabilities types.
P3
SessionScope.md:50uses?onactivated, andSessionScope.md:74uses?onphase; both operations have no error kind (SessionScope.md:138).SessionScope.md:75,92callholdandopen_branchwithout thecaller: &Ctxthe appendix requires (SessionScope.md:346,361). TheobserveFaultlistener also returns aResultwhose failure behavior is not stated (SessionScope.md:145). Fix the examples or the signatures, and say what a failed listener does.FileAccessFacts.md:58says a write grant is active underunrestricted, butcrates/dim-agent-capabilities/src/file_access.rs:182-188returnsgrant: truefor a write only underFileAccess::WorkspaceReadWrite. The dependency list atFileAccessFacts.md:45-49also omits the source of thesystemfact, the platform roots used atcrates/dim-agent-capabilities/src/file_access.rs:176-180and named in ADR 014 D1. Fix the sentence and add the dependency, or state that the system fact comes from the Session part.- Duplicate sentences:
SessionScope.md:370repeats the caller and cancellation explanation,ContextFacts.md:254repeats the contributions sentence, andRequestSettings.md:145repeats "The reply's members are the crate's existing data." Delete the repeats. RequestSettings.md:42insertsrequest_idintometadata.extensions, a flattenedserde_json::Map, whoseinserttakes aValue; aStringdoes not convert implicitly. Add.into()or makerequest_idaValue.ContextCompaction.md:117,134,376still nameHistoryRendererand the old host ports.ContextProjection.md:142-145supersedes only theruntime-owner-operations.mdandservice-faces.mdrows; addContextCompaction.mdto that Supersedes list or update the references.
Verification
node scripts/adr-check.mjs --base 1bc7d67d7e3b357a64fd82c2589f57e4cb4b4becpassed (ADR freeze, 10 changed files).- All markdown links and anchors in the ten changed files resolve. The code-span paths at
SessionScope.md:223,225do not: both name files underdocs/design/contracts/that do not exist. - Every code and doc line cited above was checked in the worktree at 5e5dd00; no build was run.
- PR state before drafting: head 5e5dd00, OPEN, MERGEABLE, not draft. CI:
ci-okandchangespass; the other jobs are skipped. Head rechecked before writing the drafts; unchanged. - Diff: 10 files, +1511, -36.
| caller: &Ctx, | ||
| request: OpenBranchRequest, | ||
| cancelled: dim_agent_capabilities::host::CancelledFn, | ||
| ) -> Result<Arc<TimelineContext>, SessionScopeError> { /* ... */ } |
There was a problem hiding this comment.
P2: openBranch returns Arc<TimelineContext> from a #[rutis::service] impl, but rutis 0.23 requires a marked method's reply to be Serialize (Returnable) and TimelineContext (crates/dim-agent-runtime/src/timeline_context.rs:29-49) has no serde form. The appendix does not compile; adding #[rutis::service(skip)] removes the operation from the wire, contradicting the rule check at line 204 and the "wire call the same methods" sentence at line 203. Mark it Rust-only and say TimelineTree is Rust, or return an id and a take operation.
There was a problem hiding this comment.
Fixed in a4f2377. SessionScope.md:126 marks the operation Rust-only and #[rutis::service(skip)]; SessionScope.md:207-208 and the appendix at SessionScope.md:366-374 state that the wire calls every method except openBranch. TimelineContext no longer has to be serde for this face. A new inconsistency remains in plugin-contract.md:118, which lists openBranch under a service that crosses languages; noted in the body.
| - `docs/design/contracts/runtime-owner-operations.md`: the `sessionLifecycle` rows of "Retained operations" and "New rutis APIs on existing owners", the `sessionLoader` row, and the "Calls from a Session to a selected branch" section — a branch-group service is resolved by line id (`line_owner::<T>(line)`), and `timelineTree.call` is removed rather than kept. | ||
| - `docs/design/contracts/service-faces.md`: §3.6's `timelineFactory` row and §3.2's `agentConfig`, `skillsConfig` and `collaborationConfig` rows; the Session-scoped `timelineStore` spelling in §3.4 is stated by this contract, with the engine's operations left to #2018. | ||
| - `docs/design/plugin-contract.md`: the `sessionIdentity`, `sessionLifecycle`, `sessionConfig` and `agentConfig` rows of the named-services table. | ||
| - `docs/design/contracts/resource-faces.md` §5: the Session-scoped `timelineStore` names this contract spells; the engine and its process face remain #2018's. |
There was a problem hiding this comment.
P2: the Supersedes paths do not resolve (docs/design/contracts/resource-faces.md here and docs/design/contracts/service-faces.md at line 223; the files are docs/design/resource-faces.md and docs/design/service-faces.md). The retained rows also still state the old split: service-faces.md:129 and resource-faces.md:616 put createSession, sessionConfig, releaseSession, rollbackSession, append and query on the Session-scoped timelineStore; plugin-contract.md:62,362-366 still name sessionIdentity and sessionLifecycle; and line 215 calls query TimelineTree's while lines 105 and 216 put it on store. Update those rows or list them in Supersedes with correct paths, and state which owner has query.
There was a problem hiding this comment.
Partially fixed in a4f2377. The Supersedes paths now resolve (SessionScope.md:226-229), and §3.4, §5 and the plugin-contract rows are updated. Remaining: the query ownership conflict and the undefined timelineTree.read described in the body (SessionScope.md:108,219,220; runtime-owner-operations.md:7,25,27,44).
| - `mount` answers `invalid` for a group outside the Session's subtree, `not_ready` for a definition whose row failed (and leaves no instance), and shuts down an abandoned mount; `unmount` answers `cleanup` when the shutdown fails and `invalid` for another Session's id. | ||
| - `activated` answers false when the Session closes before publishing; `closing` returns when the close starts. | ||
| - `openBranch` answers `closed` during the Session's close; a failed construction settles the branch scope before the reply; the tree closes every branch before the Session scope unloads. | ||
| - `config`, `identity` and `phase` do not change while the Session runs. |
There was a problem hiding this comment.
P2: this contradicts the record and the error table. Line 11 says language is updated in place (the native store does update it, crates/dim-agent-runtime/src/config.rs:72-78) and phase moves through loading, active, closing and closed. Line 180 also still says unmount answers invalid for another Session's id, while lines 122 and 132 say unknown and invalid is not an unmount error. Say what is fixed and change line 180 to unknown.
There was a problem hiding this comment.
Fixed in a4f2377. SessionScope.md:187 distinguishes fixed identity, monotonic phase and config.language; SessionScope.md:184 says unknown for an id this Session never issued, matching the table at SessionScope.md:125,136.
| } | ||
| ``` | ||
|
|
||
| `caller: &Ctx` and `cancelled: CancelledFn` are the binding's caller row and cancellation argument; the dispatch fills them and no caller sends or names a row. `LeaseId`, `InstanceId` and the ancestor pairs cross as strings and numbers. `cancelled` and `caller: &Ctx` are the binding's cancellation and caller-row arguments, not request fields; the dispatch fills them. Errors cross as `{code, message}`: `code` is the variant name in snake_case, `message` is `Display`, and a variant's own members (for example `build`'s `cleanup`) travel beside them. |
There was a problem hiding this comment.
P2: the error enums in this and the other four contracts that define errors derive only Debug and thiserror::Error. rutis 0.23 uses FailDebug for a non-Serialize error, so the code is the Debug identifier (Closed, NotReady) rather than snake_case, and no data travels, so build.cleanup cannot appear beside the message. The project's lowercase codes come from enums with #[serde(tag = "code", rename_all = "snake_case")] and struct message variants (crates/dim-agent-capabilities/src/file_access.rs:59-63, crates/dim-agent-capabilities/src/host.rs:768-771). Add that form or state the CamelCase codes and drop the cleanup claim. The same issue applies to FileAccessFacts.md:171-181, ContextFacts.md:228-238, ContextProjection.md:230-240 and SummaryStrategy.md:224-234.
There was a problem hiding this comment.
Fixed in a4f2377. The five error enums derive serde with the code tag and struct message variants: SessionScope.md:322-340, FileAccessFacts.md:171-182, ContextFacts.md:228-239, ContextProjection.md:260-271, SummaryStrategy.md:245-256. Build carries cleanup at SessionScope.md:334-337, and the footnotes state the wire code. This matches FailSerde in rutis 0.23.
| ```rust | ||
| // ContextPreparation: one request's budget. | ||
| let facts = facts.describe(DescribeRequest { model: selection.clone() }).await?; | ||
| let counted = facts.count(CountRequest { model: selection.clone(), request: request.clone() }).await?; |
There was a problem hiding this comment.
P2: CountRequest declares only request (lines 179-181), and the table at line 80 and note at line 84 say count takes the request; the model field here does not exist. Line 32 also shadows the owner facts with the describe reply, so facts.count would call count on Limits. The example does not compile; name the owner and the reply separately and pass only request.
There was a problem hiding this comment.
Fixed in a4f2377. ContextFacts.md:32-34 names the owner owner and passes only CountRequest { request }; there is no model field and no shadowing. CountRequest at ContextFacts.md:179-181 has only request.
|
|
||
| ```rust | ||
| use dim_agent_runtime::{ContextHistory, PublicService}; | ||
| use dim_agent_types::{AgentEvent, HistoryEntry, ProjectionCheckpoint, RecoverySnapshot, TimelinePosition}; |
There was a problem hiding this comment.
P2: HistoryEntry is not in dim_agent_types; it is dim_agent_capabilities::history::HistoryEntry (crates/dim-agent-capabilities/src/history.rs:231). The import does not resolve, and the footnote's promise that it gains serde must be done on that type. The other names on this line are in dim_agent_types.
There was a problem hiding this comment.
Fixed in a4f2377. ContextProjection.md:152-157 no longer imports HistoryEntry; Entry and History are this face's wire forms (ContextProjection.md:186-210), mapped from HistoryEntry and ContextHistory at ContextProjection.md:297. The internal types stay unchanged.
| use dim_agent_capabilities::host::StrategyDiagnostics; | ||
| use dim_agent_runtime::{ModelSelection, PublicService}; | ||
| use dim_agent_types::{ | ||
| AgentEvent, BaselineSource, CompactionCut, CompactionTrigger, HistoryEntry, Message, |
There was a problem hiding this comment.
P2: HistoryEntry is in dim_agent_capabilities::history (crates/dim-agent-capabilities/src/history.rs:231) and CompactionCut in crates/dim-agent-capabilities/src/host.rs:1284, not dim_agent_types; both imports do not resolve. AgentEvent is unused here (the footnote says it is not part of the request). Fix the imports and remove the unused name; the same ModelSelection import at line 153 is not re-exported by dim_agent_runtime.
There was a problem hiding this comment.
Fixed in a4f2377. SummaryStrategy.md:152-157 imports Entry from the projection face and the remaining names from dim_agent_types; HistoryEntry, CompactionCut, AgentEvent and std::sync::Arc are gone. Cut, Diagnostics and CompactionCheckpoint are this face's wire forms (SummaryStrategy.md:172-202).
| ## Binding appendix | ||
|
|
||
| ```rust | ||
| use dim_agent_runtime::{ModelId, ModelSelection, PublicService}; |
There was a problem hiding this comment.
P2: dim_agent_runtime re-exports ModelId (crates/dim-agent-runtime/src/config.rs:1) but not ModelSelection, which lives in dim_agent_types (crates/dim-agent-types/src/prompt.rs:88); the import does not resolve, and ModelId is unused. Import ModelSelection from dim_agent_types or re-export it, and drop ModelId.
There was a problem hiding this comment.
Partially fixed in a4f2377. RequestSettings.md:120-122 imports ModelSelection from dim_agent_types and drops ModelId, so the import resolves. The imported ModelSelection is still unused because the reply uses provider_id and model_id strings; use the type or drop it. Noted in the body.
| ```rust | ||
| // ShellInput: the run's hold lives in the part's registry, not in the call. | ||
| scope.phase()?; // closing or closed -> RpcError::closed() | ||
| let lease = scope.hold().await?.lease_id; |
There was a problem hiding this comment.
P3: the appendix signatures require caller: &Ctx for hold and open_branch (lines 346 and 361), so these Rust examples do not compile; line 92 has the same omission. Line 50 also uses ? on activated and line 74 on phase, although both have no error kind (line 138). Pass the caller or show how a Rust part gets its row, and remove the ?. The note at line 370 should distinguish wire callers, which do not send a row, from Rust callers, which do.
There was a problem hiding this comment.
Fixed in a4f2377. SessionScope.md:50 no longer uses ? on activated; SessionScope.md:74 matches the phase instead of using ?; SessionScope.md:75,92 pass ctx to hold and open_branch. The listener failure behavior is stated at SessionScope.md:174.
| metadata: defaults.metadata.map(|mut metadata| { | ||
| metadata.session_id = Some(session_id); | ||
| metadata.turn_id = Some(turn_id); | ||
| metadata.extensions.insert("requestId".into(), request_id); // per request, written by Loop |
There was a problem hiding this comment.
P3: metadata.extensions is a flattened serde_json::Map and insert takes a Value; a String does not convert implicitly, so the example does not compile. Add .into() to request_id, as the aimux prepare does (crates/dim-agent-aimux/src/plugin.rs:356-379).
There was a problem hiding this comment.
Fixed in a4f2377. RequestSettings.md:42 inserts request_id.into() into the extensions map.
|
已按评审与自查标准修改,head 评审逐条
自查 7 条(规则第 1 节)
绑定附录编译在临时 crate(workspace 三个 crate 的 path 依赖 + rutis 0.23、pinned 1.100)里放了六个附录、 客户端可见变更无:客户端 wire 字段、错误码、通知、用户可见行为、模型可见文本、
|
Define the owners behind #2025: SessionScope and the four Session host ports. Each contract follows docs/templates/owner-redesign.md. - SessionScope: one `sessionScope` face for the creation record, identity, phase, leases, fault record, content mounts and branch construction. - RequestSettings: `prepareModelHost` becomes a value. - ContextFacts: `contextModelHost` becomes four reads. - ContextProjection: `historyRenderer` becomes branch-scoped reads; the Session-level fold by branch id is removed. - SummaryStrategy: `compactionStrategyHost` becomes two operations and the model object leaves the input. Refs #2025
SessionScope gains withHold for work whose extent is the call; hold stays for work that outlives it, and the owner settles every lease at the row's unload. Content instances are the Session's, not the caller's, so unmount retires content early instead of being a required release. Refs #2025
…elling SessionScope answers the instance of a line by line id so Session parts reach that line's owners; the write and the read stay with those owners. File access facts become a data owner with check and workspaceRoots. The Timeline engine keeps one spelling: query and sessionConfig on store, per-line reads and completions on the Session timelineStore. Refs #2025
SessionScope publishes lineOwner.call: a Session part names a branch-scope operation and the owner runs it at the line's instance, answering that owner's reply and errors unchanged. A line that is not live answers ended or unknown; a closing Session answers closed. Refs #2025
A line's owner is reached by the mechanism's typed resolution by line id; SessionScope adds no forwarding operation or request envelope. The branch context handover now states who creates, holds and closes it, and what either side's close means, citing lifecycle.md and single-tree. Refs #2025
- Drop withHold: every lease-taking run outlives the call, so hold carries the id and the owner settles it at the calling row. - FileAccessFacts uses FileAccess and GrantMode, and workspaceRoots answers the workspace and managed worktree roots. - Lease operations take caller: &Ctx; the binding errors carry the code, message and cleanup. - Contributions return the counter's facts; count takes the request. - The streamed projection keeps its fields without the event list. - No legal cut is skipped; the caller measures the duration. - State the record's one mutable member and the request id Loop writes. - Supersede the Session rows in runtime-owner-operations, service-faces and plugin-contract, and replace timelineTree.call with typed line resolution. Refs #2025
- openBranch is the one Rust-only method, marked service(skip), with the handover design as its reason. - The Session timelineStore spelling is fixed in service-faces and resource-faces; plugin-contract's scope and R2 rows name sessionScope. - Verification states what changes; unmount answers unknown. - Error enums derive serde with the code tag and struct message variants. - Count takes the request; contributions stay facts; imports and serde derives named; line access cites ADR 027 and #2127. Refs #2025
Entry, History, Cut, Diagnostics and CompactionCheckpoint are the faces' own serde forms; the owner maps HistoryEntry, ContextHistory, CompactionCut and StrategyDiagnostics in one place and the internal types stay unchanged. The binding appendix now compiles as written. Refs #2025
read is TimelineTree's and named in #2092; query and sessionConfig exist only on the store's process face. The catalog row marks openBranch as Rust-only and cites the shared lifecycle design that section 7 requires for an object. The projection's wire types are this contract's; the upper contract aligns its import. Refs #2025
The build error table names the message it carries, the contributions example has no unused binding, and the snapshot reads state which one answers none. Refs #2025
The Report rows and the Session-scoped timelineStore rows become pointers to the contracts that define them; the summary strategy reports calls and usage, and the caller measures the duration. Refs #2025
The Session timelineStore rows point at SessionStore's contract, the treeCommands rows follow the line_owner route, the compaction ports point at their owners, config is fixed and resolution stays with Permission. The remaining documents that name the deleted services are listed for delivery. Refs #2025
The Session timelineStore face carries no sessionId: the instance identity supplies it. The operations table renders again, a fault is still recorded after close, the tree rows and the plugin-contract cells match #2092, the adopted allowance is repaired at adoption, and the delivery mapping lists the current instance errors. Refs #2025
Allowance repair runs at the read boundary, including a restored Session replaying context/configured. The snapshot reads and the strategy outcome fields are named as the wire sends them, the projection note gives the real module path, and the architecture index no longer calls the projection Session-scoped. Refs #2025
requestSettings gains repair({config?}) -> {config?}; Loop's read and a
restored Session's replay call the same operation, so the bound cannot
drift between the two paths.
Refs #2025
d4e4284 to
4557d0b
Compare
|
已按评审修改,head P1(恢复 Session 的 allowance 修复没有执行者)fixed: 台账
指针清单
预审摘要
剩余 P2(交维护者判断)
检查
Re-request review: @yyhhyyyyyy. |
Review of the contract asked for two shapes. A Session part resolves a line's owner by type (line_owner::<T>(line)) and calls that owner's own operation, instead of routing by operation-name strings with json requests; the mechanism requirement now says so and matches #2093. The directory read splits into directory() and line(id), so no caller matches an enum reply or writes unreachable!.
LineRecord gains createdAt, the sequence of the line's branch/create on its parent, and the record answers from the reservation on, which is what a line's own part reads during apply. Goal's atomic record-and-trigger write becomes a requirement on the line's input owner, submitMany, since the tree performs no input writes. The tool's cursor is the single value its owner publishes, branch_target_protected is set_default's, the default restore and the Create anchor are stated again, the two handles are owner-internal references, the ended notice is one Steer, the feature split and the SessionScope name follow the code and #2093.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Review: PR #2093, round 7, head 4557d0b
Scope: the Session-scope owner contracts and their host ports, plus the retained rows and wire forms they supersede. I reviewed the full origin/main...HEAD at 4557d0b against current main 5930539, ADR 002, ADR 014 and ADR 027, the sibling heads (#2091 c6d1dae, #2092 43f132d, #2098 c3acab3, #2102 3b48e12, #2103 59a77a3), and the code the examples cite.
Verdict: REQUEST_CHANGES. The new head adds the allowance repair the other reviewer asked for, but the operation is not owned by the contract and cannot apply the rule to an adopted model. There is also a live shape conflict with #2091.
Prior findings
Fixed in 4557d0b and withdrawn in the replies:
- The architecture README scope label (docs/architecture/rust-agent/plugins/README.md:23).
StrategyOutcomestruct-variant fields (docs/design/plugins/SummaryStrategy.md:224).- The ContextProjection module path (docs/design/plugins/ContextProjection.md:152).
- The ContextProjection snapshot verification (docs/design/plugins/ContextProjection.md:109).
- The resource-faces section 5.1 binding label (docs/design/resource-faces.md:660).
- The SessionScope
configlanguage seed (docs/design/plugins/SessionScope.md:182, :197). - The earlier P2s and P3s from rounds 1 to 5 remain fixed.
Not fixed:
- P3: the PR body's sibling-head block still names #2091 f7425d5 and #2092 d968023; the current heads are c6d1dae and 43f132d. Body-only; refresh or drop the block.
Other review
I agree with the existing review at d4e4284 on the allowance repair and the SessionStore alignment; P2 1 to P2 3 show what remains.
P2 findings
P2 1. repair asks for a config without the model limits the rule needs
Problem: RequestSettings.repair takes RepairRequest { config: Option<ModelConfig> } only (docs/design/plugins/RequestSettings.md:142-145). The rule it must apply is output_allowance(context_window, declared_max_output) (crates/dim-agent-capabilities/src/context_model.rs:32-37), and the current read-boundary repair is adopted_config(capability_snapshot, config) (crates/dim-agent-capabilities/src/context_model.rs:63-79). An adopted context/configured record carries its own capability_snapshot, and the current Loop repairs from that record's snapshot (crates/dim-agent-capabilities/src/agent_loop.rs:1231-1252). The owner's value is fixed at assembly from the creation record (docs/design/plugins/RequestSettings.md:5, :11, :72), so a request with only the config cannot read the adopted model's window and declared output. contextFacts.describe and summaryStrategy.describe both take {model} for this reason (docs/design/plugins/ContextFacts.md:79, docs/design/plugins/SummaryStrategy.md:71).
Failure scenario: a Session created on model A adopts model B mid-run (docs/design/plugins/RequestSettings.md:19, :25), then is restored and replays the older context/configured record. Loop calls repair with B's config, but the owner bounds it with A's window and declared output. An older record for B that stores an allowance at or above B's window, the case the rule and the regression name, passes through whenever A's limits are wider: with A at a 1M window and B at 100k, a stored 100k allowance stays 100k, so the input budget is zero instead of at least 50k; the request overflows B's window or compacts to an impossible request. The existing regression covers the same model only (crates/dim-agent-capabilities/tests/context_flow/product_summary.rs:1814-1857).
Evidence: docs/design/plugins/RequestSettings.md:12, :25, :71-72, :142-145; crates/dim-agent-capabilities/src/context_model.rs:32-37, :63-79; crates/dim-agent-capabilities/src/agent_loop.rs:1231-1252.
Fix: change the request to {model: ModelSelection, config?} (or {capabilitySnapshot, config?}) so the repair uses the snapshot of the configuration it repairs; state that the adopted record's snapshot is the one used on the replay path.
P2 2. The contract body does not own repair
Problem: 4557d0b adds repair to the binding (docs/design/plugins/RequestSettings.md:156-161) and mentions the rule in prose (:12, :72), but the Operations table lists only settings (:59), the requirement table still routes the adopted-record path to Business (:24), Errors and Flows still describe one operation (:63, :67), Verification never exercises repair (:77-78), and the rule check still says "Loop calls the operation" in the singular (:93). The cross-owner row also lists only settings() (docs/design/contracts/runtime-owner-operations.md:60). The operation added for the restored-Session requirement is absent from the contract an implementer or a client generator reads.
Failure scenario: an implementer builds the one-operation table and the restored replay still reaches the provider with the stored allowance, which is the regression this head was meant to close. A generated binding has no repair method to call, so another language cannot execute the documented replay path.
Evidence: docs/design/plugins/RequestSettings.md:24, :59, :63, :67, :77-78, :93, :156-161; docs/design/contracts/runtime-owner-operations.md:60.
Fix: add the repair row to the Operations table with its request, reply, cancellation and errors; change the adopted-record requirement row's handling to repair; add a verification bullet for an older stored allowance and for the restored replay; list repair in the runtime-owner-operations row and the design index.
P2 3. The Session face sessionId shape conflicts with #2091 at c6d1dae
Problem: this PR says the Session face requests carry no sessionId (docs/design/plugins/SessionScope.md:108; docs/design/resource-faces.md:619). #2091 at c6d1dae says the Session-scoped timelineStore requests take {sessionId, ...} and require it to equal the instance identity (docs/design/plugins/SessionStore.md:137-150 at #2091). #2091 moved from f7425d5, the head named in this PR's body, to c6d1dae after the body was refreshed, so the alignment was not rechecked. docs/design/resource-faces.md:672 also describes a Session-scoped query binding, although query is process-store only here and in #2091 (docs/design/plugins/SessionStore.md:18 at #2091).
Failure scenario: a caller or generated binding follows one contract and sends a sessionId field; the other requires its absence. The Session face then has two wire shapes and the earlier merged contract cannot be implemented against the later one. The conflict is not only wording: merge-tree against #2091 reports content conflicts in resource-faces.md and service-faces.md.
Evidence: docs/design/plugins/SessionScope.md:108, :230; docs/design/resource-faces.md:619, :672; #2091 at c6d1dae, docs/design/plugins/SessionStore.md:18, :137-150.
Fix: pick one shape in #2091 and here (the instance supplies the id and requests carry no field, or the field is present and must equal the instance), state it once in #2091's owner contract and link it here, delete the query clause at docs/design/resource-faces.md:672, and refresh the sibling-head block.
P3 (optional)
- ContextCompaction section 4.2 still says "Both values are bound explicitly in every profile, as
ContextModelHostis today" after the port table was replaced (docs/design/plugins/ContextCompaction.md:205-206), and itsCompactionInputtable still listsmodel(docs/design/plugins/ContextCompaction.md:230) while SummaryStrategy removes that field (docs/design/plugins/SummaryStrategy.md:147). The author left these to #2102; a one-line pointer would remove the contradiction. - docs/design/plugins/RequestSettings.md:165 still says
ModelSelectionisdim_agent_typesdata, but the file no longer uses or imports it.
Cross-PR and main
- Current main is 5930539.
git merge-tree --write-tree origin/main HEADis clean. - Merge-tree against #2080 ed23162 conflicts in docs/design/plugins/README.md; against #2091 c6d1dae in docs/design/plugins/README.md, docs/design/resource-faces.md and docs/design/service-faces.md; against #2092 43f132d in docs/design/contracts/runtime-owner-operations.md and docs/design/plugin-contract.md; against #2102 3b48e12 in docs/design/contracts/runtime-owner-operations.md, docs/design/plugins/ContextCompaction.md, docs/design/plugins/README.md and docs/design/service-faces.md; against #2103 59a77a3 in docs/design/contracts/runtime-owner-operations.md, docs/design/plugins/Attachments.md, docs/design/plugins/README.md and docs/design/service-faces.md. #2098 c3acab3 is clean. These are the shared cells the merge order names; the head must rebase after each merge.
- The #2092 contract matches the names this PR uses (
create,end,set_default,directory,line,read).
Verification
node scripts/adr-check.mjs --base origin/main: passed, 13 changed files.git diff --check origin/main...HEAD: passed.- Relative-link scan over the changed docs: 256 links and 21 code-span paths, no problems. The pre-existing miss at docs/design/plugins/ContextCompaction.md:529 (
model-configuration.mdshould be../model-configuration.md) is on a line this PR does not change. - CI at 4557d0b:
changes,static-checksandci-okpass; the other jobs are skipped. I did not wait for CI. - No Rust build was run; this is a documentation-only PR.
Unverified
| #[serde(rename_all = "camelCase", deny_unknown_fields)] | ||
| pub struct RepairRequest { | ||
| #[serde(default, skip_serializing_if = "Option::is_none")] | ||
| pub config: Option<ModelConfig>, |
There was a problem hiding this comment.
P2: RepairRequest carries only config, but the rule needs the model's window and declared output (output_allowance(context_window, declared_max_output), crates/dim-agent-capabilities/src/context_model.rs:32-37, and the current adopted_config(snapshot, config) at :63-79). An adopted context/configured record carries its own capability_snapshot, and the current Loop repairs from it (crates/dim-agent-capabilities/src/agent_loop.rs:1231-1252); the owner's value is fixed at assembly from the creation record, so a request with only the config bounds the adopted model with the creation model's limits. Failure: a Session created on model A adopts model B mid-run and is restored; an older record for B that stores an allowance at or above B's window, the case the rule and the regression name, passes through whenever A's limits are wider. With A at a 1M window and B at 100k, a stored 100k allowance stays 100k, so the input budget is zero instead of at least 50k; the request overflows B's window or compacts to an impossible request. Fix: take {model: ModelSelection, config?} or {capabilitySnapshot, config?}, as contextFacts.describe and summaryStrategy.describe already do with {model}.
|
|
||
| | Operation | Intent | Request | Reply | Cancellation | Errors | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `settings` | The Session's default request settings | `{}` | `{providerId, modelId, capabilitySnapshot?, config?, system?, metadata?}` | None | None | |
There was a problem hiding this comment.
P2: the new repair operation (appendix :156-161) is absent from the contract body: this table lists only settings, the requirement row at :24 still marks the adopted-record path Business, Errors and Flows describe one operation (:63, :67), Verification never calls repair (:77-78), and the cross-owner row lists only settings() (docs/design/contracts/runtime-owner-operations.md:60). An implementer or a client generator building from this table will not expose repair, so the restored-Session replay the operation was added for cannot run. Add the operation row with request, reply, cancellation and errors, route the adopted-record requirement to it, and add it to Verification.
| | --- | --- | | ||
| | Timeline (`timelineStore`) | `createSession`, `sessionConfig`, `releaseSession`, `rollbackSession`, `append` (sync), `head`, `branches`, `readPage`, `readSegments`, `query`, `trace`, `batchEnd`, `batchEndAt`, `saveSnapshot`, `latestSnapshot` | | ||
| | Timeline completion (`timelineStore`) | `commits`, `closeCommits`; notifications `{subscriptionId, batchId, branchId, through, result}` | | ||
| | Timeline (`timelineStore`) | The face stays and its owner is SessionStore; only the binding is installed in a Session instance ([SessionStore](https://github.com/arcships/dim/pull/2091), #2018). On the Session face the Session id is the instance's identity: the requests carry no `sessionId`, and a request that names another Session is `invalid`. | |
There was a problem hiding this comment.
P2: this says the Session face requests carry no sessionId, but #2091 at c6d1dae requires {sessionId, ...} on the Session-scoped timelineStore rows and requires it to equal the instance identity (docs/design/plugins/SessionStore.md:137-150 at #2091). #2091 is the owner of the spellings, and its head moved from the f7425d5 named in this PR's body after the refresh. A caller following one contract sends a field the other excludes; the two cannot be implemented together. Also, :672 describes a Session-scoped query binding although query is process-store only (docs/design/plugins/SessionScope.md:108, :230; SessionStore.md:18 at #2091). Pick one shape, state it in #2091, and point to it here.
|
Closing as part of abandoning the owner-split experiment. |
Refs #2025 · Refs #2015
Summary
Target contracts for the six owners behind the SessionScope and Session host-port board, written against design rules §7 and the owner redesign template:
SessionScope: one
sessionScopeface for the creation record, identity, phase, leases, fault record, content mounts and branch construction; a branch's runtime context crosses to TimelineTree under the handover design the contract states;holdsettles every lease at the calling row's unload.Request settings:
prepareModelHostbecomes one value,requestSettings.settings.Context facts:
contextModelHostbecomesdescribe,count,contributionsandestimate.Context projection:
historyRendererbecomes five branch-scoped reads; the Session-level fold by branch id is removed.Summary strategy:
compactionStrategyHostbecomesdescribeandcompact, and the context model object leaves the input.File access facts: the facts object becomes
fileAccessFacts.checkandworkspaceRoots.Line-addressed access is the mechanism's: a Session part resolves any branch-group data face by line id (
line_owner::<T>(line)), except registration points and lifecycle services, and calls that owner's typed operation; this contract adds no forwarding operation, and the supersededtimelineTree.callis removed.The Timeline engine keeps one spelling:
queryandsessionConfigon the processstore, per-line reads and completion subscriptions on the Session-scopedtimelineStore, which SessionStore owns and SessionScope installs (#2018).prepareContextHosthas no target: the scan report's §7 and the delivery comment remove it.Verification
node scripts/adr-check.mjs --base origin/mainpassed.cargo run --locked -p xtask-checkpassed.Delivery comment: #issuecomment-7093412347.
Superseded
Each contract carries a Supersedes section. This change replaces the Session-scope rows of
runtime-owner-operations.md,service-faces.mdandplugin-contract.md; each contract's Supersedes lists the exact rows. Accepted ADRs are not edited. No client wire protocol or user-visible behavior changes.Merge order
#2029 → #2080 → #2091/#2092/#2093 → #2094 → #2096 → the rest.
Sibling heads this change is aligned with: #2091
f7425d55c, #2092d96802349, #2098c3acab356, #21023b48e1248, #210359a77a3d1. A paragraph that depends on a sibling names that PR; its head is the one above.