Repository navigation
Conversation
|
评审(head
|
|
已按评审修改,head
|
|
复核(head
|
|
已按评审修改,head
|
|
已按 A–G 自查修改,head
|
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: target contracts for the Session registries and tools board (#2026), part of the docs series under design rules section 7 (refs #2026 and #2015). The PR rewrites 12 plugin design pages, adjusts session-boundary, tool-contributions and service-faces, and removes the superseded Attachments design sections.
Verdict: REQUEST_CHANGES
P1
P1.1 shell.run loses client-visible reply fields
Problem: the operation table (docs/design/plugins/ShellInput.md:62) and the appendix RunReply (:155-161) define only {runId, status, output, truncated, durationMs}. The current implementation also returns optional exitCode, signal, reason and recorded (crates/dim-agent-capabilities/src/shell_input.rs:377-399), and the page says the shell.* shapes stay (ShellInput.md:129).
Failure scenario: a client following the contract cannot show an exit code or signal, and cannot learn whether a record run wrote its input and at which sequence. A Rust binding generated from the appendix cannot deserialize the server's reply into RunReply without silently dropping those fields. The verification (:95) also drops them, so the claimed unchanged client shape is not verified.
Evidence: crates/dim-agent-capabilities/src/shell_input.rs:383-399 sets exitCode, signal, reason and recorded; no other page removes them.
Fix: add the four optional fields to the table, RunReply and the verification, with skip_serializing_if on the optional ones, and keep the existing client names.
P1.2 session.question.pending changes an existing client shape
Problem: docs/design/plugins/Questions.md:65 gives the request as {sessionId, branchId} and the reply as {requests}. The implementation reads {sessionId, branchId, through?, after?} and answers {branchId, through, batches, next} (crates/dim-agent-questions/src/pending.rs:9-17,163), and the page's own fixed-cut paragraph (Questions.md:165) describes batches, cutoff and continuation. The appendix uses undefined PendingQuestion (:151), and the error kinds invalid and not_pending (:64) do not match the wire codes invalid_params and question_not_pending (crates/dim-agent-questions/src/lib.rs:416-434).
Failure scenario: a client implementing the new contract cannot parse the server reply, cannot ask for a continuation page, and cannot distinguish an invalid answer from a settled question. The page says the methods stay the client's (:125), so this is a regression in a user-visible contract.
Evidence: pending.rs:11-17 and :163; lib.rs:429 uses question_not_pending; params() maps malformed input to invalid_params.
Fix: restore the current request and reply shapes, define or import the batch type, and use the existing wire codes. If the shape intentionally changes, list it as a client-visible change and update the clients in the same series.
P2
P2.1 InputMethods contradicts Hooks A.6.2 and does not supersede it
Problem: three statements in docs/design/plugins/InputMethods.md conflict with the accepted Hooks contract. Line 107 says later checks still run after a block, while Hooks A.6.2 says the first block ends the call and SubmitChecks::check returns at the first Block (docs/design/plugins/Hooks.md:514; crates/dim-agent-capabilities/src/input_queue.rs:637-642). Line 146 supersedes only session boundary A.1 and input-state-read, not Hooks A.6.2, although the page changes the registration from Arc<dyn CheckSubmission> to a direct callback and the reply from {decision, blocks, warnings} to Checked::{Proceed, Blocked}. Line 92 describes interrupted as a committed withdrawal with unconfirmed publication, while the code answers publication_unknown for that path (input_queue.rs:768-775) and uses interrupted only when the call is cancelled.
Failure scenario: an implementation following the new page runs later hooks after a refusal, adding side effects the accepted contract forbids, and returns no warnings although the page promises them. A client cannot tell a committed but unpublished withdrawal from an interrupted call. A foreign check written against Hooks A.6.2 no longer compiles against the new registration shape.
Evidence: Hooks.md:514; input_queue.rs:637-642 and :768-775; InputMethods.md:92,107,146.
Fix: align the page with Hooks A.6.2, or add Hooks A.6.2 to Supersedes and update that section in this PR. Add publication_unknown to the errors and describe interrupted as operation interruption only.
P2.2 session-boundary keeps both the old and the new interface
Problem: the added note at docs/design/contracts/session-boundary.md:205 says the A.1 registration and dispatch shapes are the SessionMethods contract's, but the retained table at :211-212 still documents register(namespace, MethodDecl[], call) and a call handler with progress returning MethodReply. The added note at :391 says ToolContribution, ToolHandler, ToolSourceSet and register(declaration, execute, options?) no longer cross the owner's boundary, but the retained A.5 prose at :395 still tells ToolBinding to use Prompt::adopt_tools, bind_current and a registry snapshot, the table at :399 still lists toolRegistry.register with ToolDeclaration, execute, and Appendix F at :641 states that those are the native types and documents register(declaration, execute, options?).
Failure scenario: an implementer reading the appendix cannot tell which interface is current; the same document says the old shapes are gone and then specifies them. The stale A.5 route also contradicts the new ToolBinding contract in #2100, which removes adopt_tools, bind_current and the snapshot path.
Evidence: session-boundary.md:205,211-212,391,395,399,641.
Fix: rewrite or remove the retained A.1 and A.5 paragraphs, tables and Appendix F text in this PR, or drop the added notes. Keep one interface per document.
P2.3 The PR breaks 33 cross-references to anchors it removes
Problem: rewriting the six design pages removed heading anchors that 33 links in the docs tree still use. Two of the broken links are inside changed files: docs/architecture/rust-agent/tool-contributions.md:91 and docs/design/contracts/session-boundary.md:283.
Failure scenario: a reader of a core contract clicks a link and lands at the top of a rewritten page with no matching section; the normative text the link promised is gone.
Evidence, 33 links:
- Attachments.md removed
#file-import-and-read,#a3-cli-contract,#a1-image-handling-cli-checks-and-modelprovider,#a2-attachmentput:docs/design/web-workspace.md:1200,docs/design/cli-attachment-input.md:9,290,docs/design/research/multimodal-input-budget.md:11,docs/design/appserver/session-files.md:449,docs/architecture/rust-agent/plugins/ModelProvider.md:14,docs/architecture/rust-agent/plugins/WorkspaceTools.md:236. - PromptSources.md removed
#3-the-agent-prompt-language-state-source,#13-content,#2-policy-at-the-factory-configuration:docs/design/clients.md:301,346,docs/design/model-prompts.md:176,docs/design/contracts/session-access.md:331,docs/design/contracts/session-boundary.md:283,docs/design/appserver/prompt-overrides.md:5,docs/architecture/rust-agent/plugins/PromptSources.md:113. - Questions.md removed
#21-the-claim-before-the-fact,#35-pending-question-read,#2-data-and-state,#9-requirements-raised-to-mechanism-owners,#a1-tool-ask_user:docs/design/clients.md:176,docs/design/overview.md:375,559,docs/design/web-tui-parity.md:38,docs/architecture/rust-agent/tool-contributions.md:91,docs/architecture/rust-agent/plugins/ToolRegistry.md:44,docs/architecture/rust-agent/plugins/Loop.md:120,docs/architecture/rust-agent/plugins/ToolExecution.md:108,docs/architecture/rust-agent/plugins/Questions.md:88,124. - Recall.md removed
#14-acceptance-flow-tests,#1-problem-and-scope,#4-handles-time-and-event-id:docs/design/compaction-quality.md:79,84,107,docs/design/plugins/ContextCompaction.md:1078. - ShellInput.md removed
#a5-changes-to-other-plugins,#a2-execution,#a1-methods:docs/design/appserver/idle-unload.md:13,136,529,docs/design/host-platform-isolation-spike.md:244,docs/design/research/model-retry-recovery.md:182.
Fix: update every referrer to the new section, or keep stable heading anchors on the rewritten pages. The two changed-file links must be fixed in this PR.
P2.4 Code and test comments cite removed section numbers
Problem: the rewritten pages drop their numbered sections and appendices, but code and tests still cite those numbers. Examples: crates/dim-agent-capabilities/tests/recall_flow.rs:1,11,207,267,333,434,523,690,762,892,927,1006,1461,1496 cites Recall §14 and §3, crates/dim-app-server/tests/transport_flow/recall.rs:3 cites §13 and §14, and crates/dim-agent-capabilities/src/recall.rs:2 cites §3 and §4. crates/dim-agent-capabilities/src/prompt_sources.rs:71,74,136,138,363,574, crates/dim-agent-runtime/src/config.rs:95,97 and crates/dim-app-server/tests/session_language_flow.rs:1,5 cite PromptSources §2 and §3. crates/dimcode/tests/cli_flow/prompt_suggestion.rs:4 cites PromptSuggestion §11, and crates/dim-agent-capabilities/src/prompt_suggestion.rs:433,808,916,1128,1179,1260 cites §9 and §15. crates/dim-agent-capabilities/src/shell_input.rs:158,225,424,545 cites ShellInput A.1, A.3, §5.2, §9 and §15; crates/dim-agent-attachments/src/lib.rs:65 cites Attachments A.2; crates/dim-agent-capabilities/src/workspace_tools/files.rs:194 cites WorkspaceTools §7.2.
Failure scenario: a maintainer follows a test or code comment to the design and finds no such section, so the rationale for the test is no longer readable. Tests that name an acceptance flow by section cannot be traced to the contract after the rewrite.
Evidence: the listed lines, plus the removed-section lists in the pages.
Fix: update the references to the new section titles and anchors, or keep the old numbered headings as stable anchors during the rewrite. This is a docs-only PR, so the comment updates belong here or in an explicitly tracked follow-up.
P2.5 Binding appendices and examples do not compile
Problem: several appendix snippets use types from the wrong crate or undefined names, and examples do not match the signatures beside them.
Failure scenario: the appendix is the implementation and cross-language binding source; copied code fails to compile, and the self-check claim that examples match signatures does not hold.
Evidence:
PromptSources.md:192importsPromptEntryandPromptScopefromdim_agent_runtime; both are indim_agent_typesand the runtime re-exports onlyPermissionPolicyandPermissionPreset.PromptSources.md:221andToolRegistry.md:231callremote.message()onrutis_bridge::session::Error; that type hascode(),data()and public variants withmessagefields, but nomessage()method.ToolRegistry.md:201andWorkspaceTools.md:163importToolExecutionContextfromdim_agent_types; it is defined incrates/dim-agent-capabilities/src/host.rs.WorkspaceTools.md:196also returnsToolResultfromexecute, while the operation table at:77listsinvalid,cancelledandclosederrors.SessionMethods.md:174importsMethodCall,MethodDeclandMethodReplyfromdim_agent_types. The first two are incrates/dim-agent-capabilities/src/methods.rs;MethodReplyis not defined in the tree, and the native handler returnsResult<Value, RpcError>. The caller example at:58-61also matches the unit variantsReloading,UnavailableandInterruptedwith{ .. }and callsRpcError::unavailable(), which does not exist.InputMethods.md:155importsSubmitCheckReply,SubmitCheckRequestandSubmitEntryfromdim_agent_types; they are incrates/dim-agent-capabilities/src/input_queue.rs.Questions.md:35-39registers with aRegisterToolstruct and an optionalclaim, while the ToolRegistry contract atToolRegistry.md:279-285takescaller, declaration, execute, claimwith a mandatory claim.Questions.md:129names aClaimFntype that no document or crate defines.WorkspaceTools.md:41-42awaits the synchronousdeclarations()and passes aHostToolstruct toregister, and:48-50usesExecuteTool,ResolveWriteandOrderCallrequest structs, while the appendix at:194-205and the ToolRegistry contract use positional arguments.
Fix: correct the imports, define or remove MethodReply, PendingQuestion and ClaimFn, use existing constructors, and make each example use the owner's exact signature.
P2.6 Sibling contracts disagree on shared interfaces
Problem: the new pages call operations whose shapes are defined differently in the sibling PRs they depend on.
Failure scenario: the owner contracts cannot be implemented together; whichever side lands first forces the other to rework its interface.
Evidence:
ToolRegistry.md:297-302definesrun(adoption, call, context, cancelled),resolve_write(adoption, call, cancelled), a synchronousdeclarations()returningResult<Declarations, ToolError>and a claim request without a context. The ToolBinding contract in #2100 callsregistry.run(RunCall { adoption, call, caller }),registry.resolve_write(ResolveWrite { adoption, call }, cancelled)andregistry.declarations().await?, and itsclaimrequest carriescontext.PromptSources.md:51,55,66usesConfigureRequest::Initial,ConfigureRequest::LoadedandLanguageUpdate; the Prompt contract in #2102 definesConfigureRequest { sources, model, tools }as a struct and returnsConfigureOutcome.PromptSources.md:63callsstore.set_session_language, while #2091 names the SessionStore operationsetLanguageand this page's own requirement at:178sayssetLanguage;:64passesSetLanguage { language }while the appendix at:260definesset(Option<ReplyLanguage>).- The ToolBinding side in #2100 also uses the struct request names above, so the registry and ToolBinding cannot both be canonical.
Fix: choose one shape for each shared operation and update the owning sibling PRs. #2100 owns ToolBinding, #2102 owns Prompt adoption and #2091 owns SessionStore; note the forward dependency in the page until those land.
P2.7 The claim operation cannot supply the context its callback needs
Problem: ToolRegistry.md:284 requires every registered tool's claim callback to receive a ToolExecutionContext, but the claim operation at :106,300 takes only {request, calls} and has no way to pass a context. :143 also says host tools are read from the host owner, but register requires a claim callback for every tool, and no host-tool claim is described.
Failure scenario: toolRegistry.claim cannot call a contributor's claim callback with the line, request and call key that the callback uses to insert its pending entry. ToolBinding's claim request in #2100 carries context, so one of the two contracts must change. Host tools cannot be registered at all unless the implementation invents an undocumented no-op claim.
Evidence: ToolRegistry.md:106,143,284,300; the claim callback signature and Questions' key construction (docs/design/plugins/Questions.md:32-39).
Fix: add context to the claim request and the Rust signature, and state how host tools claim, for example a documented no-op claim or a claim-less registration path.
P2.8 Client-visible wire codes are missing or renamed
Problem: several new error tables use kind names that do not match the wire codes the current clients read, and do not give the mapping.
Failure scenario: clients that branch on appError lose their handling for real failures, or treat a committed operation as uncommitted.
Evidence:
PromptGuide.md:65,75,152usesinvalid, while the existing Prompt contract definesinvalid_entry(docs/design/plugins/Prompt.md:52) and also producesno_caller_row(:54). The page supersedes only Prompt §4 (PromptGuide.md:129), so §2 still applies.ShellInput.md:72,77folds a reused run id intoinvalidand omitsduplicate_runandsession_closedfrom the wire list. The implementation answersshell_busy,duplicate_run,shell_unavailable,spawn_failed,invalid_params,service_reloading,operation_interruptedandsession_closed(crates/dim-agent-capabilities/src/shell_input.rs:192-199andRpcError::closed).Attachments.md:72,76lists five kinds and five codes without pairing them. The implementation mapsnot_foundtosession_closed, mapsinvalidto eitherinvalid_paramsorattachment_invaliddepending on the cause, and can returnnode_unavailable, which the list omits (crates/dim-agent-attachments/src/lib.rs:65-74and the empty-text path at:229-236).WorkspaceTools.md:84-85usesmissingandunavailableforsession.exec.outputandsession.exec.output.page, while the existing method returnsexec_task_unknownandexec_output_unavailable(crates/dim-agent-capabilities/src/workspace_tools/mod.rs:529,534).
Fix: give an explicit kind to wire-code mapping for each table, or use the wire codes as the kinds, and keep every code the implementation can return.
P2.9 Requirement records and catalog rows are not synced
Problem: two pages that move a branch read by line id record no requirement, and the catalog still carries rows the new contracts remove.
Failure scenario: the mechanism owners for (session, line) access (#2024 and #2025) do not see the need from Recall and Questions, so the implementation cannot reach the reads the pages specify. Readers see two catalogs that disagree about which faces exist.
Evidence:
Recall.md:96,105,109says the implementation replaces theTreeCommands/Branchlookup withtimelineTree.readand calls that the only mechanism requirement, but the Requirements section saysNone.Questions.md:121also saysNone, while:65,165require a fixed-cut pending read and the implementation reads the line throughTreeCommands(crates/dim-agent-questions/src/pending.rs:19-40). An equivalent need is raised explicitly byInputMethods.md:142.docs/design/contracts/runtime-owner-operations.md:10still listsinitialPromptConfiguration.get,promptHost.load,toolSourcesView.get/observeand the oldtoolRegistry.register, althoughPromptSources.md:183andToolRegistry.md:192supersede them.docs/design/service-faces.md:102keeps atoolSourcesViewrow althoughToolRegistry.md:175says the name leaves the catalog, and there is nopromptSourcesrow in §4.8 althoughPromptSources.md:184says it supersedes that row. The Session branch row is still namedpromptSourcesBranch.
Fix: add the line-access requirements to Recall and Questions, and either update the catalog rows in this PR or state precisely where the superseded rows live and which PR changes them.
P3
P3.1 The suggestion reason list omits accepted
Problem: docs/design/plugins/PromptSuggestion.md:60 lists the stable reasons but omits accepted, while :77 says respond emits cleared with accepted or dismissed and the implementation emits reason: "accepted" on accept (crates/dim-agent-capabilities/src/prompt_suggestion.rs:1330-1331).
Failure scenario: a client validating cleared reasons against the list treats the accept notice as unknown.
Fix: add accepted to the reason list.
P3.2 Some operations say Errors: None but return a Result
Problem: PromptSources.md:86-88 gives initial, get and set no errors, while the appendix returns Result<InitialReply, SourceError> for initial (:254). ToolRegistry.md:108-109 gives declarations and sources no errors, while the appendix returns Result<Declarations, ToolError> and Result<SourcesReply, ToolError> (:302-303).
Failure scenario: an implementer cannot tell whether closed can be returned during session close; the binding has to invent an error path.
Fix: list the reachable errors or make the signatures non-Result where the operation cannot fail.
P3.3 README assigns guideEntries to two owners
Problem: docs/design/plugins/README.md:17 adds PromptGuide with guideEntries, while the existing Prompt row at :30 still lists guideEntries as Prompt's Session part.
Failure scenario: a reader cannot tell which part owns the guide table, which the PromptGuide page says is separate from the branch publisher.
Fix: update the Prompt row to the branch publisher only, or state the split explicitly.
P3.4 The Wait reload settlement text is not the current result
Problem: docs/design/plugins/Wait.md:40-41 maps WaitError::Closed to ToolResult::error("The wait was cancelled: capability reloading."), while the current tool returns a cancelled call with the text capability reloading (crates/dim-agent-capabilities/src/wait.rs:440-443) and the WaitBranch contract in #2102 says the tool writes the reload settlement and the turn fails.
Failure scenario: the page calls the result texts protocol (:79), so a client or test matching the text breaks on a reload.
Fix: use the existing settlement text and state whether it is a tool result or a cancelled call.
Self-check and error-tag commit
The self-check comment's claims do not all hold against this head.
- Claim A (appendices compile and examples match signatures) is false: see P2.5.
- Claim B (error tables complete) is false: see P1.2, P2.1 and P2.8.
- Claim C (only the owner's existing paragraphs synced) is partly false:
runtime-owner-operations.md:10and theservice-faces.mdrows still describe the superseded faces, and the retained session-boundary A.1/A.5 text is not synced (P2.2, P2.9). - Claim D (client-visible shapes restored) is false for
shell.run(P1.1) and incomplete for Attachments (P2.8). - Claim F (cross-PR and relative links fixed, §7 links to #2029) is false: this PR breaks 33 links (P2.3), and no changed file links #2029 or
principles.md#7; every Rule check row uses a bare§7. - Claim G (all Session parts use
line_owner::<T>(line)for branch data faces) is partly false: Recall and Questions still need a line read but record no requirement and do not name the access (P2.9).
The error-tag commit's narrow claim holds: moving the callback error under cause removes the duplicate top-level code key, and the From<CallError> conversions intend to preserve the callback's code and message. The Rust snippets do not compile because of remote.message(), which is reported in P2.5.
Verified against the tree
node scripts/adr-check.mjs --base 1bc7d67d7e3b357a64fd82c2589f57e4cb4b4becpasses for all 16 changed files.- The Attachment content limits, the
attachment.put/import/readrequest and reply fields, and the Attachments implementation path match the code. - The Wait tool's request, result reasons and refusal text match the WaitBranch contract in #2102 and
crates/dim-agent-capabilities/src/wait.rs, apart from the reload text in P3.4. - The
session.exec.pendingandsession.exec.finishedshapes match the background task list contract, andsession.input.pendingmatches the current input-state read shape. - The
sessionLanguagecatalog change and the new README rows for the six Session parts are consistent with the code paths they describe; the remaining catalog row issues are in P2.9.
| ## Exceptions with reasons | ||
|
|
||
| - A check that fails counts as proceed: an input check is an opinion, and a failing check must not block the operator's input. | ||
| - The first block in name order is the answer; later checks still run for their warnings: the caller reads one refusal and every warning, as the operator-entry flow already does. |
There was a problem hiding this comment.
Problem: this says later checks still run after a block. SubmitChecks::check returns at the first Block (crates/dim-agent-capabilities/src/input_queue.rs:637-642), and Hooks A.6.2 says the first block ends the call and discards the warnings collected so far (docs/design/plugins/Hooks.md:514). Failure: an implementation following this page runs later hooks after a refusal, adding side effects the accepted contract forbids, and promises warnings the table never returns. Fix: say the first block ends the call, and add Hooks A.6.2 to Supersedes or keep its shape.
There was a problem hiding this comment.
Partially fixed in 734d364. InputMethods.md:113 now says the first block ends the call and later checks do not run, and :147 adds Hooks A.6.2 to Supersedes. This thread's line 107 still says later checks run for their warnings and every warning is returned, which contradicts both line 113 and Hooks A.6.2 (docs/design/plugins/Hooks.md:514). Delete the second clause at line 107.
There was a problem hiding this comment.
Not fixed in 59a77a3. InputMethods.md:107 still says later checks run for their warnings and every warning is returned, while line 113 and Hooks A.6.2 stop at the first block. See the new inline comment and F4 in the review.
|
|
||
| ## Supersedes | ||
|
|
||
| - [session boundary A.1](../contracts/session-boundary.md): the `session.input.withdraw` and `session.input.pending` shapes; the client shapes stay, and the method table registration is `sessionMethods.register`. |
There was a problem hiding this comment.
Problem: this Supersedes list omits Hooks A.6.2, although the page changes the submit-check registration from Arc<dyn CheckSubmission> to a direct callback and the reply from {decision, blocks, warnings} to Checked::{Proceed, Blocked}. Failure: Hooks.md still tells contributors to register a CheckSubmission and return A.6.2's shapes, so one operation has two contracts. Fix: add Hooks A.6.2 and update that section in this PR, or keep its registration and reply shapes.
There was a problem hiding this comment.
Fixed in 734d364. Supersedes now includes Hooks A.6.2 with the direct-callback registration (docs/design/plugins/InputMethods.md:147). The remaining first-block behavior is tracked in the other thread.
|
|
||
| ```rust | ||
| use crate::host::CancelledFn; | ||
| use dim_agent_types::{InputMode, SubmitCheckReply, SubmitCheckRequest, SubmitEntry, SubmitWarning, UserInput}; |
There was a problem hiding this comment.
Problem: SubmitCheckReply, SubmitCheckRequest and SubmitEntry are defined in crates/dim-agent-capabilities/src/input_queue.rs, not in dim_agent_types; only SubmitWarning lives there. Failure: the appendix does not compile. Fix: import the three types from crate::input_queue and keep InputMode, SubmitWarning and UserInput from dim_agent_types.
There was a problem hiding this comment.
Fixed in 734d364. SubmitCheckReply, SubmitCheckRequest and SubmitEntry now come from crate::input_queue, and SubmitWarning from dim_agent_types (docs/design/plugins/InputMethods.md:156-157).
| | `invalid` | The check name is empty, the entry/mode pair is unknown, or the request is malformed | | ||
| | `cancelled` | The entry's call was interrupted while a check ran; write nothing | | ||
| | `input_blocked` | A check refused the input; the message is the caller's error | | ||
| | `interrupted` | The withdrawal was admitted and its publication not confirmed; read the line's state before retrying | |
There was a problem hiding this comment.
Problem: interrupted is described as an admitted withdrawal whose publication is unconfirmed, but the implementation returns publication_unknown for that path (crates/dim-agent-capabilities/src/input_queue.rs:768-775) and uses interrupted only when the call's token fires. Failure: the real publication_unknown code is missing from the error table, so a client cannot tell a committed but unpublished withdrawal from an interrupted one. Fix: add publication_unknown for the unconfirmed publication and describe interrupted as operation interruption only.
There was a problem hiding this comment.
Partially fixed in 734d364. The table now has publication_unknown and interrupted is described as a call interruption (InputMethods.md:79,92), but the appendix InputError at :164-177 still has Interrupted with the old committed-but-unpublished meaning and has no PublicationUnknown. The enum also serializes Blocked as blocked where the page promises input_blocked. A generated client still reads the old codes; see the new inline finding.
There was a problem hiding this comment.
Fixed in 59a77a3. InputBlocked and PublicationUnknown are in the appendix with their wire codes, and Checked has its derive back (InputMethods.md:164-197).
| /// The file-encoding guidance the environment source carries. | ||
| pub file_encoding_guidance: Option<Arc<str>>, | ||
| use crate::host::CancelledFn; | ||
| use dim_agent_runtime::{ConfigureUpdate, PromptEntry, PromptScope, PromptSourceTarget, ReplyLanguage}; |
There was a problem hiding this comment.
Problem: PromptEntry and PromptScope are defined in dim_agent_types; dim_agent_runtime re-exports only PermissionPolicy and PermissionPreset. Failure: the appendix does not compile. Fix: import them from dim_agent_types and keep ConfigureUpdate, PromptSourceTarget and ReplyLanguage from the runtime.
There was a problem hiding this comment.
Fixed in 734d364. PromptEntry and PromptScope now come from dim_agent_types (docs/design/plugins/PromptSources.md:202).
|
|
||
| ### A.5 Tool contribution | ||
|
|
||
| The tool surface is the [ToolRegistry](../plugins/ToolRegistry.md#own-contract) contract's; `ToolContribution`, `ToolHandler`, `ToolSourceSet` and the `register(declaration, execute, options?)` binding no longer cross the owner's boundary. This appendix keeps the tool-effect behavior (A.6) that the redesign does not change. |
There was a problem hiding this comment.
Problem: this note says ToolContribution, ToolHandler, ToolSourceSet and register(declaration, execute, options?) no longer cross, but the retained A.5 prose at line 395 still tells ToolBinding to use Prompt::adopt_tools, bind_current and a registry snapshot, the table at line 399 still lists toolRegistry.register with ToolDeclaration, execute, and Appendix F at line 641 states that these are the native types and documents the options argument. Failure: the same contract specifies and removes the same interface, and the stale route contradicts ToolBinding's contract in #2100. Fix: rewrite those paragraphs, the table and Appendix F in this PR, or drop this note.
There was a problem hiding this comment.
Fixed in 734d364. A.5 now points at the ToolRegistry contract and the old table, prose and Appendix F paragraph are removed (docs/design/contracts/session-boundary.md:389-393).
|
|
||
| ### A.1 Method contributions | ||
|
|
||
| The table's registration and dispatch shapes are the [SessionMethods](../plugins/SessionMethods.md#own-contract) contract's; this appendix keeps the client error, interruption and routing behavior that the redesign does not change. |
There was a problem hiding this comment.
Problem: this note says the A.1 registration and dispatch shapes are SessionMethods' contract's, but the retained table at lines 211-212 still documents register(namespace, MethodDecl[], call) and a handler with progress returning MethodReply, which the SessionMethods page does not define (it uses caller: &Ctx, namespace, declarations, call and a two-argument callback). Failure: an implementer cannot tell which shape wins. Fix: update the A.1 table and the surrounding text to the SessionMethods shapes, or remove the note.
There was a problem hiding this comment.
Partially fixed in 734d364. The register row now includes caller, but the call row at session-boundary.md:212 still passes cancelled and returns MethodReply data, and the text block at :222-230 still defines MethodCall with origin and MethodReply with handedOff. SessionMethods' appendix (:182-212) and #2095's ManagementMethods define different shapes. The A.1 text and the two tables must be reduced to one shape; see the new inline comment.
There was a problem hiding this comment.
Partially fixed in 59a77a3. A.1's call row now passes progress, but the shape block at session-boundary.md:223-230 still defines MethodCall with callId and MethodReply with handedOff, unlike SessionMethods.md:181-207. See F1 and the new inline comment.
|
|
||
| | Operation | Intent | Request | Reply | Cancellation | Errors | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `register` | Publish an entry for the calling row's lifetime | `{scope, entry}` | `{}` | None | `invalid`, `duplicate_marker`, `too_large`, `closed` | |
There was a problem hiding this comment.
Problem: the error kind invalid conflicts with the existing Prompt contract, which defines invalid_entry and no_caller_row for this registration (docs/design/plugins/Prompt.md:52,54). The page supersedes only Prompt §4 (line 129), so §2 remains in force; the appendix also uses invalid at line 152. Failure: a foreign caller or bridge maps the same failure to different codes, and the no_caller_row path has no documented code. Fix: use the §2 codes or add §2 to Supersedes and update it in this PR.
There was a problem hiding this comment.
Fixed in 734d364. The kinds are now invalid_entry and no_caller_row in the table and appendix (docs/design/plugins/PromptGuide.md:65,75-76,169-171), matching docs/design/plugins/Prompt.md:52-54.
|
|
||
| ```rust | ||
| use crate::host::CancelledFn; | ||
| use dim_agent_types::{MethodCall, MethodDecl, MethodReply}; |
There was a problem hiding this comment.
Problem: MethodCall and MethodDecl are defined in crates/dim-agent-capabilities/src/methods.rs, not in dim_agent_types, and MethodReply is not defined anywhere in the tree; the native handler returns Result<Value, RpcError>. The caller example at lines 58-61 also matches the unit variants Reloading, Unavailable and Interrupted with { .. } and calls RpcError::unavailable(), which does not exist. Failure: the appendix and its example do not compile. Fix: import from crate::methods, define MethodReply or use the wire reply type, and correct the patterns and error constructors.
There was a problem hiding this comment.
Partially fixed in 734d364. The imports and RpcError constructors are fixed, but MethodReply::Error { code: i32, app_error } cannot be built from MethodCallbackError { code: String, message } (SessionMethods.md:194,209-211), and MethodCall is defined at :182 while :170 says it is the capabilities crate's type. The shape also conflicts with #2095 and A.1; see the new inline comment.
There was a problem hiding this comment.
Partially fixed in 59a77a3. CallerRef is no longer declared here, but it is imported from crate::methods and Appendix F does not define it; MethodReply and MethodError still differ from A.1. See F1.
| local path through `sessionFiles.import`. `image` defaults to false. `name` | ||
| defaults to `image` for images and `attachment` for ordinary files, and follows | ||
| the Session files name rule. | ||
| The Session method entry maps these kinds to the client codes `invalid_params`, `attachment_invalid`, `attachment_too_large`, `session_closed`, `storage_failed`; a cancelled call answers `service_reloading`, and a WebEntry transport failure keeps `node_unavailable`. |
There was a problem hiding this comment.
Problem: the five kinds are not paired with the five client codes, and the mapping is not one to one. not_found maps to session_closed (crates/dim-agent-attachments/src/lib.rs:68), invalid maps to either invalid_params or attachment_invalid depending on the cause (:229-236 and RpcError::invalid), and node_unavailable can be returned but is missing from the list (:72). Failure: a client or test cannot derive which code a kind produces, and an inactive node's error is undocumented. Fix: give the explicit mapping and include node_unavailable and the two invalid outcomes.
There was a problem hiding this comment.
Fixed in 734d364. The mapping now pairs each kind with its client code and includes node_unavailable and both invalid outcomes (docs/design/plugins/Attachments.md:76), matching crates/dim-agent-attachments/src/lib.rs:65-74,229-236.
…adoption interface The five owner documents keep the new contract and the still-valid client and fork behavior; each has one Rule check. ToolRegistry keeps the Session's resolvable generations; ToolBinding calls adopt, release, claim and release_claims and settles them from the request's terminal facts.
52d078a to
734d364
Compare
|
已按评审与自查标准修改,head 评审逐条
7 条自查
绑定编译临时 crate( 客户端可见变更无。 |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
PR 2103 review at 734d364
Scope
Target contracts for the Session registries and tools (#2026, refs #2015). The full diff changes 17 files (+2376/-2391): six new pages (InputMethods, PromptGuide, SessionMethods, ToolRegistry, Wait, WorkspaceTools), six rewritten pages (Attachments, PromptSources, PromptSuggestion, Questions, Recall, ShellInput), and the catalog and contract sync in README, runtime-owner-operations, service-faces, session-boundary and tool-contributions. SessionStore and ProgramSlots are not in this diff; SessionStore is #2091's page. Reviewed main...head at 734d364, with 1dd2790..734d364 as the delta.
Verdict
REQUEST_CHANGES.
Round-1 status
Fixed, withdraw these findings:
- P1.1:
shell.runnow documentsexitCode,signal,reasonandrecordedin the table,RunReplyand Verification, and the shapes matchcrates/dim-agent-capabilities/src/shell_input.rs:383-399. Therecordedunion matches the code at:400-410. - P2.3: the 33 anchors resolve. The
Previous sectionsheadings produce the old slugs, and a local link check over docs found no broken link or anchor to a changed page. The two changed-file links,docs/architecture/rust-agent/tool-contributions.md:91anddocs/design/contracts/session-boundary.md:283, resolve. - P2.7:
claimnow takes{request, calls, context}andClaimCallscarries the context; the host-tool no-op claim is documented. - P3.1:
acceptedis in the reason list. - P3.2:
initial,getandsetare non-Result;declarationsnow has an error, although its new async form conflicts with #2100 (P2.6 below). - P3.4: the Wait reload text now matches
crates/dim-agent-capabilities/src/wait.rs:440-443. - The import and constructor inline comments are fixed:
SubmitCheck*fromcrate::input_queue,PromptEntry/PromptScopefromdim_agent_types,ToolExecutionContextfromcrate::host,remote.message()replaced,RpcError::unavailable()replaced,WorkspaceTools.declarationssync,session-boundaryA.5 rewritten,PromptGuidecodes,Attachmentsmapping, Recall requirement.
Partially fixed, see the findings below: P1.2, P2.1, P2.2 (A.5 fixed, A.1 not), P2.4, P2.5, P2.6, P2.8, P2.9, P3.3.
Still open and unchanged: the Recall model-facing input comment (round-1 inline 4666976781) and the ShellInput caller-unload cell (round-1 inline 4666976825).
New in 734d364: the PromptGuide and InputMethods appendices no longer compile; the SessionMethods and PromptSources examples do not match the current heads of #2095 and #2102; the pending reads omit timelineTree; and the Rule check rows cite a section that only exists in unmerged #2029.
P1
P1.1 session.question.pending still cannot be paged (round-1 P1.2, partially fixed)
Problem: The request and reply field names are restored, and PendingQuestionBatch is the right type, but the appendix types after and next as Option<String> (docs/design/plugins/Questions.md:159,168). The read takes after: Option<QueryCursor> and returns the query's next cursor (crates/dim-agent-questions/src/pending.rs:14-18,163), and QueryCursor is an object with binding and keys (crates/dim-agent-runtime/src/timeline_query/properties.rs:331-334). The new table row also has six cells under a five-column header (Questions.md:66): when rendered, the reply lands in Cancellation and the invalid/cancelled errors are dropped.
Failure scenario: A client takes the string in next, passes it back as after, and the server rejects it as invalid_params; the second page cannot load. A reader of the rendered table sees {branchId, through, batches, next} under Cancellation and no error list, so the continuation contract is lost.
Evidence: Questions.md:66,159,168; crates/dim-agent-questions/src/pending.rs:14-18,163; crates/dim-agent-runtime/src/timeline_query/properties.rs:331-334.
Fix: Type both fields as Option<QueryCursor> (or import the cursor type from dim_agent_runtime), make the row five cells, and state the pending read's cancelled wire code (operation_interrupted, pending.rs:24). If the appendix error enum stays, give invalid and cancelled their wire codes or show the conversion.
P2
P2.1 Two appendices do not compile
Problem: Two snippets added in 734d364 are not valid Rust.
docs/design/plugins/PromptGuide.md:149-155: the original derive and#[serde(tag = "code", rename_all = "snake_case")]now attach toGuideListenerErrortogether with a second derive, so the struct gets conflictingDebug/Serialize/Deserialize/Errorimpls and atagattribute on a struct.GuideErrorat:167-178has no derive at all, so its#[error(...)]attributes do not resolve.docs/design/plugins/InputMethods.md:179-185:CheckCallbackErrorhas two derive attributes and two#[serde(rename_all = "camelCase")]attributes.
Failure scenario: cargo check of either appendix fails with conflicting implementations (E0119) and unknown or duplicate attributes. The self-check says the temporary crate compiled; these two snippets as written cannot be part of it.
Evidence: the listed lines, and the parent 1dd2790 where both items were correct or absent.
Fix: restore the first derive and tag to GuideError and keep one derive on GuideListenerError; delete the first derive and serde pair in InputMethods.
P2.2 InputMethods still contradicts Hooks A.6.2 on the first block
Problem: docs/design/plugins/InputMethods.md:107 still says later checks run after the first block and that every warning is returned. Line 113 in the same page says the first block ends the call, later checks do not run, and collected warnings are discarded. Hooks A.6.2 says the same (docs/design/plugins/Hooks.md:514), and the page now lists Hooks A.6.2 in Supersedes (InputMethods.md:147), so the exception bullet is the only outlier.
Failure scenario: An implementation following line 107 runs the remaining hooks after a refusal, adding side effects the accepted contract forbids, and returns warnings the error path never had.
Evidence: InputMethods.md:107,113,147; Hooks.md:514.
Fix: delete the second clause at line 107 or replace it with line 113's rule.
P2.3 InputMethods session.input.pending is not the current shape
Problem: The page says the request, page and reply are unchanged (InputMethods.md:148), but the appendix omits includeBlockPresence and types after and next as Option<String> (InputMethods.md:205-219). The current read accepts after: Option<QueryCursor> and include_block_presence: bool, and returns next: Option<QueryCursor> (crates/dim-agent-capabilities/src/input_queue/pending.rs:14-22,182). docs/design/input-state-read.md:24-28 documents the block-presence extension and its hasRawBlocks reply field.
Failure scenario: A client generated from this page cannot request hasRawBlocks and cannot round-trip the continuation cursor; the server rejects the string cursor. The page also promises a shape that its own PendingInput.hasRawBlocks field suggests but the request cannot select.
Evidence: InputMethods.md:80,148,205-219; crates/dim-agent-capabilities/src/input_queue/pending.rs:14-22,182; docs/design/input-state-read.md:4,24-28.
Fix: Add includeBlockPresence? to the table and the appendix, and use Option<QueryCursor> for both cursor fields.
P2.4 SessionMethods, ManagementMethods and session-boundary A.1 define three method shapes
Problem: The same shared interface has three definitions.
- 2103
SessionMethods.md:182-188definesMethodCall { callId, method, params, connectionId? };:209-212definesMethodReplywithValueorError { code: i32, app_error, message }; the handler returnsResult<Value, MethodCallbackError>whereMethodCallbackError.codeis a String (:194). - #2095
ManagementMethods.md:193-199definesMethodCall { method, params, caller? };:163-169definesMethodReply { Value, HandedOff };:172-176definesCallOutcome { Reply, Error };:157-161definesMethodError { code: i32, app_error, message }. ItsregistertakesRegisterRequestand its errors are wire names (invalid_params,service_reloading), while 2103 uses kind names (invalid,reloading). session-boundary.md:222-230still calls its shapes canonical and givesMethodCallanoriginobject andMethodReplyahandedOffkind.
Failure scenario: MethodCallbackError cannot fill MethodReply::Error: the callback's code is a String app code, while the reply wants a numeric code plus appError. A handler written against #2095 does not fit the 2103 callback, and a client sees different MethodReply variants depending on which table served it. The 2103 page itself says ManagementMethods has "the same shape" (SessionMethods.md:5).
Evidence: SessionMethods.md:5,86-88,182-212; #2095 docs/design/plugins/ManagementMethods.md:70-71,157-176,193-199,222-231 (head 82c6f8e); docs/design/contracts/session-boundary.md:201,222-230.
Fix: Pick one shape. A.1 and #2095 already agree on MethodReply { value | handedOff } plus MethodError { code, appError, message }; keep the handler error as that data and define CallOutcome in both pages, or update A.1 and #2095 to the 2103 shape. Do not keep both definitions of MethodReply and MethodCall.
P2.5 PromptSources examples do not match #2102
Problem: The page says ConfigureRequest and ConfigureOutcome are #2102's types (PromptSources.md:198), then builds ConfigureRequest { sources: Some(vec![(target, Some(entry))]), model: None, tools: None } at :57-61 and :72-76. #2102 defines ConfigureRequest as an enum with Initial(ConfigureUpdate), Loaded { sources: Vec<PromptEntry> }, LanguageUpdate { version } and Tools(ToolSetAdoption) (#2102 docs/design/plugins/PromptAdoption.md:174-179, head 851f531). The second example should be LanguageUpdate { version }. Separately, #2102's PromptSources page says the SessionLanguage face "has no write" (#2102 docs/design/plugins/PromptSources.md:71) and keeps S:PromptRegistry (:77), while this page adds sessionLanguage.set (PromptSources.md:98,271-274) and supersedes promptRegistry (:177).
Failure scenario: The examples do not compile against the sibling. Whichever PR lands first forces the other to rework the call sites and the language write. A reader cannot tell whether the language face is writable.
Evidence: PromptSources.md:57-61,72-76,98,177,198,271-274; #2102 docs/design/plugins/PromptAdoption.md:174-179, docs/design/plugins/PromptSources.md:71,77.
Fix: Use ConfigureRequest::Loaded and ConfigureRequest::LanguageUpdate exactly as #2102 defines them, and reconcile the sessionLanguage write and the PromptRegistry replacement with #2102 in the same series.
P2.6 ToolRegistry declarations is async, but #2100 calls it synchronously
Problem: The appendix makes declarations async and the example awaits it (ToolRegistry.md:340,82), while ToolBinding calls registry.declarations()? without an await at #2100 ToolBinding.md:58 and :82, and its Requirements call that read "the one read Loop and the fingerprint make" (:227).
Failure scenario: The #2100 call sites do not compile against this contract, and the fingerprint read now has an error path (closed) it did not have. The page's own sources() is synchronous, so the two current-state reads have different shapes.
Evidence: ToolRegistry.md:82,110,340; #2100 docs/design/plugins/ToolBinding.md:58,82,227 (head 038e60c).
Fix: Make declarations synchronous and non-Result, as #2100 expects, or update #2100 to await it. One shape for both current-state reads is simpler.
P2.7 Questions tool registration does not match ToolRegistry
Problem: The Questions caller example registers an execute closure with three arguments, |call, context, cancelled|, and a claim closure that "returns nothing" (Questions.md:35-40). ToolRegistry's register takes execute: Fn(ToolCall, ToolExecutionContext) and claim: Fn(ToolCall, ToolExecutionContext) -> BoxFuture<Result<bool, ToolCallbackError>> (ToolRegistry.md:321-322); its own example uses the two-argument execute (ToolRegistry.md:50).
Failure scenario: The snippet does not compile against ToolRegistry's signature. If the execute callback has no cancellation token, the ask_user wait cannot observe cancellation the way Questions.md:84 describes ("the call's token removes the entry"); the contract must instead say the dropped future or the claim guard removes it.
Evidence: Questions.md:35-40,84; ToolRegistry.md:50-51,321-322.
Fix: Use the same callback signatures in both pages, and state how a cancelled tool call releases the waiter without a token.
P2.8 Pending reads miss the timelineTree dependency
Problem: session.question.pending and session.input.pending read the line through timelineTree.query (Questions.md:91, InputMethods.md:102,142), but their Dependencies tables do not list S:timelineTree (Questions.md:53-57, InputMethods.md:71). InputMethods also registers session.input with sessionMethods (InputMethods.md:252) without listing S:sessionMethods. Recall lists S:timelineTree correctly (Recall.md:52), but its requirement says line_owner::<T>(line) gives the tool timelineTree.read by id (Recall.md:105); #2092 defines TimelineTree as a Session part and says it is not in the line-owner path (#2092 TimelineTree.md:3,94-96, head 6d0162b).
Failure scenario: At composition the part cannot resolve timelineTree, and the requirement asks #2127 for a branch route that does not exist for a Session service. An implementer following the requirement adds a line lookup that #2092 explicitly excludes.
Evidence: the listed lines; #2092 docs/design/plugins/TimelineTree.md:3,94-96; #2093 SessionScope.md:26 for the branch-group scope of line_owner.
Fix: List S:timelineTree and S:sessionMethods in the two Dependencies tables, and drop the line-owner claim for timelineTree in Recall. Keep line_owner for the branch parts only (InputQueue, WaitBranch, Prompt, ContextUsage).
P2.9 Code and test comments still cite sections the rewrite removed
Problem: The Previous sections stubs preserve §1, §3, §4, §14 for Recall and §9 and §15 for PromptSuggestion, but not the other cited sections. crates/dim-agent-capabilities/src/recall.rs:2-3 cites Recall §5 and §6; crates/dim-app-server/tests/transport_flow/recall.rs:3 cites §13 and §14; crates/dimcode/tests/cli_flow/prompt_suggestion.rs:4 cites PromptSuggestion §11. Those sections existed on origin/main and this PR drops them.
Failure scenario: A maintainer follows a code or test comment to the design and finds no such section, so the rationale for the test or the implementation note is no longer readable.
Evidence: the listed comments; Recall.md:115-131 preserves only §1, §3, §4, §14; PromptSuggestion.md:149-157 preserves only §9 and §15.
Fix: Add the missing numbered headings to the Previous sections sections, or update the comments to the new titles. The WorkspaceTools §7.2 comment was already stale on main; a follow-up is acceptable there.
P2.10 Rule check rows cite section 7 of unmerged #2029 without a link
Problem: Every new page's Rule check uses bare §7 rows (InputMethods.md:129-133, ToolRegistry.md:175-179, and the same rows in PromptGuide, PromptSources, PromptSuggestion, Questions, Recall, SessionMethods, ShellInput, Wait, WorkspaceTools). docs/architecture/rust-agent/principles.md on main ends at section 6; #2029 adds ## 7. 所有者与操作 (head da6f4a9). This PR does not link #2029 anywhere.
Failure scenario: A reader on main cannot resolve §7, and the cross-PR dependency on an unmerged rule is invisible. The round-1 self-check claimed the cross-PR references use PR URLs; these do not.
Evidence: the listed rows; principles.md headings 1 to 6 on origin/main; #2029 principles.md:108 for section 7.
Fix: Link each §7 row to the #2029 PR URL, or add one note at the Rule check that section 7 is #2029's proposed rule.
P2.11 tool-contributions mixes current and target implementation
Problem: docs/architecture/rust-agent/tool-contributions.md is an Implemented architecture page. Section 2.1 now says ToolHost and ToolDriver no longer exist as public types and §7.5 says snapshot, source, fixed and contributed are replaced by the target operations (tool-contributions.md:94-99,229-232). The same page's section 1 still says host tools are provided through ToolHost (:34,38), section 2's code block registers ToolContribution (:67,72), and section 3 keeps ToolHost as a current dependency (:105). The types still exist in the tree (crates/dim-agent-capabilities/src/host.rs:1225, crates/dim-agent-capabilities/src/tool_registry.rs:719).
Failure scenario: A maintainer reading the architecture page cannot tell what the current implementation is. The design's Supersedes says these shapes are replaced, but the implementation task has not happened; the architecture page should describe current code until then.
Evidence: the listed lines; ToolRegistry.md:193 and WorkspaceTools.md:159-161 for the target claims.
Fix: Revert the two target sections on this page, or mark the page and those sections as target text and keep the current implementation described elsewhere.
P2.12 Recall still documents the wrong model-facing input
Problem: The appendix says the tool input is {query?, after?, limit?} (Recall.md:113), but the declaration the model receives is {about?, tool?, before?, open?, offset?} (crates/dim-agent-capabilities/src/recall.rs:56-84). The page does not list a model-facing change, and the round-1 inline comment on this line is still open.
Failure scenario: An implementation following the appendix changes the model-facing tool schema silently, or the documented schema and the declaration disagree for every request.
Evidence: Recall.md:113; crates/dim-agent-capabilities/src/recall.rs:56-84.
Fix: Document the current {about?, tool?, before?, open?, offset?} schema, or state and verify the schema change in the model-facing text section.
P2.13 ShellInput caller-unload cell still releases the run
Problem: The Flow table's Caller unloads cell for shell.run says "The run's process tree is released; the part's unload joins the runs" (ShellInput.md:86). The implementation says an Rpc reload or this provider's unload ends only the wait; the run stays with this generation (crates/dim-agent-capabilities/src/shell_input.rs:297-300), and the page's own exceptions say a client disconnect does not cancel the run (ShellInput.md:93). The round-1 inline comment on this cell is still open.
Failure scenario: An implementer following this cell kills a command when the caller's row unloads, or hides the documented interrupted-wait behavior.
Evidence: ShellInput.md:86,93; crates/dim-agent-capabilities/src/shell_input.rs:293-300.
Fix: Say the caller's wait ends and the run continues in the Caller unloads cell; keep "running commands stop and settle" in the Owner closes or reloads cell.
P3 (optional, non-blocking)
docs/design/service-faces.md:102: the newpromptSourcesrow ends with "观察仍由 toolRegistry.sources()/observe_sources 提供". PromptSources has no observation; the clause is leftover from the removedtoolSourcesViewrow. Delete it.docs/design/plugins/README.md:61: the By scope list still says "Prompt (the entries table)" while the index row at:30now assigns the guide table to PromptGuide. Update the By scope entry.docs/design/plugins/PromptSources.md:193-194: Supersedes points at session-boundary A.2 and A.3, but those are Call channel and Entries and export; the prompt faces are not in session-boundary. ThepromptSourcesrow is in service-faces section 3.2, not 4.8. Repoint or remove these references.docs/design/plugins/ShellInput.md:80: "invalidisinvalid_paramsorduplicate_run" whileduplicate_runis its own kind at:73. Make the mapping one to one.docs/design/plugins/Wait.md:79says a reload ends the call as cancelled with the text, not as a tool result; #2102WaitBranch.md:94says the tool writes the marked error result. Align the sibling text.docs/design/plugins/InputMethods.md:78,100say a running check "stops with the token", but the callback has no token and:82says its future is dropped. Use the drop wording consistently.- The
Previous sectionsstubs add about 100 lines of redirects across six pages. They work, but updating the 33 referrers would leave less text. Optional.
Verified against the tree
node scripts/adr-check.mjs --base 6e86d48c8361e95575cf8e4425e77f4ec048fc41passes for all 17 changed files.- CI at 734d364:
ci-oksuccess; the docs-only jobs are skipped. The PR is open and mergeable, blocked by review. - Local link and anchor check over
docs/found no broken link or anchor to a changed page. The 33 round-1 referrers resolve through thePrevious sectionsheadings. shell.runfields matchshell_input.rs:383-410; Attachments codes matchcrates/dim-agent-attachments/src/lib.rs:65-74and:229-236; WorkspaceTools exec codes matchcrates/dim-agent-capabilities/src/workspace_tools/mod.rs:529,534; Wait reload text matcheswait.rs:440-443.- The self-check claim that the binding appendix compiles does not hold for PromptGuide and InputMethods as written (P2.1). The claim that the samples match the sibling heads does not hold for #2100, #2102 and #2095 (P2.4 to P2.6).
Conflicts with main and other open PRs
- #2100 ToolBinding:
declarationsis synchronous there, async here. - #2102 Prompt adoption:
ConfigureRequestis an enum there, a struct here; its PromptSources copy says the language face has no write, this page addsset; its WaitBranch wording on the reload settlement differs. - #2095 ManagementMethods: different
MethodCall,MethodReply,CallOutcomeand error names; #2095 itself points at #2103's head as the Session shape. - #2092 and #2093:
line_ownerresolves branch-group faces;timelineTreeis Session. The Recall requirement and the two pending-read dependency tables do not reflect that. - #2029: section 7 is the Rule check authority but is not linked.
- #2102, #2093 and this PR all modify
PromptSources.md,session-boundary.md,service-faces.md,runtime-owner-operations.mdandREADME.md. A merge order has to be chosen, and the duplicate PromptSources page has to be reconciled before either lands.
Unverified
- The sibling heads used above are the heads at review time: #2095 82c6f8e, #2100 038e60c, #2102 851f531, #2092 6d0162b, #2093, #2029 da6f4a9. Re-check after their next rebase.
- The author's temporary binding crate is not in the PR; its claimed compile could not be reproduced. The two snippets above fail as written.
- The textual merge result of the overlapping PRs was not tested.
| | `register` | Publish a check for the calling row's lifetime | `{name, check}` | `{}` | None | `duplicate`, `invalid`, `closed` | | ||
| | `check` | Turn a candidate input into the input an entry writes | `{entry, branchId, user, mode}` | `{proceed: {user, warnings}}` or `{blocked: {message}}` | The caller's token stops the checks; a check already running stops with the token | `cancelled`, `closed` | | ||
| | `session.input.withdraw` | Withdraw a pending input on a line | `{sessionId, branchId, inputId, reason?, steer?}` | the queue's receipt | The caller's token; a committed withdrawal is not undone | `invalid`, `input_blocked`, `publication_unknown`, `cancelled`, `closed` | | ||
| | `session.input.pending` | A line's pending inputs at a cutoff, one page | `{sessionId, branchId, through?, after?}` | `{branchId, through, inputs, next}` | The caller's token stops the read | `invalid`, `cancelled`, `closed` | |
There was a problem hiding this comment.
Problem: this row and the appendix at 205-219 omit includeBlockPresence and type after and next as Option<String>. The current read takes after: Option<QueryCursor> and include_block_presence: bool and returns next: Option<QueryCursor> (crates/dim-agent-capabilities/src/input_queue/pending.rs:14-22,182), and input-state-read.md:24-28 documents the block-presence extension and hasRawBlocks.
Failure scenario: a client generated from this page cannot request hasRawBlocks and cannot pass the string cursor back as after; the server rejects it as invalid_params. The Supersedes claim that the request, page and reply shapes are unchanged (line 148) is false.
Fix: add includeBlockPresence? to the table and appendix, and use Option<QueryCursor> for both cursor fields.
There was a problem hiding this comment.
Fixed in 59a77a3. The row and appendix now have includeBlockPresence and QueryCursor after and next (InputMethods.md:80,205-219).
| #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] | ||
| #[serde(rename_all = "camelCase")] | ||
| /// A check's own failure; the table treats it as no opinion and proceeds. | ||
| #[derive(Debug, Clone, thiserror::Error, serde::Serialize, serde::Deserialize)] |
There was a problem hiding this comment.
Problem: this item has two derive attributes (179 and 182) and two #[serde(rename_all = "camelCase")] attributes. Rust rejects the duplicate Debug, Clone, Serialize, Deserialize and thiserror::Error implementations (E0119), and serde rejects the duplicate attribute.
Failure scenario: the appendix does not compile. This contradicts the self-check that the temporary binding crate compiled.
Fix: delete the first derive and serde pair at 179-180 and keep this one.
There was a problem hiding this comment.
Fixed in 59a77a3. CheckCallbackError has one derive pair and Checked has its derive back (InputMethods.md:180-197).
| #[derive(Debug, thiserror::Error, serde::Serialize, serde::Deserialize)] | ||
| #[serde(tag = "code", rename_all = "snake_case")] | ||
| /// A listener's own failure, reported to the table; it does not undo the composition. | ||
| #[derive(Debug, Clone, thiserror::Error, serde::Serialize, serde::Deserialize)] |
There was a problem hiding this comment.
Problem: the original derive and #[serde(tag = "code", rename_all = "snake_case")] at 149-150 now attach to GuideListenerError together with this second derive. The struct gets conflicting Debug, Serialize, Deserialize and thiserror::Error impls (E0119), and tag is not a struct attribute. GuideError at 167 then has no derive, so its #[error(...)] attributes do not resolve.
Failure scenario: the appendix does not compile, contradicting the self-check that the temporary binding crate compiled.
Fix: move 149-150 back onto GuideError and keep one derive on GuideListenerError.
There was a problem hiding this comment.
Fixed in 59a77a3. The tag and derive are back on GuideError, and GuideListenerError has one derive (PromptGuide.md:149-166).
| | Contribution | Request | Reply | Cancellation | Errors | | ||
| | --- | --- | --- | --- | --- | | ||
| | `session.question.respond` | `{sessionId, branchId, requestId, callId, answers? \| declined: true}` | `{}` | The call's own admission | `invalid`, `not_pending` | | ||
| | `session.question.pending` | A line's pending question batches at a cutoff | `{sessionId, branchId, through?, after?}` | `{branchId, through, batches, next}` | The caller's token stops the read | `invalid`, `cancelled` | |
There was a problem hiding this comment.
Problem: this row has six cells under a five-column header, so the rendered table puts the reply under Cancellation and drops invalid/cancelled. The appendix also types after and next as Option<String> (159,168), while the read takes after: Option<QueryCursor> and returns the query's next (crates/dim-agent-questions/src/pending.rs:14-18,163). QueryCursor is {binding, keys} (crates/dim-agent-runtime/src/timeline_query/properties.rs:331-334).
Failure scenario: a client sends the string next as after and the server rejects it as invalid_params, so paging still fails. A reader of the rendered table sees the reply under Cancellation and no error list.
Fix: make the row five cells, type both fields as Option<QueryCursor>, and state the pending read's cancelled wire code (operation_interrupted, pending.rs:24).
There was a problem hiding this comment.
Fixed in 59a77a3. The contribution row now has five cells and after and next are QueryCursor (Questions.md:67,159,168).
| tools.register( | ||
| ctx, | ||
| ask_user_definition(), | ||
| |call, context, cancelled| Box::pin(run_ask_user(call, context, cancelled)), |
There was a problem hiding this comment.
Problem: this execute closure takes three arguments, including a cancellation token, but ToolRegistry's register takes execute: Fn(ToolCall, ToolExecutionContext) and its own example omits the token (ToolRegistry.md:50,321). The claim closure here is described as returning nothing, while ToolRegistry's claim returns Result<bool, ToolCallbackError> (ToolRegistry.md:322).
Failure scenario: the snippet does not compile against ToolRegistry, and the waiting tool has no way to observe cancellation as the page's flow at line 84 describes. A dropped future or the claim guard must remove the waiter, which the page does not state.
Fix: use the same callback signatures in both pages and state how cancellation releases the waiter.
There was a problem hiding this comment.
Not fixed in 59a77a3. The execute closure still takes (call, context, cancelled) while ToolRegistry.register's execute takes (ToolCall, ToolExecutionContext), and Questions.md:85 still says the call's token removes the entry. See F3.
| if let Some(entry) = sources.load("dim/instructions/project".into(), scope, cancelled.clone()).await? { | ||
| if adopted.version != entry.version { | ||
| prompt.configure(ConfigureRequest { | ||
| sources: Some(vec![(target, Some(entry))]), |
There was a problem hiding this comment.
Problem: ConfigureRequest here is a struct with sources, model and tools, but #2102 defines it as an enum: Initial(ConfigureUpdate), Loaded { sources: Vec<PromptEntry> }, LanguageUpdate { version } and Tools(ToolSetAdoption) (PR 2102 head 851f531, docs/design/plugins/PromptAdoption.md:174-179). The page itself says ConfigureRequest is #2102's type at line 198.
Failure scenario: this literal and the language example at 72-76 do not compile against the sibling. Whichever PR lands first forces the other to rework its call sites.
Fix: use ConfigureRequest::Loaded and ConfigureRequest::LanguageUpdate exactly as #2102 defines them.
| pub fn ordering(&self, adoption: AdoptionId, call: ToolCall) -> Result<OrderClass, ToolError> { /* ... */ } | ||
| pub async fn claim(&self, caller: &Ctx, request: ClaimCalls) -> Result<Claimed, ToolError> { /* ... */ } | ||
| pub async fn release_claims(&self, caller: &Ctx, request: ReleaseClaims) -> Result<(), ToolError> { /* ... */ } | ||
| pub async fn declarations(&self) -> Result<Declarations, ToolError> { /* ... */ } |
There was a problem hiding this comment.
Problem: declarations is async and awaited at line 82, but ToolBinding calls registry.declarations()? without an await at PR 2100 head 038e60c, docs/design/plugins/ToolBinding.md:58 and :82, and its Requirements call that the one read Loop and the fingerprint make (:227).
Failure scenario: the #2100 call sites do not compile, and the current-state read grows a closed error path it did not have. The page's sources() remains synchronous, so the two reads have different shapes.
Fix: make declarations synchronous and non-Result as #2100 expects, or update #2100 to await it.
| #[serde(tag = "kind", rename_all = "camelCase")] | ||
| pub enum MethodReply { | ||
| Value { value: serde_json::Value }, | ||
| Error { code: i32, app_error: String, message: String }, |
There was a problem hiding this comment.
Problem: MethodReply::Error carries code: i32 and app_error, but the handler returns MethodCallbackError { code: String, message } (:194), and the prose at :92 says the error is {code, message}. No conversion supplies the numeric code or appError. The shape also conflicts with #2095's MethodReply { Value, HandedOff } plus MethodError { code, appError, message } (PR 2095 head 82c6f8e, ManagementMethods.md:157-176) and with session-boundary A.1 (session-boundary.md:222-230).
Failure scenario: a handler written against #2095 or A.1 cannot fill this reply, and a client sees different variants from the two tables. MethodCall is also defined here with callId/connectionId while A.1 uses origin and #2095 uses caller.
Fix: pick one shared shape across SessionMethods, ManagementMethods and A.1; the handler error should be A.1's MethodError data.
There was a problem hiding this comment.
Still open in 59a77a3. MethodReply::Error needs code: i32 and app_error, MethodCallbackError has code: String, and A.1 has handedOff. See F1.
| 各宿主绑定(`WorkspaceTools`、`ShellSession`、嵌入方自己的 `ToolHost`)给出同一个原始执行面。 | ||
| 宿主工具的面是 [WorkspaceTools 契约](../../design/plugins/WorkspaceTools.md#own-contract) 的 `toolHost`: | ||
| `declarations()`、`execute(call, context, cancelled)`、`resolve_write(call, cancelled)`、`ordering(call)`。 | ||
| `ToolHost` 与 `ToolDriver` 作为公开类型不再存在;宿主工具的声明由 ToolRegistry 在 apply 时读 `declarations`, |
There was a problem hiding this comment.
Problem: this page is marked Implemented, but this sentence says ToolHost and ToolDriver no longer exist, while section 1 (:34,38) still says host tools are provided through ToolHost, section 2's code block (:67,72) registers ToolContribution, and section 3 (:105) keeps ToolHost as a current dependency. Both types still exist in the tree (crates/dim-agent-capabilities/src/host.rs:1225, tool_registry.rs:719). Section 7.5 (229-232) makes the same target claim.
Failure scenario: a maintainer cannot tell what the current implementation is. The design's Supersedes says these shapes are replaced, but the implementation has not changed; an architecture page should describe current code until then.
Fix: revert the two target sections on this page, or mark them and the page as target text and keep the current implementation described.
There was a problem hiding this comment.
Fixed in 59a77a3. The implemented page is restored to the current implementation and is no longer in the PR diff.
|
已按评审修改,head 评审处理
自查发现
left for step 2
绑定编译
客户端可见变更无。 |
|
已按评审修改,head 跨 PR 对齐:
验证: |
|
补充提交,head |
|
补充说明(ADR 027 收回到决定层后):本 PR 的契约没有 |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
PR 2103 review at 59a77a3
Scope
Target contracts for the Session registries and tools (#2026, refs #2015). At this head the PR changes 16 files (+2346/-2323): six new pages (InputMethods, PromptGuide, SessionMethods, ToolRegistry, Wait, WorkspaceTools), six rewritten pages (Attachments, PromptSources, PromptSuggestion, Questions, Recall, ShellInput), and catalog and contract sync in README, runtime-owner-operations, service-faces, session-boundary and tool-contributions. Reviewed main...head at 59a77a3, with 734d364..59a77a3 as the delta. Merge base 6e86d48, current origin/main decc589.
The delta is 9 files +112/-74. Its three commit messages claim the round-5 items are answered in step 1; the claims that hold are the paging shapes, the two appendix derivations, the PromptSources ConfigureRequest examples, Recall's requirements, and the ShellInput cell. The shared method-table shape and the Questions registration do not hold, and the PR still does not merge with main.
Verdict
REQUEST_CHANGES.
Prior status
Fixed, withdraw these findings:
- P1:
session.question.pendingcan be paged.afterandnextareOption<QueryCursor>(Questions.md:159,168), the row at:67has five cells, and the cancelled wire code isoperation_interrupted(crates/dim-agent-capabilities/src/methods.rs:105-109). The round-1 thread 4666976765 and the round-2 inline 4675580989 are fixed. - P2.1: the PromptGuide and InputMethods appendices now compile. The tag and derive are back on
GuideError(PromptGuide.md:165-166),GuideListenerErrorhas one derive (:150-152), andCheckCallbackErrorandCheckedeach have one derive (InputMethods.md:180-183,195-197). Round-2 inlines 4675580980 and 4675580982 are fixed. - P2.3:
session.input.pendingnow hasincludeBlockPresenceandQueryCursorcursors (InputMethods.md:52,80,205-219). Round-2 inline 4675580978 is fixed. - P2.10: section 7 now resolves. #2029 merged into origin/main (
docs/architecture/rust-agent/principles.md:108), so the bare §7 rows are readable after the rebase. Do not change them. - P2.11:
tool-contributions.mdis restored to the current implementation and is no longer in the main...head diff. Round-2 inline 4675581032 is fixed. - P2.13: the ShellInput caller-unload cell now says the wait ends
operation_interrupted, the run stays with this generation, and its result is still written (ShellInput.md:86), matchingcrates/dim-agent-capabilities/src/shell_input.rs:293-300. Round-1 thread 4666976825 is fixed. - The round-1 InputError thread 4666976686 is fixed:
InputBlockedandPublicationUnknownare in the appendix (InputMethods.md:164-177).
Partially fixed, see below: P2.4, P2.5, P2.7, P2.8. Still open and unchanged: P2.2, P2.6, P2.9, P2.12.
P2 (blocking)
F1 The shared method-table types are still three definitions, and CallerRef is undefined
Problem: The delta removed the local CallerRef and now imports it from crate::methods (SessionMethods.md:174,181,244), saying Appendix F defines it. Appendix F defines Caller (the notification handle) and Origin { caller: Option<Caller> }, not CallerRef (session-boundary.md:617-624); no document defines CallerRef. Separately, MethodReply here is {Value | Error { code: i32, app_error, message }} (SessionMethods.md:204-207), A.1 says {kind:"value", value} or {kind:"handedOff"} (session-boundary.md:228), A.1's MethodError is {code, appError, message} with a numeric code (:230), and the handler returns MethodCallbackError { code: String, message } (SessionMethods.md:189), which cannot fill Error.code: i32. #2095 imports MethodCallbackError, MethodReply and MethodError from crate::methods (ManagementMethods.md:137-140 at fa2eea2), while #2103 says only MethodDecl, Interruption and RpcError are crate types and defines the rest in its own appendix (SessionMethods.md:170). A.1's MethodCall has a top-level callId (session-boundary.md:223); SessionMethods says A.1's MethodCall is {method, params, origin} (SessionMethods.md:181); Appendix F matches the latter (session-boundary.md:617).
Failure scenario: use crate::methods::{CallerRef, ...} fails to resolve, and #2095's import of MethodReply, MethodError and MethodCallbackError fails with it. A handler that returns MethodCallbackError has no defined conversion to MethodReply::Error, so each table must invent one. A client sees handedOff from A.1, a numeric Error from one appendix, and {code, message} from the prose.
Evidence: the lines above, and docs/design/plugins/ManagementMethods.md:74,137-140 at #2095 fa2eea2.
Fix: put MethodCall, Origin, CallerRef (or the existing Caller), MethodReply, MethodError and MethodCallbackError in one place, most naturally crate::methods, and make A.1, SessionMethods and #2095 use that definition. Define CallerRef explicitly or use Caller; drop handedOff or add it to MethodReply; state the handler-error to reply-error conversion.
F2 ToolRegistry.declarations is async against #2100's synchronous call sites
Problem: The appendix makes declarations async and the example awaits it (ToolRegistry.md:82,340), while #2100 calls registry.declarations()? without an await (ToolBinding.md:58,82 at 437266b) and calls it "the one read Loop and the fingerprint make" (:227). The page's own sources() is synchronous (ToolRegistry.md:341).
Failure scenario: The #2100 call sites do not compile, and the fingerprint read gains a closed error path it did not have. Implementers must choose which PR to break.
Evidence: ToolRegistry.md:82,110,340-341; docs/design/plugins/ToolBinding.md:58,82,227 at #2100 437266b.
Fix: Make declarations synchronous and non-Result as #2100 expects, or update #2100 in the same series. One shape for both current-state reads is simpler.
F3 The Questions caller example does not fit ToolRegistry, and cancellation is undefined
Problem: The execute closure takes three arguments, |call, context, cancelled| (Questions.md:38), while ToolRegistry.register takes Fn(ToolCall, ToolExecutionContext) (ToolRegistry.md:321). The claim now answers true (fixed). The flow still says "The call's token removes the entry" (Questions.md:85), but the registry's execute callback has no token; run drops the callback's future and leaves settlement to the contributor (ToolRegistry.md:105,114).
Failure scenario: The snippet does not compile against the registry, and an implementer following the flow looks for a token the execute callback does not receive. On cancellation the waiter is not removed by the documented mechanism.
Evidence: Questions.md:35-40,85; ToolRegistry.md:50-51,105,114,321-322.
Fix: Use the two-argument execute in both pages, and state that the dropped future or the registry's claim release removes the waiter, or extend ToolRegistry.register deliberately and update its example.
F4 InputMethods still contradicts Hooks A.6.2 on the first block
Problem: InputMethods.md:107 says later checks still run for their warnings and every warning is returned. InputMethods.md:113 says the first block ends the call, later checks do not run, and collected warnings are discarded. Hooks A.6.2 says the same (Hooks.md:514), and the page lists Hooks A.6.2 in Supersedes (InputMethods.md:147). The code returns at the first block (crates/dim-agent-capabilities/src/input_queue.rs:551-575).
Failure scenario: An implementation following line 107 runs the remaining hooks after a refusal, adding side effects the accepted contract forbids and returning warnings the error path never had.
Evidence: InputMethods.md:107,113,147; docs/design/plugins/Hooks.md:514; crates/dim-agent-capabilities/src/input_queue.rs:551-575.
Fix: Delete the second clause at line 107 or replace it with line 113's rule.
F5 Dependency tables omit the Session services their handlers use
Problem: InputMethods says "None beyond the line's input owner, reached by line id" (InputMethods.md:71), yet its methods are registered with sessionMethods.register (:146,253) and its pending read uses timelineTree.read (:80,102,142,253). WorkspaceTools lists S:sessionMethods but not S:timelineTree (WorkspaceTools.md:64-70), while its session.exec.pending and session.exec.finished handlers read the line's facts (WorkspaceTools.md:82-83; the current handler requires the tree at crates/dim-agent-capabilities/src/workspace_tools/mod.rs:381-383, and the read uses QueryCursor at crates/dim-agent-capabilities/src/workspace_tools/pending.rs:13-18). Questions and Recall list both services correctly (Questions.md:57-58, Recall.md:52-53).
Failure scenario: At composition the part cannot resolve sessionMethods or timelineTree, or an implementer adds undeclared injections and the part fails to load. AGENTS.md rule 1 requires every dependency declared.
Evidence: the lines above.
Fix: Add S:sessionMethods and S:timelineTree to InputMethods, and S:timelineTree to WorkspaceTools. If session.exec.pending is meant to read through another owner, name that owner instead.
F6 PromptSources still conflicts with #2102, and one example does not match its appendix
Problem: The ConfigureRequest examples now use the enum (fixed). The contract still disagrees with #2102 at 3b48e12: #2102 says the SessionLanguage face "has no write" and lists S:PromptRegistry (#2102 docs/design/plugins/PromptSources.md:71,77), while this page adds sessionLanguage.set (PromptSources.md:90,266) and supersedes promptRegistry (:169,185). Separately, sources.load(...) returns LoadReply (PromptSources.md:235,258), so if let Some(entry) = sources.load(...).await? (:55) does not compile; entry is a field of the reply.
Failure scenario: Whichever PR lands second leaves two contracts for the same owner: readers cannot tell whether the language face is writable or whether sources register with promptSources or PromptRegistry. The caller example fails against its own appendix.
Evidence: PromptSources.md:55,90,169,185,235,258,266; #2102 docs/design/plugins/PromptSources.md:71,77 at 3b48e12.
Fix: Reconcile the language write and the registry replacement with #2102 in the same series, or state that this page supersedes #2102's and get that page updated. Change the example to sources.load(...).await?.entry.
F7 Recall still documents the wrong model-facing input
Problem: The appendix says the tool input is {query?, after?, limit?} (Recall.md:113), but the declaration the model receives is {about?, tool?, before?, open?, offset?} (crates/dim-agent-capabilities/src/recall.rs:56-84). The page lists no model-facing change, and round-1 thread 4666976781 is still open.
Failure scenario: An implementation following the appendix silently changes the model-facing schema, or the documented schema and the declaration disagree for every request.
Evidence: Recall.md:113; crates/dim-agent-capabilities/src/recall.rs:56-84.
Fix: Document the current {about?, tool?, before?, open?, offset?} schema, or state and verify the schema change in the model-facing text section.
F8 Code and test comments still cite sections the rewrite removed
Problem: The Previous sections stubs preserve §1, §3, §4 and §14 for Recall (Recall.md:115-131) and §9 and §15 for PromptSuggestion (PromptSuggestion.md:149-157). crates/dim-agent-capabilities/src/recall.rs:1-4 cites §5 and §6; crates/dim-app-server/tests/transport_flow/recall.rs:1-3 cites §13 and §14; crates/dimcode/tests/cli_flow/prompt_suggestion.rs:1-4 cites §11. Those sections existed on main and this PR drops them.
Failure scenario: A maintainer follows a code or test comment to the design and finds no such section, so the rationale for the test or the implementation note is no longer readable.
Evidence: the listed comments and stub sections.
Fix: Add the missing numbered headings to the Previous sections sections, or update the comments to the new titles. The WorkspaceTools §7.2 comment was already stale on main; a follow-up is acceptable there.
F9 The PR does not merge with main, and a naive Attachments resolution drops main's image-routing design
Problem: git merge-tree --write-tree origin/main HEAD returns tree f264b402d2eddba468c1aa2e6b81a0a8b6afc75b and one conflict, docs/design/plugins/Attachments.md (content conflict). This is a conflict with main, not with a sibling: main added image destination routing, the 32 MiB encoded-image budget and Bedrock placement after this PR's base (origin/main:docs/design/plugins/Attachments.md:120-170). The head's rewrite keeps only a one-line pointer that the per-request view belongs to ModelProvider (Attachments.md:90,94) and omits those sections. The PR body says remaining business detail stays, so dropping them contradicts the stated approach.
Failure scenario: Resolving the conflict by taking the PR's Attachments side deletes current design content for image routing and the request budget. The document then describes behavior that main's code and other design pages no longer match.
Evidence: the merge-tree output; origin/main:docs/design/plugins/Attachments.md:120-170; Attachments.md:87-94. CI at this head is green because docs-only jobs are skipped; it does not exercise the merge.
Fix: Rebase onto current main and merge main's image-routing text into the rewritten page, keeping the owner contract's new structure. Do not resolve the conflict by taking one side wholesale.
P3 (optional, non-blocking)
Questions.md:58says theS:timelineTreedependency usesquery; the body at:92and #2092 useread(TimelineTree.md:38-39at c80f8e1). Change it toread.Questions.md:67omitsclosedfrom the pending read's errors while the InputMethods row lists it and the read can fail with the Session closing; add it for symmetry.runtime-owner-operations.md:27,52still saystimelineTree.query; #2092's face isread, and the three plugin pages in this delta were changed toread. Update these two lines or label them current.service-faces.md:102still ends the newpromptSourcesrow with a clause saying observation is provided bytoolRegistry.sources()/observe_sources. PromptSources has no observation; the clause is left over from the removedtoolSourcesViewrow. Delete it.plugins/README.md:61still says "Prompt (the entries table)" in By scope while the index at:30assigns the guide table to PromptGuide. Update the By scope entry.ShellInput.md:80says "invalidisinvalid_paramsorduplicate_run" whileduplicate_runis its own kind at:73. Make the mapping one to one.Wait.md:79says a reload ends the call as cancelled with the text, not as a tool result. #2102WaitBranch.md:94says the tool writes the marked error result and the turn fails. Align the sibling text.InputMethods.md:78,100say a running check "stops with the token", but the callback has no token and:82says its future is dropped. Use the drop wording consistently.PromptSources.md:185supersedes session-boundary A.2 and A.3, which are the call channel and entries/export; the prompt faces are in service-faces §3.2 and session-access. Repoint or remove the reference.- The
Previous sectionsstubs add about 100 lines of redirects across six pages. They work, but updating the 33 referrers would leave less text. Optional.
Verified
node scripts/adr-check.mjs --base origin/mainpasses: 16 changed files.--base HEAD^1passes for 1 changed file.- A local link and anchor check over the changed files found 0 broken links. A check over all English docs found only pre-existing failures unrelated to the changed pages; none point at a page this PR changes.
git merge-tree --write-tree origin/main HEADconflicts only ondocs/design/plugins/Attachments.md; see F9.- CI at 59a77a3:
ci-oksuccess; docs-only jobs (static-checks,verify,macos-native,windows-cli,web,dependencies,scripts,acp-registry) are skipped. The PR is open and not a draft;mergeable=false,mergeStateStatus=DIRTY. - Sibling heads rechecked at publication: #2095 fa2eea2, #2100 437266b, #2102 3b48e12, #2093 c8f1812 (the brief said 53961a1; the PR advanced), #2098 c3acab3, #2097 ed43cd9, #2092 c80f8e1 (moved after the review; TimelineTree.md is unchanged).
shell.runfields matchcrates/dim-agent-capabilities/src/shell_input.rs:383-410; the pending reads'QueryCursorandoperation_interruptedmatchcrates/dim-agent-questions/src/pending.rs:14-18,163andcrates/dim-agent-capabilities/src/input_queue/pending.rs:14-22,182;InputErrorcodes matchInputMethods.md:162-177; Attachments codes matchcrates/dim-agent-attachments/src/lib.rs:65-74,229-236.
Cross-PR conflicts
- #2100 ToolBinding:
declarationsis synchronous there (ToolBinding.md:58,82,227), async here (ToolRegistry.md:340). F2. - #2102 Prompt adoption: its PromptSources copy says the language face has no write and keeps
PromptRegistry; this PR addssetandpromptSources. #2102 also modifiesRecall.md, which this PR rewrites, and its copies of session-boundary A.1/A.5 use different method and tool shapes. F6, and the merge order has to be decided. - #2095 ManagementMethods: it now defers to #2103 for
MethodCall,MethodReply,MethodError,MethodCallbackErrorandCallerRef(ManagementMethods.md:74,134,137-140), but #2103 does not defineCallerRefand does not put all of those types incrate::methods. F1. - #2093, #2098 and #2097 overlap this PR on
runtime-owner-operations.md,service-faces.md,plugins/README.mdandsession-boundary.md; textual conflicts are expected on rebase. No direct shape conflict was found beyond the shared README and service-faces rows. - The PR body's sibling list is stale: it names #2092
d96802349and omits #2100; the current heads above must be used.
Unverified
- The appendices were not compiled here. F1's
CallerRefresult is a static import check against Appendix F and the tree; the rest is a type-shape comparison. - The author's temporary binding crate is not in the PR, so its claimed compile could not be reproduced.
- Sibling merge conflicts beyond the overlapping-file list were not tested with
git merge-treeagainst sibling branches; only the merge against origin/main was run. - The sibling heads above are those at review time and should be rechecked after their next rebase.
|
|
||
| ```rust | ||
| use crate::host::CancelledFn; | ||
| use crate::methods::{CallerRef, Interruption, MethodCall, MethodDecl, Progress, RpcError}; |
There was a problem hiding this comment.
F1: CallerRef is imported here from crate::methods but is not defined in Appendix F (which defines Caller and Origin { caller: Option<Caller> } at session-boundary.md:617-624) or anywhere in docs. The same appendix defines MethodReply::Error with code: i32, while MethodCallbackError has code: String and A.1's MethodReply has handedOff. #2095 imports these from crate::methods and will not resolve. Define the types once, define CallerRef or use Caller, and add the handler-error to reply-error conversion. See the review body, F1.
| | `register` (the table's) | async | `namespace`, `MethodDecl[]`, `call` | Nothing once registered; an error when refused | | ||
| | `call` (the registering part's function) | async | `MethodCall`, `cancelled`, `progress` | `MethodReply`, or `MethodError` | | ||
| | `register` (the table's) | async | `caller`, `namespace`, `MethodDecl[]`, `call` | Nothing once registered; an error when refused | | ||
| | `call` (the registering part's function) | async | `MethodCall`, `cancelled`, `progress` | `MethodReply` data; the handler's own error is `{code, message}` | |
There was a problem hiding this comment.
F1: A.1 still calls these shapes canonical, but they differ from SessionMethods.md:181-207: MethodCall here has callId, MethodReply has handedOff, and MethodError has a numeric code, while SessionMethods has no callId, no handedOff, and kind-named MethodError. The new progress row is right, but one method-table shape is still not shared. Align A.1 with SessionMethods and #2095.
| pub fn ordering(&self, adoption: AdoptionId, call: ToolCall) -> Result<OrderClass, ToolError> { /* ... */ } | ||
| pub async fn claim(&self, caller: &Ctx, request: ClaimCalls) -> Result<Claimed, ToolError> { /* ... */ } | ||
| pub async fn release_claims(&self, caller: &Ctx, request: ReleaseClaims) -> Result<(), ToolError> { /* ... */ } | ||
| pub async fn declarations(&self) -> Result<Declarations, ToolError> { /* ... */ } |
There was a problem hiding this comment.
| tools.register( | ||
| ctx, | ||
| ask_user_definition(), | ||
| |call, context, cancelled| Box::pin(run_ask_user(call, context, cancelled)), |
There was a problem hiding this comment.
F3: The execute closure takes (call, context, cancelled), but ToolRegistry.register's execute is Fn(ToolCall, ToolExecutionContext) (ToolRegistry.md:321). The claim fix is correct, but this snippet does not compile and Questions.md:85's "call's token" does not exist. Use the two-argument execute and state how a cancelled call releases the waiter.
| ## Exceptions with reasons | ||
|
|
||
| - A check that fails counts as proceed: an input check is an opinion, and a failing check must not block the operator's input. | ||
| - The first block in name order is the answer; later checks still run for their warnings: the caller reads one refusal and every warning, as the operator-entry flow already does. |
There was a problem hiding this comment.
F4: This sentence still says later checks run for their warnings, while line 113, Hooks A.6.2 (Hooks.md:514) and the code (crates/dim-agent-capabilities/src/input_queue.rs:551-575) stop at the first block and discard the warnings collected before it. Delete the second clause.
| | `collaborationConfig` | `collaborationConfig.get()` | 形状见 §4.8。 | | ||
| | `worktreeAssociations` | `store.associateWorktree` | 形状见 §4.8。 | | ||
| | `toolSourcesView` | `toolSourcesView.get/observe` | 同一 ToolRegistry owner 的独立只读观察面;贡献注册仍由 `toolRegistry` 负责,见 [工具贡献 §7.5](../architecture/rust-agent/tool-contributions.md#75-服务接口)。 | | ||
| | `promptSources` | `promptSources.register/load/initial` | 形状见 [PromptSources](plugins/PromptSources.md#own-contract);观察仍由 `toolRegistry.sources()`/`observe_sources` 提供。 | |
There was a problem hiding this comment.
P3: This new promptSources row says observation is still provided by toolRegistry.sources()/observe_sources. PromptSources has no observation; this is a leftover from the removed toolSourcesView row. Delete the clause.
| | Session parts | Questions, ShellInput, Attachments, SessionTitle, Report, PromptSuggestion, Goal, Web, Recall, ImageUnderstanding, EventHub, Hooks, Scheduler, Workflow, PromptSources, Prompt (the entries table), Code Mode when enabled, SettingsTool (the one `settings` tool, registered by ExecutionSettings in v1) | | ||
| | Branch parts | Goal (with Pursuit), ModelRecovery (proposed), Hooks, Prompt, Code Mode when enabled, EnvironmentClientsBranch (registered by Connection), SettingsSnapshotBranch (registered by ExecutionSettings) | | ||
| | Process parts | Provider (management supplement), Scheduler, Workflow, ExternalAgent, Modality, PluginManager, RuntimeManager, RemoteGateway, Skills (installation), PromptSuggestion (the Settings source), `CodeMode` when installed, light-ocr in the daemon, EventHub, Report, WorkspaceToolsOwner (the mention index and write coordinator); AcpGateway in its client host process; ClientView (the connection's viewed line) | | ||
| | Session parts | Questions, ShellInput, Attachments, SessionTitle, Report, PromptSuggestion, Goal, Web, Recall, ImageUnderstanding, EventHub, Hooks, Scheduler, Workflow, PromptSources, PromptGuide, ToolRegistry, SessionMethods, InputMethods, WorkspaceTools, Wait, Prompt (the entries table), Code Mode when enabled, SettingsTool (the one `settings` tool, registered by ExecutionSettings in v1) | |
There was a problem hiding this comment.
P3: By scope still says "Prompt (the entries table)" while the index row at line 30 assigns the guide table to PromptGuide. Update the By scope entry.
| | `operation_interrupted` | The wait ended before the run did; the run continues and its result still arrives | | ||
|
|
||
| Rules: [principles §1 and §4](../../architecture/rust-agent/principles.md), [ADR 002](../../adr/002-plugin-scope.md) D1–D5. | ||
| The wire codes stay the client's: `invalid` is `invalid_params` or `duplicate_run`, `shell_busy` is `shell_busy`, a failed spawn is `spawn_failed`, an absent platform is `shell_unavailable`, `closed` is `session_closed` (or `service_reloading` while the part reloads), and an interrupted wait is `operation_interrupted`. `recorded` is `{sequence}` when the `record` input was written or `{error: {message, appError?}}` when it was not. |
There was a problem hiding this comment.
P3: invalid is mapped to invalid_params or duplicate_run, but duplicate_run is its own kind at line 73 and its own table row. Make the mapping one to one.
|
|
||
| ## Exceptions with reasons | ||
|
|
||
| - The tool's result texts are protocol: the model reads the task ids and the end reason, and a change to either changes what it can do next. A reload ends the call as cancelled with the text `capability reloading`, not as a tool result; the turn fails. |
| | `S:sessionScope` | `config` for `interactive`, read per call; a non-interactive Session gets an error result. | | ||
| | `S:toolRegistry` | Register `ask_user` until this part unloads. | | ||
| | `S:sessionMethods` | Register `session.question` until this part unloads. | | ||
| | `S:timelineTree` | `query` for the pending read at the line's cutoff. | |
|
Closing as part of abandoning the owner-split experiment. |
Target contracts for the Session registries and tools board (#2026), written against
origin/main1bc7d67d.Owners covered: ToolRegistry (with the tool source view), SessionMethods, PromptSources (PromptSources and SessionLanguage), PromptGuide, InputMethods, WorkspaceTools (host tools and the mention index), Questions, Wait, Recall, ShellInput, Attachments, PromptSuggestion.
The design parts are in
docs/design/plugins/; the delivery part is the comment on #2026 (linked below). The contract sections in the documents that already had a design supersede their old public-surface sections; the remaining text is the owner's business detail and stays.Delivery comment: #2026 (comment)
Refs #2026, Refs #2015.
Merge order
#2029 → #2080 → #2091/#2092/#2093 → #2094 → #2096 → the rest.
Sibling heads this change is aligned with: #2092
d96802349, #2095fa2eea2c7, #210118d5e4f07, #21023b48e1248. A paragraph that depends on a sibling names that PR; its head is the one above.