Repository navigation
Conversation
|
评审(head
|
|
已按评审修改,head
检查: |
|
自查完成,head
检查: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: Target contracts for the branch turn chain (#2027), part of the owner-operations documentation series refs #2027 and #2015. The PR adds owner contracts for Loop, ContextPreparation, ContextUsage, ModelProvider, Prompt adoption, PromptSourcesBranch, InputQueue and WaitBranch, and rewires the surrounding contracts and indexes.
Verdict: REQUEST_CHANGES
P1
1. Manual compaction still has two owners
Problem: The new summary at ContextCompaction.md:21, items 4-5 at lines 44-45 and the §2.1 note at line 108 give the command, the single-flight slot and the step to ContextPreparation. The rest of the same file still assigns them to Loop and AgentLoop: the §2 diagram (line 92), §2.2 (line 127), §3 (line 150), §4.1 (line 170), §4.3 (line 233), §5.3 (line 807), §5.4-§5.5, §5.8 (line 1006) and the rule check (line 1260). ContextPreparation.md:14 gives the command and slot to ContextPreparation, and its Supersedes list at line 128 names only §1 items 4-5, §1.1 and §2.1. The header at ContextCompaction.md:5 also still declares Session parts plus supplements to Loop and ContextPreparation, while README.md:23 now calls the document a policy detail with no parts.
Failure scenario: An implementer following ContextCompaction writes context/compact from AgentLoop and keeps the Loop slot, while the Session RPC is routed to contextPreparation.compact. The two designs cannot both run, and a manual compaction requested during a request has no single sequencer or cancellation owner.
Fix: Keep ContextPreparation as the owner, update the listed sections, and extend the Supersedes list to §3, §4.1, §4.3, §5.3-§5.5, §5.8, §10 and §12. If the Loop should own the step instead, revert the lines that moved it.
P2
2. ContextUsage changes the wire values of baselineSource
Problem: The appendix at ContextUsage.md:152-157 defines BaselineSource with Counted and ProviderMeasured, serialized by camelCase as counted and providerMeasured. The repository already has dim_agent_types::BaselineSource at crates/dim-agent-types/src/model.rs:333-337 with wire values provider_baseline and full_estimate; ContextCompaction.md:166 still documents those values, and the CLI reads provider_baseline at crates/dim-cli/src/session_host.rs:607-608.
Failure scenario: Implementing this contract changes session.context.usage from provider_baseline or full_estimate to counted or providerMeasured. A provider-baselined read then renders as "estimated" in the CLI, and any client matching the old strings misreads the baseline.
Fix: Reuse dim_agent_types::BaselineSource and keep the existing wire values, or state a versioned breaking change and update every reader. Do not add a second type for the same data; the module's use dim_agent_types::* also makes the name shadow the existing type.
3. InputQueue's pending and withdraw shapes conflict with the existing read and #2103
Problem: The current session.input.pending (docs/design/input-state-read.md:3-16) returns a page {branchId, through, inputs, next} from TimelineTree.query. PR #2103's InputMethods keeps that page (InputMethods.md:80, 102) and states that it needs no InputQueue operation. This PR's InputQueue.pending (InputQueue.md:83) takes one inputId and returns {pending}, and InputQueue.md:154 says session.input.pending becomes its caller. Withdraw uses WithdrawRequest and publication_unknown here, while #2103 uses WithdrawInput and interrupted (InputMethods.md:63, 79).
Failure scenario: The Session entry cannot produce the client's page from a single-id bit, so the queued-messages inventory either loses its page or falls back to N+1 calls. If the owner's error is publication_unknown, the Session entry in #2103 maps a different code.
Fix: Keep the page read on TimelineTree and scope the owner pending to the single-id membership check, or add a paged owner operation and update #2103. Align the withdraw request type and the publication error name with the caller contract.
4. Prompt adoption's configure shape conflicts with #2103
Problem: #2103's PromptSources calls prompt.configure(ConfigureRequest::Initial(..)), ConfigureRequest::Loaded { sources: vec![entry] } and LanguageUpdate { version } (PromptSources.md:51-66), and compares adopted.version. This PR's ConfigureRequest is a single struct with (PromptSourceTarget, Option<PromptEntry>) pairs (PromptAdoption.md:186-193), AdoptedEntries has no version, and the configure row lists source_failed even though the request already carries loaded entries and the use/scope assigns loading to callers.
Failure scenario: The Session callers in #2103 cannot call this owner shape, and source_failed has no path. The two contracts cannot both land.
Fix: Align the configure request with #2103 or update #2103 in the same series; state who loads sources; remove source_failed or give it a request path.
5. Loop requires ToolBinding operations that #2100 does not define
Problem: Loop.md:67 lists bind, claim, transfer, retain_only and release, and line 145 asks for all five as data operations. PR #2100's ToolBinding defines bind, adopted, claim and transfer, and settles records and claims from the line's facts (ToolBinding.md:131-136, 154-155); it has no retain_only or release operation for Loop.
Failure scenario: Following Loop.md, the Loop calls operations that the ToolBinding owner does not provide; the two target contracts cannot both land.
Fix: Update Loop.md to bind, adopted, claim and transfer, or add retain_only and release to #2100 with a stated settlement rule.
6. ContextUsage's persistence contract is not specified and contradicts itself
Problem: ContextUsage.md:5 says the saved formats are decided in ADR 023, but ADR 023's Non-goals exclude snapshot formats, table structure and write transactions. The previous text carried the v5 and covered shapes; the new text says "at the version the format decides" (line 12) without naming an owner. Separately, line 12 says a context-usage/covered extension is written for a checked no-effect tail, line 71 says a no-effect source only advances in-memory state, line 109 says no new record, and the current code writes COVERED (crates/dim-agent-capabilities/src/context_usage.rs:115).
Failure scenario: Implementers have no format contract for recovered or covered, and they cannot tell whether a no-effect tail is persisted. Recovery and compatibility work will diverge.
Fix: State the recovered and covered format here or link the page that owns it; decide whether the covered record is written and state it once.
7. The projection handover contradicts ContextPreparation.md and #2093
Problem: ContextUsage.estimate takes a StreamedContext (ContextUsage.md:181) from ContextPreparation, but ContextPreparation.md:12 says no projection object crosses an owner and the preparation projects internally. PR #2093's ContextProjection contract says Loop builds the projection and hands it to ContextPreparation, and makes StreamedContext serde (ContextProjection.md:25, 164-180).
Failure scenario: The same projection has three owners: Loop renders it, ContextPreparation says it renders it, and ContextUsage receives it. Implementers cannot tell which call owns the cutoff and which value crosses the owner boundary.
Fix: Settle one handover. If the projection is a value, update ContextPreparation.md and say where it is rendered; if it stays inside ContextPreparation, estimate must take an id, cutoff or already-counted contributions.
8. ContextPreparation writes facts owned by Loop and ModelProvider
Problem: ContextPreparation.md:98 says prepare writes context/prepare and step/model-output-end on a host or budget failure. Loop.md:14 lists context/prepare among Loop's own turn and step facts; ModelProvider.md:13 and 86 say ModelProvider owns step/model-output-end. The current code writes context/prepare from AgentLoop (crates/dim-agent-capabilities/src/agent_loop.rs:1342) and the terminal from ModelProvider (crates/dim-agent-capabilities/src/model_provider.rs:145).
Failure scenario: Two owners write the same terminal fact, or recovery folds a preparation terminal that ModelProvider does not know about. The first-fact-wins and failure-chain rules become ambiguous.
Fix: Assign each fact one writer; if ContextPreparation must settle a request that never reached ModelProvider, state that exception in ModelProvider's contract and in both rule checks.
9. A committed cancelled compaction has no outcome
Problem: ContextPreparation.compact's reply is completed, skipped or failed, and its only cancellation error means "the wait stopped; the step continues" (ContextPreparation.md:96). A committed cancelled compaction has no variant, while ContextCompaction.md:176-177 and crates/dim-agent-capabilities/src/context_methods.rs:173 expose compaction_cancelled.
Failure scenario: A client waiting on an interrupted step cannot distinguish compaction_cancelled from operation_interrupted, and the documented reply is unreachable.
Fix: Add cancelled {reason} to CompactionOutcome, or define the mapping from the committed cancelled fact to the Session error code.
10. Broken relative links in service-faces.md
Problem: docs/design/service-faces.md uses ../plugins/InputQueue.md (line 149), ../plugins/Loop.md (lines 173-174), ../plugins/PromptAdoption.md (175, 180, 181), ../plugins/ContextPreparation.md (176), ../plugins/ContextUsage.md (177) and ../plugins/PromptSourcesBranch.md (320). From docs/design, this prefix resolves to docs/plugins, which does not exist.
Failure scenario: Every new link to the owner contracts returns 404, so the catalog cannot be followed.
Fix: Use plugins/InputQueue.md and the same form in all nine places.
11. Prompt.md removes anchors that five documents still link
Problem: The rewrite keeps only headings 2, 3.3, 4, 5, 6.1 and 6.3. Inbound links now point to missing anchors: ContextCompaction.md:2077 (#31-the-frame), EventHub.md:257 (#34-adopted-when-its-writer-loads), Scheduler.md:386, ShellInput.md:187 and Workflow.md:360 (#62-the-writers). Prompt.md:8 says the old sections remain as pointers so comments keep their anchors, but only some anchors remain.
Failure scenario: The five documents link to headings that no longer exist; a reader or code comment that follows one lands nowhere.
Fix: Keep a stub heading for every removed anchor, or update the five linkers and narrow the sentence at line 8 to the anchors that remain.
12. InputQueue documents line_ended but the error enum has no variant
Problem: InputQueue.md:81 and 92 list line_ended for submit; the appendix enum at lines 213-226 has Invalid, InputBlocked, PublicationUnknown, Cancelled and Closed.
Failure scenario: The submit path cannot return the documented error, and a caller matching line_ended gets a different variant or an internal error.
Fix: Add LineEnded, or remove the error from the operation and the Errors table.
13. adoptedConfiguration drops the revision the Intent promises
Problem: PromptAdoption.md:97 says the reply is the adopted settings and their revision, but the reply is {settings?} and the Adopted appendix at line 212 has only settings. Current Prompt::adopted_configuration returns (Option<ModelConfiguration>, u64) (crates/dim-agent-capabilities/src/prompt.rs:1074), and the App Server reports that cutoff (crates/dim-app-server/src/connection/tree.rs:609).
Failure scenario: session.agent.get and model_get lose the cutoff they currently return; a read at the returned state cannot be expressed, and existing callers break.
Fix: Add through or a revision to Adopted, or state which operation supplies the cutoff to the Session entry.
14. The unchanged model.progress notice cannot be built from the new Progress value
Problem: ModelProvider.md:92 says the notice keeps its field names and gains requestId, textCharacters and thinkingCharacters. requestId already exists (crates/dim-app-server/src/tree_protocol.rs:373). The new Progress value (lines 152-165) has counts, part ids and a different retry shape, but the notice keeps text, textOffset, thinking, thinkingOffset and tools, and rule check line 128 removes StateCell<ModelProgress>.
Failure scenario: After the state cell is removed, the notice's text and tool fields have no source; either the client-visible notice changes or an unstated second source remains.
Fix: State where the notice is built or extend Progress with the fields it needs; correct the additive-field list and reconcile the retry shape.
15. runtime-owner-operations keeps host APIs the new contracts replace
Problem: The Compaction row at line 31 is updated, but lines 69-75 still define PrepareModelHost, PrepareContextHost, ContextModelHost, CompactionStrategyHost and prepare(...) -> ModelRequest. Loop.md uses RequestSettings, GuideEntries and ContextPreparation.prepare; ContextPreparation.md:166 says ContextFacts and SummaryStrategy replace contextModelHost and compactionStrategyHost; ContextPreparation.prepare returns {} and the projection does not cross.
Failure scenario: Two contracts describe the same operations, and an implementer wires the old host ports that the new owner contracts no longer use.
Fix: Update lines 69-75, or state explicitly that they remain #2025's target and link the sibling contract; remove the old prepare return shape.
P3
16. Stale catalog rows and references
Problem:
- service-faces.md:130 still lists
promptSourcesBranch, while PromptSourcesBranch.md:111 says the service is removed. service-faces.md:185-187 still listprepareModelHost,contextModelHostandcompactionStrategyHostas "to migrate", while Loop.md and ContextPreparation.md consume the new owners. - ContextCompaction.md:5 still declares Session parts plus supplements to Loop and ContextPreparation, and §4.4 still installs
ProductSummaryStrategyPluginandContextMethodsPlugin; README.md:23 now calls the document a policy detail with no parts. - Recall.md:538 and docs/zh/design/plugins/Recall.md:303 still say compaction runs "as a Loop step"; ContextPreparation.md:14 moves the manual step to ContextPreparation.
- Loop.md:109 says it supersedes the compaction row that assigns the manual command to
agentLoop, but runtime-owner-operations.md:31 already assigns it tocontextPreparation. PromptAdoption.md:132 listsinitialCompletion, which runtime-owner-operations.md:61 no longer has.
Failure scenario: Readers follow stale rows and references after the new contracts land.
Fix: Update or remove them in this PR.
17. Appendix hygiene
Problem:
- Unused imports remain in ContextUsage.md:150 (
rutis::Ctx), ContextPreparation.md:178, PromptAdoption.md:182, InputQueue.md:165, WaitBranch.md:130 and severalPublicServiceimports; the last commit removed the same class of import only from Loop.md. - ContextUsage.md:161 defines
Usagein a module that doesuse dim_agent_types::*(crates/dim-agent-capabilities/src/context_usage.rs:10), and crates/dim-agent-capabilities/src/context_usage/sources.rs:39 uses the modelUsagethroughuse super::*; the new name shadows the existing type. - ContextPreparation's
CompactionRequest { manual: bool }is always true and itsDefaultis false, which the operation does not define;WaitRequestderivesDefaultwithtimeout_ms0, outside the documented 1 through cap range.
Failure scenario: The appendices do not compile as copied, and callers can construct invalid requests.
Fix: Remove unused imports and duplicate names; use a unit request or make the flag meaningful; do not derive Default for a request with a required positive timeout.
18. Examples and cross-PR type names
Problem:
- PromptSourcesBranch.md:40 calls
entries.geton a Vec andcancelled.child_tokenonCancelledFn. - #2103's Wait.md uses a
WaitReplystruct and aReasonenum (Wait.md:36-48), while WaitBranch.md:142 definesWaitOutcomeas an internally tagged enum. Use the owner's type in the tool contract, or define one type for both. - #2096's Provider.md:53 uses
line_owner::<PromptAdoption>, while this PR and #2103 usePrompt. Align the type name. InputQueue.submit(SubmitRequest)andWaitBranch.wait(WaitRequest)change the generated TypeScript signatures at npm/branch-services.d.ts:225 and 711; the contract does not state the migration.
Failure scenario: Cross-language callers and sibling documents use different names and shapes.
Fix: Align the names and state the caller migration.
19. Session error mapping for ContextUsage
Problem: ContextUsage.md:73-84 defines not_configured, not_ready, unsupported, unknown, cancelled and closed, but the existing Session method maps the owner's failures to context_usage_unavailable, context_not_configured and context_model_failed (crates/dim-agent-capabilities/src/context_methods.rs:196-208). The contract should state the mapping, as InputQueue.md does for session.input.withdraw.
Failure scenario: A client that handles the existing codes gets a different error.
Fix: Add the mapping or preserve the existing codes.
20. Forward references and merge risk
Problem: The new docs cite #2103 (Prompt guide and Wait), #2029 (ADR 027), #2093 (line_owner and ContextProjection), #2096 (Provider) and #2100 (ToolBinding), all unmerged. The PR also touches shared files that the siblings edit (runtime-owner-operations.md, service-faces.md, session-access.md), so the series will conflict. The self-check commit did not catch the ownership text, the broken links or the unused imports.
Failure scenario: The contracts cannot be validated end to end, and the merge order changes the text.
Fix: State the dependency and merge order, rebase after the owning contracts land, and reconcile the self-check claims with the remaining issues.
|
|
||
| The Loop runs the manual compaction step itself, in a tracked task, by calling | ||
| `ContextPolicy::compact_step`. It does not drive ContextPreparation through an event. The reasons: | ||
| The manual command and the step are ContextPreparation's; see [ContextPreparation](ContextPreparation.md). This section's earlier account of the Loop holding the step is superseded. The reasons it gave: |
There was a problem hiding this comment.
Only §2.1 is marked superseded, but this document still assigns the manual command and step to Loop in the §2 diagram (line 92), §2.2 (line 127), §3 (line 150), §4.1 (line 170), §4.3 (line 233), §5.3 (line 807), §5.4-§5.5, §5.8 (line 1006) and the rule check (line 1260). ContextPreparation.md:14 gives the command, the single-flight slot and the step to ContextPreparation, and its Supersedes list at line 128 covers only §1 items 4-5, §1.1 and §2.1. Failure scenario: an implementer following this document writes the command and slot in the Loop while the Session RPC is routed to contextPreparation.compact, so the two designs cannot both run. Fix: keep ContextPreparation as the owner, update the sections above, and extend the Supersedes list to §3, §4.1, §4.3, §5.3-§5.5, §5.8, §10 and §12.
There was a problem hiding this comment.
Fixed in 851f531. The command, the single-flight slot and the step are ContextPreparation's in the normative sections: ContextCompaction.md:5, 22, 95, 149-152, 234-236, 852-858, 912-944, 998-1008, 1260-1272; ContextPreparation.md:129-133 extends Supersedes to sections 2, 2.1, 2.2, 3, 4.1, 4.3, 5.3-5.5, 5.8, 10 and 12. The section 2 diagram and the section 4.1 route now name ContextPreparation. Two stale references remain and are in the new body as P3-4: the section 5.4 diagram still says Loop consumes k, and section 8 at 1238 still lists Loop as the supplement.
| Scope: branch. Issue: #2027. | ||
|
|
||
| ## 1. 决定与边界 | ||
| ContextUsage owns the numbers of a line's effective context: what each source contributed, the cumulative totals, the compaction cuts and the provider's measured baseline. The counting rules and the saved formats are decided in [ADR 023](../../adr/023-context-usage.md); the compaction interaction is [ContextCompaction §5](ContextCompaction.md#5-usage-and-the-compaction-cut). This document is the owner's target contract. |
There was a problem hiding this comment.
ADR 023 does not decide saved formats: its Non-goals explicitly exclude snapshot formats, table structure and write transactions. The previous ContextUsage text carried the v5 and covered shapes; this contract now says "at the version the format decides" (line 12) without naming an owner. Failure scenario: recovery and compatibility work has no format contract. Fix: state the recovered and covered format here or link the page that owns it. The link ContextCompaction.md#5-usage-and-the-compaction-cut also has no matching heading; §5 is Flows.
There was a problem hiding this comment.
Partially fixed in 851f531. The formats are now stated: ContextUsage.md:12, 72, 101 give recovered v5, covered v1 and the handoff rule. What remains: the same line still links ContextCompaction.md#5-usage-and-the-compaction-cut, which has no heading (section 5 is Flows, and the usage state is section 5.7). The new body files it as P3-1.
| | `confirm` | Save the contributions for a request that was sent with the estimate's projection | `{requestId}` | `{}` | None; the owner completes the save | `unknown` (no estimate for the id), `closed` | | ||
|
|
||
| 只将数字和来源截止交给 Usage 的按序任务,正文在请求准备结束后释放。初始化保存一份当前数字,不补建更早位置;与新来源按固定截止串接,不能漏计或重复累加。之后沿既有请求关联接收首轮 provider 基准。正常首次请求读取1遍、消息计数1遍,恢复读取0条历史正文。请求专有附加消息或不支持可组合计数的模型仍走实际请求计数合同,不把该总量保存成 Timeline 内容统计。 | ||
| `read` answers at `through`, or at the branch's current sequence when absent. `estimate` is idempotent for one request id and projection: a repeated call answers the same numbers. `confirm` makes those numbers the request's contribution; without it the estimate is discarded at the next request or at close. A saved result is written only for a source that actually changed the numbers; a processed but no-effect source only advances the in-memory position. |
There was a problem hiding this comment.
This says a no-effect source only advances the in-memory position, but line 12 promises a context-usage/covered extension for a checked no-effect tail, line 109 says no new record, and the current code writes COVERED (crates/dim-agent-capabilities/src/context_usage.rs:115). Failure scenario: implementers either drop the covered position and lose recovery state or write it against the verification. Fix: decide whether the covered record is written and state it once.
There was a problem hiding this comment.
Fixed in 851f531. ContextUsage.md:12, 72 and 101 now say a checked no-effect tail at a fixed read or turn-end handoff extends the covered record, and any other no-effect source only advances the in-memory position. The three statements agree, and the code's cover path matches the handoff rule.
|
|
||
| #[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub enum BaselineSource { |
There was a problem hiding this comment.
BaselineSource already exists at crates/dim-agent-types/src/model.rs:333 with wire values provider_baseline and full_estimate; ContextCompaction.md:166 still documents those, and crates/dim-cli/src/session_host.rs:607 reads provider_baseline. This new enum serializes as counted and providerMeasured, so session.context.usage changes values and a provider-baselined read renders as estimated. Failure scenario: existing clients silently misread the baseline. Fix: reuse the existing type or document a versioned break and update every reader. Naming this reply Usage also shadows dim_agent_types::Usage through the module glob.
There was a problem hiding this comment.
Fixed in 851f531. ContextUsage.md:5 says the saved formats are this contract's, 40 and 153 import dim_agent_types::BaselineSource with provider_baseline and full_estimate, and the reply type is renamed UsageRead (157, 212), so the model Usage is no longer shadowed.
| #[serde(rename_all = "camelCase", deny_unknown_fields)] | ||
| pub struct EstimateRequest { | ||
| pub request_id: String, | ||
| pub projection: crate::history::StreamedContext, |
There was a problem hiding this comment.
This makes ContextPreparation hand its projection to ContextUsage, but ContextPreparation.md:12 says no projection object crosses an owner and the preparation projects internally. Sibling PR #2093's ContextProjection contract also says Loop hands the projection to ContextPreparation and makes StreamedContext serde. Failure scenario: the three documents disagree about who projects and where the value crosses. Fix: settle one handover; if the projection is a value, update ContextPreparation.md; if it stays inside ContextPreparation, pass an id, cutoff or contributions here.
There was a problem hiding this comment.
Fixed in 851f531. estimate now takes {requestId, through} (ContextUsage.md:69, 98, 175-178) and no longer receives a StreamedContext; ContextPreparation.md:12 and 42-45 render the projection and pass it once as a value. The remaining old handover in ContextCompaction section 15 is a separate P2 in the new body (P2-5).
| | Fault producers and Session observers → `sessionLifecycle` | `reportFault(error) → void`, `failure({}) → SessionFault or null`, `observeFault(listener) → id`, `release(id) → boolean`. The listener receives the current failure (initially null) and subsequent reports. Caller unload releases the observation. The first fault wins until a storage failure supersedes it; the first storage failure wins. | | ||
| | Check providers and input admission → SubmitChecks | `register(name, check) → void`; `check({entry, branchId, user?, mode}, cancelled) → proceed{blocks, warnings} or block{message}`. Run in name order through the first block. Interrupted checks write nothing. | | ||
| | Compaction, stop and activity callers → `agentLoop` | `agentLoop.compact({}) → sequence`, `stopTurn({turnId, reason}) → sequence or null`; `agentLoop.state({}) → {phase, turnId?}`, `observe(listener)` delivers that snapshot. | | ||
| | Compaction → `contextPreparation`; stop and activity callers → `agentLoop` | `contextPreparation.compact(..)`; `agentLoop.stopTurn/state/observe`; see [Loop](../plugins/Loop.md) and [ContextPreparation](../plugins/ContextPreparation.md). | |
There was a problem hiding this comment.
The Compaction row is updated, but lines 69-75 still define PrepareModelHost, PrepareContextHost, ContextModelHost, CompactionStrategyHost and prepare(...) -> ModelRequest. Loop.md uses RequestSettings, GuideEntries and ContextPreparation.prepare; ContextPreparation.md:166 says ContextFacts and SummaryStrategy replace the two hosts; ContextPreparation.prepare returns {}. Failure scenario: two contracts for the same operations and callers wire the old hosts. Fix: update lines 69-75 or state that they stay with #2025 and link the sibling target.
There was a problem hiding this comment.
Fixed in 851f531. runtime-owner-operations.md:69-76 now lists RequestSettings, ContextFacts, SummaryStrategy, ContextProjection and the new ContextPreparation operations; the old PrepareModelHost, ContextModelHost and CompactionStrategyHost rows are gone.
| | --- | --- | --- | --- | --- | --- | | ||
| | `submit` | Admit one input into the line, once per submission id | `{input}` | `{inputId, sequence}`; a repeated submission id answers the committed input | The caller cancels before the append; nothing is written | `invalid` (the input fails its own shape or scope), `line_ended` (the line has ended), `cancelled`, `closed` | | ||
| | `withdraw` | Withdraw one held input, optionally replacing it with a checked Steer | `{inputId, reason?, steer?}` | `{status}`: `deleted{sequence}` or `notHeld` | The caller cancels the wait; a committed withdrawal stands and a later call answers `notHeld` | `input_blocked` (a submit check refused the Steer), `invalid` (a malformed Steer candidate), `publication_unknown` (committed but publication unconfirmed), `cancelled`, `closed` | | ||
| | `pending` | Whether an input is held and unapplied at a cutoff | `{inputId, through?, includeBlockPresence?}` | `{pending}` | The caller cancels the wait for the cutoff; nothing changes | `closed`, `cancelled` | |
There was a problem hiding this comment.
Two conflicts with the existing read and sibling PR #2103's InputMethods. The current session.input.pending (docs/design/input-state-read.md:3-16) returns a page of inputs through TimelineTree.query; #2103 InputMethods:80 and 102 keep that page and say it needs no InputQueue operation. This pending {inputId} reply {pending} cannot serve it, yet line 154 says the Session entry calls it. Withdraw also uses WithdrawRequest here and publication_unknown, while #2103 uses WithdrawInput and interrupted (InputMethods.md:63 and 79). Failure scenario: the client's queued-messages read loses its page, or the Session entry calls operations that do not answer its shape. Fix: keep the page on TimelineTree and scope pending to a single-id check, or add a paged operation and update #2103; align the withdraw type and error name.
There was a problem hiding this comment.
Partially fixed in 851f531. The page read stays on TimelineTree (InputQueue.md:29, 85, 125, 154) and pending is a single-id membership check (83, 191-195). withdraw now uses WithdrawInput (174). What remains: the owner error is interrupted (82, 94, 212-213), while #2103's current InputMethods declares publication_unknown (79, 92) and session-access.md:234 keeps publication_unknown; session-access.md:533 also still binds the removed InputQueue::pending(input_id) -> bool. The new body files both as P2-2 and P2-6.
| | --- | --- | --- | | ||
| | RequestSettings (#2025) | `settings` | The Session's default model settings before a configuration is adopted. | | ||
| | ContextPreparation | `prepare` | Build the request at the source's cutoff, project the history there and publish the handoff facts. | | ||
| | ToolBinding (#2028) | `bind`, `claim`, `transfer`, `retain_only`, `release` | Pin the request's tool handlers and release them when the request can no longer run. | |
There was a problem hiding this comment.
PR #2100's ToolBinding defines bind, adopted, claim and transfer, and settles records and claims from facts without a caller release. retain_only and release are not operations there. Failure scenario: Loop calls operations the owner does not provide and the two target contracts cannot both land. Fix: update this row and line 145 to bind, adopted, claim, transfer, or get the two operations added to #2100.
There was a problem hiding this comment.
Fixed in 851f531 for the named operations: Loop.md:67 and 145 use bind, adopted, claim and transfer, which #2100 defines. One new conflict remains: #2100's current ToolBinding defines release and retain_only for Loop's budget-recovery and rebuild (ToolBinding.md:37-38, 141-142, 176), while Loop.md:145 says the Loop calls no release or retain operation. The new body files it as P2-4.
| let mut changed = Vec::new(); | ||
| for target in checked { | ||
| let current = prompt_host.load(target.clone(), cancelled.child_token()).await?; | ||
| if current != entries.get(&target) { |
There was a problem hiding this comment.
AdoptedEntries.entries is Vec<(PromptSourceTarget, PromptEntry)> (PromptAdoption.md:227), so entries.get(&target) does not compile. The same example calls cancelled.child_token(), but the documented cancellation type is CancelledFn (crates/dim-agent-capabilities/src/host.rs:1169), not a CancellationToken. Failure scenario: the example cannot be copied. Fix: use a map or a lookup over the Vec, and name the cancellation type.
There was a problem hiding this comment.
Partially fixed in 851f531. CancelledFn replaces child_token (PromptSourcesBranch.md:38-40) and the example no longer calls entries.get. What remains: entries is Vec<(PromptSourceTarget, PromptEntry)> (PromptAdoption.md:213-214), so entry.source, entry.scope and entry.version at PromptSourcesBranch.md:41-42 are fields of a tuple, not of the entry; the example still does not compile. The new body files it as P3-2.
|
|
||
| #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] | ||
| #[serde(rename_all = "camelCase", deny_unknown_fields)] | ||
| pub struct SubmitRequest { |
There was a problem hiding this comment.
The current data face is submit(input: InputMessageData) (npm/branch-services.d.ts:225). Wrapping it in SubmitRequest { input } changes the wire to {input: ...} and breaks existing TypeScript callers; WaitBranch's wait(WaitRequest) does the same to wait(taskId, timeoutMs) (npm/branch-services.d.ts:711). Failure scenario: external plugin calls break with no migration note. Fix: state the shape change and the caller migration, or keep the existing parameter shape.
There was a problem hiding this comment.
Fixed in 851f531. submit keeps the direct InputMessageData parameter (InputQueue.md:222), and WaitBranch adds the client-visible migration note for the request object (WaitBranch.md:76-78).
|
已按评审与自查标准修改,head P1
P2
P3
自查额外修改
客户端可见变更
检查: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Round 2 review: target contracts for the branch turn chain
Scope: target contracts for the branch turn chain (#2027): Loop, ContextPreparation, ContextUsage, ModelProvider, Prompt adoption, PromptSourcesBranch, InputQueue and WaitBranch, plus the surrounding owner indexes and the compaction and prompt rewires. Reviewed the full main...head at 851f531 (merge base 5a279d6), not only the delta.
Verdict: REQUEST_CHANGES
Round status
| Round-1 finding | Status |
|---|---|
| 1. P1 manual compaction has two owners | Fixed |
| 2. BaselineSource wire values | Fixed |
| 3. InputQueue pending and withdraw vs the page and #2103 | Partially fixed: error code name still conflicts with #2103; the session-access pending row is stale |
| 4. Prompt adoption configure vs #2103 | Partially fixed: this contract is an enum, #2103's current head still calls the old struct |
| 5. Loop requires ToolBinding operations #2100 does not define | Fixed for the named operations; a new release/retain_only conflict with #2100 remains (P2-4) |
| 6. ContextUsage persistence contract | Fixed |
| 7. Projection handover has three owners | Fixed for ContextUsage and ContextPreparation; the old handover in ContextCompaction section 15 remains (P2-5) |
| 8. ContextPreparation writes facts owned by Loop and ModelProvider | Fixed: the writers are named and the ModelProvider exception is stated; the prepare failure reply is a P3 gap |
| 9. A committed cancelled compaction has no outcome | Fixed |
| 10. Broken service-faces links | Fixed |
| 11. Prompt.md removed anchors | Fixed |
| 12. line_ended missing from the enum | Fixed |
| 13. adoptedConfiguration drops the revision | Fixed |
| 14. model.progress notice has no source | Fixed |
| 15. runtime-owner-operations keeps old host APIs | Fixed |
| 16. Stale catalog rows and references | Fixed |
| 17. Appendix hygiene | Fixed except a duplicate PublicService line (P3-3) |
| 18. Examples and cross-PR type names | Partially fixed: the PromptSourcesBranch example still does not compile; Provider.md still names PromptAdoption |
| 19. Session error mapping for ContextUsage | Fixed |
| 20. Forward references and merge risk | Open as a merge-order note (P3-7) |
The round-1 P1 is resolved as an ownership contract. The command, the single-flight slot and the step are ContextPreparation's in the normative sections, and ContextPreparation.md:129-133 extends Supersedes to ContextCompaction sections 2, 2.1, 2.2, 3, 4.1, 4.3, 5.3-5.5, 5.8, 10 and 12. The remaining findings are two cross-PR caller mismatches, sibling API drift, one unclosed projection handover and one stale Rust binding. No round-1 opinion was a false positive; the fixed items can be withdrawn.
P2
P2-1. #2103's PromptSources cannot call the new ConfigureRequest
Problem: This PR changes ConfigureRequest to a tagged enum with Initial, Loaded { sources: Vec<PromptEntry> }, LanguageUpdate { version } and Tools (PromptAdoption.md:174-179), and Adopted has through but no version (198-202). #2103's current head 734d364 still calls the old struct shape ConfigureRequest { sources: Some(vec![(target, Some(entry))]), model: None, tools: None } in both the periodic check and the language update, and compares adopted.version (PromptSources.md:56-60, 72-75). PromptSources.md:198 says those types are Prompt adoption's.
Failure scenario: The two PRs cannot both land. The Session language update and the periodic source check cannot compile against this owner, and the Loaded variant has no caller. A client or plugin following #2103 sends {sources, model, tools} where this contract expects {kind, data}.
Evidence: docs/design/plugins/PromptAdoption.md:89, 174-179, 198-202; #2103 PromptSources.md:56-60, 72-75, 198 at head 734d364.
Fix: Update #2103's examples in the same series, or keep the struct request shape and express the variants as a versioned wire union. State the dependency and the merge order either way.
P2-2. InputQueue's interrupted conflicts with #2103's publication_unknown
Problem: withdraw now answers interrupted for a committed but unconfirmed withdrawal (InputQueue.md:82, 94, 212-213). #2103's current InputMethods declares publication_unknown for session.input.withdraw and never mentions interrupted (InputMethods.md:79, 92). PromptAdoption.md:85 and 98 use publication_unknown for the same condition, and session-access.md:234 keeps publication_unknown on the sessions method.
Failure scenario: The Session entry must invent a mapping from the owner's interrupted to its declared publication_unknown, or the client sees an undeclared code. A client that handles publication_unknown treats a committed withdrawal as a generic failure and may retry it.
Evidence: docs/design/plugins/InputQueue.md:82, 94, 212-213; #2103 InputMethods.md:63, 79, 92 at head 734d364; docs/design/plugins/PromptAdoption.md:85, 98; docs/design/contracts/session-access.md:234.
Fix: Keep publication_unknown here, or state the mapping in both contracts and update #2103. Do not add a third name for the same state.
P2-3. ContextUsage requires ToolRegistry operations that #2103 does not define
Problem: ContextUsage's dependency names definitions and toolSourcesView.get (ContextUsage.md:61, 142). #2103's current ToolRegistry exposes declarations and sources, and retires toolSourcesView (ToolRegistry.md:95, 110-112, 177). #2100's ToolBinding also says definitions is removed (ToolBinding.md:215).
Failure scenario: The path with no tools named in the adopted configuration calls operations the Session owner does not provide. An implementer either wires the removed toolSourcesView cell or cannot serve the no-tools case, and the two contracts cannot both land.
Evidence: docs/design/plugins/ContextUsage.md:61, 142; #2103 ToolRegistry.md:95, 110-112, 177 at head 734d364; #2100 ToolBinding.md:215 at head 038e60c.
Fix: Use toolRegistry.declarations() and sources() (or sources/observe_sources) and update the requirement bullet.
P2-4. Loop and #2100 disagree about release and retain_only
Problem: Loop's dependency lists only bind, adopted, claim and transfer, and its requirements say the Loop calls no release or retain operation because settlement follows step/tool-result and turn/end (Loop.md:67, 145). #2100's current ToolBinding defines release and retain_only, and says they exist for Loop's budget-recovery and rebuild steps (ToolBinding.md:37-38, 141-142, 176, 215). runtime-owner-operations.md:76 also omits both.
Failure scenario: On a rebuild, either the Loop follows this contract and leaves stale records until the owner closes, or it follows #2100 and calls an operation this contract forbids. The two target contracts cannot both land as written.
Evidence: docs/design/plugins/Loop.md:67, 145; docs/design/contracts/runtime-owner-operations.md:76; #2100 ToolBinding.md:37-38, 141-142, 176, 215 at head 038e60c.
Fix: Add release and retain_only where the Loop needs them, or get #2100 to make the owner settle a rebuild itself and say so in both contracts.
P2-5. ContextCompaction section 15 still describes the old projection handover and Usage save
Problem: The request-local projection handoff says the Loop passes the projection to ContextPreparation before publishing context/prepare, ContextPreparation retains one pending projection bound to the request object, and Usage computes and saves contributions when the final request still uses the original cutoff (ContextCompaction.md:2127-2143). ContextPreparation.md:12 and 162 say the projection crosses once as a value and the crate-private projection slot is removed. ContextUsage.md:70-72 and 93 say only confirm saves, after estimate. Section 15 is not in either contract's Supersedes list.
Failure scenario: An implementer builds a pending projection slot and a Usage save without confirm, while the new contracts remove the slot and require the confirm. The projection has two handovers and the saved contributions can be written twice or never.
Evidence: docs/design/plugins/ContextCompaction.md:2127-2143; docs/design/plugins/ContextPreparation.md:12, 103, 162; docs/design/plugins/ContextUsage.md:70-72, 93.
Fix: Add section 15 to ContextPreparation's and ContextUsage's Supersedes lists, or rewrite it to the value handover and the estimate/confirm pair.
P2-6. session-access Appendix E binds types and a method the InputQueue contract removes
Problem: The withdraw row binds line_owner::<InputQueue>(line)?.withdraw(WithdrawRequest { input_id, reason, steer }) (session-access.md:532), but the owner type is WithdrawInput (InputQueue.md:174-180). The next row still binds InputQueue::pending(input_id) -> bool and Session::service::<InputQueue> (session-access.md:533), while the owner contract removes the pending Rust method and defines pending(PendingRequest) -> Pending (InputQueue.md:146, 191-195, 224).
Failure scenario: The Rust binding names a type and a method that do not exist. An implementer following Appendix E cannot compile, and the Session page read is wired to the removed shape.
Evidence: docs/design/contracts/session-access.md:532-533; docs/design/plugins/InputQueue.md:146, 174-180, 191-195, 224.
Fix: Use WithdrawInput and line_owner::<InputQueue>(line)?.pending(PendingRequest { .. }) -> Pending, or add both rows to InputQueue's Supersedes.
P3
P3-1. ContextUsage's compaction link has no heading
Problem: ContextCompaction.md#5-usage-and-the-compaction-cut has no matching heading. Section 5 is Flows, and the usage state is section 5.7.
Failure scenario: The intro link 404s for a reader looking for the compaction interaction.
Evidence: docs/design/plugins/ContextUsage.md:5; docs/design/plugins/ContextCompaction.md:516, 979.
Fix: Link #5-flows or #57-compaction-state-for-clients.
P3-2. PromptSourcesBranch's lookup still indexes a tuple
Problem: entries is Vec<(PromptSourceTarget, PromptEntry)> (PromptAdoption.md:213-214), so the closure parameter is a tuple reference and entry.source, entry.scope and entry.version do not exist (PromptSourcesBranch.md:41-42).
Failure scenario: The example cannot be copied or compiled.
Evidence: docs/design/plugins/PromptSourcesBranch.md:41-42; docs/design/plugins/PromptAdoption.md:213-214.
Fix: entries.iter().find(|(source, _)| source == &target.source) then use .1.version, or return a keyed map.
P3-3. Appendix duplicates and a lost heading
Problem: ContextCompaction.md:177 duplicates the cancelled mapping already at 178, and lines 494-495 declare impl PublicService for ContextPreparation {} twice. WaitBranch.md:76 replaced the ## Exceptions with reasons heading with ## Client-visible changes, leaving the two exception bullets at 82-83 under the migration note.
Failure scenario: The appendix does not compile as copied, the map has two identical entries, and the exception list reads as part of the client-visible changes.
Evidence: docs/design/plugins/ContextCompaction.md:177-178, 494-495; docs/design/plugins/WaitBranch.md:76-83.
Fix: Delete the duplicate line and the duplicate impl, and restore the ## Exceptions with reasons heading.
P3-4. Compaction still has stale Loop ownership references
Problem: ContextCompaction.md:928 says the Loop's next_model starts a pending step, 1238 still lists Loop as the compaction supplement, and 952 says ContextPreparation injects CompactionStrategyHost while the target contract uses SummaryStrategy (ContextPreparation.md:89-90, 172). The overview still calls compaction a Loop step (overview.md:229), and the Chinese ContextCompaction still assigns the command, slot and step to Loop (docs/zh/design/plugins/ContextCompaction.md:100, 117, 157).
Failure scenario: A reader in these sections keeps the step start or the old port in the Loop, the same split the P1 described, even though the normative sections moved the owner.
Evidence: docs/design/plugins/ContextCompaction.md:928, 952, 1238; docs/design/overview.md:229; docs/zh/design/plugins/ContextCompaction.md:100, 117, 157.
Fix: Update these references or add them to the Supersedes lists. The Chinese page can be a follow-up, but it should not contradict the English owner contract.
P3-5. PromptHost and the Provider type name are stale
Problem: PromptAdoption.md:20 and PromptSourcesBranch.md:11, 63, 109, 121 still name PromptHost, which #2103 removes in favor of PromptSources (PromptSources.md:198). #2096's current Provider.md:53 and 65 still call line_owner::<PromptAdoption>, while this contract's type is Prompt.
Failure scenario: An implementer wires the removed PromptHost service or a nonexistent PromptAdoption type.
Evidence: docs/design/plugins/PromptAdoption.md:20; docs/design/plugins/PromptSourcesBranch.md:11, 63, 109, 121; #2103 PromptSources.md:198; #2096 Provider.md:53, 65 at head 13f9b94.
Fix: Use PromptSources and Prompt in the examples and the dependency rows.
P3-6. Operation-shape nits
Problem: prepare's reply is {} once model/call is committed, but the pre-ModelProvider failure path writes step/model-output-end and the errors list has no over_budget for prepare (ContextPreparation.md:99, 103, 105-109). runtime-owner-operations.md:72 says SummaryStrategy's compact returns cancelled, while #2093 returns completed, skipped or failed and makes cancelled an error (SummaryStrategy.md:72, 82 at head a4f2377).
Failure scenario: A Loop implementer waits for a model/call that the failure terminal replaced, and a SummaryStrategy caller handles a variant that never arrives.
Evidence: docs/design/plugins/ContextPreparation.md:99, 103, 105-109; docs/design/contracts/runtime-owner-operations.md:72; #2093 SummaryStrategy.md:72, 82.
Fix: Say prepare returns {} once model/call or its failure terminal is committed, or add over_budget to its errors; drop or cancelled from the SummaryStrategy row or name the two layers.
P3-7. Merge order is still unstated
Problem: This PR and the series edit the same shared files: runtime-owner-operations.md, service-faces.md, session-access.md and session-boundary.md. The cross-PR mismatches above are symptoms of the missing order.
Failure scenario: The series merges in a different order and the later PR restores an old shape or a stale row.
Evidence: the shared files in this PR's file list; the sibling edits in #2103, #2100 and #2093.
Fix: State the dependency and merge order, and rebase after the owning contracts land.
Verification
node scripts/adr-check.mjs --base 5a279d69passes: ADR freeze passed, 19 changed files.- A link and anchor check over the 19 changed files finds
ContextUsage.md -> ContextCompaction.md#5-usage-and-the-compaction-cutbroken.ContextCompaction.md -> model-configuration.md#model-parametersandtimeline-branches.md -> appserver/session-deletion-and-fork.md#62-why-main-onlyare pre-existing and not raised here. - This PR is docs only; no code tests were run. CI reports
changesandci-oksuccess, the other jobs skipped.mergeStateStatusis BLOCKED withreviewDecisionCHANGES_REQUESTED.
| Scope: branch. Issue: #2027. | ||
|
|
||
| ## 1. 决定与边界 | ||
| ContextUsage owns the numbers of a line's effective context: what each source contributed, the cumulative totals, the compaction cuts and the provider's measured baseline. The counting rules are decided in [ADR 023](../../adr/023-context-usage.md); the saved formats are this contract's (below). The compaction interaction is [ContextCompaction §5](ContextCompaction.md#5-usage-and-the-compaction-cut). This document is the owner's target contract. |
There was a problem hiding this comment.
Problem: [ContextCompaction section 5](ContextCompaction.md#5-usage-and-the-compaction-cut) has no matching heading. Section 5 is Flows, and the usage state is section 5.7.
Failure scenario: The intro link 404s for a reader looking for the compaction interaction.
Evidence: docs/design/plugins/ContextUsage.md:5; docs/design/plugins/ContextCompaction.md:516, 979.
Fix: Link #5-flows or #57-compaction-state-for-clients.
There was a problem hiding this comment.
Fixed in 44e6419. ContextUsage.md:5 now links ContextCompaction.md#57-compaction-state-for-clients, which matches the heading at ContextCompaction.md:977.
|
|
||
| #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] | ||
| #[serde(tag = "kind", content = "data", rename_all = "camelCase")] | ||
| pub enum ConfigureRequest { |
There was a problem hiding this comment.
Problem: #2103's current head 734d364 still calls the old struct shape ConfigureRequest { sources: Some(vec![(target, Some(entry))]), model: None, tools: None } and compares adopted.version (PromptSources.md:56-60, 72-75), while this enum has Initial, Loaded, LanguageUpdate and Tools and Adopted has no version (198-202). PromptSources.md:198 says these types are Prompt adoption's.
Failure scenario: The two PRs cannot both land. The Session language update and the periodic source check cannot compile against this owner, and the Loaded variant has no caller.
Evidence: docs/design/plugins/PromptAdoption.md:89, 174-179, 198-202; #2103 PromptSources.md:56-60, 72-75, 198 at head 734d364.
Fix: Update #2103's examples in the same series, or keep the struct request shape and express the variants as a versioned wire union.
There was a problem hiding this comment.
Partially fixed in 44e6419. #2103 at 69071dd now calls ConfigureRequest::Initial, Loaded { sources } and LanguageUpdate (PromptSources.md:52, 57, 68) and says the enum is #2102's (190), so the configure shapes agree. What remains is #2103 PromptSources.md:56, which still compares adopted.version; this contract's Adopted has settings? and through (PromptAdoption.md:198-202), and adoptedEntries returns (target, entry) pairs (213-214), so the example should call adoptedEntries. Filed as an optional P3 in the round-3 body.
| | Operation | Intent | Request | Reply | Cancellation | Errors | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `submit` | Admit one input into the line, once per submission id | `{input}` | `{inputId, sequence}`; a repeated submission id answers the committed input | The caller cancels before the append; nothing is written | `invalid` (the input fails its own shape or scope), `line_ended` (the line has ended), `cancelled`, `closed` | | ||
| | `withdraw` | Withdraw one held input, optionally replacing it with a Steer | `{inputId, reason?, steer?}` | `{status}`: `deleted{sequence}` or `notHeld` | The caller cancels the wait; a committed withdrawal stands and a later call answers `notHeld` | `input_blocked` (a submit check refused the Steer), `invalid` (a malformed Steer candidate), `interrupted` (committed but publication unconfirmed), `cancelled`, `closed` | |
There was a problem hiding this comment.
Problem: withdraw answers interrupted for a committed but unconfirmed withdrawal, but #2103's current InputMethods declares publication_unknown for session.input.withdraw and never mentions interrupted (InputMethods.md:79, 92 at head 734d364). PromptAdoption.md:85 and 98 use publication_unknown for the same condition, and session-access.md:234 keeps publication_unknown.
Failure scenario: The Session entry must invent a mapping, or the client sees an undeclared code and treats a committed withdrawal as a generic failure.
Evidence: docs/design/plugins/InputQueue.md:82, 94, 212-213; #2103 InputMethods.md:63, 79, 92; docs/design/plugins/PromptAdoption.md:85, 98; docs/design/contracts/session-access.md:234.
Fix: Keep publication_unknown here, or state the mapping in both contracts and update #2103.
| | Owner | Operation | Use | | ||
| | --- | --- | --- | | ||
| | ContextFacts (#2025, Session) | `describe`, `contributions`, `estimate` | The additive counter, the fixed contribution and one contribution's size. | | ||
| | ToolRegistry (#2026, Session) | `definitions`, `toolSourcesView.get` | The current tool declarations when the adopted configuration names no tools. | |
There was a problem hiding this comment.
Problem: The dependency names toolRegistry.definitions and toolSourcesView.get, but #2103's current ToolRegistry exposes declarations and sources and retires toolSourcesView (ToolRegistry.md:95, 110-112, 177 at head 734d364). #2100's ToolBinding also says definitions is removed (ToolBinding.md:215).
Failure scenario: The path with no tools named in the adopted configuration calls operations the owner does not provide, so the two contracts cannot both land.
Evidence: docs/design/plugins/ContextUsage.md:61, 142; #2103 ToolRegistry.md:95, 110-112, 177; #2100 ToolBinding.md:215 at head 038e60c.
Fix: Use toolRegistry.declarations() and sources() (or sources/observe_sources) and update the requirement bullet.
| | --- | --- | --- | | ||
| | RequestSettings (#2025) | `settings` | The Session's default model settings before a configuration is adopted. | | ||
| | ContextPreparation | `prepare` | Build the request at the source's cutoff from the projection and publish the handoff facts. | | ||
| | ToolBinding (#2028) | `bind`, `adopted`, `claim`, `transfer` | Pin the request's tool generation, read its declarations, register the calls' claims and move the record to a retry; settlement follows the line's facts. | |
There was a problem hiding this comment.
Problem: The row lists only bind, adopted, claim and transfer, and line 145 says the Loop calls no release or retain operation, but #2100's current ToolBinding defines release and retain_only for Loop's budget-recovery and rebuild steps (ToolBinding.md:37-38, 141-142, 176, 215 at head 038e60c).
Failure scenario: On a rebuild, either the Loop follows this contract and leaves stale records until the owner closes, or it follows #2100 and calls an operation this contract forbids.
Evidence: docs/design/plugins/Loop.md:67, 145; docs/design/contracts/runtime-owner-operations.md:76; #2100 ToolBinding.md:37-38, 141-142, 176, 215.
Fix: Add release and retain_only where the Loop needs them, or get #2100 to make the owner settle a rebuild itself and say so in both contracts.
| in-flight compaction. | ||
| - It maps the outcome: `completed` → `{status: "completed", sequence}`; | ||
| `skipped` → `{status: "skipped", reason}`; `failed` → `compaction_failed`; | ||
| `cancelled` → `compaction_cancelled`; |
There was a problem hiding this comment.
Problem: The mapping now lists cancelled -> compaction_cancelled twice (177 and 178).
Failure scenario: The mapping is ambiguous and the copied text is wrong.
Evidence: docs/design/plugins/ContextCompaction.md:177-178.
Fix: Delete one.
There was a problem hiding this comment.
Fixed in 44e6419. The duplicate cancelled -> compaction_cancelled line is gone; ContextCompaction.md:174-177 now has one mapping.
| -> Result<ContextUsage, ContextOpError>; } | ||
| impl ContextPreparation { pub async fn compact(&self, request: CompactionRequest, cancelled: CancelledFn) | ||
| -> Result<CompactionOutcome, PreparationError>; } | ||
| impl PublicService for ContextPreparation {} |
There was a problem hiding this comment.
Problem: impl PublicService for ContextPreparation {} appears twice (494-495).
Failure scenario: The appendix does not compile as copied.
Evidence: docs/design/plugins/ContextCompaction.md:494-495.
Fix: Delete one.
There was a problem hiding this comment.
Fixed in 44e6419. The duplicate declaration is gone; the appendix has one impl PublicService for ContextPreparation {} at ContextCompaction.md:493.
|
|
||
|
|
||
|
|
||
| - A reload ends an accepted wait with an error rather than replaying an arrival: a cancelled background task emits no wake, and an arrival from the previous generation is not a wake the model can still act on. |
There was a problem hiding this comment.
Problem: The ## Exceptions with reasons heading was replaced by ## Client-visible changes, so these two exception bullets (82-83) sit under the migration note.
Failure scenario: The contract's exception list has no heading and reads as part of the client-visible changes.
Evidence: docs/design/plugins/WaitBranch.md:76-83.
Fix: Restore the ## Exceptions with reasons heading before the bullets.
There was a problem hiding this comment.
Fixed in 44e6419. WaitBranch.md:80 restores the ## Exceptions with reasons heading before the two bullets at 82-83.
| | Loop → RequestSettings | `settings() → settings`; the model profile's defaults before an adoption ([#2093](https://github.com/arcships/dim/pull/2093), target). | | ||
| | ContextPreparation → PrepareContextHost | The model profile's request builder stays the host port `prepare` calls; the owner contract is [ContextPreparation](../plugins/ContextPreparation.md). | | ||
| | Context accounting and compaction → ContextFacts | `describe`, `count`, `contributions`, `estimate`; ContextFacts is the owner ([#2093](https://github.com/arcships/dim/pull/2093), target). | | ||
| | ContextPreparation → SummaryStrategy | `describe(model facts) → {name, replacementSize}`; `compact(input, cancelled) → completed, skipped, failed or cancelled` with StrategyDiagnostics; SummaryStrategy is the owner ([#2093](https://github.com/arcships/dim/pull/2093), target). | |
There was a problem hiding this comment.
Problem: This row says SummaryStrategy's compact returns cancelled, but #2093's current SummaryStrategy returns completed, skipped or failed and makes cancelled an error (SummaryStrategy.md:72, 82 at head a4f2377). Only ContextPreparation's CompactionOutcome adds a cancelled outcome.
Failure scenario: A caller handles a variant that never arrives and misses the error.
Evidence: docs/design/contracts/runtime-owner-operations.md:72; #2093 SummaryStrategy.md:72, 82.
Fix: Drop or cancelled or name the two layers.
| while one is outstanding is skipped (§5.4). | ||
| 4. **Boundaries.** | ||
| - `next_model` (except with a budget-retry source) and `turn/end` start a pending step instead | ||
| - The Loop's `next_model` (except with a budget-retry source) and `turn/end` start a pending step instead |
There was a problem hiding this comment.
Problem: This still says the Loop's next_model starts a pending compaction step, while ContextPreparation owns the step and its flow says the owner runs it at the boundary (ContextPreparation.md:14, 122). Section 8 at 1238 still lists Loop as the compaction supplement.
Failure scenario: An implementer keeps the step start in the Loop for the boundary path, the same split the P1 described.
Evidence: docs/design/plugins/ContextCompaction.md:928, 1238; docs/design/plugins/ContextPreparation.md:14, 122, 129-133.
Fix: Say the Loop signals the boundary or the owner observes it, and update section 8 to ContextPreparation.
There was a problem hiding this comment.
Fixed in 44e6419. ContextCompaction.md:850-853 and 866-867 now say ContextPreparation consumes the command and starts the pending step, and 925-927 says the Loop does not advance across the boundary. Section 8's Loop row now only says it starts no request (1236). The round-3 body notes one optional detail: name the boundary facts ContextPreparation observes.
|
已按评审修改,head 本轮处理
自查发现
留给第二步(left for step 2)
检查: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Round 3 review: target contracts for the branch turn chain
Scope: target contracts for the branch turn chain (#2027), covering Loop, ContextPreparation, ContextUsage, ModelProvider, Prompt adoption, PromptSourcesBranch, InputQueue and WaitBranch, plus the compaction and prompt rewires and the shared owner indexes. Reviewed the full main...head at 44e6419 (merge base 5a279d6) against origin/main c819cfd, not only the 851f531 to 44e6419 delta.
Verdict: REQUEST_CHANGES
Round status
| Round-2 finding | Status |
|---|---|
| P2-1 #2103 configure shape | Fixed for this contract: #2103 at 69071dd calls ConfigureRequest::Initial, Loaded { sources } and LanguageUpdate (PromptSources.md:52, 57, 68) and says the enum is this PR's (190). P3 residual: #2103 PromptSources.md:56 still compares adopted.version. |
P2-2 InputQueue interrupted |
Still open, now P2-2 below. |
P2-3 ToolRegistry definitions and toolSourcesView |
Still open, now P2-3 below. |
P2-4 Loop release and retain_only |
Still open, now P2-4 below. |
| P2-5 ContextCompaction section 15 | Still open, now P2-5 below. |
| P2-6 session-access Appendix E | Fixed in 44e6419: the rows now use WithdrawInput and pending(PendingRequest) (session-access.md:532-533, InputQueue.md:174-180, 191-195, 224). Optional follow-up below: the default for published_cutoff: None is unstated. |
| P3-1 ContextUsage compaction link | Fixed: ContextUsage.md:5 links #57-compaction-state-for-clients, matching ContextCompaction.md:977. |
| P3-2 PromptSourcesBranch tuple lookup | Partially fixed, see the P3 list. |
| P3-3 duplicate lines and heading | Fixed: one cancelled mapping (ContextCompaction.md:174-177), one PublicService impl, and the ## Exceptions with reasons heading is back at WaitBranch.md:80. |
| P3-4 stale Loop references | Partially fixed: sections 5.4, 5.5 and 8 now name ContextPreparation; ContextCompaction.md:950 still names CompactionStrategyHost, and section 5.6 is not superseded (ContextPreparation.md:133). |
| P3-5 PromptHost names | Still open, see the P3 list. |
P3-6 prepare reply and SummaryStrategy cancelled |
Partially fixed: ContextPreparation.md:99 now names the failure terminal; runtime-owner-operations.md:72 still lists cancelled. |
| P3-7 merge order | Addressed in the PR body: it now states #2029, #2080, #2091/#2092/#2093, #2100 and #2103 in order. |
All round-1 findings remain as assessed in round 2. No round-1 opinion was a false positive.
P2 (blocking)
P2-1 (round 3). PrepareRequest carries the internal StreamedContext, so #2093's renderedStream reply cannot reach prepare
Problem: PrepareRequest derives serde and declares pub projection: crate::history::StreamedContext (ContextPreparation.md:184-189). That is the internal type, pub struct StreamedContext { pub history: Vec<HistoryEntry>, ... } with only #[derive(Debug, Clone)] and no serde derive (crates/dim-agent-capabilities/src/history.rs:729-740 on origin/main). #2093 at a4f2377 changes renderedStream's reply to a wire StreamedContext with history: Vec<Entry>, owned values and serde, and keeps the internal type unchanged (ContextProjection.md:166-198, 297). The field is a non-serde internal type inside a serde request for a cross-language operation, which the contract's own §7 cross-language rule forbids (ContextPreparation.md:163).
Failure scenario: Loop calls contextProjection.renderedStream, receives #2093's wire StreamedContext, and passes it to prepare. The request field expects the internal Vec<HistoryEntry> value, which has no Serialize or Deserialize, so the serde derive on PrepareRequest cannot compile. Even in process, the wire value and the field type differ, and the conversion is nowhere defined. The same mismatch applies to the handoff text in ContextCompaction section 15 (P2-5).
Evidence: ContextPreparation.md:184-189; crates/dim-agent-capabilities/src/history.rs:728-740; #2093 ContextProjection.md:166-198, 297 at a4f2377. This was noted on #2093 at ContextProjection.md:168 and is still unfixed here.
Fix: Use #2093's exported wire type for this field (and state its import path in #2093), or state the one conversion and where it runs. Do not put a non-serde internal type in a data-face request.
P2-2 (round 3). interrupted still conflicts with #2103's and session-access's publication_unknown
Problem: withdraw answers interrupted for a committed but unconfirmed withdrawal (InputQueue.md:82, 94, 212-213). #2103 at 69071dd still declares publication_unknown for session.input.withdraw and never mentions interrupted (InputMethods.md:79, 92). session-access.md:234 keeps publication_unknown, and this PR's PromptAdoption.md:85 and 98 use it for the same condition.
Failure scenario: The Session entry in #2103 must invent a mapping or pass through an undeclared code. A client that handles publication_unknown treats a committed withdrawal as a generic failure and may retry it; a client matching interrupted cannot receive it through the declared session.input.withdraw shape.
Evidence: docs/design/plugins/InputQueue.md:82, 94, 212-213; #2103 InputMethods.md:79, 92 at 69071dd; docs/design/contracts/session-access.md:234; docs/design/plugins/PromptAdoption.md:85, 98.
Fix: Keep publication_unknown here, or state the mapping in both contracts and update #2103 and session-access.md. Do not keep two names for one state.
P2-3 (round 3). ContextUsage still requires ToolRegistry operations that #2103 retires
Problem: ContextUsage's dependency and requirement name definitions and toolSourcesView.get (ContextUsage.md:61, 142). #2103 at 69071dd exposes declarations and sources, retires toolSourcesView (ToolRegistry.md:95, 110-111, 177), and #2100 says definitions is removed (ToolBinding.md:215).
Failure scenario: The path with no tools named in the adopted configuration calls operations the Session owner does not provide. An implementer either wires the retired toolSourcesView or cannot serve the no-tools case, so the two target contracts cannot both land.
Evidence: docs/design/plugins/ContextUsage.md:61, 142; #2103 ToolRegistry.md:95, 110-111, 177 at 69071dd; #2100 ToolBinding.md:215 at a68b322.
Fix: Use toolRegistry.declarations() and sources() (or observe_sources) and update the requirement bullet.
P2-4 (round 3). Loop forbids release and retain_only that #2100 defines for it
Problem: Loop's dependency lists only bind, adopted, claim and transfer, and its requirement says the Loop calls no release or retain operation (Loop.md:67, 145). #2100 at a68b322 defines release and retain_only and says they exist for Loop's budget-recovery and rebuild steps (ToolBinding.md:18, 37-38, 141-142, 176). runtime-owner-operations.md:76 also omits both.
Failure scenario: On a rebuild, the Loop either follows this contract and leaves stale records until the owner closes, or follows #2100 and calls an operation this contract forbids. Budget recovery has the same split. The two target contracts cannot both land as written.
Evidence: docs/design/plugins/Loop.md:67, 145; docs/design/contracts/runtime-owner-operations.md:76; #2100 ToolBinding.md:18, 37-38, 141-142, 176 at a68b322.
Fix: Add release and retain_only where the Loop needs them, or get #2100 to settle a rebuild itself and say so in both contracts.
P2-5 (round 3). ContextCompaction section 15 still describes the old projection handoff and Usage save, and neither owner supersedes it
Problem: Section 15's Request-local projection handoff still says Loop passes the projection before publishing context/prepare, ContextPreparation retains at most one pending projection bound to the original request object, the value is not serialized, and Usage computes and saves contributions when the final request keeps the original cutoff (ContextCompaction.md:2127-2141). The owner contracts say the projection crosses once as a value in prepare (ContextPreparation.md:12, 103), the crate-private slot is removed (ContextPreparation.md:162), estimate does not take a StreamedContext (ContextUsage.md:144), and only confirm saves (ContextUsage.md:70-72, 93). ContextPreparation's Supersedes (ContextPreparation.md:133) and ContextUsage's Supersedes (ContextUsage.md:103-106) do not include section 15.
Failure scenario: An implementer builds the pending projection slot and a Usage save without confirm, while the owner contracts remove the slot and require confirm. The projection has two handovers, and contributions can be written twice or never.
Evidence: docs/design/plugins/ContextCompaction.md:2127-2141; docs/design/plugins/ContextPreparation.md:12, 103, 133, 162; docs/design/plugins/ContextUsage.md:70-72, 93, 103-106, 144.
Fix: Add section 15, at least the Request-local projection handoff subsection, to both Supersedes lists, or rewrite it to the value handover and the estimate/confirm pair.
P3 (optional)
- PromptSourcesBranch's lookup still does not compile (P3-2 residual). PromptSourcesBranch.md:41-45 compares
source == &target.source, wheresourceis&PromptSourceTarget({source: String, scope: PromptScope}at crates/dim-agent-runtime/src/contracts.rs:91-94) andtarget.sourceisString; it also drops the scope comparison. Usesource.source == target.source && source.scope == target.scope, orsource == &target. - The ContextUsage rewrite drops two anchors that unchanged docs still link. docs/design/owner-state-indexed-reads.md:115 links
plugins/ContextUsage.md#6-恢复切点和查询范围, and docs/design/appserver/native-storage-format.md:1614 links#61-统计版本与旧数据. The old file had those headings (5a279d6:ContextUsage.md:92, 104); the new one does not. Keep stub headings as Prompt.md:8 does, or update the two linkers. - The delta makes ContextPreparation start a pending step at a Loop boundary (ContextCompaction.md:889-891, 926-927), but section 5.5's subscription list still names only
context/compact,context/compaction-startandcontext/compaction(917-919). Hypothesis: an implementer registers only those facts, so a command consumed while a request is in flight has no trigger atstep/tool-resultorturn/end. Name the boundary facts, or state that the Loop signals the boundary. - session-access.md:533 says the owner applies its published-cutoff default, but InputQueue.md never defines what
published_cutoff: Nonemeans (83, 191-195). State the default, or pass the captured cutoff in the row. - runtime-owner-operations.md:72 still lists
cancelledas a SummaryStrategy outcome; #2093 at a4f2377 returns completed, skipped or failed and makescancelledan error (SummaryStrategy.md:72, 82). - ContextCompaction.md:950 still says ContextPreparation injects
CompactionStrategyHost; section 5.6 is not in the Supersedes list (ContextPreparation.md:133). - overview.md:229 still calls compaction "a Loop step", and docs/zh/design/plugins/ContextCompaction.md:100, 117 and 157 still assign the command, slot and step to Loop.
- PromptHost names remain (PromptAdoption.md:20; PromptSourcesBranch.md:11, 66, 112, 124) while #2103 PromptSources.md:169-170 retires
promptHost. - #2103 PromptSources.md:56 still compares
adopted.version; this contract'sAdoptedhassettings?andthrough, andadoptedEntriesreturns(target, entry)pairs (PromptAdoption.md:198-202, 213-214). UseadoptedEntriesin #2103's example.
Verification
node scripts/adr-check.mjs --base 5a279d69passes with 19 changed files.- A link and anchor check over the 19 changed files and their inbound links finds only the two ContextUsage anchors above. ContextCompaction.md:528 and the aimux and session-deletion anchors are pre-existing and not raised.
- CI:
ci-okpassed and the other jobs were skipped (docs only).mergeStateStatusis BLOCKED withreviewDecisionCHANGES_REQUESTED. No code tests were run.
| #[serde(rename_all = "camelCase", deny_unknown_fields)] | ||
| pub struct PrepareRequest { | ||
| pub source: ContextPrepareData, | ||
| pub projection: crate::history::StreamedContext, |
There was a problem hiding this comment.
Problem: PrepareRequest derives Serialize and Deserialize, but this field is the internal crate::history::StreamedContext, which has only #[derive(Debug, Clone)] and no serde derive, and holds Vec<HistoryEntry> (crates/dim-agent-capabilities/src/history.rs:729-740 on origin/main). #2093 at a4f2377 makes renderedStream's reply a wire StreamedContext with history: Vec<Entry> and serde (docs/design/plugins/ContextProjection.md:166-198, 297).
Failure scenario: Loop receives #2093's wire value and cannot pass it to prepare. The field type has no serde, so the PrepareRequest derive cannot compile, and even in process the wire value and the field type differ with no conversion defined. The prepare path cannot be built from both contracts.
Evidence: this line and ContextPreparation.md:184-189; crates/dim-agent-capabilities/src/history.rs:728-740; #2093 ContextProjection.md:166-198 at a4f2377. This was noted on #2093 at ContextProjection.md:168 and is still unfixed here.
Fix: Use #2093's exported wire type for the field (and state its import path there), or define the one conversion and where it runs.
There was a problem hiding this comment.
Still open in 3b48e12. PrepareRequest.projection is still crate::history::StreamedContext (ContextPreparation.md:188), the internal type with no serde derive (crates/dim-agent-capabilities/src/history.rs:728-740). #2093 at c8f1812 still defines contextProjection::StreamedContext, Entry and History and says #2102 must align its import (ContextProjection.md:150). See P2-1 in the round-4 body.
| | Operation | Intent | Request | Reply | Cancellation | Errors | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `submit` | Admit one input into the line, once per submission id | `{input}` | `{inputId, sequence}`; a repeated submission id answers the committed input | The caller cancels before the append; nothing is written | `invalid` (the input fails its own shape or scope), `line_ended` (the line has ended), `cancelled`, `closed` | | ||
| | `withdraw` | Withdraw one held input, optionally replacing it with a Steer | `{inputId, reason?, steer?}` | `{status}`: `deleted{sequence}` or `notHeld` | The caller cancels the wait; a committed withdrawal stands and a later call answers `notHeld` | `input_blocked` (a submit check refused the Steer), `invalid` (a malformed Steer candidate), `interrupted` (committed but publication unconfirmed), `cancelled`, `closed` | |
There was a problem hiding this comment.
Problem: interrupted is the owner's name for a committed but unconfirmed withdrawal (also 94, 212-213). #2103 at 69071dd still declares publication_unknown for session.input.withdraw (docs/design/plugins/InputMethods.md:79, 92), session-access.md:234 keeps publication_unknown, and this PR's PromptAdoption.md:85 and 98 use it for the same condition.
Failure scenario: The Session entry maps the owner's code to its declared one, or the client sees an undeclared code. A client that handles publication_unknown may retry a withdrawal that already committed.
Evidence: InputQueue.md:82, 94, 212-213; #2103 InputMethods.md:79, 92 at 69071dd; docs/design/contracts/session-access.md:234; docs/design/plugins/PromptAdoption.md:85, 98.
Fix: Keep publication_unknown, or state the mapping in both contracts and update #2103 and session-access.md.
There was a problem hiding this comment.
Partially fixed in 3b48e12. The operation table (InputQueue.md:82) and error row (94) now use publication_unknown, matching #2103 at 59a77a3 (InputMethods.md:173-174) and session-access. What remains is the binding appendix: InputQueueError::Interrupted (InputQueue.md:213) still serializes as interrupted. Rename it or add a serde rename; see P2-2 and the inline comment at line 213.
| | Owner | Operation | Use | | ||
| | --- | --- | --- | | ||
| | ContextFacts (#2025, Session) | `describe`, `contributions`, `estimate` | The additive counter, the fixed contribution and one contribution's size. | | ||
| | ToolRegistry (#2026, Session) | `definitions`, `toolSourcesView.get` | The current tool declarations when the adopted configuration names no tools. | |
There was a problem hiding this comment.
Problem: This names definitions and toolSourcesView.get, and line 142 repeats the requirement. #2103 at 69071dd exposes declarations and sources and retires toolSourcesView (docs/design/plugins/ToolRegistry.md:95, 110-111, 177); #2100 says definitions is removed (docs/design/plugins/ToolBinding.md:215).
Failure scenario: The path with no tools named in the adopted configuration calls operations the Session owner does not provide. An implementer either wires the retired toolSourcesView or cannot serve the no-tools case, so the two target contracts cannot both land.
Evidence: ContextUsage.md:61, 142; #2103 ToolRegistry.md:95, 110-111, 177 at 69071dd; #2100 ToolBinding.md:215 at a68b322.
Fix: Use toolRegistry.declarations() and sources() (or observe_sources) and update the requirement at line 142.
|
|
||
| ## Requirements raised to mechanism owners | ||
|
|
||
| - #2028 (ToolBinding): Loop needs `bind`, `adopted`, `claim` and `transfer` as data operations; settlement follows `step/tool-result` and `turn/end`, so the Loop calls no release or retain operation. |
There was a problem hiding this comment.
Problem: This says the Loop calls no release or retain operation, and the dependency at line 67 lists only bind, adopted, claim and transfer. #2100 at a68b322 defines release and retain_only and says they exist for Loop's budget-recovery and rebuild steps (docs/design/plugins/ToolBinding.md:18, 37-38, 141-142, 176). docs/design/contracts/runtime-owner-operations.md:76 also omits both.
Failure scenario: On a rebuild, the Loop either follows this contract and leaves stale records until the owner closes, or follows #2100 and calls an operation this contract forbids. Budget recovery has the same split. The two target contracts cannot both land as written.
Evidence: Loop.md:67, 145; docs/design/contracts/runtime-owner-operations.md:76; #2100 ToolBinding.md:18, 37-38, 141-142, 176 at a68b322.
Fix: Add release and retain_only where the Loop needs them, or get #2100 to settle a rebuild itself and state that in both contracts.
There was a problem hiding this comment.
Fixed in 3b48e12. Loop.md:67, 145 and runtime-owner-operations.md:76 now list release and retain_only, matching #2100 at 437266b: release({requestId}) and retain_only({requestId}) (ToolBinding.md:140-141, 299-300), Loop is the caller (18, 176), settlement stays with the line's facts (14, 169), and ToolBinding keeps records across a Loop reload (171, 194). Withdrawn.
|
已按评审修改,head 跨 PR 对齐:
验证: |
|
补充说明,head
验证: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Round 4 review: target contracts for the branch turn chain
Scope: target contracts for the branch turn chain (#2027), covering Loop, ContextPreparation, ContextUsage, ModelProvider, Prompt adoption, PromptSourcesBranch, InputQueue and WaitBranch, plus the compaction and prompt rewires and the shared owner indexes. Reviewed the full main...head at 3b48e12 (merge base 5a279d6), not only the 44e6419 to 3b48e12 delta. Sibling heads checked: #2100 437266b, #2103 59a77a3, #2093 c8f1812 (the head moved from 53961a1; ContextProjection is unchanged), #2098 c3acab3, #2097 ed43cd9.
Verdict: REQUEST_CHANGES
Round status
| Prior finding | Status |
|---|---|
| P2-1 PrepareRequest projection | Still open, see P2-1. |
| P2-2 withdraw code | Partially fixed: the table and error row now use publication_unknown (InputQueue.md:82, 94), but the binding still emits interrupted, see P2-2. |
| P2-3 ContextUsage ToolRegistry | Fixed in 823124c: ContextUsage.md:61, 142 now use declarations, and #2103 at 59a77a3 defines declarations with request {} and reply {tools, sources} (ToolRegistry.md:110, 281). Withdraw the prior opinion. |
| P2-4 Loop release and retain_only | Fixed in 823124c: Loop.md:67, 145 and runtime-owner-operations.md:76 now match #2100 at 437266b: release({requestId}) and retain_only({requestId}) (ToolBinding.md:140-141, 299-300), Loop is the caller (18, 176), settlement stays with the line's facts (14, 169), and ToolBinding keeps records across a Loop reload (171, 194). Withdraw the prior opinion. |
| P2-5 ContextCompaction section 15 | Still open, see P2-5. |
Withdraw P2-3 and P2-4 as fixed. Narrow P2-2 rather than withdrawing it. P2-1 and P2-5 stand. No prior opinion is withdrawn as a false positive.
The round-2 and round-3 P3 residuals are unchanged and remain optional: ContextCompaction.md:947-950 still names CompactionStrategyHost and section 5.6 is not superseded; the two ContextUsage anchors remain absent at owner-state-indexed-reads.md:115 and appserver/native-storage-format.md:1614; PromptSourcesBranch.md:41-45 still compares &PromptSourceTarget with &String and drops the scope; runtime-owner-operations.md:72 still lists cancelled as a SummaryStrategy outcome while #2093 SummaryStrategy.md:13, 82 makes it an error; #2103 PromptSources.md:56 still compares adopted.version; and InputQueue.md:83 does not state what publishedCutoff: None means while session-access.md:533 and #2098 Agents.md:226, 276 say the owner's published head applies.
P2 (blocking)
P2-1. PrepareRequest still carries the internal StreamedContext, not #2093's wire type
Problem: PrepareRequest derives serde and declares pub projection: crate::history::StreamedContext (ContextPreparation.md:186-189). That is the internal dim-agent-capabilities type, #[derive(Debug, Clone)] with pub history: Vec<HistoryEntry> and no serde derive (crates/dim-agent-capabilities/src/history.rs:728-740 on origin/main). #2093 at c8f1812 defines the wire types contextProjection::StreamedContext, contextProjection::Entry and contextProjection::History and explicitly says #2102 must align its import (ContextProjection.md:150, 161-198, 299). The caller example passes rendered_stream's wire reply into prepare (ContextPreparation.md:39-50), and runtime-owner-operations.md:74 repeats prepare({source, projection}).
Failure scenario: The serde derive on PrepareRequest cannot compile with a field type that has no Serialize or Deserialize. Even in process, Loop's wire value and the internal field type differ, and no conversion is defined. The prepare path cannot be built from both contracts.
Evidence: docs/design/plugins/ContextPreparation.md:186-189; crates/dim-agent-capabilities/src/history.rs:728-740 at decc589; #2093 docs/design/plugins/ContextProjection.md:150, 161-198, 299 at c8f1812; docs/design/contracts/runtime-owner-operations.md:74.
Fix: Use #2093's wire type for the field and name its import, or define the one conversion and where it runs. Do not put a non-serde internal type in a serde request.
P2-2. InputQueue's binding still emits interrupted for a committed withdrawal
Problem: The operation table and error row now use publication_unknown (InputQueue.md:82, 94), and PromptAdoption.md:85, 98 and session-access.md:234, 446 use the same code. But the binding appendix still declares Interrupted under #[serde(tag = "code", rename_all = "snake_case")] (InputQueue.md:203-213), so the compiled wire code is interrupted. #2103 at 59a77a3 declares PublicationUnknown (InputMethods.md:173-174), and origin/main's withdraw maps AgentError::PublicationUnknown to the sessions code publication_unknown (crates/dim-agent-capabilities/src/input_queue.rs:333-336; crates/dim-agent-capabilities/src/methods.rs:146).
Failure scenario: An implementer copies the binding and the owner emits interrupted while the same document's table, #2103 and session-access declare publication_unknown. The Session entry must invent a mapping, and a client that handles publication_unknown treats a committed withdrawal as an unknown failure and may retry it.
Evidence: docs/design/plugins/InputQueue.md:82, 94, 203-213; #2103 docs/design/plugins/InputMethods.md:173-174 at 59a77a3; docs/design/contracts/session-access.md:234, 446; crates/dim-agent-capabilities/src/input_queue.rs:333-336 and methods.rs:146 at decc589.
Fix: Rename the variant to PublicationUnknown, or add #[serde(rename = "publication_unknown")]. Keep one name.
P2-5. ContextCompaction section 15 still describes the old projection handoff and Usage save, and no owner supersedes it
Problem: Section 15's Request-local projection handoff still says Loop passes the projection before publishing context/prepare, ContextPreparation retains at most one pending projection bound to the original request object, the value is not serialized, and Usage computes and saves contributions when the final request keeps the original cutoff (ContextCompaction.md:2125-2141). The owner contracts say the projection crosses once as a value in prepare (ContextPreparation.md:12, 99, 103), the crate-private slot is removed (ContextPreparation.md:162), estimate does not take a StreamedContext (ContextUsage.md:144), and only confirm saves (ContextUsage.md:70-72, 93). ContextPreparation's Supersedes list omits section 15 (ContextPreparation.md:129-134), and ContextUsage's Supersedes omits it too (ContextUsage.md:103-106).
Failure scenario: An implementer builds the pending projection slot and a Usage save without confirm, while the owner contracts remove the slot and require confirm. The projection gets two handovers, and contributions can be written twice or never.
Evidence: docs/design/plugins/ContextCompaction.md:2125-2141; docs/design/plugins/ContextPreparation.md:12, 99, 103, 129-134, 162; docs/design/plugins/ContextUsage.md:70-72, 93, 103-106, 144.
Fix: Add section 15's Request-local projection handoff subsection to the Supersedes lists, or rewrite it to the value handover and the estimate/confirm pair.
P2-6. InputQueue.submit has no publication_unknown that #2097's EventHub requires
Problem: #2097 at ed43cd9 writes EventHub's guide through line_owner::<InputQueue>(line)?.submit (EventHub.md:199) and its error table and requirement say the owner's submit answers publication_unknown when the guide committed but its publication is unconfirmed (EventHub.md:141, 220). #2102's submit errors are only invalid, line_ended, cancelled and closed (InputQueue.md:81), and its flow answers after the append, not after publication (InputQueue.md:104). origin/main's sessions.input waits for publication (crates/dim-app-server/src/agents/sessions.rs:529, 562-568), so the owner submit is the path that lacks the signal.
Failure scenario: EventHub cannot distinguish a committed but unpublished guide from a failed or delayed one. It either stores the subscription and replies its id while the guide may never publish, or treats a storage failure as a normal receipt. The two target contracts cannot both land.
Evidence: #2097 docs/design/plugins/EventHub.md:141, 199, 220 at ed43cd9; docs/design/plugins/InputQueue.md:81, 104; crates/dim-app-server/src/agents/sessions.rs:529, 562-568 at decc589.
Fix: Either add publication_unknown to submit and state the publication wait, or state that submit returns at commit and change #2097 to confirm publication separately.
ADR 027 citations
The seven changed citations (ContextPreparation.md:174, ContextUsage.md:145, InputQueue.md:155, Loop.md:147, ModelProvider.md:134, PromptAdoption.md:161, WaitBranch.md:122) cite ADR 027 D1 for the caller-to-owner route and #2127 for the tracked mechanism. ADR 027 D1 (docs/adr/027-cross-scope-access-by-id.md:22-26 at decc589) owns the by-id access rule, and D2 (28-33) owns runtime routing and instance-key non-disclosure. None of the changed sentences restates D2, so no citation regression was found. The three sentences that previously said "except registration points and lifecycle services" now leave D3 to the linked ADR; the calls they describe are data-face operations, so no concrete failure follows. If the author wants the caveat back, cite D3.
Verification
node scripts/adr-check.mjs --base 5a279d69passes with 19 changed files.- The link and anchor check over the 19 changed files reports two pre-existing problems: ContextCompaction.md:528 to model-configuration.md#model-parameters, and timeline-branches.md:576 to appserver/session-deletion-and-fork.md#62-why-main-only. Both are unchanged from 5a279d6.
- CI:
ci-okpassed and the other jobs were skipped (docs only).mergeStateStatusis BLOCKED withreviewDecisionCHANGES_REQUESTED. No code tests were run. - All 60 review comments are from yyhhyyyyyy; there are no other-author review threads.
- Unverified: #2100, #2103 and #2093 are target contracts, so no origin/main code exists for
release,retain_onlyordeclarations; the PR body's temporary-crate compile claim was not reproduced, and it does not cover #2093's wire type.
| #[error("line ended")] | ||
| LineEnded, | ||
| #[error("publication unconfirmed")] | ||
| Interrupted, |
There was a problem hiding this comment.
Problem: The table and error row now use publication_unknown (InputQueue.md:82, 94), but this binding still declares Interrupted under #[serde(tag = "code", rename_all = "snake_case")], so the owner emits interrupted.
Failure: An implementer following the binding returns a code that #2103 at 59a77a3 (InputMethods.md:173-174) and session-access.md:234 do not declare. The Session entry must invent a mapping, and a client that handles publication_unknown may retry a committed withdrawal.
Evidence: this line; InputQueue.md:82, 94; #2103 InputMethods.md:173-174 at 59a77a3; session-access.md:234; origin/main crates/dim-agent-capabilities/src/input_queue.rs:333-336 returns AgentError::PublicationUnknown and methods.rs:146 emits publication_unknown.
Fix: Rename the variant to PublicationUnknown, or add #[serde(rename = "publication_unknown")].
|
|
||
| | Operation | Intent | Request | Reply | Cancellation | Errors | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `submit` | Admit one input into the line, once per submission id | `{input}` | `{inputId, sequence}`; a repeated submission id answers the committed input | The caller cancels before the append; nothing is written | `invalid` (the input fails its own shape or scope), `line_ended` (the line has ended), `cancelled`, `closed` | |
There was a problem hiding this comment.
Problem: submit lists only invalid, line_ended, cancelled and closed, and its flow answers after the append (line 104). #2097 at ed43cd9 has EventHub call line_owner::<InputQueue>(line)?.submit (EventHub.md:199) and requires it to answer publication_unknown when the guide committed but publication is unconfirmed (EventHub.md:141, 220).
Failure: EventHub cannot distinguish a committed but unpublished guide from a failed write. It either stores the subscription while the guide may never publish, or treats a storage failure as a normal receipt. The two target contracts cannot both land.
Evidence: this line; InputQueue.md:104; #2097 EventHub.md:141, 199, 220 at ed43cd9; origin/main crates/dim-app-server/src/agents/sessions.rs:529, 562-568 waits for publication.
Fix: Add publication_unknown to submit and state the publication wait, or state that submit returns at commit and change #2097 to confirm publication separately.
|
Closing as part of abandoning the owner-split experiment. |
Target contracts for the branch turn chain (#2027), following the owner-redesign template in #2029 and the cross-cutting decisions in #2015.
Owners: Loop, ContextPreparation, ContextUsage, ModelProvider, Prompt adoption, PromptSourcesBranch, InputQueue, WaitBranch.
The delivery part — deletion list, caller migration, implementation task and acceptance — is the delivery comment on #2027.
Refs #2027
Refs #2015
Dependencies and merge order: #2029 (§7) → #2080 → #2091/#2092/#2093 (ContextProjection, ContextFacts, SummaryStrategy, RequestSettings) → #2100 (ToolBinding) and #2103 (PromptGuide, PromptSources, InputMethods, Wait). Links to files added by those PRs use the PR URL and say "target"; shared files touched here change only this owner's rows. After the merge order is fixed, rebase onto the owners' latest heads and re-check the names.
The binding appendix compiles in a temporary crate (workspace
dim-agent-typesanddim-agent-runtimeplus rutis 0.23) withcargo check; the crate is not committed.Merge order
#2029 → #2080 → #2091/#2092/#2093 → #2094 → #2096 → the rest.
Sibling heads this change is aligned with: #2091
f7425d55c, #2092d96802349, #2100437266bff, #210359a77a3d1. A paragraph that depends on a sibling names that PR; its head is the one above.