Repository navigation
Conversation
42b6186 to
ae5cf08
Compare
|
评审(head
|
|
已按评审修改,head
交付评论的 Goal 迁移行与首行 head 已同步; |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: this PR rewrites the four product plugin owner contracts (Goal, SessionTitle, Web and Code Mode) plus the plugin index for the owner-operations series (refs #2033 and #2015, with the SessionStore contract in #2018/#2091), moving callers to line-id operations, the store's change callback and the account owner's face, and deleting about 1400 lines of mechanism detail.
Verdict: REQUEST_CHANGES
P1
1. session.goal.get changes the wire shape and names types that do not exist
Problem: docs/design/plugins/Goal.md:99 changes the reply to {branchId, goal?} where the goal carries {objective, status, judge, through}, and Goal.md:216 calls GoalStatus and GoalJudge "the existing types in crates/dim-goal". The existing types are GoalView, GoalViewStatus and GoalRead in crates/dim-agent-types/src/goal.rs:5-29; GoalView has objective: String and evaluator: bool, and GoalRead has a top-level through. The delivery comment on #2033 also says the result formats stay unchanged except for the removed sequence.
Failure scenario: crates/dim-cli/src/goal_command.rs:32 deserializes the reply as GoalRead, and crates/dim-cli/src/goal.rs:171 reads goal.evaluator; GoalRead and GoalView use deny_unknown_fields, so the documented reply fails to deserialize (top-level through is missing, judge and through inside the goal are rejected). The CLI /goal, the session host inventory and the ACP goal display break, and a client that keeps the old shape cannot read the new judge or through.
Fix: keep the GoalRead shape ({branchId, through, goal: {objective, status, evaluator}}) on session.goal.get and map GoalValue to it, or state the shape change and migrate every caller (CLI, session host, ACP) in the same delivery; use the real type names or define the new ones instead of calling them existing.
P2
2. The rewrite deletes anchors that standing documents and crate docs still link
Problem: the old headings are gone, but more than 30 links still target them: crates/dim-cli/README.md:744 (Goal.md#a2-session-methods), crates/dim-oauth/docs/design.md:20 and crates/dim-oauth/docs/runtime-contract.md:12 (SessionTitle.md#33-generation-routing-and-optional-service), docs/design/cli-commands.md:576 and :622, docs/design/timeline-branches.md:249, :253, :312, :323, :507, :556, docs/design/model-prompts.md:229, docs/design/plugins/Pursuit.md:16, :36, :46, :50, :58, :81, :93, docs/design/plugins/Scheduler.md:514, docs/design/plugins/Skills.md:526, docs/design/appserver/session-title-metadata.md:9, :72, :78, :154, :202, :206, :216, :230, :284, docs/design/appserver/session-notices.md:5, docs/design/appserver/idle-unload.md:110, docs/design/overview.md:563, docs/design/timeline-read-followups.md:15 and docs/design/acp-gateway-implementation.md:297.
Failure scenario: a reader following any of these links lands at the top of the rewritten document with no matching section; an implementer reading the S5b title metadata or the CLI contract loses the referenced rule. The static check only validates links written in Rust comments, so CI does not catch these.
Fix: update every referrer to the new heading or keep compatibility anchors for the old names; list anything another PR owns instead of leaving a silently broken link.
3. Standing contracts still describe the removed behavior
Problem: docs/design/overview.md:71, :78, :166 and :229 still say Goal folds goal:objective and goal:status blocks and SessionTitle observes the Session broadcast and sends text to the auxiliary model; docs/design/cli-commands.md:605 says every Goal method "replies with its input's sequence"; docs/design/plugin-contract.md:110 still lists sessionMetadata as SessionTitle's service; docs/design/appserver/session-title-metadata.md:92 and :206 still define setTitle {expectedRevision} with conflict and "SessionTitle reads again and retries"; the Chinese mirrors docs/zh/design/plugins/Goal.md, SessionTitle.md and Web.md still describe the old contracts.
Failure scenario: two documents in the same repository give different rules for one owner, and the delivery that follows this PR cannot tell which one is authoritative.
Fix: update these referrers in this PR, or name the PR that will and mark the old sections as superseded. The Chinese mirrors need at least a note that they are stale.
4. Goal's state record has two writers
Problem: Goal.md:81 says the input owner's submit carries "the command input and the state record input"; Goal.md:179 says the timeline's append "accepts an input-message draft" and Goal appends "the fact and then the record"; Goal.md:113 says the branch decision appends both.
Failure scenario: the implementation either bypasses InputQueue's ordering and idempotency by appending the record directly, or uses submit and cannot follow the stated append API. The two statements cannot both hold.
Fix: name one owner for the record: submit for the record and append only for the business fact, or append for both with the input owner's involvement stated.
5. goalLine.read is documented as cancellable but its binding has no cancellation argument
Problem: Goal.md:101 and :112 say the wait can stop and list cancellation, and Goal.md:183 says cancelled is the binding's cancellation argument, but Goal.md:201 declares pub async fn read(&self) with no cancellation argument. GoalError includes Cancelled, which this face cannot produce.
Failure scenario: an implementation following the appendix cannot stop the read when the caller drops or the Session unloads; the cancellation column and the flow row cannot be implemented.
Fix: add the cancellation argument to read and show how NoInstance and Closed map, or remove the cancellation claim and the Cancelled error from this face.
6. Goal's retry rule has no submission id
Problem: Goal.md:29 makes retry safety the row's handling ("the submission id on submit") and Goal.md:146 verifies that a command submitted twice with one submission id is accepted once; the command requests in Goal.md:96-100 have no submission id and no rule derives one.
Failure scenario: a client that retries session.goal.set after a lost reply creates a second input and a second goal execution; the verification only exercises InputQueue's submit, not Goal's method.
Fix: add a submission id to the command requests, or derive it from the client's request id and state it; move the verification to the method.
7. Goal's companion documents still state the old write and evaluator flows
Problem: Goal.md:3 says two places supersede Goal-state-read.md and that they are named below, but only Goal.md:116 names one. Goal-state-read.md:77 still requires one atomic append_batch for the command, the model state input and the business fact, and Goal-state-read.md:79 still says the public methods return the trigger's sequence. Pursuit.md:42 uses invalid_params, Pursuit.md:56 uses treeCommands.create, and Pursuit.md:57 relies on branch/create-failed; the new Goal uses TimelineTree create/end and invalid.
Failure scenario: the documents that Goal calls authoritative for state and evaluator behavior contradict the new contract, so an implementer keeps the atomic batch and the sequence reply.
Fix: update both companions here, or name the owning PR, and make the supersession list accurate.
8. SessionTitle depends on an unmerged store contract and its binding does not match it
Problem: SessionTitle.md:169 calls PR #2091's setTitle {id} + change "SessionStore's current contract" and says no requirement is open, but #2091 is open and main still implements setTitle {sessionId, expectedRevision, title} with conflict (crates/dim-app-server/src/storage/metadata.rs:201, docs/design/appserver/session-title-metadata.md:22 and :92). SessionTitle.md:204 defines a synchronous TitleChange over StoredTitle; #2091's ChangeFn is async (BoxFuture) over TitleState.
Failure scenario: the appendix and the caller examples do not compile against the cited contract; an implementation against main cannot provide the change callback; the document hides a forward dependency behind the word "current".
Fix: mark #2091 as the owning open PR in the dependency table, use TitleState and the async ChangeFn (or say why the binding differs), and state what replaces the S5b expectedRevision/conflict rule.
9. Web says a profile without the account owner has no web_search
Problem: Web.md:72 says "A profile without an account owner declares web_fetch only"; A.5 (Web.md:252) and Appendix D.1 keep the configured adapter path, and the implementation declares web_search for an adapter with its API key (crates/dim-app-server/src/web.rs:1017-1022).
Failure scenario: an operator with a configured adapter and no Dim account loses web_search, contradicting the source's own searchService field and the acceptance test.
Fix: state the adapter path: a configured adapter with a key declares web_search regardless of the account; the account owner decides only when the source names no adapter or a dim-oauth configuration.
10. Code Mode's v4 gate reads a protocol version SessionScope does not provide
Problem: CodeMode.md:29 and :72 say the entry gates on the client's protocol version from SessionScope's config; the SessionScope contract returns SessionConfig (PR #2093), which has no protocol version (crates/dim-agent-runtime/src/config.rs:39-88). The current gate is SessionConfig.excluded_tools, set by exclude_codemode_below (config.rs:190-192, crates/dim-app-server/src/connection.rs:1881-1883).
Failure scenario: the entry cannot compose the v4 gate from config; a v3 Session may be offered codemode, or a v4 Session may be refused.
Fix: keep the mount exclusion as the gate and state it, or add a protocol-version read to SessionScope's contract and link it.
11. Code Mode's slot example cannot return its result
Problem: CodeMode.md:54-59 passes a closure to with_slot, but the SlotWork type at CodeMode.md:170-172 returns Result<(), ProfileError> and the closure returns Ok(program_result(outcome, effects)); with_slot returns Result<(), SlotError>, so the run's ToolResult is dropped. The example also calls executor.close(..., cancelled), while #2100's close takes only CloseRequest. ProfileError is HostError, which has no From<rutis::host::CallError>; the runtime implements that conversion for AgentError (crates/dim-agent-runtime/src/error.rs:283).
Failure scenario: the appendix does not compile, the run cannot answer the outer call, and the callback cannot absorb a bridge call failure.
Fix: make SlotWork and with_slot generic over the work's reply or capture the result outside; call close with the request only; use an error type with the rutis conversion or add it.
12. Goal's evaluator line has no refusal path
Problem: Goal.md:114 opens a child line at the turn end, and Goal.md:19 and :96 allow a goal on any line, but TimelineTree's create refuses a non-opener line (not_opener) and the Session's cap (limit_reached) (PR #2092). Goal's operations, flows and errors name neither.
Failure scenario: a goal with judge: "evaluator" on a child line cannot create the evaluator; the goal stays active and retries at every turn end, or the branch decision fails without a terminal state.
Fix: name the refusal and the paused reason in Goal and Pursuit, or refuse judge: "evaluator" for lines that may not open one.
P3
13. TimelineTree shape names do not match the cited contract
Problem: Goal.md:46 uses LineRequest { line } and calls the unknown-line error line_missing; the TimelineTree contract (PR #2092) defines line as {line} with unknown and closed, and Goal.md:99 lists line_missing for get even though the get example at Goal.md:58 never calls line and maps NoInstance to no_goal_owner.
Failure scenario: a client cannot tell which error an unknown line produces, and the example against the owner contract does not compile.
Fix: use the owner's request shape and error names; add the line check to get or drop line_missing from its row.
14. SessionTitle's ROOT is undefined
Problem: SessionTitle.md:57 reads line: ROOT; the conversation line is directory().default (PR #2092, and Goal.md:44 uses it), and no ROOT exists in the contract.
Failure scenario: the example does not compile, or it titles from a line that is not the conversation line after the default moves.
Fix: resolve tree.directory()?.default.
15. Code Mode and Web binding details
Problem: CodeMode.md:164 marks ProgramSlots with #[rutis::service] while CodeMode.md:159 says the process part provides codeMode; one Rust type is one name, so the catalog name is programSlots unless the attribute says name = "codeMode" (the pattern in PR #2096). CodeMode.md:100 lists interrupted and gate_closed as operation errors, but the run's error list at :79 and RunError at :189-195 have neither. CodeMode.md:68 names Session access (#2025) for the line's owner, while its own requirements at :153 and Goal.md:88 put the line-id mechanism in TimelineTree (#2024). Web.md:153 defines sets() -> Vec<ToolSet>, but the trait is fn sets(&self) -> Vec<Arc<ToolSourceSet>> (crates/dim-agent-capabilities/src/tool_registry.rs:125-135); ToolSet is undefined. Web.md:168 says toolRegistry.registerSource while the dependency table and #2103 use register_source, and Web.md:258 says "belongs to PluginManager (PluginManager)" with no link.
Failure scenario: the catalog would show the wrong process face, the run's error table cannot be returned by its operation, and the two appendices do not compile.
Fix: add name = "codeMode", separate operation errors from program conditions, name one owner for line_owner, use Vec<Arc<ToolSourceSet>>, use one spelling, and link PluginManager.
16. Removed configuration and tool text contracts
Problem: SessionTitle.md:12, :86 and :95 still use maxLength, but the session-title document's defaults, range and user-only/no-project rule are gone; Goal.md:85 keeps maxContinuations without its 1..=1000 range; CodeMode.md:11 names the eight bounds without their values; Goal.md:100 no longer pins the goal_update text that crates/dim-goal/tests/goal_product_flow.rs:487 expects (goal_update recorded: completed.).
Failure scenario: implementers cannot keep the public configuration and tool text, and existing tests break.
Fix: state the retained values or link the schema owner, and say explicitly which texts change.
17. Forward references to open PRs
Problem: the contracts depend on open PRs: #2029 for every rule 7 row, #2091 for SessionStore, #2092 for the line directory, #2093 for SessionScope and line_owner, #2096 for dimAccount and #2100 for ToolExecutor and ToolBinding. Only #2091, #2092 and #2100 are named in the text; #2029 and #2096 are not linked.
Failure scenario: a reader on main cannot resolve the operations the documents call, and the "no requirement remains open" statements hide the landing order.
Fix: list the owning PRs as open dependencies, as the series does elsewhere, and land them in order.
18. Goal's requirement count is wrong
Problem: Goal.md:162 says "Two requirements are listed below", but Goal.md:177-179 lists three: TimelineTree, the input owner and the timeline owner.
Failure scenario: a reader counts two requirements and misses the timeline owner, so the append requirement is never tracked to its owner.
Fix: say three or merge the timeline row.
19. SessionTitle's rule check still lists the Session broadcast
Problem: SessionTitle.md:153 says the part uses the Session broadcast, while the new design observes through TimelineTree read and the Exceptions at SessionTitle.md:123 explicitly remove the subscription.
Failure scenario: the rule check contradicts the flows and keeps a removed dependency visible.
Fix: remove the Session broadcast from the row.
| | The model reports completion or blockage | No: the report changes the goal, and its line is the call's line | the tool handler writes one command input to that line | | ||
| | A client reads the goal of a line | No: the goal is the line owner's state and nothing else publishes it | `goalLine.read` at the line id | | ||
| | The owner states the state to the model | No: the state block restates the whole goal and the live keys when it changes | the branch owner writes the state record input | | ||
| | A command is retried after a lost reply | No: accepting a command once is the input owner's rule | the submission id on `submit` | |
There was a problem hiding this comment.
This row says a retried command is handled by the submission id on submit, but the command requests at docs/design/plugins/Goal.md:96-100 have no submission id and no rule derives one. A client that retries session.goal.set after a lost reply composes a new input and starts a second execution; the verification at Goal.md:146 only tests InputQueue's submit, not Goal's method. Add a submission id to the command requests (or derive it from the client's request id and state that), and move the duplicate test to the method.
There was a problem hiding this comment.
Still open: the command requests at docs/design/plugins/Goal.md:96-98 carry no submission id, and no rule derives one; crates/dim-goal/src/session.rs:162-220 still accepts a plain objective and starts a new change per call.
There was a problem hiding this comment.
Fixed in 5f9a0f1. Goal.md:29 states the retry rule, :96-98 add submissionId? to every write request, :158 names the client-visible request change, and :147 tests the method rather than only submit.
| Some(line) => line, | ||
| None => tree.directory()?.default, // TimelineTree's shape (#2092) | ||
| }; | ||
| let _ = tree.line(LineRequest { line: line.clone() })?; // line_missing for a line that does not exist |
There was a problem hiding this comment.
LineRequest is not a type in the TimelineTree contract this document cites (PR #2092): line takes {line} and answers unknown and closed, not line_missing. The same mismatch appears at docs/design/plugins/Goal.md:103, and the get example at Goal.md:58 never calls line, so it cannot produce the line_missing its row lists. Use the owner's request shape and error names, and either add the line check to get or drop line_missing from it.
There was a problem hiding this comment.
Still open: LineRequest is still undefined at docs/design/plugins/Goal.md:46; the TimelineTree contract takes {line} and its example calls tree.line(id) (PR #2092), and the owner's error is unknown, not unknown_branch.
| | Owner | Operation | Use | | ||
| | --- | --- | --- | | ||
| | TimelineTree ([#2024](https://github.com/arcships/dim/issues/2024)) | `directory`, `line`, `read`, `create`, `end` | The conversation line; one line's record for the named line; an ended line's facts; opening and closing the evaluator line | | ||
| | The line's input owner ([#2027](https://github.com/arcships/dim/issues/2027)) | `submit` | The command input and the state record input | |
There was a problem hiding this comment.
This row gives the state record to the input owner's submit, but docs/design/plugins/Goal.md:179 says the timeline's append accepts an input-message draft and that Goal appends the fact and then the record, and Goal.md:113 says the branch decision appends both. Name one writer: submit for the state record and append only for the business fact, or append for both with the input owner's involvement stated; the current text cannot be implemented both ways.
There was a problem hiding this comment.
Still open: docs/design/plugins/Goal.md:81 still gives the state record to the input owner's submit, while :113, :116 and :192 append it with the timeline's append; docs/design/contracts/runtime-owner-operations.md:21 now says timeline.append for the record.
There was a problem hiding this comment.
Fixed in 5f9a0f1. Goal.md:81 gives the input owner's submit the command input only; :82 gives the timeline's append the business fact and then the state record; :113, :192 and runtime-owner-operations.md:21 agree.
| | `session.goal.*` write | Check parameters, resolve the line, compose the command input, submit it; the input owner commits it in order | Before submission nothing is written; after submission the input stays and the branch owner decides | Nothing to release: no id crossed | `closed` once the Session or the input owner is closing | the input owner; the entry holds nothing | | ||
| | `goalLine.read` | Wait for the branch part's fold to reach its head, answer the value | The wait stops; the value is unaffected | Nothing to release | `closed` when the part is closing | the branch part | | ||
| | Branch decision | Consume a command input, decide from the fold, append the business fact, append the state record, then write the continuation or ask for an evaluation | The line's closers end the branch part's tasks; an admitted input is not withdrawn | — | Closing cancels the tasks, writes `paused` with its reason, then the services are withdrawn | the branch part: its own tasks, the fact and the record; the input owner: the continuation it accepted | | ||
| | Evaluator line | Open a child line at the turn end with Goal's operation id; the evaluator reports a conclusion; Goal closes the line | The line's close stops the decision that would open it | — | On rebuild and on close Goal closes the evaluator lines it opened, before the Session closes | the branch part asks; TimelineTree creates, holds and closes the line | |
There was a problem hiding this comment.
The evaluator flow opens a child line, but docs/design/plugins/Goal.md:19 and :96 allow a goal on any line, and TimelineTree's create refuses a non-opener line (not_opener) and the Session cap (limit_reached) in PR #2092. Neither refusal appears in Goal's flows or errors, so a judge: "evaluator" goal on a child line cannot create its evaluator and the goal stays active across turn ends. State the refusal and the paused reason, or restrict judge: "evaluator" to lines that may open one.
There was a problem hiding this comment.
Still open: docs/design/plugins/Goal.md:114 and :131 open a child line, but the flows and errors at :109-127 name neither branch_not_opener nor branch_limit_reached from TimelineTree's create (PR #2092; crates/dim-agent-runtime/src/error.rs:161-170).
There was a problem hiding this comment.
| #[rutis::service] | ||
| impl GoalLine { | ||
| /// The goal of this line now; waits until the fold reaches the head. | ||
| pub async fn read(&self) -> Result<GoalValue, GoalError>; |
There was a problem hiding this comment.
read takes no cancellation argument, while docs/design/plugins/Goal.md:101 and :112 say the wait can stop and Goal.md:183 says cancelled is the binding's cancellation argument; GoalError also has a Cancelled variant this face cannot produce. Add the cancellation argument and show how NoInstance and Closed map, or remove the cancellation claim from the read row and the flow.
There was a problem hiding this comment.
Still open: docs/design/plugins/Goal.md:105 still says cancelled is the binding's cancellation argument, but the appendix at :214 declares read(&self) with no argument and the flow at :112 says the wait stops.
There was a problem hiding this comment.
Fixed in 5f9a0f1. Goal.md:105 keeps the cancellation claim, the appendix at :275 declares read(&self, cancelled: CancelledFn), and :112 says the wait stops while the value is unaffected.
| | Owner and issue | Dim runtime / ToolExecutor mechanism owner; [#1276](https://github.com/arcships/dim/issues/1276). | | ||
| | `invalid` | Fix the program: it exceeds the code byte limit | | ||
| | `closed` | The line's run owner, the executor or the process quota is unloading; the next generation serves the next call | | ||
| | `interrupted` | The turn was interrupted before the gate existed; the run answers a cancellation result | |
There was a problem hiding this comment.
interrupted and gate_closed are not operation errors of codeModeLine.run: its error list at docs/design/plugins/CodeMode.md:79 and RunError at :189-195 contain neither, and both are ToolExecutor kinds in #2100 (a child call or a close after settlement). Keep the operation's own errors in this table and state the program-visible conditions separately, or add the variants to RunError and the run's error list.
There was a problem hiding this comment.
Partly fixed: docs/design/plugins/CodeMode.md:82 now says gate_closed, interrupted and no_batch are ToolExecutor's errors, but the Errors table at :100-101 still lists interrupted and gate_closed beside the run's own invalid, closed and cancelled.
There was a problem hiding this comment.
Partly fixed in 5f9a0f1. CodeMode.md:84 now scopes gate_closed, interrupted and no_batch to ToolExecutor. Remaining: the Errors table at :102-103 still lists interrupted and gate_closed beside the run's own invalid, closed and cancelled. Label the table as covering the child operations too, or drop them from the run's table.
There was a problem hiding this comment.
Fixed in 8f440bd. CodeMode.md:102-105 labels interrupted, no_batch and gate_closed as ToolExecutor's kinds, and scopes the run's own errors to invalid, closed and cancelled.
| ```rust | ||
| use rutis::host::BoxFuture; | ||
|
|
||
| #[rutis::service] |
There was a problem hiding this comment.
The process face is documented as codeMode (docs/design/plugins/README.md:37, and the operations table at docs/design/plugins/CodeMode.md:80), but this marks the type ProgramSlots with a plain #[rutis::service]; one Rust type is one name, so the catalog name would be programSlots. PR #2096 shows the pattern for a different name: #[rutis::service(name = "dimAccount")]. Add name = "codeMode" to the attribute or rename the type.
There was a problem hiding this comment.
Still open: docs/design/plugins/CodeMode.md:170 says the process part provides codeMode, while the appendix at :175 still marks ProgramSlots with a plain #[rutis::service]; add name = "codeMode" or rename the type.
There was a problem hiding this comment.
Partly fixed in 5f9a0f1. CodeMode.md:174 now says both names are set with #[rutis::service(name = ...)]. Remaining: the appendix at :179 still marks ProgramSlots with a plain #[rutis::service], so the catalog name is programSlots, not codeMode.
There was a problem hiding this comment.
Fixed in 8f440bd. CodeMode.md:181 sets name = "codeMode"; the appendix and the prose agree.
| - Non-interactive Sessions see the same declarations for the same configuration and can use them; the tool set stays the same across Sessions (#30). | ||
| - Never visible: `structuredContent`, the service name, configuration, the API key, private-host exceptions, diagnostics. | ||
| - Fetched page text is untrusted third-party content placed in a tool result without instruction framing (A14). | ||
| The account owner is read by its face name when the source names no search adapter. A profile without an account owner declares `web_fetch` only; a profile with one declares `web_search` while that owner reports a usable account. |
There was a problem hiding this comment.
This sentence says a profile without the account owner declares web_fetch only, but the same document keeps the configured adapter path in A.5 (docs/design/plugins/Web.md:252) and Appendix D.1, and the implementation declares web_search for an adapter with its API key (crates/dim-app-server/src/web.rs:1017-1022). An operator with a configured adapter and no Dim account would lose web_search. State that a configured adapter with a key declares the tool regardless of the account, and that the account decides only when the source names no adapter or a dim-oauth configuration.
There was a problem hiding this comment.
Still open: docs/design/plugins/Web.md:72 still says a profile without the account owner declares web_fetch only, while A.5 at :264 and E A3 at :350 keep the configured adapter path, and crates/dim-app-server/src/web.rs:1015-1022 declares web_search for an adapter with its key.
There was a problem hiding this comment.
Fixed in 5f9a0f1. Web.md:72 keeps the configured adapter path and sends the account read only when the source names no adapter or dim-oauth; crates/dim-app-server/src/web.rs:1017-1022 declares web_search for an adapter with its key without an account.
| /// The dynamic source: `sets()` answers one set with `web_search` while a | ||
| /// search service is usable and no set otherwise. | ||
| impl ToolProvider for SearchSource { | ||
| fn sets(&self) -> Vec<ToolSet>; |
There was a problem hiding this comment.
ToolSet is undefined: the trait is fn sets(&self) -> Vec<Arc<ToolSourceSet>> (crates/dim-agent-capabilities/src/tool_registry.rs:125-135), with ToolSourceSet at :132. The signature as written does not implement ToolProvider. Use the real type and return type; also align registerSource at docs/design/plugins/Web.md:168 with the register_source spelling used by the dependency table and #2103.
There was a problem hiding this comment.
Still open: docs/design/plugins/Web.md:165 still returns Vec<ToolSet>; the trait is fn sets(&self) -> Vec<Arc<ToolSourceSet>> (crates/dim-agent-capabilities/src/tool_registry.rs:125-135), and registerSource at :180 still differs from register_source at :70.
There was a problem hiding this comment.
Fixed in 5f9a0f1. Web.md:165 returns Vec<Arc<ToolSourceSet>> and :180 uses register_source; the trait at crates/dim-agent-capabilities/src/tool_registry.rs:125-128 matches.
| | `proxyDns` | boolean; user-only | `true` | | ||
|
|
||
| Read at each call and used as delivered: Settings validates the document against the schema Web declares and applies its defaults on write and when reading a persisted file, and Web does not validate it again. Web has no tool that writes configuration, so the document is written only through the client methods (S8b). A change is a data update with notification, never a reload. The row's structural on/off state belongs to PluginManager (§6). Built-in adapter ids are an implementation choice (A13). The API key is `searchService.apiKey` (§1). | ||
| Read at each call and used as delivered: Settings validates the document against the schema Web declares and applies its defaults on write and when reading a persisted file, and Web does not validate it again. Web has no tool that writes configuration, so the document is written only through the client methods (S8b). A change is a data update with notification, never a reload. The row's structural on/off state belongs to PluginManager (PluginManager). Built-in adapter ids are an implementation choice (A13). The API key is `searchService.apiKey` (A.5). |
There was a problem hiding this comment.
PluginManager (PluginManager) repeats the name and drops the link the previous text had to the plugin manager's contract. Point at the PluginManager document (or the anchor that owns the built-in row's on/off state) so the reader can find the structural owner.
There was a problem hiding this comment.
Still open: docs/design/plugins/Web.md:270 still reads PluginManager (PluginManager) with no link to the plugin manager's contract.
There was a problem hiding this comment.
Fixed in 5f9a0f1. Web.md:270 links PluginManager.md instead of repeating the name.
|
自查完成(A–G),head
|
2f15ff7 to
9783fa5
Compare
|
分支已清理为 docs-only,head
文件清单: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: this PR rewrites the Goal, SessionTitle, Web and Code Mode owner contracts and the plugin index for the owner-operations series (refs #2033 and #2015), moving callers to line-id operations, the store's change callback and the account face, and deleting about 1400 lines of mechanism detail.
Verdict: REQUEST_CHANGES
Round-1 status
Round 1 had 1 P1, 11 P2 and 7 P3. The P1 is fixed on the wire shape: docs/design/plugins/Goal.md:99 now matches GoalRead ({branchId, through, goal?} with {objective, status, evaluator}), and GoalJudge is gone. The nonexistent GoalStatus remains and is now P2. Of the P2s, nine are open and two are partial: docs/design/contracts/runtime-owner-operations.md now states the Goal write order and the Chinese mirrors carry a stale note; the standing docs, the companions and the rest are unchanged. Of the P3s, four are open and three are partial.
P1
None open. The round-1 wire-shape break is fixed at docs/design/plugins/Goal.md:99.
P2
1. The Goal command reply sequence changes meaning and contradicts the caller example
Problem: docs/design/plugins/Goal.md:96 defines the reply as {sequence}: the accepted input's position. Goal.md:38 says the same call has "no sequence", :153 says the field stays, and :157 says no client field changes. The current reply is the trigger's sequence (crates/dim-goal/src/session.rs:163 and :220), and crates/dim-goal/tests/goal_product_flow.rs:335 asserts that value; docs/design/plugins/Goal-state-read.md:79 still states it, and the Supersedes list at Goal.md:150 does not include it.
Failure scenario: a client or test that reads from the returned sequence now starts at the command input instead of the trigger. The product-flow test goal_continues_to_the_limit_and_stops_on_completion fails, and a client that positions the state read by the reply sees the input, not the state record.
Fix: keep the trigger's sequence in the reply and remove the input-position wording, or state the semantic change, migrate the test and every caller, and add Goal-state-read.md:79 to the Supersedes list.
2. Goal's state record still has two writers
Problem: docs/design/plugins/Goal.md:81 gives the input owner's submit "the command input and the state record input". :113 and :116 append the business fact and then the state record, and :192 says the timeline's append accepts both and Goal appends the fact and then the record. docs/design/contracts/runtime-owner-operations.md:21 now says Goal appends its state record with timeline.append.
Failure scenario: an implementation either bypasses the input owner's ordering and idempotency by appending the record directly, or follows submit and cannot follow append. The two rows cannot both hold.
Fix: make submit carry only the command input and append carry the fact and the record, or make append carry both with the input owner's role stated.
3. goalLine.read is documented as cancellable but takes no cancellation argument
Problem: docs/design/plugins/Goal.md:105 says cancelled is the binding's cancellation argument and :112 says the wait stops, but the appendix at :214 declares pub async fn read(&self) with no argument.
Failure scenario: a Session unload or a dropped caller cannot stop the wait, so the cancellation column and the flow row cannot be implemented.
Fix: add the cancellation argument and show how closed and NoInstance map, or remove the cancellation claim from the row, the flow and the appendix.
4. Goal's command requests have no submission id
Problem: docs/design/plugins/Goal.md:29 makes retry safety the input owner's rule ("the submission id on submit"), and :146 verifies that one submission id is accepted once, but the command requests at :96-98 carry no submission id and no rule derives one. :191 repeats that submit receives one with its submission id.
Failure scenario: a client that retries session.goal.set after a lost reply composes a new input and starts a second execution. The verification only exercises the input owner, not Goal's method.
Fix: carry a submission id in the command requests or derive it from the client's request id, and test the method.
5. session.goal.get on an ended line becomes a client-visible change
Problem: docs/design/plugins/Goal.md:143 verifies that get on an ended line answers service_reloading, and :133 says Goal does not answer for an ended line. Today crates/dim-goal/src/session.rs:116-128 falls back to crate::read::current and answers the last GoalRead from facts (crates/dim-goal/src/read.rs:34-53), and the CLI displays it (crates/dim-cli/src/goal_command.rs:32-60). Goal.md:157 says no client field, code or notification changes.
Failure scenario: /goal on an ended line shows no goal or an error after the delivery, unless every client is migrated to fold the line's facts. The contract names that migration as business at Goal.md:21 and :30 but not in Client-visible changes.
Fix: state the client change and the affected clients, or keep the ended-line read in the owner.
6. GoalStatus is not an existing type
Problem: docs/design/plugins/Goal.md:206 declares status: GoalStatus and :227 calls GoalStatus and GoalView "the existing types in dim_agent_types". The crate has GoalView and GoalViewStatus (crates/dim-agent-types/src/goal.rs:5-29); GoalStatus does not exist. The wire-shape part of the round-1 P1 is fixed.
Failure scenario: the binding appendix does not compile against the crate it cites, and an implementer adds a parallel type where GoalViewStatus is the existing one.
Fix: use GoalViewStatus, or define GoalStatus in the contract and stop calling it existing.
7. The evaluator line's refusals are missing
Problem: docs/design/plugins/Goal.md:114 and :131 open a child line with TimelineTree's create, but Goal's flows and errors at :109-127 name neither branch_not_opener nor branch_limit_reached, the two create refusals in the TimelineTree contract (PR #2092; crates/dim-agent-runtime/src/error.rs:161-170).
Failure scenario: a judge: "evaluator" goal on a child line cannot open the evaluator. The goal stays active and retries at every turn end, or the branch decision fails without a terminal state.
Fix: name the refusal and the paused reason, or refuse judge: "evaluator" on lines that cannot open one.
8. SessionTitle depends on open #2091 with a different binding
Problem: docs/design/plugins/SessionTitle.md:181 says "None open" and calls #2091 SessionStore's current contract, but #2091 is open and main still implements the revision-checked setTitle (crates/dim-app-server/src/storage/metadata.rs:201). The appendix at :216-218 defines a synchronous TitleChange over Option<StoredTitle> returning Result<..., Rejected>. #2091's ChangeFn is an async BoxFuture over TitleState returning Result<Option<Title>, StoreRejected>, and its set_title takes caller: &Ctx, the request and the change, with no cancellation argument. The examples at :40-45 and :68-72 call TitleChange::new, pass cancelled and omit the caller; StoredTitle and Rejected are not defined there. The rule check at :166 says one requirement is open while the Requirements section says none.
Failure scenario: the appendix and both caller examples do not compile against the store the contract depends on. #2091 also edits SessionTitle.md, session-title-metadata.md, resource-owner-operations.md and resource-faces.md, so landing order is hidden.
Fix: mark #2091 as the open owning PR in the dependency table, use TitleState, the async ChangeFn, StoreRejected and the caller parameter, remove the cancellation argument, and reconcile the requirement count.
9. Web declares web_search without the account even with a configured adapter
Problem: docs/design/plugins/Web.md:72 says "A profile without an account owner declares web_fetch only". A.5 at :264 and Appendix E A3 at :350 keep the configured adapter path, and crates/dim-app-server/src/web.rs:1015-1022 returns true for a brave adapter with its API key without a signed-in account.
Failure scenario: an operator with a configured search adapter and no Dim account loses web_search, contradicting the source's own searchService field and acceptance test 1.
Fix: state that a configured adapter with a key declares web_search regardless of the account, and that the account decides only when the source names no adapter or a dim-oauth configuration.
10. Code Mode's v4 gate reads a protocol version SessionScope does not provide
Problem: docs/design/plugins/CodeMode.md:29 and :72 gate the tool on the client's protocol version from SessionScope's config. SessionScope's config returns SessionConfig (PR #2093), and SessionConfig has no protocol version (crates/dim-agent-runtime/src/config.rs:39-88). The current gate is SessionConfig.excluded_tools, set by exclude_codemode_below (config.rs:190-192, called at crates/dim-app-server/src/agents.rs:1588 and :2004).
Failure scenario: the entry cannot compose the gate; a v3 Session may be offered codemode, or a v4 Session may be refused.
Fix: keep the mount exclusion as the gate and state it, or add a protocol-version read to SessionScope's contract and link it.
11. Code Mode's slot and executor examples do not compile
Problem: docs/design/plugins/CodeMode.md:54-59 passes work to with_slot that returns Ok(program_result(outcome, effects)), but with_slot at :179-184 takes caller: &Ctx and a work callback returning Result<(), ServiceError>; the example omits the caller and returns a ToolResult, so the outer result is dropped. executor.open at :55 omits the caller: &Ctx that ToolExecutor's binding takes, and executor.close at :57 passes cancelled while ToolExecutor's close takes the caller and CloseRequest with no cancellation argument (PR #2100).
Failure scenario: the appendix does not compile and the run cannot answer the outer call.
Fix: take the caller in the examples, make with_slot generic over the work's reply or capture the result outside, and call close with the request only.
12. The rewrite deletes anchors that standing documents still link
Problem: 34 links into the rewritten documents now miss their headings, including crates/dim-cli/README.md:744, crates/dim-oauth/docs/design.md:20, crates/dim-oauth/docs/runtime-contract.md:12, docs/design/timeline-branches.md:249, :253, :312, :323, :507, :556, docs/design/plugins/Pursuit.md:16, :36, :46, :50, :58, :81, :93, docs/design/model-prompts.md:229, docs/design/plugins/Scheduler.md:514, docs/design/plugins/Skills.md:526, docs/design/plugins/Hooks.md:186, docs/design/appserver/idle-unload.md:110, docs/design/appserver/session-notices.md:5, docs/design/overview.md:563, docs/design/acp-gateway-implementation.md:268, docs/design/timeline-read-followups.md:15 and docs/zh/design/plugins/SessionTitle.md:183. No repository check validates Markdown anchors.
Failure scenario: a reader following any of these links lands at the top of the document with no matching section; the S5b title metadata and the CLI contract lose the referenced rule.
Fix: update every referrer to the new heading, or keep compatibility anchors for the old names, and list anything another PR owns.
13. Standing and companion documents still state the removed behavior
Problem: docs/design/overview.md:71, :166 and :229 still fold the goal from goal:objective and goal:status blocks and still have the methods read state; docs/design/plugin-contract.md:110 still lists sessionMetadata; docs/design/appserver/session-title-metadata.md:22 and :205 still define setTitle {sessionId, expectedRevision, title} with a conflict retry, while SessionTitle.md:98 says the caller keeps no retry; docs/design/cli-commands.md:605 still says every call replies with its input's sequence. docs/design/plugins/Goal-state-read.md:77-79 still requires one atomic append_batch and the trigger's sequence; docs/design/plugins/Pursuit.md:17, :56, :57, :68 and :178 still use treeCommands.create, branch/create-failed and treeCommands.input/end. The Chinese mirrors now carry a stale note, but nothing marks these English pages stale.
Failure scenario: two authoritative rules for one owner; an implementer keeps the atomic batch, the revision retry or the old tree API.
Fix: update the referrers in this PR, or mark each old section as superseded and name the PR that will update it.
P3
14. Goal's line request and error names still do not match TimelineTree
Problem: docs/design/plugins/Goal.md:46 calls tree.line(LineRequest { line }), but the TimelineTree contract takes {line} and its example calls tree.line(id) (PR #2092); LineRequest is not defined there. Goal.md:103 calls unknown_branch TimelineTree's line refusal, but the owner's error is unknown; the get row at :99 lists unknown_branch, while its example at :57-63 only resolves line_owner and maps NoInstance to service_reloading, so the row cannot produce that code.
Failure scenario: the example does not compile, and a client that names an unknown line receives service_reloading (shown as no goal) instead of unknown_branch.
Fix: use tree.line(line) and the owner's unknown kind, or state the RPC mapping; add the line check to the get example or drop unknown_branch from its row.
15. Goal's requirement count is still wrong
Problem: docs/design/plugins/Goal.md:173 says "Two requirements are listed below", but :190-192 lists three: TimelineTree, the input owner and the timeline owner.
Failure scenario: the append requirement is not tracked to its owner.
Fix: say three or merge the timeline row.
16. SessionTitle's rule check still lists the Session broadcast
Problem: docs/design/plugins/SessionTitle.md:165 lists the Session broadcast, while :108 and :123 observe the first adopted input at a fixed cutoff and subscribe to nothing.
Failure scenario: the rule check contradicts the flows and keeps a removed dependency visible.
Fix: remove the broadcast from the row.
17. SessionTitle's example names undefined values
Problem: docs/design/plugins/SessionTitle.md:57 reads line: ROOT and fields: INPUT_FIELDS; neither is defined in the contract. The conversation line is tree.directory()?.default, as docs/design/plugins/Goal.md:44 uses.
Failure scenario: the example does not compile, or it titles from a line that is not the conversation line after the default moves.
Fix: resolve the default first and name the field selection.
18. Code Mode and Web binding details are incomplete
Problem: docs/design/plugins/CodeMode.md:170 says the process part provides codeMode, but the appendix at :175 marks ProgramSlots with a plain #[rutis::service], whose catalog name is programSlots; :70 gives adopted {requestId} the reply {adopted}, while ToolBinding answers {adoption, tools} (PR #2100). docs/design/plugins/Web.md:165 returns Vec<ToolSet>; the trait is fn sets(&self) -> Vec<Arc<ToolSourceSet>> (crates/dim-agent-capabilities/src/tool_registry.rs:125-135). Web.md:180 says registerSource while :70 says register_source, and :270 reads PluginManager (PluginManager) with no link.
Failure scenario: the catalog shows the wrong process face, the adopted read does not match its owner, and the appendices do not compile.
Fix: add name = "codeMode", use {adoption, tools}, Vec<Arc<ToolSourceSet>> and one registration spelling, and link PluginManager.
19. Open dependencies are still not listed as such
Problem: docs/design/plugins/SessionTitle.md:181 says "None open" while #2091 is open; docs/design/plugins/Web.md:69 and docs/design/plugins/Goal.md:80 link issue #2019 and #2024 rather than the owning PRs #2096 and #2092; #2029 (ADR 027) is not linked. The Goal and Code Mode requirement sections still cite issues with no landing order.
Failure scenario: a reader on main cannot resolve the operations the documents call, and the "no requirement remains open" statements hide the order.
Fix: list the owning PRs as open dependencies in each dependency table and land them in order.
20. Removed configuration and verification text is not recoverable
Problem: docs/design/plugins/SessionTitle.md:3 and :146 put the generation policy, the text rules and the acceptance list in a previous version of the document that is no longer in the tree; maxLength's default and range are still absent (:86). Goal's maxContinuations range (Goal.md:85) and Code Mode's eight bound values (CodeMode.md:11) are also absent.
Failure scenario: implementers cannot keep the public configuration, and the acceptance list cannot be verified from the contract.
Fix: state the retained values in the contract or link the schema owner, and say which texts and acceptance items change.
| | C7:本轮非自动续行驱动,或调用过工具,或连续无进展轮数仍小于 3 | 暂停,reason=no_progress。 | | ||
| | Operation | Intent | Request | Reply | Cancellation | Errors | | ||
| | --- | --- | --- | --- | --- | --- | | ||
| | `session.goal.set` | Start a new execution of a goal on a line | `{sessionId, branchId?, objective, judge?}` | `{sequence}`: the accepted input's position | Before the input is submitted | `invalid_params`, `branch_ended`, `unknown_branch`, `service_reloading`, `closed`, `operation_interrupted` | |
There was a problem hiding this comment.
{sequence} here is defined as the accepted input's position, but the current reply is the trigger's sequence (crates/dim-goal/src/session.rs:163 and :220), crates/dim-goal/tests/goal_product_flow.rs:335 asserts that value, and docs/design/plugins/Goal-state-read.md:79 still states it. Goal.md:38 also says the call has "no sequence" and :157 says no client field changes. Keep the trigger's sequence, or state the semantic change and migrate the test and every caller.
There was a problem hiding this comment.
Fixed in 5f9a0f1. Goal.md:38, :96 and :158 define {sequence} as the committed command input's sequence. The current code returns the trigger's sequence (crates/dim-goal/src/branch.rs:597-605), and crates/dim-goal/tests/goal_product_flow.rs:335 calls the value the set trigger, so "as today" holds.
| ### A.6 Timeline mechanics | ||
| - `set` writes one input to the named line; the branch owner states `active` with the objective; `get` answers the same value while the line is live. | ||
| - `pause`, `resume` and `clear` change the status in the stated order; a paused goal does not continue; `clear` retires the model-visible keys. | ||
| - `get` on an ended line answers `service_reloading`, and the line's facts still carry the last state for a client that folds them. |
There was a problem hiding this comment.
This is a client-visible change: today session.goal.get on an ended line answers the last GoalRead from facts (crates/dim-goal/src/session.rs:116-128, crates/dim-goal/src/read.rs:34-53) and the CLI displays it (crates/dim-cli/src/goal_command.rs:32-60). After this row it answers service_reloading, so /goal on an ended line shows no goal unless the client folds the line's facts, while Goal.md:157 says no client-visible changes. Name the client migration and the affected clients, or keep the read.
There was a problem hiding this comment.
Fixed in 5f9a0f1. Goal.md:159 states the ended-line change, names the CLI and session-host readers, and gives the migration; :99 and :144 answer service_reloading for an ended line.
| | §4 rule 5 (batches) | The fact and the record are separate appends in that order, so recovery never reads state that was not committed. | | ||
| | §4 rule 6 (context) | The model reads goals only through adopted inputs; `goalLine.read` serves callers, not context preparation. | | ||
| | §4 rule 7 (public events and services) | The branch part uses the Dispatcher, its timeline, TimelineTree and the input owner; the entry uses the registration points and the mechanism. | | ||
| | §4 rule 8 (requirements) | Two requirements are listed below; no core change. | |
There was a problem hiding this comment.
Three requirements are listed at :190-192 (TimelineTree, the input owner, the timeline owner), not two. Say three or merge the timeline row.
| | --- | --- | --- | | ||
| | Session access ([#2025](https://github.com/arcships/dim/issues/2025)) | the line's owner by line id | The entry reaches `CodeModeLine`; the run reaches the line's ToolExecutor | | ||
| | ToolExecutor ([#2028](https://github.com/arcships/dim/issues/2028)) | `open {parentCallId, context}` → `{gateId}`; `invoke {gateId, call}` → `{result}`; `close {gateId}` → `{effects}` | Child calls, admission, child facts; the run closes the gate to word its result, and the owner closes it again at parent settlement with the effects merged once | | ||
| | ToolBinding ([#2028](https://github.com/arcships/dim/issues/2028)) | `adopted {requestId}` → `{adopted}` | The request's pinned declarations for `tools.list`, `tools.describe`, `tools.call` | |
There was a problem hiding this comment.
The owner's reply is {adoption, tools} (docs/design/plugins/ToolBinding.md in PR #2100), not {adopted}. The run needs both the adoption id and the pinned declarations; fix the row to the owner's shape.
There was a problem hiding this comment.
Fixed in 8f440bd. runtime-owner-operations.md:76 now says adopted({requestId}) -> {adoption, tools}; #2100 ToolBinding.md:137-138 matches.
| ## 5. Context mapping | ||
| ```rust | ||
| let text = title_text(params.title.as_deref(), &document)?; // owner rules: trim, no control characters, length | ||
| let change = TitleChange::new(move |current: Option<StoredTitle>| { |
There was a problem hiding this comment.
TitleChange::new has no constructor: TitleChange is defined at :216-218 as a bare Arc<dyn Fn...>. The callback is synchronous over Option<StoredTitle> returning Rejected, while #2091's ChangeFn is an async BoxFuture over TitleState returning StoreRejected, and its set_title takes caller: &Ctx, the request and the change with no cancellation argument. The examples at :45 and :72 therefore pass an extra cancelled and no caller. Use the store's ChangeFn, TitleState and StoreRejected and the caller parameter, or state that this is a different adapter.
9783fa5 to
5f9a0f1
Compare
|
已按评审与自查标准修改,head 评审逐条#1 sequence:回复保持 自查(第 1–3、6–7 条)
绑定附录编译四份附录放进临时 crate( 客户端可见变更
评审人请重看。 |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope
This PR rewrites the four product owner contracts (Goal, SessionTitle, Web and Code Mode) and the plugin index for the owner-operations series (refs #2033 and #2015). It moves callers to line-id operations, SessionStore's change callback and the account face, and deletes about 1400 lines of mechanism detail. I reviewed the full main...head at 5f9a0f1, not only the round-4 delta.
Verdict
REQUEST_CHANGES
Round-2 status
Fixed and withdrawn:
- P2 1 sequence, 2 state writer, 3 read cancellation, 4 submission id, 5 ended-line get, 6
GoalStatus, 7 evaluator refusals, 8 SessionTitle #2091, 9 Web account, 10 CodeMode gate. - P3 14
LineRequest, 15 requirement count, 16 broadcast, 17ROOT/INPUT_FIELDS. - The round-1 P1 wire shape remains fixed.
Partly fixed:
- P2 11 CodeMode slot example: caller and close are fixed, and the example returns the result; the operations table still drops it and the appendix uses an undefined callback type (P2 6 below).
- P2 12 anchors: SessionTitle is mostly fixed; Goal is not (P2 1 below).
- P2 13 standing documents: the metadata doc is still wrong and Pursuit E1 still names
treeCommands(P2 3 and P3 below). - P3 18 binding details: adopted,
ToolSet,register_sourceand the PluginManager link are fixed; thecodeModename is not (P2 7 below). - P3 19 open dependencies: narrowed to the Goal and Web rows (P3 below).
- P3 20 previous version: values are now stated; the acceptance list still points at a version not in the tree (P3 below).
P1
None.
P2
1. The Goal compatibility anchors still do not match the links they are meant to preserve
Problem: The new Goal compatibility section uses the Chinese mirror's headings (### 2. 数据与状态, ### A.2 Session 方法), but every broken referrer uses the English headings of the base document (#2-data-and-state, #a2-session-methods). 25 link occurrences (21 distinct source and anchor pairs) into Goal.md still break, and all of them were valid at 6e86d48. SessionTitle.md fixed most of its file with English anchors, but ### 0.1 Fields read for one title attempt is missing, leaving 3 more.
Failure scenario: A reader following docs/design/timeline-branches.md:249 or docs/design/cli-commands.md:576 lands at the top of Goal.md; the context-mapping, branch-clearing and A.2/A.3/A.5 rules the links name are unreachable. A reader following docs/design/plugins/Skills.md:526 or Hooks.md:186 loses SessionTitle's field-selection rule.
Evidence: docs/design/plugins/Goal.md:199-253; broken links at docs/design/timeline-branches.md:249, :253, :312, :507, :556, docs/design/model-prompts.md:229, docs/design/cli-commands.md:576, :622, docs/design/plugins/Pursuit.md:16, :36, :46, :50, :81, crates/dim-cli/README.md:744, docs/design/plugins/Scheduler.md:514, docs/design/acp-gateway-implementation.md:268. docs/design/plugins/SessionTitle.md:204-258; docs/design/plugins/Hooks.md:186, docs/design/plugins/Skills.md:526, docs/design/timeline-read-followups.md:15.
Fix: Use the base English heading text for the Goal anchors (### 2. Data and state, ### 3.4 A new branch clears the inherited goal, ### 5. Context mapping, ### A.2 Session methods, and so on), or add explicit <a id="2-data-and-state"></a> anchors. Add ### 0.1 Fields read for one title attempt to SessionTitle.
2. Goal's error codes do not match the input owner or the codes clients receive today
Problem: Goal.md:103 and :158 say every listed code is one the client already receives. Two are not. AgentError::UnknownBranch maps to session_invalid_input, and crates/dim-goal/tests/goal_product_flow.rs:540 asserts that for a missing branchId; AgentError::Closed maps to session_closed (crates/dim-agent-capabilities/src/methods.rs:138-139). Goal.md:103 also says branch_ended is the input owner's refusal, but PR #2102's submit answers line_ended and closed (InputQueue.md:81, :92), not branch_ended. The retained row runtime-owner-operations.md:25 repeats the same confusion: the tree's line answers unknown, not unknown_branch (PR #2092, TimelineTree.md:131, :153).
Failure scenario: An implementer who makes the table true changes the wire code for a missing line from session_invalid_input to unknown_branch; the existing test at crates/dim-goal/tests/goal_product_flow.rs:540 fails, and the wire code /goal receives for a missing line changes. An implementer who keeps today's mapping still answers session_invalid_input, which the table omits and clients do not handle. Mapping submit's line_ended to branch_ended is stated nowhere, so the entry and the owner disagree. session.goal.get on an unknown line also becomes service_reloading through NoInstance, a client-visible change that Goal.md:159 does not list.
Evidence: docs/design/plugins/Goal.md:96-99, :103, :125, :158-159; crates/dim-agent-capabilities/src/methods.rs:138-139, :186-191; crates/dim-goal/tests/goal_product_flow.rs:540; PR #2102 docs/design/plugins/InputQueue.md:81, :92; PR #2092 docs/design/plugins/TimelineTree.md:131, :153; docs/design/contracts/runtime-owner-operations.md:25.
Fix: Keep today's RPC codes and state the mapping (line_ended to branch_ended, unknown to session_invalid_input, data-face closed to session_closed), or list the new codes as client-visible changes and migrate the test, the CLI and the session-host readers. Make the retained line row say unknown.
3. session-title-metadata.md now states an unimplementable setTitle request and contradicts its own table
Problem: The round-4 replacement puts the phrase "the change callback's current title and revision" inside a request shape, and repeats it inside "commits revision ... + 1". The result is not an implementable request. It contradicts the document's own table at :91 ({id} plus the change), :15 ("revision-checked write") and :95 ("title is required in setTitle"). PR #2091's head already has the coherent text: store.title and store.setTitle(id, change), with no expectedRevision (session-title-metadata.md:3, :22-24, :93).
Failure scenario: An S5b implementer cannot tell whether the request carries a session id, a title, the current revision or a callback; the summary and the method table describe different protocols. The PR and #2091 edit the same paragraphs, so landing either first leaves a semantic conflict.
Evidence: docs/design/appserver/session-title-metadata.md:15, :21-22, :28-29, :91, :95; docs/design/plugins/SessionTitle.md:101; PR #2091 head docs/design/appserver/session-title-metadata.md:3, :22-24, :30, :93; PR #2091 head docs/design/plugins/SessionStore.md:121-122.
Fix: Use #2091's wording: setTitle {id} plus a change callback that receives the current {revision, title} and returns the next title or its own refusal; the store commits the returned title as the next revision and fails rejected, not_found or storage. Update :15, :28-29 and :95 with it, or drop this file from the PR and let #2091 own it.
4. runtime-owner-operations.md still gives toolBinding.adopted the wrong reply
Problem: The retained row says adopted({requestId}) -> {adopted}. Code Mode's table at :72 says {adoption, tools}, and PR #2100's ToolBinding.md:137-138 defines the reply as the adoption id plus the pinned declarations. #2100's copy of the same runtime row already says {adoption, tools}.
Failure scenario: Code Mode's tools.list, tools.describe and tools.call need both the adoption id and the declarations. An implementer following {adopted} returns one opaque value and cannot pass the adoption to invoke or list the pinned tools.
Evidence: docs/design/contracts/runtime-owner-operations.md:76; docs/design/plugins/CodeMode.md:72; PR #2100 docs/design/plugins/ToolBinding.md:137-138; PR #2100 docs/design/contracts/runtime-owner-operations.md:76.
Fix: Change the row to adopted({requestId}) -> {adoption, tools}.
5. Code Mode's dependency table still names SessionScope (#2093) for the line-id mechanism
Problem: CodeMode.md:70 names Session access (#2025, target, pending #2093) as the owner that provides "the line's owner by line id". The same document's requirements at :166-168 say the mechanism is #2127 and "SessionScope's contract has no such operation". PR #2093's SessionScope.md:26 and :39 say SessionScope publishes no operation for that path. Goal.md:88 says the same.
Failure scenario: An implementer adds a SessionScope dependency for line_owner, but #2093 does not provide it, so the entry cannot be assembled. An implementer who follows #2127 has a dependency table that contradicts the requirements.
Evidence: docs/design/plugins/CodeMode.md:70, :166-168; PR #2093 docs/design/plugins/SessionScope.md:26, :39; docs/design/plugins/Goal.md:88; issue #2127.
Fix: Replace the row's owner with "the id routing mechanism (#2127)" and keep the operation as line_owner::<T>(line), or mark the row as a mechanism requirement, not a SessionScope dependency.
6. Code Mode's with_slot still drops the work's result in the operations table and uses an undefined callback type
Problem: CodeMode.md:82 says codeMode.with_slot replies {}, while the round-4 appendix is generic (with_slot<T> -> Result<T, ServiceError>, :183-188) and the example relies on the work's result (let slot: Result<ToolResult, ServiceError> = ...await?, :54-61). The appendix also uses ChangeFn<T>, which is undefined in this contract; ChangeFn is SessionStore's type in SessionTitle.md:289-292, an async callback over TitleState.
Failure scenario: An implementer following the table discards the work's ToolResult, which is the round-2 failure: the run cannot answer the outer tool call. An implementer following the appendix cannot compile ChangeFn<T> and may reuse the store's callback type with the wrong argument.
Evidence: docs/design/plugins/CodeMode.md:82, :54-61, :183-188, :186; docs/design/plugins/SessionTitle.md:289-292.
Fix: State the reply as the work's reply T (the run's Result<ToolResult, ServiceError>), and name or define the callback type, for example WorkFn<T> = Arc<dyn Fn(CancelledFn) -> BoxFuture<'static, Result<T, ServiceError>> + Send + Sync>.
7. Code Mode's binding appendix contradicts its own service-name sentence
Problem: CodeMode.md:174 says both names are set with #[rutis::service(name = ...)] on the owner type, but the appendix at :179 still marks ProgramSlots with a plain #[rutis::service]. One Rust type has one name, so the catalog name is programSlots, while README.md:37, the dependency table and the operations table use codeMode.
Failure scenario: The catalog exposes programSlots; the Session entry and codeMode.with_slot cannot resolve the process face. An implementer who follows the code block ships the wrong name.
Evidence: docs/design/plugins/CodeMode.md:174, :179, :80; docs/design/plugins/README.md:37.
Fix: Add name = "codeMode" to the attribute or rename the type.
P3
- SessionTitle still points at a version not in the tree.
SessionTitle.md:3,:13,:165and:254put the generation policy and acceptance list in "the previous version";maxLength10..=200 and default 80 are now stated at:12,:105and:242. State the acceptance items or name the follow-up that carries them. - Open dependencies are labeled unevenly. Goal's table at
:80,:84,:85and:86cites issues #2024, #2025, #2017 and #2026 without the pending PRs #2092, #2093, #2094 and #2103; Web's account row at:69cites #2019 without pending #2096; SessionTitle's registry row at:106cites #2026 without pending #2103. Pursuit.md:177still usestreeCommands.info(own id)after the same file moved P5, section 4 and E2 totimelineTree. The target face isline.Goal.md:57-63is thesession.goal.getexample, but it returns the owner'sGoalValuefields (objective,status,evaluator,through) while the get reply at:99isGoalRead{branchId, through, goal?}. Show the mapping.plugin-contract.md:110no longer names a service in theNamecolumn, whilesession-title-metadata.md:28-29and:86still documentsessionMetadata. Either keep the name or mark it superseded consistently.CodeMode.md:102-103still listsinterruptedandgate_closedbeside the run's own errors, after:84scoped them to ToolExecutor. Label the table as covering the child operations too, or drop them from the run's error table.CodeMode.md:166says "Both requirements below" but the section has three bullets at:168-170; the first two are the line-id requirements and the third is the timeline owner.- ADR 027 exists only in open #2029, and the four contracts reference it without a link or a pending label. Use a link to #2029 and label it pending, as the other forward references do.
SessionTitle.md:263importsMetadataErrorandSessionMetadata(current types) but the appendix usesChangeFn,TitleState,StoreRejectedandSetTitle. Import the target types or drop the old ones.runtime-owner-operations.md:26still says InputQueue usestimelineTree.input; PR #2102's target isinputQueue.submit. Update the row with #2102, or leave a note that it is #2102's.
Cross-PR and main
- The PR is rebased on 6e86d48 and reports
MERGEABLE.node scripts/adr-check.mjs --base 6e86d48cpasses with an isolated HOME, TMPDIR and XDG. CI at the head:ci-okandchangespass; the other jobs are skipped. docs/design/appserver/session-title-metadata.mdis edited by both this PR and #2091. #2091's head already has the coherent target text; this PR's partial edit produces the sentence in P2 3. Landing order matters: #2099 should align with #2091 or drop its edits to that file.docs/design/contracts/runtime-owner-operations.mdis edited by #2092, #2093, #2100, #2102, #2103 and this PR. #2093, #2100, #2102 and #2103 still carry the old Goal rows (inputsbatch,directory({id})), while #2100's copy already hasadopted -> {adoption, tools}and this PR's does not. A later merge can revert this PR's rows or conflict with them.- ADR 027 numbering matches the series: D1 reach by id, D2 runtime routing, D3 data faces, D4 call by id is not a dependency, D5 keeping the target loaded belongs to Agents. The Goal and CodeMode rows use D1, D3 and D4 correctly; Web's D2 row is about not resolving a service by id, which is a consequence of D2 and has no numbering error.
- No conflict with main is visible. The remaining conflicts are the sibling PRs above and the metadata doc.
Unverified
- I did not run the Goal tests. The
session_invalid_inputbehavior is read fromcrates/dim-agent-capabilities/src/methods.rs:138-139and the assertion atcrates/dim-goal/tests/goal_product_flow.rs:540, not from a test run. - The sibling PR heads were fetched on 2026-11-24; they may move. The line numbers for #2091, #2092, #2093, #2100 and #2102 refer to those heads.
- The redacted field placeholders in the documents prevent checking the exact Rust field types of
GoalValue,RenameRequestandRenameReply. - Target-only names such as
GoalLine,codeModeLine, the quota face andline_ownerhave no current code. Their shapes are checked only against the sibling contracts where those names exist. - The anchor count uses the GitHub slug algorithm. The Chinese/English mismatch is unambiguous, but GitHub's renderer may vary the exact count.
Previous opinions to withdraw
- Withdraw the round-2 P2 findings 1 to 10 and P3 findings 14 to 17. The head fixes the sequence wording, the state writer, the read cancellation, the submission id, the ended-line read,
GoalStatus, the evaluator refusals, SessionTitle's #2091 binding, Web's account path and CodeMode's gate. The round-1 P1 wire shape is also fixed. - Withdraw the claim that Goal's
{sequence}semantics are still open.Goal.md:38,:96and:158now name the committed command input's sequence, and the current code returns the trigger's sequence (crates/dim-goal/src/branch.rs:597-605), which the test atcrates/dim-goal/tests/goal_product_flow.rs:335calls the set trigger. - Keep the round-2 P2 anchor and standing-document findings, narrowed as above.
- Keep the round-2 P2 slot-example and P3 binding findings, narrowed as above.
| 以下标题只为保留其他文档与代码注释里的旧锚点;每一节的正文都已并入上面的契约。 | ||
|
|
||
| 返回 {branchId, through, goal};goal 为 null 或 {objective, status, evaluator}。status 为 {kind:active|completed|blocked|none} 或 {kind:paused,reason},保持 GoalRead 的既有外部类型。 | ||
| ### 2. 数据与状态 |
There was a problem hiding this comment.
Problem: these compatibility anchors use the Chinese mirror's headings (### 2. 数据与状态), but every English referrer uses the base document's English anchors. 25 link occurrences (21 distinct source and anchor pairs) into Goal.md still break, and all were valid at 6e86d48. Failure scenario: a reader following docs/design/timeline-branches.md:249 or docs/design/cli-commands.md:576 lands at the top of this document with no matching section. Evidence: docs/design/timeline-branches.md:249, :253, :312, :507, :556, docs/design/plugins/Pursuit.md:16, :36, :46, :50, :81, docs/design/model-prompts.md:229, crates/dim-cli/README.md:744, docs/design/plugins/Scheduler.md:514, docs/design/acp-gateway-implementation.md:268. Fix: use the base English headings (### 2. Data and state, ### 3.4 A new branch clears the inherited goal, ### A.2 Session methods, and so on), or add explicit <a id="2-data-and-state"></a> anchors.
There was a problem hiding this comment.
Fixed in 8f440bd. The compatibility section uses the base English headings (2. Data and state, 3.4 A new branch clears the inherited goal, 5. Context mapping, A.2 Session methods, A.5.1 Protocol and policy, and the rest), SessionTitle.md:208 adds the 0.1 anchor, and a fragment check over the modified docs finds no broken links. The 25 Goal and 3 SessionTitle referrers resolve.
| | `goalLine.read` | The line's published goal value | `{}` | `{objective?, status, evaluator, through}` | The wait stops; the value is unaffected | `closed` | | ||
|
|
||
| 加载行为唯一见 [Goal 状态设计](Goal-state-read.md#4-get-与冷恢复):最后 active 映射为内存 paused,不写回、不读取旧轮次和次数、不补答旧决定、不恢复旧评估。set/resume 才开始新执行。 | ||
| `invalid_params` covers what Goal itself checks: an objective outside 1..=4000 characters, a summary outside 1..=2000, an unknown judge, an empty `branchId`. `unknown_branch` is TimelineTree's `line` refusal (`unknown` in the tree's vocabulary, mapped to the published code); `branch_ended` is the input owner's refusal; `service_reloading` is the mechanism's answer that the line has no live goal owner, which the client shows as no goal and reads from history instead. Every code above is one the client already receives today. |
There was a problem hiding this comment.
Problem: two of these codes are not received today, and branch_ended is attributed to the wrong owner. AgentError::UnknownBranch maps to session_invalid_input (crates/dim-agent-capabilities/src/methods.rs:138), and crates/dim-goal/tests/goal_product_flow.rs:540 asserts that for a missing branchId; AgentError::Closed maps to session_closed (methods.rs:139). The input owner answers line_ended, not branch_ended (PR #2102, InputQueue.md:81, :92). Failure scenario: making the table true changes the wire code for a missing line and breaks the test at crates/dim-goal/tests/goal_product_flow.rs:540; keeping today's mapping leaves unknown_branch and closed unreachable, and get on an unknown line becomes service_reloading without a client-visible change entry. Fix: keep today's codes and state the line_ended/unknown mapping, or list the new codes as client-visible changes and migrate the callers.
There was a problem hiding this comment.
Partly fixed in 8f440bd. session_invalid_input and session_closed now match crates/dim-agent-capabilities/src/methods.rs:137-154, and Goal maps the tree's unknown to session_invalid_input. Remaining: the write table still lists branch_ended, but the target path has no producer: Goal.md:46 discards the line record, #2102's submit answers line_ended (InputQueue.md:81), and NoLine maps to service_reloading (Goal.md:105, :128). The get example has no tree.line check, so a missing line answers service_reloading, not the table's session_invalid_input. runtime-owner-operations.md:25 still says unknown_branch and keeps Goal's ended-history read. The body has findings 1 and 2.
| - [SessionStore #2091](https://github.com/arcships/dim/pull/2091) is open: `set_title(caller, SetTitle, ChangeFn)` running the change under the owner's serialization with `rejected` as a kind, and `title` answering `{revision, title?: {text, source}}`. SessionTitle's examples and appendix use that binding; landing order: #2091 before this contract's implementation. | ||
|
|
||
|
|
||
| ## Compatibility anchors |
There was a problem hiding this comment.
Problem: the English anchors fix most referrers, but ### 0.1 Fields read for one title attempt is missing, so three links still break. Failure scenario: a reader following docs/design/plugins/Skills.md:526, docs/design/plugins/Hooks.md:186 or docs/design/timeline-read-followups.md:15 lands at the top of this document and loses the field-selection rule. Evidence: SessionTitle.md:204-258; those three links, all valid at 6e86d48. Fix: add the 0.1 compatibility anchor, and the other old headings if the full set is wanted.
There was a problem hiding this comment.
Fixed in 8f440bd. SessionTitle.md:208 adds ### 0.1 Fields read for one title attempt; Skills.md:526, Hooks.md:186 and timeline-read-followups.md:15 resolve.
| `auto` or `manual`. Clearing keeps the counter, so a revision never repeats. | ||
| - **Write.** `setTitle {sessionId, expectedRevision, title | null}` commits revision `expectedRevision + 1` or fails | ||
| `conflict`, `not_found` or `storage`. The call is the handover: SessionStore admits the write when called, unless it | ||
| - **Write.** `setTitle {sessionId, the change callback's current title and revision, title | null}` commits revision `the change callback's current title and revision + 1` or fails |
There was a problem hiding this comment.
Problem: this is not a request shape. The sentence makes the request carry "the change callback's current title and revision" and repeats it in "commits revision ... + 1", while the table at :91 says {id} plus the change. It also contradicts :15 ("revision-checked write") and :95 ("title is required in setTitle"). PR #2091's head already has the coherent text: store.title and store.setTitle(id, change), no expectedRevision (SessionStore.md:121-122; #2091's copy of this file at :3, :22-24, :93). Failure scenario: an S5b implementer cannot tell whether the request has a session id, a title, a revision or a callback. Fix: use #2091's wording, or drop this file's edit and let #2091 own it.
There was a problem hiding this comment.
Fixed in 8f440bd: the file is no longer in the PR. #2091 owns session-title-metadata.md, and SessionTitle.md:161 says so.
| | Loop and ModelProvider → ContextPreparation | `prepare({source: ContextPrepareData, projection?}, cancelled) → ModelRequest`, `validate({requestId, request}, cancelled) → void`. Reuse the prepared projection at the original cutoff. | | ||
| | ContextPreparation and usage readers → ContextUsage | `read({through?}, cancelled) → {through, contextWindow, outputTokens, thresholdTokens, estimatedInputTokens, baselineSource}`. | | ||
| | Loop, ToolExecutor and Code Mode definition readers → `toolBinding` | `bind({requestId, through, tools, toolSources}) → void`, `bindCurrent({requestId, declared?}) → ToolDefinition[]`, `definitions({requestId}) → ToolDefinition[]`, `transfer({from, to}) → void`, `release({requestId}) → void`. ToolBinding retains the pinned handler generation. | | ||
| | Loop, ToolExecutor and Code Mode definition readers → `toolBinding` | `bind`, `bindCurrent`, `adopted({requestId}) → {adopted}`, `transfer`, `release`. ToolBinding retains the pinned handler generation; Code Mode reads `adopted` ([CodeMode](../plugins/CodeMode.md#own-contract)). | |
There was a problem hiding this comment.
Problem: adopted answers {adoption, tools}, not {adopted}. CodeMode.md:72 and PR #2100's ToolBinding.md:137-138 define the reply as the adoption id plus the pinned declarations, and #2100's copy of this row already says {adoption, tools}. Failure scenario: Code Mode's tools.list, tools.describe and tools.call need both the adoption id and the declarations; an implementer following this row returns one opaque value and cannot pass the adoption to invoke or list the pinned tools. Fix: change the reply to {adoption, tools}.
There was a problem hiding this comment.
Fixed in 8f440bd. runtime-owner-operations.md:76 now says adopted({requestId}) -> {adoption, tools}, matching #2100 ToolBinding.md:137-138.
| ### 2.1 The `codemode` tool | ||
| | Owner | Operation | Use | | ||
| | --- | --- | --- | | ||
| | Session access ([#2025](https://github.com/arcships/dim/issues/2025), target, pending [#2093](https://github.com/arcships/dim/pull/2093)) | the line's owner by line id | The entry reaches `CodeModeLine`; the run reaches the line's ToolExecutor | |
There was a problem hiding this comment.
Problem: this row names Session access (#2025, target, pending #2093) for line_owner, while :166-168 say the mechanism is #2127 and "SessionScope's contract has no such operation". PR #2093's SessionScope.md:26 and :39 say SessionScope publishes no operation for that path. Failure scenario: an implementer adds a SessionScope dependency that #2093 does not provide, so the entry cannot be assembled. Fix: name the id routing mechanism (#2127) here and keep the operation as line_owner::<T>(line), or mark the row as a mechanism requirement.
There was a problem hiding this comment.
Fixed in 8f440bd. CodeMode.md:70 names the id routing mechanism #2127 and line_owner::<T>(line); #2093 SessionScope.md:26 and :39 publish no such operation.
| | --- | --- | --- | --- | --- | --- | | ||
| | `codemode` | The model submits one program | `{code}` | the program's returned value as JSON text, or a terminal failure text, with the confirmed effects | The program is interrupted: a synchronous loop stops, a pending child is cancelled and new children are refused | `invalid_input` when the arguments or the code size are refused, returned as an error result | | ||
| | `codeModeLine.run` | Run one program on this line | `{outerCallId, code, context}` | `ToolResult` | Interrupts the program and closes the gate; committed children settle through ToolExecutor | `invalid`, `closed`, `cancelled` as the service error `{code, message}`; a failed program is the result's text | | ||
| | `codeMode.with_slot` | Run one program inside a process slot | `{work}` as a direct callback parameter, plus `caller: &Ctx` | `{}` | The work is cancelled and joined; the slot is released | `closed` as the service error `{code, message}`; a cancelled work is the callback's own result | |
There was a problem hiding this comment.
Problem: the reply is {} here, but the appendix returns Result<T, ServiceError> (:183-188) and the example uses the work's ToolResult (:54-61). Failure scenario: an implementer following this table drops the run's ToolResult, the round-2 failure; the run cannot answer the outer call. Fix: state the reply as the work's reply T.
There was a problem hiding this comment.
Fixed in 8f440bd. CodeMode.md:82 returns the work's reply T, :54-61 returns the program result, and WorkFn is defined at :212-214. The example's let slot: Result<ToolResult, ServiceError> = ... .await? annotation is still wrong; P3 in the body.
|
|
||
| ## Binding appendix | ||
|
|
||
| The process part provides `codeMode`; the branch part provides `codeModeLine`; the Session part registers the tool. Both names are set with `#[rutis::service(name = ...)]` on the owner type. Request, reply and error types are data; `cancelled` is the binding's cancellation argument. |
There was a problem hiding this comment.
Problem: the prose says both names are set with #[rutis::service(name = ...)], but the appendix at :179 marks ProgramSlots with a plain #[rutis::service]. One Rust type has one name, so the catalog name is programSlots, while this document and README.md:37 use codeMode. Failure scenario: the entry cannot resolve codeMode.with_slot, and the catalog exposes the wrong process face. Fix: add name = "codeMode" to the attribute or rename the type.
There was a problem hiding this comment.
Fixed in 8f440bd. CodeMode.md:181 marks ProgramSlots with #[rutis::service(name = "codeMode")]; the two face names match the prose.
| pub async fn with_slot<T>( | ||
| &self, | ||
| caller: &Ctx, | ||
| work: ChangeFn<T>, |
There was a problem hiding this comment.
Problem: ChangeFn<T> is undefined in this contract, and ChangeFn is SessionStore's type in SessionTitle.md:289-292, an async callback over TitleState. Failure scenario: the appendix does not compile, or an implementer reuses the store's callback type with the wrong argument. Fix: define or name the quota callback type here, for example WorkFn<T> = Arc<dyn Fn(CancelledFn) -> BoxFuture<'static, Result<T, ServiceError>> + Send + Sync>.
There was a problem hiding this comment.
Fixed in 8f440bd. WorkFn<T> is defined at CodeMode.md:212-214; ChangeFn is no longer used in this contract.
|
已按评审修改,head 评审逐条
上一轮已修、本轮复核仍成立的项( 自查发现(1–9)
留给 step 2 的跨 PR 项
客户端可见变更(本 PR 维持不变)
绑定附录编译四份附录 + 示例(
|
|
已按评审修改,head 跨 PR 对齐:
验证: |
|
补充说明,head
验证: |
Goal writes a command input to the line and reads the goal owner's published value; the routing table, the Session-side re-fold and the pre-commit callback are removed. Code Mode keeps the process program slots as one callback operation and runs the program in the line's owner. SessionTitle writes titles through SessionStore's change callback and reads Goal's published value. Web names its two tool contributions and the Dim account's search operations. Refs #2033 Refs #2015
Goal keeps the trigger's sequence, names the state record's one writer, takes cancellation on the line read, carries a submission id, states the ended-line client change and the evaluator refusals, and uses GoalViewStatus. SessionTitle follows #2091's ChangeFn binding and drops the broadcast row. Web declares search for a configured adapter. Code Mode gates on the mount exclusion and its examples compile. Compatibility anchors and the standing documents' owner paragraphs point at the new contracts. Refs #2033
Goal keeps today's wire codes, gets English compatibility anchors, and maps the tree's unknown kind. SessionTitle adds the 0.1 field anchor and states the policy and acceptance it used to defer. Code Mode names the id routing mechanism, returns the work's reply, labels the executor's error kinds and names both faces in the appendix. The shared S5b title document is left to #2091. Refs #2033
The ended-line read, the state record's order and the optional submission id are stated as separate client-visible changes with their affected callers. Refs #2033
3bb0861 to
8f440bd
Compare
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope
This PR rewrites the four product owner contracts (Goal, SessionTitle, Web and Code Mode) and the plugin index for the owner-operations series (refs #2033 and #2015). It moves callers to line-id operations, SessionStore's change callback and the account face, and deletes about 1400 lines of mechanism detail. I reviewed the full main...head at 8f440bd, not only the five commits after the round-3 review.
Verdict
REQUEST_CHANGES
Prior P2 status
Fixed and withdrawn:
- P2 1 anchors: the Goal compatibility section now uses the base English headings (
Goal.md:209-259), SessionTitle adds0.1(SessionTitle.md:208), and a fragment check over the modified docs finds no broken links. The 25 Goal and 3 SessionTitle referrers resolve. - P2 3 metadata:
session-title-metadata.mdis no longer in the PR; #2091 owns it. - P2 4 adopted:
runtime-owner-operations.md:76now says{adoption, tools}, matching #2100ToolBinding.md:137-138. - P2 5 CodeMode dependency:
CodeMode.md:70names #2127, and #2093'sSessionScope.md:26,:39publish no such operation. - P2 6 with_slot:
CodeMode.md:82returns the work's replyTandWorkFnis defined at:212-214. The example still has a type error; see P3. - P2 7 service name:
CodeMode.md:181setsname = "codeMode". - The round-2 P2s 1-10 and P3s 14-17 stay fixed.
Partly fixed:
- P2 2 Goal error codes:
session_invalid_inputandsession_closednow matchcrates/dim-agent-capabilities/src/methods.rs:137-154, and Goal maps the tree'sunknown. Remaining: findings 1 and 2.
P2
1. Goal's write and get paths still cannot produce the codes the tables promise
Problem: The write table lists branch_ended at Goal.md:98-100, but no target path produces it. The write example reads tree.line and discards the record (Goal.md:46); for an ended line the target line returns a record with state: ended (#2092 TimelineTree.md:133), not an error. The entry then calls line_owner::<InputQueue>; a line whose scope is gone answers NoLine, which Goal.md:105 maps to service_reloading, and submit on an ending line answers line_ended (#2102 InputQueue.md:81, :92). The paragraph at :105 says both that branch_ended is "the ended-line refusal today" and that line_ended "lands as a client-visible code", and :128 says NoLine includes an ended line and maps to service_reloading. The get table lists session_invalid_input (no such line) at :101, but the get example (:58-64) never calls tree.line; NoLine covers an id that is not this Session's (#2092 TimelineTree.md:98), so a stale branchId answers service_reloading, not session_invalid_input. The Client-visible changes list says "Three changes ... everything else keeps its codes" (:160), while :105 announces the new line_ended code and the get path changes an unlisted error.
Failure scenario: A client on an ended line gets line_ended or service_reloading while the table promises branch_ended, so its handler misses the error. A client with a stale branchId retries service_reloading forever instead of fixing the line. A test written from the shown path cannot trigger branch_ended.
Evidence: docs/design/plugins/Goal.md:46, :58-64, :98-101, :105, :128, :160-164; PR #2102 docs/design/plugins/InputQueue.md:81, :92; PR #2092 docs/architecture/rust-agent/plugins/TimelineTree.md:98, :133; current code crates/dim-goal/src/session.rs:116-130, crates/dim-goal/src/read.rs:33-55.
Fix: Add the tree.line(line.clone())? check to the get example and state that its unknown is session_invalid_input. For writes, either inspect the record's state and answer branch_ended (then delete the line_ended note), or pass line_ended through and add it to the client-visible list. State the NoLine mapping per operation, not once for both.
2. The retained runtime row still says unknown_branch and keeps Goal's ended-line read
Problem: runtime-owner-operations.md:25, which this PR changes, says line({line}) answers one record or unknown_branch. #2092's line answers unknown (TimelineTree.md:133), and Goal.md:105 publishes that as session_invalid_input. The same row says "Goal reads ended history through read", while Goal.md:136 says Goal does not answer for an ended line and :162 says the entry no longer folds and answers service_reloading.
Failure scenario: An implementer handles an unknown_branch kind that no owner returns and misses unknown; the ended-line read path is reintroduced, reverting Goal's first client-visible change.
Evidence: docs/design/contracts/runtime-owner-operations.md:25; PR #2092 docs/architecture/rust-agent/plugins/TimelineTree.md:98, :133; docs/design/plugins/Goal.md:105, :136, :162.
Fix: Say line({line}) answers unknown; say the client reads an ended line's history through read (or drop the clause), and remove Goal's ended-line read.
3. Goal-state-read still keeps the ended-line read the Goal contract removes
Problem: The new note at Goal-state-read.md:9 supersedes only the one-batch command write and its ordering rule. Section 4.2 at :117 still says an ended branch with no live owner is read through TreeCommands.query and preserves the original GoalRead. Goal.md:136 and :162 say the entry no longer folds and answers service_reloading; the client reads the facts. The note's last clause says the load mapping still follows Goal-state-read, so the two documents ship different contracts.
Failure scenario: An implementer follows Goal-state-read's load mapping and keeps the ended-line read; session.goal.get then still returns GoalRead on an ended line while Goal.md says service_reloading, and the client migration in Goal.md:162 is not needed. The ended-line behavior depends on which document the implementer reads.
Evidence: docs/design/plugins/Goal-state-read.md:9, :117; docs/design/plugins/Goal.md:136, :153, :162.
Fix: Extend the note to supersede section 4.2's ended-branch read as well, and mark :117 pre-contract, or update :117 to answer service_reloading and leave the fold to the client.
P3 (optional)
SessionTitle.md:52-54:StoreError::NotFoundis a struct variant (#2091 SessionStore.md:122, enum at:386-396), so the pattern needs{ .. }; the catch-all mapsStoreError::Closedtostorage_failedalthough the operations table listsservice_reloading. Fix the pattern and mapClosedtoservice_reloading.CodeMode.md:54:quota.with_slot(...).await?yieldsT = ToolResult, but the annotation isResult<ToolResult, ServiceError>; theWorkFnisFnand the closure movescodeandcontextinto the async block, whichFncannot. AnnotateToolResultand clone the captures, or change the callback type.Web.md:164-166:ToolProvider::setsis the current trait; the dependency row at:70and #2103's target useregister_source(name, sets, execute)withSourceSet(#2103 ToolRegistry.md:102,:325-330). Show the target call or label the appendix as current-code only.Pursuit.md:177,:181still usetreeCommands.info; the target face istimelineTree.line(#2092 TimelineTree.md:133).Goal.md:59callsowner.read()without thecancelledargument the appendix declares at:281.Goal.md:257is theAppendix E. Assumptionsstub where Pursuit's A16 link lands; it talks about parameter limits, not the worker-completed request. Move the A16 statement or point the link at Pursuit P4.SessionTitle.md:11and:13: the generation flow does not state the interactive-leader guard that the acceptance and the current code require (crates/dim-session-title/src/lib.rs:222); a member Session would title.Goal.md:64and:101/:166: the get example readsGoalValuefields; show theGoalRead { branchId, through, goal }mapping.- Open dependency labels:
Goal.md:82,:86,:87-88(#2024 without pending #2092, #2025 without #2093, #2017 without #2094, #2026 without #2103),SessionTitle.md:106(#2026 without #2103),Web.md:69(#2019 without #2096). plugin-contract.md:110: the Name column should keepstoreas the face name (#2091 SessionStore.md:229).SessionTitle.md:267importsMetadataErrorandSessionMetadatawhile the body usesChangeFn,TitleState,StoreRejectedandSetTitle.CodeMode.md:168says "Both requirements below" while the section has three bullets at:170-172.
Cross-PR and main
- The PR is based on
4d081fe6,origin/mainisdecc5894, and the merge base is4d081fe6; it reportsMERGEABLE.node scripts/adr-check.mjs --base 4d081fe6passes with isolated HOME, TMPDIR and XDG. CI at the head:ci-okandchangespass; the other jobs are skipped. - I checked the current sibling heads: #2091
9ff2b07d, #2092c80f8e16, #2093c8f18126, #2098c3acab35, #2100437266bf, #21023b48e124, #210359a77a3d. docs/design/contracts/runtime-owner-operations.mdis edited by #2091, #2092, #2093, #2098, #2100, #2102, #2103 and this PR, and their copies disagree on the Goal and InputQueue rows. #2092 deletes the old Goal row and usesline_ownerfor InputQueue; #2102 addsinputQueue.submitbut keeps the old Goal row; this PR changes the Goal row but still saystimelineTree.inputin the InputQueue row. #2091, #2093, #2098, #2100 and #2103 still carry the old Goal rows. A later merge can revert any of these. Align the row set before landing.docs/design/plugins/SessionTitle.mdis edited by #2091 (title binding), #2098 (the 3.4create_sessionchange) and rewritten here. #2098's change sits in a section this rewrite deletes; #2091's copy is the pre-contract document. Land #2091 first and rebase this rewrite over #2098's 3.4 change.- #2091's SessionStore
setTitlebinding has no cancellation argument (SessionStore.md:409-418), which matchesSessionTitle.md:295-296; #2091's own example at:82still passescancelled. That is #2091's issue, but it is the binding this document cites. - #2100's
ToolBinding.adoptedmatches the new runtime row; #2102'ssubmitanswersline_endedandclosed, which are the codes Goal must map; #2103'sregister_sourceis not theToolProvidertrait Web's appendix still shows. - No conflict with
origin/mainis visible. The remaining conflicts are the sibling rows and the SessionTitle edit.
Unverified
- I did not run the Rust tests. The code claims come from
crates/dim-agent-capabilities/src/methods.rs,crates/dim-goal/src/session.rs,crates/dim-goal/src/read.rs,crates/dim-app-server/src/storage/metadata.rsandcrates/dim-session-title/src/lib.rs. - The anchor check uses the GitHub slug algorithm; the renderer may vary the exact count, but the once-broken English headings now match the base document.
- Sibling line numbers are from the heads above and may move.
- The exact Rust field types of
GoalValue,RenameRequestandRenameReplywere not independently checked. - Target-only names such as
GoalLine,codeModeLine,WorkFnandline_ownerhave no current code; their shapes are checked only against the sibling contracts.
Previous opinions to withdraw
- Withdraw the round-3 P2 1 anchors, P2 3 metadata, P2 4 adopted, P2 5 CodeMode dependency, P2 6 with_slot reply and ChangeFn (the main claim) and P2 7 service name. They are fixed at 8f440bd.
- Keep P2 2 narrowed to findings 1 and 2.
- Withdraw the round-3 P3 about ADR 027 existing only in #2029; ADR 027 is in main at 4d081fe.
- Withdraw the round-3 P3 about SessionTitle pointing at a version not in the tree; the policy and acceptance are restated.
- Withdraw the round-3 P3 about CodeMode's Errors table; the kinds are labeled ToolExecutor's.
- Keep the round-3 P3s about Pursuit's
treeCommands.info, the uneven pending labels, the get example'sGoalReadmapping, the plugin-contract Name column and the SessionTitle appendix imports; they remain.
| | History RPC and line-read tools → timelineTree | `batchEnd(id, sequence) → void`, `pageEnd(id, after, limit, through) → sequence`, and `page` at the same cutoff. Preserve complete batches and the fixed head of ended lines. | | ||
| | Context RPC → target branch | `agentLoop.compact` and `contextUsage.read`. | | ||
| | Goal and Shell admission → timelineTree | `directory({id})` returns the matching directory entry or the unknown-branch error using a single-branch lookup. Goal reads ended history through `query`; writes retain the ended/unknown errors. | | ||
| | Goal and Shell admission → timelineTree | `directory()` answers the lines and the default; `line({line})` answers one record or `unknown_branch`. Goal reads ended history through `read`; writes retain the ended and unknown errors. | |
There was a problem hiding this comment.
Problem: this changed row still says line({line}) answers unknown_branch, but PR #2092's line answers unknown (TimelineTree.md:133), and Goal.md:105 publishes that as session_invalid_input. The row also says Goal reads ended history through read, while Goal.md:136 and :162 say the entry no longer folds or answers an ended line. Failure scenario: an implementer handles an unknown_branch kind the owner never returns and misses unknown; the ended-line read path is reintroduced, reverting Goal's first client-visible change. Evidence: this row; PR #2092 docs/architecture/rust-agent/plugins/TimelineTree.md:98, :133; docs/design/plugins/Goal.md:105, :136, :162. Fix: say line({line}) answers unknown; say the client reads an ended line's history through read (or drop the clause), and remove Goal's ended-line read.
| ```rust | ||
| let goal = match line_owner::<GoalLine>(&line) { | ||
| Ok(owner) => owner.read().await?, | ||
| Err(NoLine) => return Err(AgentError::Reloading("Goal".into())), // service_reloading |
There was a problem hiding this comment.
Problem: the get example maps NoLine to service_reloading, but the operation table at :101 promises session_invalid_input for a missing line. NoLine covers an id that is not this Session's or is gone (PR #2092 TimelineTree.md:98), so a stale branchId takes this arm and answers service_reloading, not session_invalid_input. Failure scenario: a client with a stale branchId retries service_reloading forever, and the code the table says it gets is unreachable. Evidence: this line; Goal.md:101, :105; PR #2092 TimelineTree.md:98. Fix: add the tree.line(line.clone())? check the write example uses at :46 before this match, and state that the tree's unknown maps to session_invalid_input.
| ## Client-visible changes | ||
|
|
||
| 公开入口仍为 session.goal.set/edit/pause/resume/clear/get 和工具 goal_update;参数、GoalRead 和命令 sequence 返回保持原接口。[Appendix A](#appendix-a-interface-details)列出合同。无 Goal 数据库或专用查询机制。 | ||
| Three changes reach clients; everything else keeps its field names, codes and notifications. |
There was a problem hiding this comment.
Problem: the list says three client-visible changes and that everything else keeps its codes, but the contract also says the input owner's line_ended lands as a client-visible code (Goal.md:105) and the write table still lists branch_ended (:98-100). The get path's missing-line case also changes to service_reloading unless a tree.line check is added (:60). Failure scenario: a client built from this list does not handle line_ended and treats a missing line's new service_reloading as a reload. Evidence: this line; Goal.md:98-101, :105, :128; PR #2102 InputQueue.md:81, :92. Fix: either map line_ended to branch_ended and keep the three changes, or add line_ended and the missing-line code as client-visible changes with their landing condition.
|
|
||
| 依据:[Goal](Goal.md)、[读取与输入删除](Goal-property-queries.md)、[设计规则](../../architecture/rust-agent/principles.md)、[ADR 002](../../adr/002-plugin-scope.md)、[插件合同](../plugin-contract.md)、[rutis](../rutis-usage.md)。本文件规定状态保存与读取合同。 | ||
|
|
||
| > 目标契约见 [Goal](Goal.md)。[Goal](Goal.md#client-visible-changes) 取代本文的命令与状态记录同批规则和「回复是 trigger 的 sequence」之外的排序描述;状态对象、加载映射与属性查询仍以本文为准。 |
There was a problem hiding this comment.
Problem: the note supersedes only the one-batch command write and its ordering rule, while section 4.2 still says an ended branch with no live owner is read through TreeCommands.query and preserves the original GoalRead (:117). Goal.md:136 and :162 say the entry no longer folds and answers service_reloading, and the client reads the facts. Failure scenario: an implementer follows this document's load mapping and keeps the ended-line read, so session.goal.get still returns GoalRead on an ended line while Goal.md promises service_reloading. Evidence: this note; Goal-state-read.md:117; Goal.md:136, :153, :162. Fix: extend the note to supersede the ended-branch read and mark :117 pre-contract, or update :117 to answer service_reloading and leave the fold to the client.
|
Closing as part of abandoning the owner-split experiment. |
Refs #2033 · Refs #2015
Summary
The target contracts of the four owners in the product plugin block, one document each:
goalLine.read). The process-wide routing table, the Session-side re-fold and the pre-commit callback are removed; the branch owner composes the state record after the business fact.with_slot, a callback by reference) and the line's owner runs the program (codeModeLine.run). The run opens ToolExecutor's gate, invokes by gate id, and closes the gate once to word its result with the confirmed effects; ToolExecutor closes it again at parent settlement and merges the effects once. The pinned declarations come fromtoolBinding.adopted. The process runner table, the runner trait and the executor wrapper are removed.invokewithOnce, the account owner'stitlewhen that owner exists, reads Goal's published value, and writes through SessionStore'ssetTitle(id, change), deciding inside the callback whether the stored title allows the write.dimAccount.searchand the declaration followsdimAccount.availabilityandsubscribe; the removedmanagedSearchface is not used.The requirements the block raises are listed in each document and sent to the owners' issues: #2024 (who provides the line-id operations to Session parts, per the cross-cutting decision), #2027 (
inputQueue.submit). #2028'sopen/invokeandadoptedand #2018'ssetTitlechange callback are used as their contracts state; no requirement remains open on either.Delivery part: #2033 comment (deletion list, caller migration, implementation task, acceptance).
Design rule checklist
beforecallbacks: Goal registers none and folds what it committed.Documentation
Verification
node scripts/adr-check.mjs --base origin/mainpassed.cargo run --locked -p xtask-checkpassed.Merge order
#2029 → #2080 → #2091/#2092/#2093 → #2094 → #2096 → the rest.
Sibling heads this change is aligned with: #2091
f7425d55c, #2092d96802349, #2100437266bff, #210118d5e4f07. A paragraph that depends on a sibling names that PR; its head is the one above.