Repository navigation
Conversation
|
评审(head |
|
评审符合,无需修改,head |
zerob13
left a comment
There was a problem hiding this comment.
Two material items before this becomes the target contract. First, the EventHub rewrite removes the shipped guide and tool text blocks under A.6 and A.4; both existing Linux assertions fail at the heading lookup and ci-ok is red. Please preserve the shipped text and assertions (or move the source of truth and update both consumers consistently). Second, keep Scheduler recovery read-only: the current bounded receipt lookup does not submit new input, while resubmitting the same ID can create input if the original never committed. Specify the receipt lookup and how cross-Session restoration and admission work before adopting the new call map. No runtime reproduction; the first finding is verified in hosted CI and the second is a contract review.
|
Updated for review, head
Re-requesting review from @zerob13. |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: this PR writes the target owner contracts for EventHub and Scheduler and updates their references across 18 design files (refs #2023, refs #2015).
Verdict: REQUEST_CHANGES
The restored A.4/A.6 text blocks match the current constants, and recovery no longer repeats the input. The findings below are what remains in the new contract as written.
P1
1. The Scheduler job, history and loop shapes break the shipped clients and the stored job documents
Problem. docs/design/plugins/Scheduler.md:197 says the schedule.* methods, session.loop.*, the schedule tool and the loop tool keep their wire names and shapes. The appendix does the opposite. Schedule becomes an internally tagged form object (Scheduler.md:274-279), Target changes the tag from kind to type (Scheduler.md:289-293), JobOrigin becomes internally tagged (Scheduler.md:282-286), Job and Run switch to camelCase field names. Job loses enabled_at and disabled_reason, the list reply loses next_window, schedule_error and last_run, and Run loses window, policy, attempts, released and job_revision (Scheduler.md:260-309). delete returns unit (Scheduler.md:478), and the conflict code becomes conflict (Scheduler.md:147) instead of schedule_conflict. CreateJob and UpdateJob also take a full stored Job (Scheduler.md:322-331), which requires id, revision and created_by that a creator cannot know, while schedule.save is a patch.
Failure scenario. The shipped web scheduler (web/src/rpc/scheduler.ts:4-86, web/src/features/settings/ScheduledSettings.vue:210-235) reads created_by, enabled_at, disabled_reason, next_window, schedule_error, last_run, run_id, job_id and policy, and the web audit contract (docs/design/web-workspace.md:828-829) also requires next window, window, session origin and policy. The client wraps {job} and {job_id} and checks schedule_conflict. With the appendix, readScheduledJobs throws on the createdBy/created_by mismatch before rendering, the create and save payloads use untagged schedules and kind targets that no longer deserialize, the delete reply loses job_id, and a stale save is not recognized as a conflict. The CLI requirements in docs/design/cli-commands.md:1313-1321 still require created_by, enabled_at, disabled_reason and Disabled: {code} at {instant}. Existing schedule.json documents with untagged schedules and kind targets stop deserializing, and the contract has no format decision or migration for that persisted shape.
Fix. Keep the current job, run, schedule, target, origin, delete and run-now shapes on the management and tool surfaces, or list every change in Client-visible changes and migrate the web, CLI, tool and stored documents in the same change. If the new shapes are intended, add the persistence format decision and migration required by AGENTS.md, and keep schedule_conflict or map it explicitly. Define a create input without owner-derived fields and an update patch whose absent fields mean keep stored.
2. The generated service faces cannot carry the documented error codes
Problem. EventHubError and SchedulerError are plain serde structs with a String code field, and both owner types are marked #[rutis::service] (docs/design/plugins/EventHub.md:367-375, docs/design/plugins/Scheduler.md:464-472). The service macro classifies a struct error by its type name; the dynamic code field is not the wire code. docs/design/service-faces.md:332 records exactly this as the reason the old eventSubscriptions face was a handwritten HostDispatch.
Failure scenario. A TypeScript producer calling eventHub.declare after unknown_source sees failure.code === 'EventHubError', not unknown_source. docs/typescript-plugin-authoring.md:533-535 and runtime/fixtures/event-hub-producer.ts:28-31 retry on that comparison, so the declared retry never runs. The EventHub error table (EventHub.md:132-144) and the Scheduler error table (Scheduler.md:143-154) are not the wire contract, and the scheduleJobs face collapses every code to SchedulerError.
Fix. Define each error as an internally tagged enum with one variant per code (the pattern in crates/dim-agent-capabilities/src/file_access.rs:62-68), or keep the handwritten HostDispatch that writes error.code for the merged faces, and state the chosen wire shape. Update the TypeScript authoring example and the producer fixture if the code stays in data.
P2
3. The EventHub face merge hands subscription management to every producer
Problem. The new contract replaces eventHub and eventSubscriptions with one eventHub face of six operations (EventHub.md:169). docs/typescript-plugin-authoring.md:497-500 still promises that the injected service "has declare and publish and nothing else, so a producer cannot create or remove another Session's subscriptions." The merged face gives every eventHub injector subscribe, unsubscribe and list, and list {sessionId?} returns every subscription (EventHub.md:124-126).
Failure scenario. A producer row that injects eventHub can subscribe another Session, retire another Session's guide, or enumerate all subscriptions. The old design kept the subscription core on a separate name with a documented trusted-plugin boundary; the new contract removes that boundary without listing the authority change in Client-visible changes.
Fix. Keep the producer face to declare and publish and expose the subscription operations on a separate face or name, or scope the operations to the calling row and authorize the target Session. If the broader authority is intended, state it in the TypeScript guide and in Client-visible changes.
4. Recovery contradicts the Sessions lookup semantics and loses the persisted attempt bound
Problem. The new paragraph says unknown settles lost and only reloading and transport retry (Scheduler.md:173). The Sessions contract says lookup answers unknown as final only for writes that returned before the lookup began; an admitted write whose reply was lost keeps running to its own outcome (docs/design/appserver/sessions-service.md:289-296, docs/design/contracts/session-access.md:305). The old Scheduler contract at the merge base stated that unknown, reloading, ambiguous and a transport failure each keep the record delivering, count toward a persisted five-attempt bound, and that unknown cannot settle a record. The new contract drops ambiguous, drops the bound's terminal rule, and the new Run type has no attempts field (Scheduler.md:297-309).
Failure scenario. A Scheduler row reload happens while an accepted sessions.input is still in flight. The lookup answers unknown, the record settles lost, and the old task then commits the input. The delivery is recorded lost while the model received the prompt, and no later pass repairs the history. After a restart the owner cannot know how many lookup attempts a delivering record spent because the record no longer carries the count. The loop flow says a pending round is settled by lookup, while the current loop pass reads sessions.pending and leaves an inconclusive round for the next window (crates/dim-agent-scheduler/src/loops.rs:698-716, 843-855); the contract does not state the loop rule.
Fix. Restore the old rule: unknown, reloading, ambiguous and transport keep the record delivering, each persists an attempts increment before the lookup, and the bound settles lost with a stated detail. State the loop and wakeup rules separately and add the in-flight case to the verification.
5. The admission hold cannot be reconstructed as stated
Problem. processActivity.hold returns an id that release(id) consumes, and the implementation records that a lost owner leaves admission busy until process shutdown (crates/dim-app-server/src/control.rs:76-96). The contract says a row unload does not release the hold and the next generation "reconstructs it from the delivering records" (Scheduler.md:173-175), but the new Run type stores no hold id and no operation adopts an existing id.
Failure scenario. After a row reload the old hold is never released, so admission stays busy for the process lifetime, or the next generation takes a second hold per record and can release only the new one. Either way the statement that the hold is released after the terminal record is false for the old hold.
Fix. State that the old hold is intentionally retained until process shutdown and the next generation takes a separate hold per unsettled record, with the release that ends it. Alternatively persist the hold id in the record and define a cross-generation adopt and release. Add a verification for a row reload with an in-flight delivery.
6. The caller example and binding disagree on wakeup and loop replies
Problem. create_wakeup returns WakeupId, a bare string (Scheduler.md:486), but the table says {wakeupId} (Scheduler.md:129) and the example uses created.wakeup_id (Scheduler.md:69). cancel_wakeup returns WakeupState while the table says {state?} (Scheduler.md:131, Scheduler.md:488). stop_loop returns Loop while the table says {loop, settled} (Scheduler.md:134, Scheduler.md:491), and settled is what docs/design/acp-gateway-implementation.md:298 and docs/design/cli-commands.md:701-702 depend on. jobs.list(ListJobs) uses an undefined ListJobs while list takes no request (Scheduler.md:58, Scheduler.md:474).
Failure scenario. The examples do not compile against the appendix. A session.loop.stop client cannot read settled, a wakeup create caller cannot read wakeupId from a bare string, and a stop reply cannot distinguish a terminal stop from a still-settling one.
Fix. Add reply structs such as CreateWakeupReply, CancelWakeupReply, StopLoopReply { loop, settled } and ListJobs, or change the tables and examples to the bare values. Keep the settled flag on the stop reply and state when it is false.
7. EventHub publish optional fields and the subscribe publication_unknown reply
Problem. The table marks attributes? and to? optional (EventHub.md:122), but PublishRequest has non-optional attributes: BTreeMap and to: Vec with no #[serde(default)] (EventHub.md:331-339). The current type and the TypeScript declaration mark both optional (crates/dim-event-hub/src/model.rs:42-56, npm/plugin.d.ts:321-330). Separately, subscribe lists publication_unknown as an error (EventHub.md:124, EventHub.md:142), while the old contract said a committed guide stores the subscription and the call answers its id.
Failure scenario. A producer publishing to subscribers only, as in the TypeScript fixture and the authoring guide, omits to and attributes and now fails to deserialize. A subscriber whose guide committed but whose reply was lost gets publication_unknown and cannot tell whether the record was stored; a retry can duplicate the subscription or hit the limit.
Fix. Add #[serde(default)] to attributes and to. For publication_unknown, either store the record and reply the subscription id as the old contract did, or define a distinct stored-but-unconfirmed reply with an idempotent retry.
8. The schedule window semantics are gone
Problem. The new Schedule type has Cron, Every and At (Scheduler.md:275-279), but the contract no longer defines the every anchor, the cron time zone default, DST gap and overlap handling, missed-window collapse, the first-window rule, the at disable rule, or the max_run_minutes and input_mode defaults. The old contract pinned those rules in A.4 and its acceptance. The new Job has no enabled_at (Scheduler.md:260-271), and Target::Session requires input_mode while the text says inputMode? (Scheduler.md:137, Scheduler.md:291).
Failure scenario. A re-enabled or edited every job has no defined first window; two implementations can disagree on DST and missed windows; a caller omitting inputMode or maxRunMinutes gets a deserialization failure or an undefined launch stop time. The new verification does not test any of these.
Fix. Keep enabled_at and the old A.4 window rules, or state the new anchor, DST and missed rules explicitly. Mark input_mode and max_run_minutes optional with their defaults, and add the window cases to the verification.
9. The serde attributes do not produce the documented field spelling
Problem. #[serde(tag = "form", rename_all = "camelCase")] and the same on Target, JobOrigin, Cadence and Delivery rename variant names, not the fields inside struct variants. Target therefore serializes session_id, branch_id and input_mode while the contract text says sessionId, branchId and inputMode (Scheduler.md:137, Scheduler.md:289-292). JobOrigin and Cadence keep snake_case fields inside camelCase objects, and Delivery keeps snake_case fields and serializes absent options as null, while the current wire is camelCase and omits them (EventHub.md:359-365, crates/dim-event-hub/src/publish.rs:42-75).
Failure scenario. A caller following the contract text sends sessionId and the face answers for an unknown field. A caller reading delivery.inputId, delivery.subscriptionIds or delivery.truncated sees input_id, subscription_ids or null. The appendix and the current wire disagree.
Fix. Add #[serde(rename_all_fields = "camelCase")] or per-variant #[serde(rename_all = "camelCase")] and skip_serializing_if, or spell the wire as snake_case in the contract text.
P3
- Reply wrappers.
EventHub.md:380,383return bareSourcesandSubscriptionswhile the table says{sources}and{subscriptions}and the current wire is an object. The same mismatch applies tolist_wakeups,list_loops,start_loop,next_loop,create,getandset_enabled. Fix the reply types or the tables. - Current-state claim.
docs/design/contracts/session-boundary.md:281says the namespaces are "registered today" and now listssession.loopwithoutsession.wakeup. The current code registers both (crates/dim-agent-scheduler/src/session.rs:258-270). Keep the current list and add the target removal, or retitle the list as the target state. - Broken links.
docs/design/appserver/sessions-service.md:504linksplugins/Scheduler.mdfrom a file underappserver/; the file is at../plugins/Scheduler.md, so the changed line is broken.docs/design/appserver/management-methods.md:234uses#13-concrete-package-rowswhile the heading is### 1.3 Concrete package row(docs/design/plugins/Workflow.md:92). - Stale surfaces.
docs/design/overview.md:105still says clients subscribe througheventhub.*;EventHub.md:175removes them.overview.md:169still says Scheduler has a "run-outcome report" althoughScheduler.md:199removes the notices and the contract writes no report.docs/design/plugins/Notifications.md:39,178,209still describes Scheduler'sscheduled_run_outcomesevent; the new Scheduler contract has no such event, and the Notifications page is withdrawn and reference only. Update these or mark them historical. - Stale history.
docs/INDEX.md:105anddocs/design/roadmap.md:31,135still cite#317, although the PR body says#317is no longer cited.#317is merged, so this is stale history rather than a forward reference, but the claim is not true for the tree. - Unmerged rule source. The Rule check rows cite §7.2 of
docs/architecture/rust-agent/principles.md, whose §7 exists only in #2029 (open). Report the owning PR #2029, and either link the rule text or keep the docs unmerged until it lands. - Dangling section numbers.
Scheduler.md:177keeps a### 12. Loopheading with no parent §12, andEventHub.md:157keeps### 9.1with no §9. Numberless headings would avoid the dangling references. - Verification and bounds. The new verification drops the old acceptance for schedule windows, the 16-job, 8-loop, prompt and body bounds, the wakeup grace, the CAS conflict retry and legacy documents. The error kinds
loop_limit,invalidandtoo_largeare referenced without their bounds. Keep the rules in the contract or in the delivery acceptance. - Translation drift.
docs/zh/design/contracts/session-boundary.md:280still listssession.wakeupandschedule.watch, anddocs/zh/design/overview.md:150,268,289,407,560anddocs/zh/design/cli-commands.md:751,1028still cite#317and the old Scheduler sections. The two zh plugin pages get banners, but the zh counterparts of the changed English pages still describe the removed surfaces. - Typed state and defaults.
Run.stateis a freeString(Scheduler.md:300) instead of the currentDeliveryStateenum, and the state list is no longer enumerated.Target::Launch.max_run_minutesisOption<u32>with no default. Use an enum or list the states, and state the defaults.
| | `unknown_type` (subscribe) | Fix the pattern or declare the source | | ||
| | `limit_reached` | Remove a subscription first; 32 per Session, 1024 in total | | ||
| | `session_closed` / `branch_missing` / `branch_ended` | The target cannot take input; fix the target | | ||
| | `reloading` / `rejected` / `ambiguous` / `failed` / `publication_unknown` / `transport` | The `sessions` call's answer; the subscription is stored only after a committed guide, `publication_unknown` included | |
There was a problem hiding this comment.
Problem: publication_unknown is listed as an error, but it means the guide input committed, so the subscription should be stored and the call should answer its id; the old A.3 said exactly that.
Failure: a lost reply leaves the caller unable to tell whether the record exists, and a retry can duplicate the subscription or hit the limit.
Fix: make it a stored success (reply the subscription id) or define a distinct stored-but-unconfirmed reply with an idempotent retry.
There was a problem hiding this comment.
Partially fixed in d02268b. publication_unknown is gone from the error list, and the cancellation column says a committed guide stores the record even when its publication is unknown (EventHub.md:122). Remaining: the error table and the Agents requirement (EventHub.md:141,218) do not name publication_unknown, which the accepted sessions.input contract still returns (docs/design/contracts/session-access.md:229). An implementer cannot tell that answer is the stored-success case. Name it or define the distinct reply.
There was a problem hiding this comment.
Partially fixed at 853b6aa. EventHub.md:141 names publication_unknown as the stored-success answer, but the new requirement at EventHub.md:220 asks InputQueue's submit for it. submit replies {inputId, sequence} and its errors are invalid, line_ended, cancelled and closed; only withdraw answers publication_unknown (origin/pr-2102:docs/design/plugins/InputQueue.md:81-82,94, head 823124c7). See P2 2 in the new body.
|
|
||
| The marker is the only channel an event uses. Nothing is injected into a request, and an event never becomes a system-prompt change: the guide entry is the writer's contribution to the guide, and the guide is composed where its writers load ([Prompt §3.4](Prompt.md#34-adopted-when-its-writer-loads)). | ||
| - `docs/design/plugins/EventHub.md` sections 1–10 and Appendices B–E (the old feature design) are replaced by this contract; A.4 and A.6 remain as the published model-visible texts. | ||
| - `docs/design/service-faces.md` §3.2's `eventHub`/`eventSubscriptions` rows and §4's `eventSubscriptions` section: one `eventHub` face with the six operations; `eventSubscriptions` is gone. |
There was a problem hiding this comment.
Problem: merging the two names into one eventHub face gives every row that injects eventHub the subscribe, unsubscribe and list operations. docs/typescript-plugin-authoring.md:497-500 still promises a producer cannot create or remove another Session's subscriptions, and npm/plugin.d.ts:355-358 declares only declare and publish. list {sessionId?} also returns every subscription.
Failure: a producer row can manage another Session's subscriptions and enumerate all subscriptions, an authority change the contract does not list.
Fix: keep the subscription operations on a separate face or name, or scope them to the calling row and authorize the target Session; update the TypeScript guide and Client-visible changes if the broader authority is intended.
There was a problem hiding this comment.
Fixed in d02268b. The producer face is declare and publish only; sources, subscribe, unsubscribe and list are pub(crate) in-process operations (EventHub.md:115,449-452), and list takes one Session (EventHub.md:124). Client-visible changes records the authority change (EventHub.md:175). The requirement table at EventHub.md:30 still says every subscription; that leftover is in the new body.
There was a problem hiding this comment.
| pub id: Option<String>, | ||
| pub title: Option<String>, | ||
| pub body: String, | ||
| pub attributes: std::collections::BTreeMap<String, String>, |
There was a problem hiding this comment.
Problem: the table marks attributes? and to? optional (line 122), but this struct requires both. The current type and the TypeScript declaration use #[serde(default)] (crates/dim-event-hub/src/model.rs:42-56, npm/plugin.d.ts:321-330).
Failure: the TypeScript fixture and the authoring guide publish without to and attributes and now fail to deserialize.
Fix: add #[serde(default)] to both fields, or make them Option.
There was a problem hiding this comment.
Fixed in d02268b. PublishRequest.attributes and .to have #[serde(default)] (EventHub.md:261-264), matching crates/dim-event-hub/src/model.rs:51-55.
|
|
||
| ### A.4 The `events` tool | ||
| #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] | ||
| #[serde(tag = "status", rename_all = "camelCase")] |
There was a problem hiding this comment.
Problem: rename_all on an enum renames variant names only; these fields stay snake_case, and the two Option fields serialize as null. The current wire is camelCase (inputId, subscriptionIds) and omits absent options (crates/dim-event-hub/src/publish.rs:42-75).
Failure: a producer reading delivery.inputId or delivery.subscriptionIds sees input_id and subscription_ids, and a consumer sees truncated: null where the current wire has no field.
Fix: add per-variant #[serde(rename_all = "camelCase")] and skip_serializing_if, or document the new wire.
There was a problem hiding this comment.
Fixed in d02268b. Delivery adds per-variant #[serde(rename_all = "camelCase")] and skip_serializing_if on the two optional fields (EventHub.md:384-415), matching crates/dim-event-hub/src/publish.rs:42-75.
| #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, thiserror::Error)] | ||
| #[serde(rename_all = "camelCase")] | ||
| #[error("{code}: {message}")] | ||
| pub struct EventHubError { |
There was a problem hiding this comment.
Problem: this plain serde struct is served by a generated #[rutis::service] face, which classifies the error by its type name; the dynamic code is not the wire code. docs/design/service-faces.md:332 records exactly this as the reason eventSubscriptions was a handwritten HostDispatch.
Failure: a TypeScript caller sees failure.code === EventHubError, not unknown_source; docs/typescript-plugin-authoring.md:533-535 and runtime/fixtures/event-hub-producer.ts retry on that comparison, so the declared retry never runs. The error table is not the wire contract.
Fix: define an error enum with one variant per code, or keep the handwritten face that writes error.code; state the wire shape.
There was a problem hiding this comment.
Fixed in d02268b. EventHubError is now an internally tagged enum with one variant per code (EventHub.md:416-437). The rutis service macro takes the serde tag as the wire code, so failure.code is unknown_source and the retry in docs/typescript-plugin-authoring.md:533-535 fires.
| pub async fn cancel_wakeup(&self, request: CancelWakeup) -> Result<WakeupState, SchedulerError>; | ||
| pub async fn start_loop(&self, request: StartLoop) -> Result<Loop, SchedulerError>; | ||
| pub async fn next_loop(&self, request: NextLoop) -> Result<Loop, SchedulerError>; | ||
| pub async fn stop_loop(&self, request: StopLoop) -> Result<Loop, SchedulerError>; |
There was a problem hiding this comment.
Problem: stop_loop returns Loop, but the table says {loop, settled} (line 134), and docs/design/acp-gateway-implementation.md:298 and docs/design/cli-commands.md:701-702 depend on settled: false to report a still-settling stop.
Failure: the session.loop.stop reply loses settled, so the ACP and CLI cannot tell a terminal stop from a pending one.
Fix: return StopLoopReply { loop, settled } or a tuple, and state when settled is false.
There was a problem hiding this comment.
Fixed in d02268b. StopLoopReply { loop, settled } is defined and returned (Scheduler.md:745,791), and the semantics are stated (Scheduler.md:198).
|
|
||
| 六个进程端口的内容本来就是数据,所有者各自把读绑定成端口类型上的 operation,`#[rutis::service]` 生成 dispatcher,名字 shared;Rust 调用方直接调同一个方法,不另写适配层。`eventSubscriptions` 手写 `HostDispatch`,因为 owner 的错误是带动态 `code` 的 struct,生成面会把 `code` 写成类型名。 | ||
|
|
||
| > `eventSubscriptions` 面已由 [EventHub](plugins/EventHub.md) 取代:四个操作在同一个 `eventHub` 面上。 |
There was a problem hiding this comment.
Problem: the blockquote says the face is replaced but leaves line 332's rule standing: a generated face writes the dynamic code as the type name, which is why eventSubscriptions was handwritten. The new EventHub appendix uses a generated face with exactly that error shape. The blockquote also names four operations, which reads as the whole face, while EventHub.md:117-126 defines six.
Failure: the replacement silently reintroduces the error-code loss the handwritten face avoided and leaves the catalog count wrong.
Fix: say how the error code is preserved (enum or handwritten dispatch) and update the count.
There was a problem hiding this comment.
Partially fixed in d02268b. The EventHub appendix now uses an error enum, so the generated face keeps the code (EventHub.md:416-437). Remaining: the blockquote at service-faces.md:334 still says four operations on the same eventHub face; the contract puts declare and publish on the face and the other four in process (EventHub.md:115). Update the blockquote and the count, and update the line 332 rule now that the face uses an enum.
There was a problem hiding this comment.
| ``` | ||
|
|
||
| Session namespaces registered today: `session.question` (Questions), `session.goal` (Goal), `session.rename` (SessionTitle), `session.input` (InputQueue), `session.context` (ContextCompaction), `session.exec.output` (WorkspaceTools, [background task output](../background-task-output.md)), `session.agent` ([model configuration](../model-configuration.md)), `session.language` (App Server, [PromptSources §3](../plugins/PromptSources.md#3-the-agent-prompt-language-state-source)), `attachment` (Attachments), `shell` (ShellInput), `session.wakeup` (Scheduler, [Scheduler §10](../plugins/Scheduler.md#10-session-scoped-wakeup)), `session.collaboration` (Collaboration, [Collaboration §6.7](../plugins/Collaboration.md#67-stopping-a-member-from-the-client)). `approval.respond` is a built-in Session method, not a part registration. The branch methods — `session.branch_create`, `session.branch_end`, `session.branch_set_default`, `session.branches` and `session.branch.get` — are built-ins too, and their contract is [timeline branches §9, §10 and §14](../timeline-branches.md#14-clients): each `branchId` they take names one line, and one that is omitted names the Session's default branch, not its root. `session.branch_set_default` accepts the root as a target whenever it is not the default branch and refuses only a target that is already the default branch; `session.branch_end` refuses the default branch for every caller, so ending it takes a move of the default branch first. Hooks registers no Session namespace: its `hooks.*` methods are management methods ([Hooks A.7](../plugins/Hooks.md#a7-management-methods)). Each plugin document is authoritative for its methods. | ||
| Session namespaces registered today: `session.question` (Questions), `session.goal` (Goal), `session.rename` (SessionTitle), `session.input` (InputQueue), `session.context` (ContextCompaction), `session.exec.output` (WorkspaceTools, [background task output](../background-task-output.md)), `session.agent` ([model configuration](../model-configuration.md)), `session.language` (App Server, [PromptSources §3](../plugins/PromptSources.md#3-the-agent-prompt-language-state-source)), `attachment` (Attachments), `shell` (ShellInput), `session.loop` (Scheduler, [Scheduler](../plugins/Scheduler.md)), `session.collaboration` (Collaboration, [Collaboration §6.7](../plugins/Collaboration.md#67-stopping-a-member-from-the-client)). `approval.respond` is a built-in Session method, not a part registration. The branch methods — `session.branch_create`, `session.branch_end`, `session.branch_set_default`, `session.branches` and `session.branch.get` — are built-ins too, and their contract is [timeline branches §9, §10 and §14](../timeline-branches.md#14-clients): each `branchId` they take names one line, and one that is omitted names the Session's default branch, not its root. `session.branch_set_default` accepts the root as a target whenever it is not the default branch and refuses only a target that is already the default branch; `session.branch_end` refuses the default branch for every caller, so ending it takes a move of the default branch first. Hooks registers no Session namespace: its `hooks.*` methods are management methods ([Hooks A.7](../plugins/Hooks.md#a7-management-methods)). Each plugin document is authoritative for its methods. |
There was a problem hiding this comment.
Problem: the paragraph says these namespaces are registered today, but the current code registers session.wakeup.* and session.loop.* (crates/dim-agent-scheduler/src/session.rs:258-270). This line removes session.wakeup and adds session.loop.
Failure: the current-state list no longer matches the build; a reader cannot tell the target removal from today's registry.
Fix: keep the current list and add the target removal, or retitle the list as the target state.
There was a problem hiding this comment.
Fixed in d02268b. The list now includes session.wakeup and session.loop and says the target removes session.wakeup (docs/design/contracts/session-boundary.md:281).
| `{sessionId}` → `{defaultBranchId}`; errors `rejected`, `session_closed`, `reloading`, `failed`. | ||
|
|
||
| The read answers the line the Session's conversation is on: the tree's current default, read from its owner (`TreeCommands::default_branch`) after the Session is acquired, so an idle-unloaded Session is restored for the answer as for §6.10. It reads no history page and writes no event. It exists for the request-side defaults that name no line: a management `schedule.save` that records the default branch for a new job ([Scheduler §2.1](plugins/Scheduler.md#21-the-two-targets)), and the `loops`, `wakeups` and EventHub faces when a request omits a branch ([timeline branches §20.22](../timeline-branches.md#20-acceptance)). A caller resolves it once per request. | ||
| The read answers the line the Session's conversation is on: the tree's current default, read from its owner (`TreeCommands::default_branch`) after the Session is acquired, so an idle-unloaded Session is restored for the answer as for §6.10. It reads no history page and writes no event. It exists for the request-side defaults that name no line: a management `schedule.save` that records the default branch for a new job ([Scheduler](plugins/Scheduler.md)), and the `loops`, `wakeups` and EventHub faces when a request omits a branch ([timeline branches §20.22](../timeline-branches.md#20-acceptance)). A caller resolves it once per request. |
There was a problem hiding this comment.
Problem: this link is relative to docs/design/appserver/, so plugins/Scheduler.md resolves to a missing file; the changed line keeps the broken path.
Failure: the request-side default section's Scheduler reference is dead.
Fix: use ../plugins/Scheduler.md.
There was a problem hiding this comment.
Fixed in d02268b. The link is now ../plugins/Scheduler.md (docs/design/appserver/sessions-service.md:504).
| | Case | Native process owner | TypeScript process owner ([process rows](../process-typescript.md)) | Shipped configuration today | | ||
| | --- | --- | --- | --- | | ||
| | Pending on a dependency whose row is Failed, Unresolved or Disabled | No. A required host row that fails during startup fails startup (`lib.rs`, required failures); after startup only `RunningServer::restart` can fail one, it has no caller in this repository, and its allow-list (`Rpc`, `Connection`, `Transport`, `Agents`, `Mcp`) holds no provider of an owner dependency | Yes, through the embedding input: an extension row's failure is its own diagnostic and does not fail startup (process rows §2.1), so an owner that injects another process row's service stays Pending when that row fails | None. `dimcode` configures no process rows; the planned Scheduler and Workflow owners inject only `sessions`, `settings`, `pluginFiles` and, respectively, `managementMethods` ([Scheduler §1](../plugins/Scheduler.md#1-structure)) and `workflowFiles` ([Workflow §1.3](../plugins/Workflow.md#13-concrete-package-rows)), all provided by required host rows that cannot be restarted (process rows §5.1) | | ||
| | Pending on a dependency whose row is Failed, Unresolved or Disabled | No. A required host row that fails during startup fails startup (`lib.rs`, required failures); after startup only `RunningServer::restart` can fail one, it has no caller in this repository, and its allow-list (`Rpc`, `Connection`, `Transport`, `Agents`, `Mcp`) holds no provider of an owner dependency | Yes, through the embedding input: an extension row's failure is its own diagnostic and does not fail startup (process rows §2.1), so an owner that injects another process row's service stays Pending when that row fails | None. `dimcode` configures no process rows; the planned Scheduler and Workflow owners inject only `sessions`, `settings`, `pluginFiles` and, respectively, `managementMethods` ([Scheduler](../plugins/Scheduler.md)) and `workflowFiles` ([Workflow §1.3](../plugins/Workflow.md#13-concrete-package-rows)), all provided by required host rows that cannot be restarted (process rows §5.1) | |
There was a problem hiding this comment.
Problem: the changed line's Workflow link uses #13-concrete-package-rows, but the heading is ### 1.3 Concrete package row (docs/design/plugins/Workflow.md:92).
Failure: the anchor does not resolve.
Fix: use #13-concrete-package-row.
There was a problem hiding this comment.
Fixed in d02268b. The Workflow link is now #13-concrete-package-row, and the Scheduler link is plain (docs/design/appserver/management-methods.md:234).
|
已按评审与自查标准修改,head 评审逐条
P3
自查额外修改
客户端可见变更
请 @zerob13 复审。 |
zerob13
left a comment
There was a problem hiding this comment.
[P2] Preserve the current default-branch selection on management saves. The revised Scheduler contract and binding now preserve the request field spelling, but say an omitted branch_id defaults to main. The shipped management save resolves the Session’s current default branch at save time; only a legacy stored row without a branch keeps the root fallback. If the user has moved the default, the same management request would silently schedule work on a different line. Keep optional branch_id on the management input, resolve and persist the current default on save, and retain the root fallback just for legacy rows. Pin both cases in acceptance. This is separate from the existing read-only receipt and EventHub recovery findings. Verified statically; Linux and macOS passed in the hosted run, with the final gate pending at review.
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: this PR writes the target owner contracts for EventHub and Scheduler and updates their references across 21 design files (refs #2023 and #2015). I reviewed the full main...head at d02268b (merge base 5a279d6), not only the delta from 56b47b4.
Verdict: REQUEST_CHANGES
Round-1 status
The two P1s are fixed.
- P1 1, Scheduler shapes break clients and stored documents: the appendix now keeps the shipped shapes.
Scheduleis untagged,Targetkeepskindand snake_case fields,JobOriginkeeps its shape,Jobkeeps the legacy fields, andRunis the delivery record (Scheduler.md:286-341, 368-402, 484-530). The delete reply is{job_id}and the conflict code isschedule_conflict(Scheduler.md:129, 159). The web reader's fields are present and the legacy documents decode as written (Scheduler.md:232; web/src/rpc/scheduler.ts:4-92). - P1 2, generated faces lose error codes: both owners now define internally tagged error enums with one variant per code (EventHub.md:416-437; Scheduler.md:753-770), and the Scheduler text states the wire code (Scheduler.md:153). The rutis service macro takes the serde tag as the wire code, so the
unknown_sourceretry in docs/typescript-plugin-authoring.md:533-535 can fire.
Of the 18 round-1 inline threads, 15 are fixed and 3 are partially fixed: 4668856825 (publication_unknown), 4668856906 (recovery and the loop rule), 4668856987 (service-faces blockquote). The P2s on face authority, the recovery paragraph and the hold, the reply wrappers, the window semantics and the serde spelling are fixed; the loop part of the recovery P2 remains.
CI at d02268b: verify (linux), macos-native and ci-ok pass. node scripts/adr-check.mjs --base 5a279d69 passes for 21 changed files.
P2
1. The loop recovery rule is missing and contradicted
Problem. Scheduler.md:192 says the loop pass does not use lookup and settles rounds through sessions.pending. The shipped recovery does use lookup: a record left delivering_round is settled by sessions.lookup with loop:<loopId>:<round> (crates/dim-agent-scheduler/src/loops.rs:933-1070). The forward pass reads sessions.pending only after it has last_input_id (loops.rs:807-858); a recovered record has no input id because the id comes from the reply that was lost.
Failure scenario. A loop round's input commits and the sessions.input reply is lost. The record stays delivering_round (loops.rs:886-914). After a restart the contract's pass reads sessions.pending, which needs an input id the record does not have, so the round cannot settle. The loop stalls with delivering_round set, or a later pass clears it and writes the same round again, duplicating the prompt. Scheduler.md:198 also says "the next pass settles it" without naming the lookup that can do it.
Evidence. docs/design/plugins/Scheduler.md:192,198; crates/dim-agent-scheduler/src/loops.rs:807-858, 886-914, 933-1070.
Fix. State both rules: the forward pass reads sessions.pending and leaves an inconclusive round for the next window; the recovery pass settles a delivering_round by the read-only lookup with the round's submission id. Add the crash-after-commit case to the verification.
2. The sessions dependencies conflict with ADR 027 and the Agents contract
Problem. The dependency lists and the requirements still ask Agents for sessions.input, lookup, pending and defaultBranchId (Scheduler.md:109, 263; EventHub.md:106, 218). The #2029 head this document cites includes ADR 027, which moves those operations to the target owners: a process caller reaches a branch-group data face by (sessionId, branchId) and a Session-group face by sessionId (ADR 027 D1 and D3), and Agents keeps only its own operations plus holds (ADR 027 D5 and D6). The Agents contract states the split and names Scheduler's pending and default-line reads and EventHub's input, receipt and delete cleanup as by-id calls (origin/pr-2098:docs/design/plugins/Agents.md:239, 275).
Failure scenario. If this contract is implemented as written, Scheduler and EventHub keep a sessions facade that principles §7.2 forbids. When the Agents contract lands, sessions.input, lookup, pending and defaultBranchId are removed (ADR 027 D6), so the two owners lose the interfaces this contract depends on. If Agents keeps them, the facade and the target owners' operations both exist, which the same rule forbids.
Evidence. docs/design/plugins/Scheduler.md:109, 263; docs/design/plugins/EventHub.md:106, 218; ADR 027 D1, D3, D5 and D6 at #2029 head da6f4a9; origin/pr-2098:docs/design/plugins/Agents.md:239, 275.
Fix. Call the InputQueue branch data face and the TimelineTree default-line read by id, keep launch, stop, delete, exists and the delete notice with Agents, and use the Agents lease for restore. If the transitional sessions shape is intended until #2098 merges, say so and link #2098.
3. publication_unknown is no longer named
Problem. The subscribe error list and the Agents requirement drop publication_unknown (EventHub.md:122, 218), while the accepted sessions.input contract still answers it when the input committed and its publication failed (docs/design/contracts/session-access.md:229). The old A.3 made it the stored-success case: the guide committed, so the subscription is stored and the call answers its id. The new text keeps the semantics in prose ("a committed guide stores the record even when its publication is unknown", EventHub.md:122) but no longer names the answer or asks Agents for it. The error table row at EventHub.md:141 also groups rejected with "a committed guide stores the record", although rejected is a refusal.
Failure scenario. A subscribe whose guide input commits but whose reply is lost gets publication_unknown. An implementation that follows the error list treats it as an error and stores nothing, so the branch has a guide block with no subscription and the model is told to subscribe to a source that never delivers. A retry writes a second guide block and can hit the subscription limit. publication_unknown was the one code that prevented this, and it is now absent from the contract.
Evidence. EventHub.md:122, 141, 218; docs/design/contracts/session-access.md:229; docs/design/appserver/sessions-service.md:254; current handling at crates/dim-event-hub/src/subscribe.rs:110.
Fix. Name publication_unknown as the stored-success case in the operation table and the Agents requirement (store the record, reply its id), or define a distinct stored-but-unconfirmed reply with the idempotent retry. Move rejected out of the committed-guide row.
4. The scheduleJobs face loses the caller for tool creates
Problem. Scheduler.md:273 says caller is request data, but CreateJob and UpdateJob carry only job and revision (Scheduler.md:623-636); no request has a caller. The current face carries Caller {session_id, branch_id, cwd} (crates/dim-agent-scheduler/src/methods.rs:1167-1174, 1444-1455), and the tool create uses it to set the target and to forbid a launch target (tool_merge, methods.rs:1193-1225). The new text still says only a management create or update may set a launch target (Scheduler.md:141), but without the caller the owner cannot tell a tool call from a management call.
Failure scenario. A cross-language schedule tool row calls create with {job: {name, schedule, prompt}, revision: null}. The owner has no Session or branch, so it cannot fill the target; the call fails or stores a job with no target. If the row fills JobInput.target itself, the owner cannot reject a launch target from a tool, so the management-only rule is unenforceable.
Evidence. docs/design/plugins/Scheduler.md:141, 273, 623-636; crates/dim-agent-scheduler/src/methods.rs:1167-1174, 1193-1225, 1444-1455.
Fix. Add caller: Caller to the create and update requests, or define separate tool operations with the caller, and state which operations are tool and which are management. Take caller: &Ctx instead if the runtime supplies the calling row.
5. The delivery retention rule is the wrong one
Problem. The flow table says terminal records older than seven days are removed (Scheduler.md:186), but the shipped delivery history keeps the newest 100 terminal deliveries per existing job, plus every delivering record and the last record naming a launch-owned Session (crates/dim-agent-scheduler/src/engine.rs:29, 558-700). Seven days is the wakeup and loop retention rule, not the delivery rule. The new verification asserts "the 100-record history" (Scheduler.md:232), so the two parts of the contract disagree.
Failure scenario. A job with 150 terminal deliveries in seven days: the contract keeps all of them because none is older than seven days, while the shipped owner keeps 100. A job with 20 terminal deliveries older than seven days: the contract drops records the shipped owner keeps and schedule.history can still read. A launch-owned Session's deletion follows its last record, so the retention rule also changes when the Session is deleted.
Evidence. docs/design/plugins/Scheduler.md:186, 232; crates/dim-agent-scheduler/src/engine.rs:29, 558-700; the old contract's rule at the merge base, Scheduler.md:660 and 855, is the newest 100 terminal deliveries per job.
Fix. State the newest 100 terminal deliveries per existing job, the delivering and launch-owner exceptions, and the separate seven-day rule for wakeups and loops. Keep the verification in sync.
6. The omitted branch default is wrong
Scheduler.md:141 says an omitted session branch_id defaults to main, but the shipped management save resolves the Session's current default branch at save time (crates/dim-agent-scheduler/src/methods.rs:683-700); only a legacy stored row without a branch keeps the root fallback. A save after the user moves the default schedules the job on main, the wrong line. Keep the resolution rule and pin both cases in acceptance.
P3 (optional)
- service-faces.md:334 still says the four subscription operations are on the same
eventHubface. EventHub.md:115 putsdeclareandpublishon the face and the other four in process. Update the blockquote and the count; the generated-face error-code sentence at service-faces.md:332 is also outdated now that EventHub uses an error enum. - EventHub.md:30 still says a caller reads every subscription; EventHub.md:124 takes
{sessionId}. Drop "or every subscription". - Scheduler.md:225 says the save answers
conflict; the table saysschedule_conflict(Scheduler.md:127, 159). - Scheduler.md:121 claims the surfaces keep the same error codes, but
rejectedis new (Scheduler.md:128, 162) and the web's known-error list does not include it (web/src/features/settings/ScheduledSettings.vue:151). List the new code or drop the claim. - Operation error lists are incomplete:
historycan answerschedule_invalid(methods.rs:1096-1103) andlocked(runs.rs:35-38), andrunNowcan answerservice_reloading(engine.rs:122). JobInputcarries bothtargetandinput_mode(Scheduler.md:429-448) and does not say which wins when both are present.ScheduledJobomits absentenabled_atanddisabled_reason(Scheduler.md:404-427) whilereported()emits null (document.rs:357-370);StopLoopReplyalways serializessettled(Scheduler.md:745) whilesession.loop.stopomits it when true (session.rs:401-407). The text claims the wire values are unchanged; either match the current wire or list the difference.- Dangling headings:
### 12. Loop(Scheduler.md:198) has no parent §12, and### 9.1(EventHub.md:159) has no parent §9. - Translation drift: docs/zh/design/contracts/session-boundary.md:579 keeps a dead
Scheduler §11.2anchor; docs/zh/design/appserver/sessions-service.md:337 linksplugins/Scheduler.md#21-两个目标from underappserver/; docs/zh/design/plugins/Notifications.md still citesScheduler §9. These pages are not updated. - EventHub.md:169 says §3.2 has eventHub/eventSubscriptions rows; the actual section is §4.9. EventHub.md:126 still describes a
clientorigin although no client subscribe path ships.
|
|
||
| The timer evaluates wakeups as part of the same one-second pass as job windows; there is no second scheduler and no Job-engine path. A `scheduled` record whose instant is observed within the grace window fires once: the process owner writes one Queue input through the public `sessions.input` with `submissionId` `wakeup:<wakeup_id>`, a first raw block `<dim-scheduler kind="wakeup">wakeup id</dim-scheduler>`, and the prompt as content. Nothing else is called: no `sessions.launch`, no `sessions.stop`, no `withdraw`, no deadline. Several records due in one pass reach their Sessions in `at` order, with the record id as the stable tie-breaker between records sharing an instant; the file's order is not a contract. | ||
| - `sessions` ([#2020](https://github.com/arcships/dim/issues/2020)): `input` for a delivery, `lookup` for the submission id, `pending` for a busy branch, `launch`, `stop` and `delete` for a launch target, and `defaultBranchId` for an omitted branch. |
There was a problem hiding this comment.
Problem: The dependency asks Agents for sessions.input, lookup, pending and defaultBranchId (also Scheduler.md:263), but ADR 027 at the #2029 head this document cites moves those operations to the target owners and leaves Agents only launch, stop, delete, exists and holds (D1, D3, D6). The Agents contract names Scheduler's pending and default-line reads as by-id calls (origin/pr-2098:docs/design/plugins/Agents.md:239,275).
Failure scenario: an implementation that follows this contract keeps the sessions facade principles §7.2 forbids; when #2098 lands, the methods this owner depends on are deleted, so the contract cannot be implemented as written. If Agents keeps them, the facade and the target owners' operations both exist.
Evidence: docs/design/plugins/Scheduler.md:109,263; ADR 027 D1/D3/D6 at #2029 head da6f4a950; origin/pr-2098:docs/design/plugins/Agents.md:239,275.
Fix: call the InputQueue branch data face and the TimelineTree default-line read by id, keep launch/stop/delete/exists and the delete notice with Agents, and use the Agents lease for restore. If the transitional sessions shape is intended until #2098 merges, say so and link #2098.
There was a problem hiding this comment.
Fixed in 853b6aa. Scheduler.md:108-111 now lists Agents' create_session/delete_session/session/acquire, the input owner's submit/pending, TimelineTree's directory and Loop's stop_turn, reached by id. The sessions row is gone. The remaining Dependencies heading for by-id calls is P3 in the new body.
| | The Scheduler generation unloads (reload, disable, shutdown) | `operation_interrupted`, sent by the existing call admission. The client calls `schedule.watch` again; while the namespace reloads, that call answers `service_reloading`, which is retryable | | ||
| | The same connection calls `schedule.watch` again | `{}`, and the new call takes over | | ||
| | The connection closes | `{}`, which nobody receives. A disconnect cancels nothing, so the handler ends on `caller.closed()` | | ||
| The loop pass does not use `lookup`: it reads `sessions.pending` for the loop's branch, and an inconclusive round is left for the next window; a pending round is not written again. A wakeup fire that gets a definite refusal settles `cancelled`; an uncertain reply keeps the record `scheduled` and retries within the grace; a record past the grace settles `expired` and is never replayed. A job window whose write is uncertain follows the delivery rule above. |
There was a problem hiding this comment.
Problem: This says the loop pass does not use lookup, but the shipped loop recovery settles a delivering_round by sessions.lookup with loop:<loopId>:<round> (crates/dim-agent-scheduler/src/loops.rs:933-1070). The forward pass reads sessions.pending only when it has last_input_id; a recovered record has no input id because the id comes from the lost reply.
Failure scenario: a loop round's input commits and the reply is lost; the record stays delivering_round (loops.rs:886-914). After a restart the contract's pass reads sessions.pending, which needs an input id the record does not have, so the round stalls or is written again, duplicating the prompt. Scheduler.md:198 also says "the next pass settles it" without the lookup rule.
Evidence: docs/design/plugins/Scheduler.md:192,198; crates/dim-agent-scheduler/src/loops.rs:807-858,886-914,933-1070.
Fix: state that the forward pass reads sessions.pending and the recovery pass settles delivering_round by read-only lookup with the round's submission id; add the crash-after-commit case to the verification.
There was a problem hiding this comment.
Fixed in substance at 9b87ef9, still present at 853b6aa: the recovery pass settles a delivering_round by re-submitting loop:<loopId>:<round> (Scheduler.md:187,195). Remaining: Scheduler.md:191 and :232-234 still call it lookup and expect accepted; submit replies {inputId, sequence} (origin/pr-2102:docs/design/plugins/InputQueue.md:81). See P2 3.
There was a problem hiding this comment.
Still present in ed43cd9. The recovery paragraph and the verification still say lookup and accepted. See P2 3.
|
|
||
| If step 3 fails with `storage`, the process is still running, so EventHub retires the guide input it wrote for each source the failed subscription named that no stored subscription on that branch names, with the same retire form and the submission id `eventhub-guide-retire:<subscriptionId>:<source>` using the failed subscription's id, skips a retire that cannot be written, and then answers `storage` (Appendix C). | ||
| - `sessions` ([#2020](https://github.com/arcships/dim/issues/2020)): `input` for an event and a guide, `lookup` for the per-branch idempotency, `exists` for the deletion reconciliation, and `defaultBranchId` for a request that omits its branch. `agent/session-deleted` is the notice that removed the Session's stored rows. |
There was a problem hiding this comment.
Problem: The dependency asks Agents for sessions.input, lookup and defaultBranchId (also EventHub.md:218), but ADR 027 at the #2029 head this document cites moves those operations to the target owners (D1, D3, D6); the Agents contract names EventHub's input, receipt and delete cleanup as by-id calls (origin/pr-2098:docs/design/plugins/Agents.md:239,275).
Failure scenario: EventHub keeps a sessions facade principles §7.2 forbids; when #2098 lands, input, lookup and defaultBranchId are removed from sessions, so delivery and reconciliation cannot run. If Agents keeps them, the facade and the InputQueue and TimelineTree operations both exist.
Evidence: docs/design/plugins/EventHub.md:106,218; ADR 027 D1/D3/D6 at #2029 head da6f4a950; origin/pr-2098:docs/design/plugins/Agents.md:239,275.
Fix: call the InputQueue branch data face for input and lookup and the TimelineTree read for defaultBranchId by id, keep exists and the delete notice with Agents, and use the Agents lease for restore.
There was a problem hiding this comment.
Partially fixed at 853b6aa. EventHub.md:220 now names Agents' session/acquire, the input owner's submit and TimelineTree's directory, but EventHub.md:106 still lists sessions.input/lookup/exists/defaultBranchId and :161 still calls sessions.exists. See P2 1.
| | `too_large` / `invalid_event` | Fix the body or fields; the event was not delivered | | ||
| | `limit_reached` | Remove a subscription first; 32 per Session, 1024 in total | | ||
| | `session_closed` / `branch_missing` / `branch_ended` | The target cannot take input; fix the target | | ||
| | `reloading` / `rejected` / `ambiguous` / `failed` / `transport` | The `sessions` call's answer; a committed guide stores the record and replies its id; `rejected` carries the `sessions` code in `reason` | |
There was a problem hiding this comment.
Problem: The contract removes publication_unknown from the subscribe errors and the Agents requirement (EventHub.md:122,218), but the accepted sessions.input contract still answers it when the guide committed and its publication failed (docs/design/contracts/session-access.md:229). The old A.3 made it the stored-success case. This row also groups rejected with "a committed guide stores the record", although rejected is a refusal.
Failure scenario: a subscribe whose guide input commits but whose reply is lost gets publication_unknown; an implementation that follows the error list stores nothing, so the branch has a guide block with no subscription and the model is told to subscribe to a source that never delivers. A retry writes a second guide block and can hit the subscription limit.
Evidence: EventHub.md:122,141,218; docs/design/contracts/session-access.md:229; docs/design/appserver/sessions-service.md:254; current handling at crates/dim-event-hub/src/subscribe.rs:110.
Fix: name publication_unknown as the stored success (store the record, reply the id) in the errors table and the Agents requirement, or define a distinct stored-but-unconfirmed reply with the idempotent retry. Move rejected out of this row.
There was a problem hiding this comment.
Partially fixed at 853b6aa. EventHub.md:141 and :220 name publication_unknown as the stored-success answer, but the write now targets InputQueue's submit, which has no such code; only withdraw answers it (origin/pr-2102:docs/design/plugins/InputQueue.md:81-82,94, head 823124c7). See P2 2.
|
|
||
| ## Binding appendix | ||
|
|
||
| The job operations are marked on the `Scheduler` owner type under the wire name `scheduleJobs`. `caller` is request data: the Session and branch a tool-created job targets. The wakeup and loop operations are Rust methods on the same owner type; the Session part calls them in process. `next` and the record's internal pass stay off the job face. |
There was a problem hiding this comment.
Problem: This says caller is request data, but CreateJob and UpdateJob carry only job and revision (Scheduler.md:623-636); no request has a caller. The current face carries Caller {session_id, branch_id, cwd} (crates/dim-agent-scheduler/src/methods.rs:1167-1174,1444-1455), and the tool create uses it to set the target and to forbid a launch target (tool_merge, methods.rs:1193-1225). The new text still says only a management create or update may set a launch target (Scheduler.md:141), but without the caller the owner cannot tell a tool call from a management call.
Failure scenario: a cross-language schedule tool row calls create with {job: {name, schedule, prompt}, revision: null}. The owner has no Session or branch, so it cannot fill the target; the call fails or stores a job with no target. If the row fills JobInput.target itself, the owner cannot reject a launch target from a tool, so the management-only rule is unenforceable.
Evidence: docs/design/plugins/Scheduler.md:141,273,623-636; crates/dim-agent-scheduler/src/methods.rs:1167-1174,1193-1225,1444-1455.
Fix: add caller: Caller to the create and update requests, or define separate tool operations with the caller, and state which operations are tool and which are management. Take caller: &Ctx instead if the runtime supplies the calling row.
There was a problem hiding this comment.
Partially fixed at 853b6aa. caller is on CreateJob and UpdateJob (Scheduler.md:130-131, 634-650), and the example supplies it (Scheduler.md:56). Remaining: Scheduler.md:144 says create and update fill a session target from caller and refuse a launch target, but tool_merge fills the target from caller only on create; on update it keeps the stored target and only patches input_mode (crates/dim-agent-scheduler/src/methods.rs:1193-1245), and the shipped tool patch has no target (methods.rs:1156-1166). The example also sends both target (Scheduler.md:52) and caller (Scheduler.md:56). See P2 6.
|
已按评审修改,head 本轮处理(剩余 inline 项)
自查发现(1–9)
留给第二步
绑定附录临时 crate(workspace crates + rutis 0.23.0、rustc 1.100) |
zerob13
left a comment
There was a problem hiding this comment.
Verdict: changes requested. The round-5 fixes hold: the loop recovery text matches loops.rs, the events list row and service-faces 4.9 are corrected, and publication_unknown is now documented as the stored-success answer. Three items still block this as a target contract.
Must fix
1. The omitted branch_id default contradicts the shipped management save.
Scheduler.md:142 says an omitted branch_id defaults to main. The shipped save resolves the Session's current default branch instead: TargetInput::resolve calls shared.default_branch(&session_id) when branch_id is absent; only a stored legacy row without it keeps the root fallback. An implementation that follows the contract would schedule work on main after the user moved the default. Say that the management save resolves the current default, and that a stored legacy row without branch_id means the root. Keep branch_id optional on the management input.
2. EventHub and Scheduler still depend on sessions operations that ADR 027 removes.
EventHub.md:106 and Scheduler.md:110 depend on sessions.input, lookup, pending and defaultBranchId; the requirement blocks repeat them at EventHub.md:220 and Scheduler.md:265. At the cited #2029 head a3c7c4d8a, ADR 027 D6 says the sessions methods that are not Agents' own are deleted and callers reach target owners by id; #2098 names the same reads by id. The PR body leaves this for "step 2". A target contract that keeps a facade the same series deletes is not implementable. Move input/lookup/pending to the InputQueue face and defaultBranchId to the TimelineTree read, and keep launch/stop/delete/exists, the delete notice and the restore lease with Agents. If the current shape is intentionally transitional, say so on those rows, link the follow-up issue, and remove them from the target requirement table.
3. caller on update is under-specified and does not match tool_merge.
Scheduler.md:142 says create and update both fill a session target from caller and refuse a launch target. tool_merge fills the target from caller only on create; on update it keeps the stored target and only patches input_mode when the stored target is a session. As written, an implementer would replace a management-created launch job's target or reject an update it should accept. State the create and update paths separately. Also, the shipped update path never reads caller (it is used only for create's origin and quota), so UpdateJob.caller currently carries no behaviour. Either define what update enforces, or drop the field.
Minor
- The appendix
Calleromits the shippedcwdfield. Nothing reads it today, so dropping it is safe, but the appendix is the binding: keep it or say why it is gone. - The
#2029head cited at EventHub.md:216 and Scheduler.md:261 is already behind #2029 (9e629e9). The ADR still has D6, so finding 2 is unchanged, but the "reviewed against that head" note goes stale on every push.
Verified
loops.rsforwardpendingpath andsettle_deliveringlookup match the new text, includingloop:<loopId>:<round>.subscribe.rstreatspublication_unknownas written and stores the subscription before replying its id.- CI at
9b87ef9:ci-ok,macos-nativeandverify (linux)pass.
|
已按评审修改,head 跨 PR 对齐:
验证: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: target owner contracts for EventHub and Scheduler, with reference updates across 21 design files (refs #2023 and #2015). Reviewed the full main...head at 853b6aaa (merge base 5a279d69), including the new by-id conversion commit.
Verdict: REQUEST_CHANGES
What the new commit changed
853b6aaa replaces Scheduler's sessions dependency list with by-id calls to Agents, InputQueue, TimelineTree and Loop, and changes the requirement and rule check to match. That fixes the Scheduler half of the round-2 sessions finding. EventHub's requirement moved to the same shape, but its dependency row and sessions.exists line did not. Scheduler's recovery paragraph now re-submits the same submissionId, but the answer set, the status word and the verification still describe the old lookup.
P2
1. EventHub still keeps the sessions facade in its dependency row
Problem. EventHub.md:106 still declares sessions with input, lookup, exists and defaultBranchId, and EventHub.md:161 repairs a missed delete notice with sessions.exists. EventHub.md:220 now asks for Agents' session, Agents' acquire, the input owner's submit by (sessionId, branchId) and TimelineTree's directory. ADR 027 D1/D2/D3/D4/D5/D6 and the Agents contract move those calls to the target owners and delete the non-Agents sessions methods (origin/pr-2098:docs/design/plugins/Agents.md:217-229,239, head 59e4316d; origin/pr-2029:docs/adr/027-cross-scope-access-by-id.md D1 to D6, head ff3298f).
Failure scenario. An implementer follows the dependency section, injects sessions and calls input and lookup; #2098 removes them, so delivery and reconciliation cannot run. If Agents keeps them, the facade principles §7.2 forbids and the requirement at :220 both exist, and the two sections of this contract disagree.
Evidence. docs/design/plugins/EventHub.md:106,161,220; origin/pr-2098:docs/design/plugins/Agents.md:217-229,239,275; origin/pr-2029:docs/adr/027-cross-scope-access-by-id.md D1, D2, D3, D4, D6.
Fix. Replace the sessions row with the same by-id calls the requirement names: Agents' session and acquire, the input owner's submit, and TimelineTree's directory. Change :161 to the Agents session read. State that these are by-id calls, not injected dependencies.
2. Both contracts ask submit for publication_unknown, which only withdraw answers
Problem. EventHub.md:220 says the input owner's submit answers publication_unknown, and Scheduler.md:267 lists it as a submit retry answer. At the current InputQueue head, submit replies {inputId, sequence} and its errors are invalid, line_ended, cancelled and closed; publication_unknown belongs to withdraw (origin/pr-2102:docs/design/plugins/InputQueue.md:81-82,94, head 823124c7). The Agents contract resolves a lost reply by re-sending the same submissionId, whose duplicate answers the existing receipt, and says no separate lookup exists (origin/pr-2098:docs/design/plugins/Agents.md:223,276). EventHub's subscribe error table still carries the old sessions.input set at EventHub.md:141-143: publication_unknown, reloading/ambiguous/failed/transport and rejected.
Failure scenario. A guide write or a delivery commits and its reply is lost. submit never answers publication_unknown, so an implementation that waits for it cannot settle the record; one that adds the code to submit diverges from #2102, and one that maps ambiguous or failed sees codes the target does not send. A retry with a new subscription id writes a second guide block.
Evidence. docs/design/plugins/EventHub.md:141-143,220; docs/design/plugins/Scheduler.md:267; origin/pr-2102:docs/design/plugins/InputQueue.md:81-82,91-95; origin/pr-2098:docs/design/plugins/Agents.md:223,276.
Fix. Settle a lost reply by re-sending the same submissionId and using the existing receipt. If publication_unknown is genuinely needed on submit, add it to #2102's submit contract as an explicit requirement and update both error tables; do not assume it. Map the EventHub table to submit's errors and the route errors below, and keep publication_unknown only where withdraw is the operation.
3. Scheduler's recovery text still describes the removed lookup
Problem. Scheduler.md:191 now says a delivering record is settled by re-submitting the same submissionId and that submit answers the existing receipt, but then says "the answer accepted settles delivered with the input's id and sequence" and keeps the old lookup answers unknown, reloading and ambiguous; the next paragraph says a cold Session answers NoSession at the route. submit replies {inputId, sequence} with no status, and its errors are invalid, line_ended, cancelled and closed (origin/pr-2102:docs/design/plugins/InputQueue.md:81,91-95). The verification repeats the old text: "settles delivering records by the read-only lookup" and "the first lookup may answer unknown, and a later accepted settles it" (Scheduler.md:232-234).
Failure scenario. An implementer waits for a status: accepted that submit never returns, or treats invalid or line_ended as an undetermined answer, so every recovery attempt is recorded as unknown and the fifth attempt settles lost although the input committed. The attempt bound is also stated for answers submit does not produce.
Evidence. docs/design/plugins/Scheduler.md:191,232-234; origin/pr-2102:docs/design/plugins/InputQueue.md:81,91-95; origin/pr-2098:docs/design/plugins/Agents.md:223.
Fix. State the submit recovery in submit's terms: the receipt settles delivered with its inputId and sequence; a repeated submissionId returns the existing receipt; a transport failure or the route's retry answer counts toward the persisted bound; line_ended, closed and the route's definite answers settle failed. Add SessionClosing/NoLine handling from #2127. Update the verification.
4. The omitted branch still defaults to main
Problem. Scheduler.md:144 says a session target's branch_id defaults to main. The shipped management save resolves the Session's current default branch when the input omits it (TargetInput::resolve, crates/dim-agent-scheduler/src/methods.rs:683-710, shared.default_branch at :696); only a stored legacy row without a branch keeps the root fallback (crates/dim-agent-scheduler/src/document.rs:240-260). The changed paragraph at docs/design/appserver/sessions-service.md:504 says the management save records the default branch.
Failure scenario. A user moves the Session's default line, then a management save without branch_id schedules the job on main, the wrong line, and the stored job keeps delivering there.
Evidence. docs/design/plugins/Scheduler.md:144; crates/dim-agent-scheduler/src/methods.rs:683-710; crates/dim-agent-scheduler/src/document.rs:240-260; docs/design/appserver/sessions-service.md:504.
Fix. State that a management save resolves and persists the current default, and that a stored row without branch_id means the root. Keep branch_id optional and pin both cases in acceptance.
5. The delivery retention rule is still the wrong one
Problem. Scheduler.md:189 says terminal records older than seven days are removed. The shipped delivery history keeps the newest 100 terminal deliveries per existing job plus every delivering record and the last record naming a launch-owned Session (crates/dim-agent-scheduler/src/engine.rs:29,558-600). Seven days is the wakeup and loop rule (crates/dim-agent-scheduler/src/wakeups.rs:31,379; crates/dim-agent-scheduler/src/loops.rs:40,789). The verification still says "the 100-record history" (Scheduler.md:236).
Failure scenario. A job with 150 terminal deliveries in seven days keeps all 150 here while the owner keeps 100; terminal records older than seven days are dropped although schedule.history reads them today. A launch-owned Session's deletion follows its last record, so the rule also changes when that Session is deleted.
Evidence. docs/design/plugins/Scheduler.md:189,236; crates/dim-agent-scheduler/src/engine.rs:29,558-600; merge base Scheduler.md:660,782,855.
Fix. State the newest 100 terminal deliveries per existing job, the delivering and launch-owner exceptions, and the separate seven-day rule for wakeups and loops.
6. caller is added but create and update are still conflated
Problem. Scheduler.md:144 says the tool's create and update pass caller: Caller and the owner fills a session target from it, refusing a launch target with schedule_invalid. The shipped tool patch has no target (crates/dim-agent-scheduler/src/methods.rs:1156-1166), and tool_merge fills the target from caller only on create; on update it keeps the stored target and only patches input_mode (crates/dim-agent-scheduler/src/methods.rs:1193-1245). UpdateJob.caller is never read. The example sends both target (Scheduler.md:52) and caller (Scheduler.md:56).
Failure scenario. A tool update of a management-created launch job is rejected with schedule_invalid or retargeted to the calling Session, neither of which is shipped behavior; Client-visible changes lists no such change. A tool create that follows the example sends target and caller, and the owner cannot tell which to store.
Evidence. docs/design/plugins/Scheduler.md:52,56,130-131,144,634-650; crates/dim-agent-scheduler/src/methods.rs:1156-1166,1170-1174,1193-1245.
Fix. State the create path and the update path separately; remove target from the tool request or make the caller-only rule explicit; drop caller from UpdateJob if update does not read it. Keep or explain cwd on Caller (methods.rs:1170-1174).
P3 (optional)
- The route names in
Scheduler.md:193(NoSession) and:267(NoLine) are both defined by #2127. The requirement still lists onlyNoLinewhile the recovery paragraph relies onNoSessionand omitsSessionClosing. Name all three or point at #2127 for the names and next steps. lookupstill appears atScheduler.md:12,34,181,187,195,197,201,232-234,236although no lookup operation exists. The P2 3 fix should sweep these to the submit wording.- The Scheduler dependency section now lists by-id calls under the heading
Dependencies(Scheduler.md:106-111). ADR 027 D4 says a by-id call is not a dependency; retitle the list or mark those rows as calls. - The EventHub delete requirement asks for one
agent/session-deletednotice for loaded and unloaded Sessions (EventHub.md:161,220), while #2098 splits it intoagent/unloaded-session-deletedandagent/session-deleted(origin/pr-2098:docs/design/plugins/Agents.md:235). EventHub should consume both or say thesessionreconciliation covers the unloaded case.docs/design/plugin-contract.md:209has the same one-notice wording. EventHub.md:171saysservice-faces.md§3.2 has theeventHub/eventSubscriptionsrows and §4 theeventSubscriptionssection; the section is §4.9.docs/design/appserver/sessions-service.md:489still linksEventHub §3.4, andservice-faces.md:354still referencesEventHub A.3. The zh counterparts (docs/zh/design/plugin-contract.md:179-180,docs/zh/design/plugins/Notifications.md:41,198,209,362,docs/zh/design/contracts/session-boundary.md:579,docs/zh/design/appserver/sessions-service.md:229,337) still link removed anchors.- Dangling headings remain:
Scheduler.md:199has### 12. Loopwithout a parent §12, andEventHub.md:159has### 9.1without a parent §9. Scheduler.md:228says a competing write answersconflictwhile the table saysschedule_conflict(Scheduler.md:162).rejectedis new in the table but not in the web's known-error list (web/src/features/settings/ScheduledSettings.vue:151).historycan answerschedule_invalidandlocked, andrunNowcan answerservice_reloading, but the error columns omit them.StopLoopReplyserializessettledeven when true whilesession.loop.stopomits it (crates/dim-agent-scheduler/src/session.rs:401-407), andCalleromits the shippedcwd.EventHub.md:126still describes aclientorigin although no client subscribe path ships.- The #2029 head cited at
EventHub.md:216andScheduler.md:263(a3c7c4d8a) is behind the current headff3298f. The ADR is unchanged; the note goes stale on every push.
Verification
ADR freeze passes for 21 changed files: node scripts/adr-check.mjs --base 5a279d69. At 853b6aaa, macos-native and changes pass, verify (linux) is in progress, and ci-ok has not reported yet. origin/main is 4d081fe6 (#2029 merged); git merge-tree against it is clean, so there is no textual conflict with main.
Cross-PR
- #2029 at
ff3298f(merged as4d081fe6): ADR 027 keeps D1 to D6 and §7.2; the new commit changed onlydocs/templates/owner-redesign.md. - #2098 at
59e4316d: the directory table still moves input and lookup to InputQueue, pending to InputQueue, and defaultBranchId to TimelineTree, and says no separate lookup exists (Agents.md:217-229,239,275). - #2102 at
823124c7:submitanswers{inputId, sequence}with errorsinvalid,line_ended,cancelled,closed;withdrawis the only operation withpublication_unknown(InputQueue.md:81-82,94). The earlierinterruptednaming conflict with #2103 is resolved: both now usepublication_unknownforwithdraw. - #2103 at
5d3fddd:session.input.withdrawanswerspublication_unknown(InputMethods.md:79,92), matching #2102. - #2127 is the authority for the route error names
NoSession,SessionClosingandNoLine; the contracts should cite it rather than restate a subset. - #2100 at
c7ec39be: the branch tool chain files do not overlap EventHub or Scheduler; no conflict found.
|
|
||
| If step 3 fails with `storage`, the process is still running, so EventHub retires the guide input it wrote for each source the failed subscription named that no stored subscription on that branch names, with the same retire form and the submission id `eventhub-guide-retire:<subscriptionId>:<source>` using the failed subscription's id, skips a retire that cannot be written, and then answers `storage` (Appendix C). | ||
| - `sessions` ([#2020](https://github.com/arcships/dim/issues/2020)): `input` for an event and a guide, `lookup` for the per-branch idempotency, `exists` for the deletion reconciliation, and `defaultBranchId` for a request that omits its branch. `agent/session-deleted` is the notice that removed the Session's stored rows. |
There was a problem hiding this comment.
Problem: This row still declares sessions with input, lookup, exists and defaultBranchId, and EventHub.md:161 still repairs a missed notice with sessions.exists. The requirement at EventHub.md:220 now asks for Agents' session, Agents' acquire, the input owner's submit and TimelineTree's directory. ADR 027 D1/D2/D3/D4/D6 and the Agents contract move those calls to the target owners and delete the non-Agents methods (origin/pr-2098:docs/design/plugins/Agents.md:217-229,239, head 59e4316d).
Failure: an implementer follows this section, injects sessions and calls input/lookup; #2098 deletes them, so delivery and reconciliation cannot run. If Agents keeps them, the facade and the requirement both exist and the two sections disagree.
Evidence: docs/design/plugins/EventHub.md:106,161,220; origin/pr-2098:docs/design/plugins/Agents.md:217-229,239,275; origin/pr-2029:docs/adr/027-cross-scope-access-by-id.md D1, D2, D3, D4, D6 (head ff3298f).
Fix: replace the row with Agents' session and acquire, the input owner's submit, and TimelineTree's directory; change :161 to the Agents session read; state these are by-id calls, not injected dependencies.
There was a problem hiding this comment.
Still present in ed43cd9. EventHub.md:106 still declares sessions with input, lookup, exists and defaultBranchId, :161 still calls sessions.exists, and :220 still asks the input owner's submit for publication_unknown. #2098 at c3acab35 still moves these calls by id (Agents.md:219-229,239), and ADR 027 is now in origin/main. Also, replacing lookup for per-branch idempotency requires the deterministic submission id eventhub:{source}:{eventId} (crates/dim-event-hub/src/publish.rs:869-874) and the duplicate receipt; the contract does not state it. See P2 1.
|
|
||
| ## Requirements raised to mechanism owners | ||
|
|
||
| - **Agents (#2020) and the line's input owner (#2027):** Agents' `session` for a target's existence, `acquire` when a subscription's reconciliation must keep a Session loaded, the `agent/session-deleted {agentId, sessionId}` notice, and the input owner's `submit` reached by `(sessionId, branchId)` id, which answers `publication_unknown` when the guide committed and its publication is unconfirmed (targets pending [#2098](https://github.com/arcships/dim/pull/2098) and [#2102](https://github.com/arcships/dim/pull/2102)); TimelineTree's `directory` supplies an omitted branch. EventHub takes no `HostDispatch` object and decodes no reply envelope. |
There was a problem hiding this comment.
Problem: This asks the input owner's submit to answer publication_unknown. At the current InputQueue head submit replies {inputId, sequence} and its errors are invalid, line_ended, cancelled and closed; publication_unknown is a withdraw answer (origin/pr-2102:docs/design/plugins/InputQueue.md:81-82,94, head 823124c7). The Agents contract resolves a lost reply by re-sending the same submissionId, whose duplicate answers the existing receipt (origin/pr-2098:docs/design/plugins/Agents.md:223,276). The subscribe error table at EventHub.md:141-143 still carries the old sessions.input set (publication_unknown, reloading/ambiguous/failed/transport, rejected).
Failure: a guide commits and its reply is lost; submit never answers publication_unknown, so the subscribe cannot settle, or an implementation adds an out-of-contract code and diverges from #2102. A retry with a new subscription id writes a second guide block.
Evidence: docs/design/plugins/EventHub.md:141-143,220; origin/pr-2102:docs/design/plugins/InputQueue.md:81-82,91-95; origin/pr-2098:docs/design/plugins/Agents.md:223,276.
Fix: settle a lost reply by re-sending the same submissionId and using the existing receipt. If publication_unknown is needed on submit, add it to #2102's submit contract explicitly and update this table; otherwise map the table to submit's errors and the route errors.
There was a problem hiding this comment.
Still present in ed43cd9. submit at #2102 3b48e124 replies {inputId, sequence} with invalid, line_ended, cancelled and closed; publication_unknown is a withdraw error (InputQueue.md:81-82,94). EventHub's own EventHubError enum (EventHub.md:416-439) has no PublicationUnknown variant, so the table lists a code the binding cannot produce. See P2 2.
| | `{seq: 0, kind: "watching"}` | Once, after the connection's watch is registered and before any change can be sent to it | | ||
| | `{seq: n, kind: "jobs"}` | A write to the `schedule` Settings document commits: a job save, delete or pause/resume; from the `schedule` source's `settings.changed` event | | ||
| | `{seq: n, kind: "run", jobId, runId, state, terminal}` | A delivery's record changes: one item for each state the record took in that write, in the order the writes happened; `terminal` is true exactly on a state that ends the delivery: `delivered`, `failed`, `lost` or `missed` | | ||
| Recovery is read-only and never repeats the input. A `delivering` record is settled by re-submitting the same `submissionId` to the line's input owner (`submit` answers the existing receipt, so no separate lookup operation exists); the answer `accepted` settles `delivered` with the input's id and sequence. `unknown`, `reloading`, `ambiguous` and a transport failure carry no fact: the record stays `delivering`, and each answer counts toward a persisted five-attempt bound. `unknown` is final only for a write that returned before the lookup began; an admitted write whose reply was lost keeps running to its own outcome, so `unknown` cannot settle a record. Each pass persists the incremented `attempts` before it sends the lookup, and a crash between the persist and the lookup still counts that attempt. A record whose stored `attempts` is already five settles `lost` with `detail: lookup_budget_exhausted` before any lookup; the fifth answer without a fact settles `lost` with `detail` naming that answer. `session_closed`, `branch_missing` and `branch_ended` settle the record `failed` and disable the session-target job, cancel the wakeup or stop the loop. A launch record whose Session was never created settles `lost` with `detail: launch_reply_unknown`. The record's stored `job_revision` decides the target-gone disable; a record without it never disables its job. A row reload while an accepted input is in flight is the same case: the first lookup may answer `unknown`, the record stays `delivering`, and a later `accepted` settles it `delivered`; the verification covers it. |
There was a problem hiding this comment.
Problem: The paragraph now says recovery re-submits the same submissionId, but still says "the answer accepted settles delivered" and keeps the lookup answers unknown, reloading and ambiguous. submit replies {inputId, sequence} with no status, and its errors are invalid, line_ended, cancelled and closed (origin/pr-2102:docs/design/plugins/InputQueue.md:81,91-95, head 823124c7); a duplicate submission id answers the existing receipt (origin/pr-2098:docs/design/plugins/Agents.md:223). The verification repeats the old text at Scheduler.md:232-234.
Failure: an implementer waits for status: accepted that submit never returns, or treats invalid/line_ended as undetermined, so a committed input can be settled lost after five attempts.
Evidence: docs/design/plugins/Scheduler.md:191,232-234; origin/pr-2102:docs/design/plugins/InputQueue.md:81,91-95; origin/pr-2098:docs/design/plugins/Agents.md:223.
Fix: state that the receipt settles delivered with its inputId and sequence; a duplicate returns the existing receipt; transport or the route's retry answer counts toward the bound; line_ended, closed and the route's definite answers settle failed. Update the verification and the remaining lookup wording.
There was a problem hiding this comment.
Still present in ed43cd9. The paragraph still says the answer accepted settles delivered and keeps unknown, reloading, ambiguous and lookup; the verification at :232-234 repeats it. submit replies {inputId, sequence} with no status (origin/pr-2102:docs/design/plugins/InputQueue.md:81). See P2 3.
| - Items go only to the connections that watched: there is no broadcast, and a connection that did not watch receives nothing. | ||
| - One watch per connection: a second `schedule.watch` on the same connection answers the earlier call `{}` and takes over, so one change sends one item. The earlier call's progress ends at its reply. | ||
| - A watch belongs to the generation that admitted it. The call ends in one of three ways, as the client sees it: | ||
| The re-submission reaches the target Session by id: a cold Session answers `NoSession` at the route, the scheduler takes an Agents hold, and the next call after Agents loads the generation delivers; the delivery's admission covers the restore and the call. Admission: the hold is taken before the record's external effect and released after the terminal record. A row unload does not release the old hold; it stays until process shutdown, and the next generation takes a separate hold per unsettled record and releases that one after the terminal record. The next generation reconstructs the unsettled set from the `delivering` records before its first window; `activated` gates the first pass. Scheduler never holds a Session handle across the lookup or the delivery. |
There was a problem hiding this comment.
P3. NoSession is defined by #2127, and so are SessionClosing and NoLine. The requirement at Scheduler.md:267 lists only NoLine at the route, while this paragraph relies on NoSession and does not mention SessionClosing. Name all three or point at #2127 for the names and next steps. This does not block beyond the P2 recovery fix.
There was a problem hiding this comment.
|
|
||
| **Retention.** A terminal record has no consumer after it settles: `list` is its only reader, and a record nobody listed is already unrecoverable, so the bound costs no information the design promises. A terminal record is removed once seven days have passed since it settled — `settled_at`, not `created_at`, so a record created long before it fired is not dropped early; the timer pass removes it in the same write that settles the pass's other outcomes, so the file never grows without bound, the per-second pass never parses more than it must, and `list` reads exactly what is stored. The pass reads the file once per second, takes one clock reading, and writes at most once per pass. | ||
| A job's target is the shipped shape: `{kind: "session", session_id, branch_id?, input_mode?}` or `{kind: "launch", cwd, agent_id?, policy?, max_run_minutes?}`. `branch_id` defaults to `main`; `input_mode` defaults to `queue`; `max_run_minutes` defaults to 60. Only a management create or update may set a launch target; the tool's create and update pass `caller: Caller` and the owner fills a session target from it, refusing a launch target with `schedule_invalid`. The management save omits `caller` and carries the target explicitly. A job stores its revision; an update reads the stored job under the Settings change and patches the fields the caller sent. The job's submission ids are `scheduler:<runId>`, `wakeup:<wakeupId>` and `loop:<loopId>:<round>`. |
There was a problem hiding this comment.
Problem: branch_id defaults to main here, but the shipped management save resolves the Session's current default branch when the target omits it (TargetInput::resolve, crates/dim-agent-scheduler/src/methods.rs:683-710, shared.default_branch at :696). Only a stored legacy row without a branch keeps the root fallback (crates/dim-agent-scheduler/src/document.rs:240-260). The changed paragraph at docs/design/appserver/sessions-service.md:504 says the management save records the current default.
Failure: the user moves the Session's default line, then a management save without branch_id schedules the job on main, the wrong line, and the stored job keeps delivering there.
Evidence: docs/design/plugins/Scheduler.md:144; crates/dim-agent-scheduler/src/methods.rs:683-710; crates/dim-agent-scheduler/src/document.rs:240-260; docs/design/appserver/sessions-service.md:504.
Fix: state that a management save resolves and persists the current default when branch_id is omitted, and that a stored row without branch_id means the root. Keep branch_id optional and pin both cases in acceptance.
There was a problem hiding this comment.
Still present in ed43cd9. Scheduler.md:144 still says branch_id defaults to main, and the binding at :327-346 cannot express an omitted branch (Target::Session.branch_id is a required String). The shipped management save resolves the default at crates/dim-agent-scheduler/src/methods.rs:683-714, shared.default_branch at :696; only a legacy stored row keeps the root (document.rs:240-260). See P2 4.
| | Wakeup expiry | A record past the grace is `expired` unless its submission id is found; a gone target is `cancelled` | — | — | The next load settles it | Scheduler | | ||
| | Loop round | The pass reads the file, writes one queued input, advances the round or leaves the loop `waiting` | A stop settles the record; a pending round is not written | The record stays; the next load re-evaluates | The forward pass reads the input owner's `pending` when it has `last_input_id`; the recovery pass settles a stored `delivering_round` by the read-only `lookup` with `loop:<loopId>:<round>` | Scheduler | | ||
| | Loop stop | Settle `stopped`; a terminal record is returned unchanged | — | — | — | Scheduler | | ||
| | Retention | Terminal records older than seven days are removed in the pass's write | — | — | The next load prunes | Scheduler | |
There was a problem hiding this comment.
Problem: This row applies the seven-day rule to deliveries. The shipped delivery retention keeps the newest 100 terminal deliveries per existing job plus every delivering record and the last record naming a launch-owned Session (crates/dim-agent-scheduler/src/engine.rs:29,558-600). Seven days is the wakeup and loop rule (crates/dim-agent-scheduler/src/wakeups.rs:31,379; crates/dim-agent-scheduler/src/loops.rs:40,789). The verification still says "the 100-record history" (Scheduler.md:236), so the contract disagrees with itself.
Failure: a job with 150 terminal deliveries in seven days keeps all 150 here while the owner keeps 100; terminal records older than seven days are dropped here although schedule.history reads them today. A launch-owned Session's deletion follows its last record, so the rule also changes when that Session is deleted.
Evidence: docs/design/plugins/Scheduler.md:189,236; crates/dim-agent-scheduler/src/engine.rs:29,558-600; merge base docs/design/plugins/Scheduler.md:660,782,855.
Fix: state the newest 100 terminal deliveries per existing job, the delivering and launch-owner exceptions, and the separate seven-day rule for wakeups and loops.
There was a problem hiding this comment.
Still present in ed43cd9. Scheduler.md:189 still applies seven days to deliveries; the shipped rule is the newest 100 terminal deliveries per existing job plus non-terminal and launch-owner records (crates/dim-agent-scheduler/src/engine.rs:29,558-600). Seven days is the wakeup and loop rule (wakeups.rs:31,379; loops.rs:40,789). :236 still says the 100-record history. See P2 5.
| ..JobInput::default() | ||
| }, | ||
| revision: None, | ||
| caller: Some(Caller { session_id, branch_id }), |
There was a problem hiding this comment.
Problem: The example sends both a session target (Scheduler.md:52) and caller (here), while Scheduler.md:144 says the tool's create and update pass caller and the owner fills a session target from it. The shipped tool patch has no target (crates/dim-agent-scheduler/src/methods.rs:1156-1166), and tool_merge fills the target from caller only on create; on update it keeps the stored target and only patches input_mode when that target is a session (crates/dim-agent-scheduler/src/methods.rs:1193-1245). UpdateJob.caller is never read (Scheduler.md:644-650).
Failure: a tool update of a management-created launch job is rejected with schedule_invalid or retargeted to the calling Session, neither of which is shipped behavior; Client-visible changes lists no such change. A tool create that follows the example sends target and caller, and the owner cannot tell which to store.
Evidence: docs/design/plugins/Scheduler.md:52,56,144,634-650; crates/dim-agent-scheduler/src/methods.rs:1156-1166,1193-1245.
Fix: state the create path (caller fills the session target) and the update path (stored target kept, input_mode may change) separately. Remove target from the tool request, and drop caller from UpdateJob if update does not read it. Keep cwd on Caller or say why it is gone (methods.rs:1170-1174).
There was a problem hiding this comment.
Still present in ed43cd9. Scheduler.md:144 still says create and update both fill a session target from caller; tool_merge fills it only on create and on update keeps the stored target and patches only input_mode (crates/dim-agent-scheduler/src/methods.rs:1193-1245), and UpdateJob.caller is never read. The example still sends target (:52) and caller (:56). See P2 6.
|
|
||
| ## Requirements raised to mechanism owners | ||
|
|
||
| - **Agents (#2020), the line's input owner (#2027), TimelineTree (#2024) and Loop (#2027):** the operations the dependency list names, reached by id (ADR 027), with `session_closed`, `line_ended`, `NoLine` at the route, `reloading`, `publication_unknown` and `transport` as the target-gone and retry answers. Scheduler takes no `HostDispatch` object and decodes no reply envelope. |
There was a problem hiding this comment.
Problem: This lists publication_unknown as a submit retry answer. At the current InputQueue head submit has no such error; only withdraw answers it (origin/pr-2102:docs/design/plugins/InputQueue.md:81-82,94, head 823124c7), and a lost submit reply is resolved by re-sending the same submissionId, whose duplicate answers the existing receipt (origin/pr-2098:docs/design/plugins/Agents.md:223,276). The recovery paragraph at Scheduler.md:191 omits publication_unknown from its no-fact set, so the two sections disagree.
Failure: a delivery commits and its reply is lost; the contract gives no answer that submit can produce, so an implementation either waits for publication_unknown or records the delivery failed/lost while the input was accepted.
Evidence: docs/design/plugins/Scheduler.md:191,267; origin/pr-2102:docs/design/plugins/InputQueue.md:81-82,91-95; origin/pr-2098:docs/design/plugins/Agents.md:223.
Fix: use the duplicate submission receipt and restate the no-fact set as transport plus the route's retry answer; remove publication_unknown from this row unless #2102 adds it to submit. Keep the requirement, the recovery paragraph and the verification on one answer set.
|
补充说明,head
验证: |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
Scope: target owner contracts for EventHub and Scheduler, plus reference updates across 21 design files (refs #2023, #2015). Reviewed the full main...head at ed43cd9 (merge base 5a279d6). The delta from 853b6aa is two Scheduler citations of #2127 and ADR 027 in ed43cd9; none of the six P2s changed.
Verdict: REQUEST_CHANGES
The six P2s remain
P2 1. EventHub still keeps the sessions facade in its dependency row
Problem. EventHub.md:106 still declares sessions with input, lookup, exists and defaultBranchId, and EventHub.md:161 still repairs a missed notice with sessions.exists. The requirement at EventHub.md:220 asks Agents' session and acquire, the input owner's submit and TimelineTree's directory. ADR 027 is now in origin/main (docs/adr/027-cross-scope-access-by-id.md, D1, D3, D4, D5, D6), and the Agents contract moves sessions.input to InputQueue's submit, sessions.lookup to a re-sent submit, sessions.defaultBranchId to TimelineTree's directory and sessions.exists to session.state (origin/pr-2098:docs/design/plugins/Agents.md:219-229,239, head c3acab35).
Failure. An implementer follows the dependency row, injects sessions and calls input/lookup; #2098 deletes those methods, so delivery and reconciliation cannot run. If Agents keeps them, the facade principles §7.2 forbids and the requirement at :220 both exist, and the two sections disagree. Separately, :106 gives lookup for per-branch idempotency and the publish flow still says "look up each branch" (:153), but the target has no lookup and the contract does not state the deterministic submission id (eventhub:{source}:{eventId}, crates/dim-event-hub/src/publish.rs:869-874). An implementer who submits without it writes a second input on a republish, against the verification at EventHub.md:185.
Evidence. docs/design/plugins/EventHub.md:106,153,161,185,220; ADR 027 D1, D3, D4, D5, D6 in origin/main; origin/pr-2098:docs/design/plugins/Agents.md:219-229,235,239,276.
Fix. Replace the row with Agents' session and acquire, the input owner's submit by (sessionId, branchId) and TimelineTree's directory, marked as by-id calls, not injected dependencies (ADR 027 D4); change :161 to the Agents session read; state the deterministic event submission id and that a duplicate answers the existing receipt; consume both agent/session-deleted and agent/unloaded-session-deleted (origin/pr-2098:docs/design/plugins/Agents.md:235).
P2 2. Both contracts ask submit for publication_unknown, which only withdraw answers
Problem. EventHub.md:220 says the input owner's submit answers publication_unknown; EventHub.md:122,141 keep it in the subscribe errors and the stored-success row; Scheduler.md:267 lists it as a submit retry answer. At the current InputQueue head, submit replies {inputId, sequence} with invalid, line_ended, cancelled and closed; publication_unknown is a withdraw error (origin/pr-2102:docs/design/plugins/InputQueue.md:81-82,94, head 3b48e124). The Agents contract resolves a lost reply by re-sending the same submissionId, whose duplicate answers the existing receipt (origin/pr-2098:docs/design/plugins/Agents.md:223,276). EventHub's own EventHubError enum (EventHub.md:416-439) has no PublicationUnknown variant, so the table lists a code the binding cannot produce.
Failure. A guide write or a delivery commits and its reply is lost; submit never answers publication_unknown, so the subscribe cannot settle, or an implementation adds an out-of-contract code and diverges from #2102. A retry with a new subscription id writes a second guide block and can hit the subscription limit. EventHub's error table also names reloading, rejected, ambiguous, failed and transport, which submit does not send.
Evidence. docs/design/plugins/EventHub.md:122,141-143,220,416-439; docs/design/plugins/Scheduler.md:267; origin/pr-2102:docs/design/plugins/InputQueue.md:81-82,91-95; origin/pr-2098:docs/design/plugins/Agents.md:223,276.
Fix. Settle a lost reply by re-sending the same submissionId and using the existing receipt. Remove publication_unknown from the submit error list and the Scheduler requirement; keep it only where withdraw is the operation. Map the EventHub table to submit's errors and the #2127 route errors. If publication_unknown is genuinely needed on submit, add it to #2102's contract explicitly first.
P2 3. Scheduler's recovery text still describes the removed lookup
Problem. Scheduler.md:191 says recovery re-submits the same submissionId, but then says "the answer accepted settles delivered" and keeps the lookup answers unknown, reloading and ambiguous; :193,197 still say lookup; the verification repeats the old text at :232-234. submit replies {inputId, sequence} with no status (origin/pr-2102:docs/design/plugins/InputQueue.md:81), and a duplicate submission id answers the existing receipt (origin/pr-2098:docs/design/plugins/Agents.md:223).
Failure. An implementer waits for a status: accepted that submit never returns, or treats invalid or line_ended as an undetermined answer, so a committed input is settled lost after five attempts. The verification cannot pass as written.
Evidence. docs/design/plugins/Scheduler.md:191,193,197,232-234; origin/pr-2102:docs/design/plugins/InputQueue.md:81,91-95; origin/pr-2098:docs/design/plugins/Agents.md:223.
Fix. State that the receipt settles delivered with its inputId and sequence; a duplicate returns the existing receipt; a transport failure or the route's retry answer counts toward the persisted bound; line_ended, closed and the route's definite answers settle failed. Sweep lookup and accepted from the flows and the verification.
P2 4. The omitted branch still defaults to main
Problem. Scheduler.md:144 says a session target's branch_id defaults to main, and the binding cannot express an omitted branch: Target::Session.branch_id is a required String with default_branch_id() returning main (Scheduler.md:327-346). The shipped management save resolves the Session's current default branch when the target omits it (TargetInput::resolve, crates/dim-agent-scheduler/src/methods.rs:683-714, shared.default_branch at :696); only a stored legacy row without a branch keeps the root fallback (crates/dim-agent-scheduler/src/document.rs:240-260).
Failure. A user moves the Session's default line, then a management save without branch_id schedules the job on main, the wrong line, and the stored job keeps delivering there. A management save cannot omit the branch at all because the request type fills main.
Evidence. docs/design/plugins/Scheduler.md:144,327-346; crates/dim-agent-scheduler/src/methods.rs:683-714; crates/dim-agent-scheduler/src/document.rs:240-260; docs/design/appserver/sessions-service.md:504.
Fix. State that a management save resolves and persists the current default when branch_id is omitted and that a stored row without branch_id means the root; keep the request branch optional (a separate input type or Option<String>); pin both cases in acceptance.
P2 5. The delivery retention rule is still the wrong one
Problem. Scheduler.md:189 says terminal records older than seven days are removed. The shipped delivery history keeps the newest 100 terminal deliveries per existing job, plus every non-terminal record and the last record naming a launch-owned Session (crates/dim-agent-scheduler/src/engine.rs:29,558-600). Seven days is the wakeup and loop rule (crates/dim-agent-scheduler/src/wakeups.rs:31,379; crates/dim-agent-scheduler/src/loops.rs:40,789). The verification still says "the 100-record history" (Scheduler.md:236), so the contract disagrees with itself.
Failure. A job with 150 terminal deliveries in seven days keeps all 150 here while the owner keeps 100; terminal records older than seven days are dropped here although schedule.history reads them today. A launch-owned Session's deletion follows its last record, so the rule also changes when that Session is deleted.
Evidence. docs/design/plugins/Scheduler.md:189,236; crates/dim-agent-scheduler/src/engine.rs:29,558-600; crates/dim-agent-scheduler/src/wakeups.rs:31,379; crates/dim-agent-scheduler/src/loops.rs:40,789.
Fix. State the newest 100 terminal deliveries per existing job, the non-terminal and launch-owner exceptions, and the separate seven-day rule for wakeups and loops. Keep the verification in sync.
P2 6. caller is added but create and update are still conflated
Problem. Scheduler.md:144 says the tool's create and update pass caller: Caller and the owner fills a session target from it, refusing a launch target. The shipped tool patch has no target (crates/dim-agent-scheduler/src/methods.rs:1151-1165), and tool_merge fills the target from caller only on create; on update it keeps the stored target and only patches input_mode (crates/dim-agent-scheduler/src/methods.rs:1193-1245). UpdateJob.caller is never read, and Caller omits the shipped cwd (Scheduler.md:627-630; crates/dim-agent-scheduler/src/methods.rs:1170-1174). The example sends both target (Scheduler.md:52) and caller (Scheduler.md:56), and JobInput carries both target and input_mode without saying which wins (Scheduler.md:433-446).
Failure. A tool update of a management-created launch job is rejected with schedule_invalid or retargeted to the calling Session, neither of which is shipped behavior, and Client-visible changes lists no such change. A tool create that follows the example sends target and caller, and the owner cannot tell which to store.
Evidence. docs/design/plugins/Scheduler.md:52,56,144,433-446,627-650; crates/dim-agent-scheduler/src/methods.rs:1151-1165,1170-1174,1193-1245.
Fix. State the create path (caller fills the session target) and the update path (stored target kept, input_mode may change) separately. Remove target from the tool request or define a separate tool operation; drop caller from UpdateJob if update does not read it. Keep or explain cwd on Caller, and state the target versus input_mode precedence.
New in round 4
P2 7. The hold rule contradicts the ServerControl target contract
Problem. Scheduler.md:193 says "A row unload does not release the old hold; it stays until process shutdown", and :197 says a row unload does not release accepted work early. The ServerControl target says hold is settled by release or the row's unload (origin/pr-2095:docs/design/plugins/ServerControl.md:79); the calling row's unload releases its holds and a later release answers false (:85,106,114); only a row that crashes without unloading keeps its hold until the process ends (:85).
Failure. After a Scheduler row reload, ServerControl releases the old hold at unload. The next generation takes its own hold per unsettled record only before its first window (Scheduler.md:193). In the gap a graceful shutdown can begin while the delivery is unsettled, so the admission guarantee from before the external effect to the terminal record does not hold. An implementer that keeps the old id and calls release later gets false. The verification at Scheduler.md:233 expects the old hold to stay until process shutdown, which the ServerControl target contradicts.
Evidence. docs/design/plugins/Scheduler.md:193,197,233; origin/pr-2095:docs/design/plugins/ServerControl.md:79,85,106,114 (head fa2eea2c); the current code at crates/dim-app-server/src/control.rs:76-96 is the old behavior, not the target.
Fix. State both cases: a row unload releases the old generation's holds, a crashed row keeps them to process shutdown; the next generation takes its own hold before its first window. If the gap is unacceptable for a graceful close, raise a hold-transfer or hold-survives-unload requirement to #2095 instead of contradicting it. Add a row reload with a shutdown request in the gap to the verification.
P2 8. The launch stop cannot name the turn
Problem. Scheduler.md:112 lists only Loop's stop_turn to stop a launch target, and :183,205 say the launch stops at the deadline. The target Loop face takes {turnId, reason} and the caller must read state for the open turn id (origin/pr-2102:docs/design/plugins/Loop.md:51,78-79); the Agents contract states the same read before sessions.stop (origin/pr-2098:docs/design/plugins/Agents.md:224). The Scheduler dependency and requirement (Scheduler.md:112,267) do not name the state read or the line.
Failure. At the deadline Scheduler has a launched Session id, not a turn id. Calling stopTurn with an unknown id answers an absent reply and writes nothing (origin/pr-2102:docs/design/plugins/Loop.md:78,90), so the launched turn keeps running past the stop time. The current sessions.stop stops the branch's turn by branch id; no target Loop operation does that.
Evidence. docs/design/plugins/Scheduler.md:112,183,205,267; origin/pr-2102:docs/design/plugins/Loop.md:51,78-79,90,96; origin/pr-2098:docs/design/plugins/Agents.md:224.
Fix. Add Loop's state read by line id to the dependency list and the requirement. State that the stop flow reads the open turn id, calls stopTurn({turnId, reason}), and treats an absent reply as already ended. State the line (the launched Session's default line at stop time, or the line recorded at launch) and whether a move of the default changes it.
P2 9. The target-gone error vocabulary contradicts the #2127 citation added in ed43cd9
Problem. Scheduler.md:267 now cites #2127 as the routing mechanism but lists session_closed, line_ended and NoLine "at the route". #2127 defines the route errors as NoSession, SessionClosing and NoLine. Scheduler.md:174 and :191 still settle a target-gone delivery with session_closed, branch_missing and branch_ended. session_closed is an Agents acquire error, line_ended is an InputQueue submit error, and branch_missing/branch_ended are the removed sessions.input codes.
Failure. A job targets a line that ended while the Session is alive; the route answers NoLine, but the settlement rule has no NoLine, so the delivery is not marked failed and the job is not disabled; it fires every window. A cold Session answers NoSession; the rule has no NoSession, so an implementer may count it as an uncertain answer until lost or disable a job whose Session can be restored.
Evidence. docs/design/plugins/Scheduler.md:174,191,267; issue #2127; origin/pr-2102:docs/design/plugins/InputQueue.md:81,94; origin/pr-2098:docs/design/plugins/Agents.md:155,192,224.
Fix. Map the route names: NoSession and SessionClosing take an Agents hold and retry; acquire session_closed and NoLine settle failed and disable; submit line_ended/closed settle failed; invalid settles failed with its detail; cancelled, transport and the route's retry answer keep delivering and count. Name the set once and cite #2127 for the names. Apply the same map to EventHub's subscribe errors.
Optional (P3, unchanged)
Scheduler.md:263andEventHub.md:216still call #2029 open ata3c7c4d8a; #2029 is merged as4d081fe6and ADR 027 is inorigin/main.Scheduler.md:107keeps by-id calls underDependencies; ADR 027 D4 says a by-id call is not a dependency.EventHub.md:171still points at service-faces §3.2/§4 foreventSubscriptions; the section is §4.9.docs/zh/design/contracts/session-boundary.md:579keeps a deadScheduler §11.2anchor.Scheduler.md:228saysconflictwhile the table saysschedule_conflict(:162);ScheduledJobomits absentenabled_at/disabled_reasonwhilereported()emits null (crates/dim-agent-scheduler/src/document.rs:357-370);StopLoopReplyalways serializessettledwhilesession.loop.stopomits it when true (crates/dim-agent-scheduler/src/session.rs:401-407).
Verification
- CI at
ed43cd98:changes,ci-ok,macos-nativeandverify (linux)pass. node scripts/adr-check.mjs --base 5a279d69passes for 21 changed files.git merge-tree --write-tree origin/main HEADis clean againstorigin/main bf3a4e63.- No code tests: the PR changes documentation only and touches no runtime fixture.
Cross-PR
- #2098
c3acab35: the directory table still moves input, lookup, pending and defaultBranchId, the Session access section keeps the facade out, and the delete notice is split intoagent/unloaded-session-deletedandagent/session-deleted. - #2102
3b48e124:submitreplies{inputId, sequence}withinvalid,line_ended,cancelled,closed;publication_unknownis awithdrawerror. - #2095
fa2eea2c: the hold conflict in P2 7. - #2092
3113d18a: TimelineTree'sdirectoryanswers{default, lines}; the PR's use of it for an omitted branch is correct. - #2091
8f9f5e1e: SessionFilesputreplies{fileId, path, bytes}; EventHub's requirement matches. - #2093
53961a15: SessionScope keepsconfigandidentity; both requirements match. - #2103
59a77a3d: no interface overlap with these two contracts. - ADR 027 / #2029: merged as
4d081fe6; D1 to D6 and principles §7.2 are inorigin/main. The facade conflict is against main, not a pending PR.
| - Agents ([#2020](https://github.com/arcships/dim/issues/2020), target, pending [#2098](https://github.com/arcships/dim/pull/2098)): `create_session` for a launch target, `delete_session` at retention, `session` for a target's existence, and `acquire` when work must keep a Session loaded across calls. | ||
| - The line's input owner, by `(sessionId, branchId)` id ([#2027](https://github.com/arcships/dim/issues/2027), target, pending [#2102](https://github.com/arcships/dim/pull/2102)): `submit` for a delivery, where a repeated `submissionId` answers the existing receipt, and `pending` for a busy branch. | ||
| - TimelineTree ([#2024](https://github.com/arcships/dim/issues/2024), target, pending [#2092](https://github.com/arcships/dim/pull/2092)): `directory` when a job omits its branch. | ||
| - Loop ([#2027](https://github.com/arcships/dim/issues/2027), target, pending [#2102](https://github.com/arcships/dim/pull/2102)): `stop_turn` to stop a launch target. |
There was a problem hiding this comment.
Problem: The dependency lists only Loop's stop_turn, but the target Loop face takes {turnId, reason} and the caller must read state for the open turn id (origin/pr-2102:docs/design/plugins/Loop.md:78-79); the Agents contract states the same read before sessions.stop (origin/pr-2098:docs/design/plugins/Agents.md:224). The requirement at :267 names only the operations in this list.
Failure: a launch record carries a Session id, not a turn id. At the deadline, stopTurn with an unknown id answers an absent reply and writes nothing, so the launched turn keeps running past the stop time. The current sessions.stop stops the branch's turn by branch id; no target Loop operation does.
Evidence: docs/design/plugins/Scheduler.md:112,183,205,267; origin/pr-2102:docs/design/plugins/Loop.md:51,78-79,90; origin/pr-2098:docs/design/plugins/Agents.md:224.
Fix: add Loop's state read by line id to this list and the requirement; state the read of the open turn id, the stopTurn({turnId, reason}) call, the absent reply as already ended, and the line the stop targets.
| - Items go only to the connections that watched: there is no broadcast, and a connection that did not watch receives nothing. | ||
| - One watch per connection: a second `schedule.watch` on the same connection answers the earlier call `{}` and takes over, so one change sends one item. The earlier call's progress ends at its reply. | ||
| - A watch belongs to the generation that admitted it. The call ends in one of three ways, as the client sees it: | ||
| The re-submission reaches the target Session by id: a cold Session answers `NoSession` at the route ([#2127](https://github.com/arcships/dim/issues/2127)), the scheduler takes an Agents hold, and the next call after Agents loads the generation delivers; the delivery's admission covers the restore and the call. Admission: the hold is taken before the record's external effect and released after the terminal record. A row unload does not release the old hold; it stays until process shutdown, and the next generation takes a separate hold per unsettled record and releases that one after the terminal record. The next generation reconstructs the unsettled set from the `delivering` records before its first window; `activated` gates the first pass. Scheduler never holds a Session handle across the lookup or the delivery. |
There was a problem hiding this comment.
Problem: This says a row unload does not release the old hold and it stays until process shutdown. The ServerControl target says hold is settled by release or the row's unload (origin/pr-2095:docs/design/plugins/ServerControl.md:79); the calling row's unload releases its holds and a later release answers false (:85,106,114); only a crashed row keeps them to process shutdown (:85).
Failure: after a Scheduler row reload the old hold is released at unload, and the next generation takes its own hold only before its first window. A graceful close can begin in the gap while the delivery is unsettled, so the admission guarantee from before the external effect to the terminal record does not hold. An implementer that keeps the old id and releases it later gets false.
Evidence: docs/design/plugins/Scheduler.md:193,197,233; origin/pr-2095:docs/design/plugins/ServerControl.md:79,85,106,114 (head fa2eea2); current code crates/dim-app-server/src/control.rs:76-96 is the old behavior.
Fix: state both cases: a row unload releases the old generation's holds, a crashed row keeps them to process shutdown; the next generation takes its own hold before its first window. If the gap is unacceptable, raise a hold-transfer requirement to #2095 instead of contradicting it. Add a reload with a shutdown request in the gap to the verification.
|
|
||
| ## Requirements raised to mechanism owners | ||
|
|
||
| - **Agents (#2020), the line's input owner (#2027), TimelineTree (#2024) and Loop (#2027):** the operations the dependency list names, reached by id ([ADR 027](https://github.com/arcships/dim/pull/2029) D1; the mechanism is [#2127](https://github.com/arcships/dim/issues/2127)), with `session_closed`, `line_ended`, `NoLine` at the route, `reloading`, `publication_unknown` and `transport` as the target-gone and retry answers. Scheduler takes no `HostDispatch` object and decodes no reply envelope. |
There was a problem hiding this comment.
Problem: This now cites #2127 but lists session_closed, line_ended and NoLine at the route. #2127 defines NoSession, SessionClosing and NoLine. Scheduler.md:174 and :191 still settle target-gone with session_closed, branch_missing and branch_ended; session_closed is an Agents acquire error, line_ended is an InputQueue submit error, and the other two are the removed sessions.input codes.
Failure: a job targets a line that ended while the Session is alive. The route answers NoLine, but the settlement rule has no NoLine, so the delivery is not failed and the job is not disabled; it fires every window. A cold Session answers NoSession; the rule has no NoSession, so an implementer may count it as uncertain until lost or disable a restorable job.
Evidence: docs/design/plugins/Scheduler.md:174,191,267; issue #2127; origin/pr-2102:docs/design/plugins/InputQueue.md:81,94; origin/pr-2098:docs/design/plugins/Agents.md:155,192,224.
Fix: map NoSession and SessionClosing to a hold and retry; acquire session_closed and NoLine to failed and disable; submit line_ended and closed to failed; invalid to failed with its detail; cancelled, transport and the route's retry answer to delivering plus the attempt count. Name the set once and cite #2127 for the names. Apply the same map to EventHub's subscribe errors.
|
Closing as part of abandoning the owner-split experiment. |
Design part for #2023: the EventHub and Scheduler owner contracts, written in the owner-redesign shape (responsibility split, caller examples, operations, errors, flows, rule check, binding).
Owners:
eventHub(declare, publish); the Sessioneventstool (sources, subscribe, unsubscribe, list) and guide entry. Subscription management is not exposed to producer rows.scheduleJobsjob face; the wakeup and loop operations used in-process by the Session part; theschedule,wakeupandlooptools;session.loop.*. The job, history and loop wire shapes are the shipped ones.Dependency contracts: #2091 (SessionFiles), #2094 (Settings), #2095 (ServerControl, ManagementMethods), #2093 (SessionScope), #2024 (TimelineTree: no operation used). #2020 (Agents) is parallel; the
sessionsandSessionDeletedrequirements are in the docs and posted on #2020. The SessionFilesputreply requirement is posted on #2018.Delivery part: #2023 (comment)
Refs #2023
Refs #2015
Merge order
#2029 → #2080 → #2091/#2092/#2093 → #2094 → #2096 → the rest.
Sibling heads this change is aligned with: #2092
d96802349, #2098c3acab356, #21023b48e1248. A paragraph that depends on a sibling names that PR; its head is the one above.