Repository navigation
Conversation
72fd420 to
16c2adc
Compare
a5ffe62 to
976c83f
Compare
Write the owner contracts for the model and provider board under design rules §7: the responsibility split, the caller compositions, the operations with their cancellation and error kinds, the flows that settle each resource, the exceptions, the rule check and the Rust bindings. Provider becomes the single model owner of the product profile: resolution, preference application, selection listing, temporary startup admissions, request execution, media routes and one-attempt credentials. It owns the driver, so credentials never leave the owner and no connection crosses. ConfiguredModels answers the same `providerService` operations from the model file. Account owners share one contract: availability and its subscription, the account catalog, and one `with_lease` operation that hands the lease to the caller's attempt, recovers once and settles the lease itself, so no caller holds a lease id. DimOAuth adds relay search and title. The ChatGPT account remains; the ManagedProviders host binding and the `managedSearch` face are retired, so no owner returns another owner's data. ModelLog and the provider document stay with the Settings board (#2094); the driver reads ModelLog's recording value. Refs #2019 · Refs #2015
976c83f to
4a29c15
Compare
|
评审(head
|
…e lease boundary
Provider owns its records, selection, preferences, candidates, pages,
source activation, adoption, edit commits, legacy import and
`store.creationRecord`; the storage engine keeps the file and transaction
primitive as a private implementation and its public face keeps
`storageReport` and the offline operations.
A temporary startup connection is admitted under the calling row and
moved to a Session by `retain_startup({session, model})`; a missed
retain or release settles with the row, and a retained source with the
Session. `release_startup({model})` is the optional early release.
The Rpc examples adopt a model on a line through PromptAdoption's
`configure` by line id instead of a Branch handle.
The account owner cannot perform the model exchange itself, so
`with_lease` hands the lease to the caller's attempt; the boundary and
its alternatives are recorded and raised for maintainer confirmation.
Refs #2019 · Refs #2015
|
已按评审修改,head
@eric8810 第 2 条的例外请确认。
如果这个例外不被接受,需要把模型传输迁到账户所有者,另行设计。 |
|
|
|
更正 #2096 (comment) :那条撤回,
|
The account owners hand out a credential value carrying the grant
generation instead of a lease handle. `credential({provider, model})`
answers the connection facts and refreshes inside its window;
`rejected({provider, generation})` refreshes the current generation once,
answers the current credential for a superseded one, and follows the
sign-out rule when the refresh is rejected or the recovered generation is
rejected again. The lease id, capacity, expiry, release, recovery
callback and `finish_rejected` are removed; retries stay with Provider's
`invoke`.
The bearer is a trusted in-process value. ManagedAccount states where it
never goes; Provider, ConfiguredModels, DimOAuth, ManagedOAuth and
ManagedProviders link that paragraph. The maintainer-confirmation
exception is removed.
Refs #2019 · Refs #2015
|
已按评审修改,head
|
|
已按核对修改,head |
|
已按评审修改,head
|
|
已按 A–G 自查修改,head
|
|
来自 #2094 的核对(评审 6025935963,P2-8): let configured = provider_settings
.user_agent()
.await
.ok()
.and_then(|view| view.user_agent);同一模式也已在本 PR 的 ProviderSettings 示例里修正。 |
…review Declare the `invoke` callbacks as direct `impl Fn` parameters returning `Result<_, CallError>`, hand the consumer a serializable chunk, require `admit`, and report retry waits as `Retrying` chunks. Derive `Debug` on the error enums, use snake_case `code` tags, and fix the selectable union, the shared `FailureChain`, and the shared credential with an optional generation. Define the account catalog, the availability callback registration and the search/title types; keep `creationRecord` with SessionStore and read it through the dependency; state the ChatGPT client-session rule in Provider. State what the contracts supersede and update those paragraphs: resource-owner-operations, resource-faces, provider-management, auxiliary-model, Modality, ImageUnderstanding and the App Server README. Add the client-visible sections (none), the §7 and #2127 links, and the retry column in the error tables. Refs #2019 · Refs #2015
|
已按评审与自查标准修改,head P2
P3
自查额外修改
保留文档只改了本所有者段落: @yyhhyyyyyy 请复核。 |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
PR #2096 at 13f9b94: review
Refs #2019 and #2015. This PR defines the target contracts for the model and provider owners: Provider, ConfiguredModels, the account owners (ManagedAccount, DimOAuth, ManagedOAuth, ManagedProviders), and the service-face, resource-face, owner-operation, management and auxiliary-model clauses that name their old surfaces. This round reviews the full main...head, not only 375e5da...13f9b94.
Verdict: REQUEST_CHANGES
Round status
Fixed in 13f9b94 (round-1 threads): invoke callbacks (4667714929), Provider Debug (4667714943), SelectableModels tagging (4667714951), retry progress (4667714967), user_agent owner (4667714976), creationRecord (4667714987), selectable invalid (4667715002), invoke not_found (4667715010), ManagedAccount Debug (4667715017), credential generation (4667715026), ConfiguredModels invoke shape (4667715050), ConfiguredModels error kinds (4667715060), DimOAuth search and title types (4667715065).
Partially fixed: FailureChain (4667714959), consumer contracts and Supersedes (4667714994), subscribe type (4667715037), process-owner operations (4667715071), provider-management 3.7 (4667715081), auxiliary-model historical sections (4667715090). The remaining parts are P2 #1 to #4 and P3 #5, #7, #8 below.
The round-1 P3 list is mostly resolved: invalid_path and output_limit are gone, AccountCatalog is defined, the DimOAuth table columns are fixed, service-faces.md uses invalid, the owner type rename is stated, FileStorage root_path is gone, the ModelLog row reference is gone, and the ChatGPT client-session rule is in Provider. The prepare_startup reply shape, the undefined admit_all, and the merge-order forward references remain.
P2
1. invoke returns no updated failure chain or failure facts
Problem: invoke takes Mode::Dialogue { chain: Option<FailureChain> } and continues the caller's retry budget, but its reply is {accepted} and its request failure is provider_failed {retryable, message} (Provider.md:159, Provider.md:386, Provider.md:349). The updated attempt and wait totals, and the runtime failure facts, never return to the caller.
Failure scenario: ModelProvider owns the terminal step/model-output-end and must write the failure chain totals and the runtime failure kinds (#2102 ModelProvider.md:13, :86, :92). With this contract it can only write the chain it sent in, so the next turn retries with a stale budget, and the terminal fact loses kind, status and provider_code. The current code supplies exactly those facts through HostError::Failed { model: ModelFailureFacts } (crates/dim-agent-capabilities/src/model_provider.rs:52-64, crates/dim-agent-types/src/events.rs:770). The Retrying chunk can approximate attempt and delay_ms, but not the failure kind, status, provider code, or a failure before the first retry. This is the failure scenario of round-1 P2 #4, still open after the type was shared.
Evidence: docs/design/plugins/Provider.md:159, :165, :186, :349, :386; #2102 head docs/design/plugins/ModelProvider.md:13, :86, :92; crates/dim-agent-capabilities/src/model_provider.rs:52-64; crates/dim-agent-types/src/events.rs:770-800.
Fix: return the updated FailureChain and a ModelFailure value with the request failure, either in InvokeReply or in the provider_failed details, and state that ModelProvider writes them into the terminal fact. If accumulation from Retrying chunks is intended, state how the non-derivable facts come back.
2. process-owner-operations.md keeps a second invoke contract
Problem: The updated row says invoke(request, mode, consume, admit?, cancelled) (process-owner-operations.md:26), making admit optional, while Provider.md:159 and Provider.md:403-405 make it required. The retained Model invocation table at lines 55-58 still defines mode as once or recovering, consume(next, cancelled) returning {kind: returned, value, replaySafe}, and hooks? with beforeAttempt and waiting, all replaced by Mode, Consumed, admit and Retrying (Provider.md:165). Line 58 also returns invalid_request, while the target uses invalid.
Failure scenario: A caller or binding built from this contract passes no admit, asks for a recovering mode and a hooks object that do not exist, and expects a consume reply shape the binding cannot encode. Provider and ModelProvider end up with two incompatible invoke shapes.
Evidence: docs/design/contracts/process-owner-operations.md:26, :55-58; docs/design/plugins/Provider.md:159, :165, :341, :403-405.
Fix: Delete the Model invocation table and point to Provider, or rewrite it to Provider's exact Mode, Consumed, admit and error names. Make admit required in the row and name admit_all.
3. DimOAuth's subscriber example contradicts its own binding
Problem: The Web example calls dim_account.subscribe(cancelled.clone()) and expects a value it can follow (DimOAuth.md:41-42). The binding in the same document takes (&Ctx, NotifyFn, CancelledFn) and returns () (DimOAuth.md:188), and ManagedAccount defines the same callback registration (ManagedAccount.md:89, :229). The value-returning Subscription is gone.
Failure scenario: Web implements or copies a stream-shaped subscribe that no binding provides, while a binding generated from the appendix takes a callback. The same face has two shapes.
Evidence: docs/design/plugins/DimOAuth.md:41-42, :188; docs/design/plugins/ManagedAccount.md:89, :193-194, :229.
Fix: Rewrite the DimOAuth example with the notify callback and state that the registration ends with the calling row or the owner's close.
4. Deleted selectable reads remain in the consumer contracts
Problem: Provider has one selectable({use}) (Provider.md:155), the host ports are deleted (provider-management.md:1006), and the account model is unchanged. Modality's target text still says Provider "adds one read to the same port, selectableForModality" (Modality.md:297) and derives its options from selectableForModality (Modality.md:465); ImageUnderstanding still names selectableModels and selectableForModality (ImageUnderstanding.md:147).
Failure scenario: Implementers add or keep a host port that no owner provides, or derive media options from a read whose reply shape no longer exists. The claim that the consumer contracts are updated is false at these lines.
Evidence: docs/design/plugins/Modality.md:297, :465; docs/design/plugins/ImageUnderstanding.md:147; docs/design/plugins/Provider.md:155; docs/design/appserver/provider-management.md:1006.
Fix: Replace these names with selectable({use: {modality: {operation}}}) and selectable({use: "chat"}) where the capability filter applies, or mark the passages historical.
P3
5. auxiliary-model replacement call passes None for admit
Problem: auxiliary-model.md:76 documents the migration target as providerService.invoke(request, Mode::Once, consume, None, cancelled). Provider now requires the admit callback and names admit_all for callers without a budget (Provider.md:165, :403-405).
Failure scenario: A caller following the only replacement note for the deleted face builds a call that does not compile against the appendix.
Evidence: docs/design/appserver/auxiliary-model.md:76; docs/design/plugins/Provider.md:165, :403-405.
Fix: Pass admit_all and name it; do not show the old optional-callback shape.
6. The plugin index still says request leases
Problem: The new rows say "request leases" and "leases" (plugins/README.md:14-16), while ManagedAccount says the caller never holds a lease, an id to release or an expiry (ManagedAccount.md:96) and the contract replaced leases with the credential generation.
Failure scenario: A reader of the plugin index reintroduces a lease operation or a lease-shaped credential reply that the account contract deliberately removed.
Evidence: docs/design/plugins/README.md:14-16; docs/design/plugins/ManagedAccount.md:96.
Fix: Replace "request leases" and "leases" with "credential generation" in the three rows.
7. Provider.md has no Supersedes section
Problem: The owner-redesign template in #2029 requires a Supersedes section, and every other owner document in this PR has one (ManagedAccount.md:231, ConfiguredModels.md:94, DimOAuth.md:125, ManagedOAuth.md:98, ManagedProviders.md:105). The previous head had one at the end of Provider.md; this head removed it.
Failure scenario: The delivery has no owner-side list of the clauses this contract replaces. The clauses were edited in this PR, but a future change cannot tell which surfaces are retired and which are still owned by the old Provider management page.
Evidence: docs/design/plugins/Provider.md section list (no Supersedes); docs/templates/owner-redesign.md:46 at #2029 head; the five sibling sections above.
Fix: Restore the section, listing the service-faces.md, provider-management.md, process-owner-operations.md, resource-owner-operations.md and auxiliary-model.md clauses this contract replaces and the deleted names (modelHost, selectableModelsHost, modelSelectionHost, auxiliaryModel, providerConnectionResolver, modalityConnectionHost).
8. prepare_startup reply shape differs between the table and the appendix
Problem: The operation table says the reply is {selection} (Provider.md:156), while the appendix returns a bare ModelSelection (Provider.md:396), the caller example binds it bare (Provider.md:125), and the cross-owner contract says prepare_startup(request) -> ModelSelection (process-owner-operations.md:28).
Failure scenario: A generated binding wraps or unwraps the wrong level, so a caller reads a selection object from selection in one binding and none in another.
Evidence: docs/design/plugins/Provider.md:125, :156, :396; docs/design/contracts/process-owner-operations.md:28.
Fix: Pick the bare ModelSelection and change the table, or wrap all four places.
9. admit_all is undefined
Problem: Provider.md:165 calls admit_all "the binding's default", and the caller examples pass it (Provider.md:94, :111; ConfiguredModels.md:43), but no definition, import or signature for it exists in either appendix.
Failure scenario: An implementer cannot tell whether to define a constant, a function, or a generated default; a foreign-language binding has no way to omit a required callback.
Evidence: docs/design/plugins/Provider.md:94, :111, :165; docs/design/plugins/ConfiguredModels.md:43; Provider appendix Provider.md:399-406.
Fix: Define admit_all as a public function or constant with its exact return type, or state that every caller supplies a function and remove the "default" wording.
10. Cross-PR overlap: #2094 edits the same provider-management lines and is not in the merge order
Problem: The PR body states the merge order #2029 -> #2080 -> #2091, #2092, #2093 -> this PR, but this PR cites ProviderSettings and ModelLog as dependencies (Provider.md:138-139, :231) and rewrites the provider source row at provider-management.md:53. #2094 changes the same row and the same page intro at provider-management.md:6, and #2094's branch still says the S4 face "remains unchanged" at line 6.
Failure scenario: #2094 merges after this PR without rebasing, or conflict resolution takes #2094's line 6, and the merged page says the auxiliary face is unchanged while this contract deletes it. The line 53 row is edited twice with different wording.
Evidence: this head docs/design/appserver/provider-management.md:6, :53; #2094 head docs/design/appserver/provider-management.md:6, :53; PR body merge order.
Fix: Add #2094 to the merge order, and decide in one PR whether line 6 and the line 53 row are written here or there.
11. Dependency errors have no stated mapping
Problem: invoke calls the account owner's credential and rejected and reads SessionStore's creationRecord (Provider.md:163, :141), but Provider's error table and ProviderError do not say how the dependency codes map. The account owner has account_required and unsupported_provider (ManagedAccount.md:106-109), SessionStore has storage (#2091 head SessionStore.md:111), and Provider has auth_required and failed (Provider.md:171-179).
Failure scenario: An implementation either leaks a code the Provider binding does not define or maps two dependency failures to the same Provider code, so a caller cannot tell whether to sign in or to fix the record.
Evidence: docs/design/plugins/Provider.md:141, :159, :163, :171-179; docs/design/plugins/ManagedAccount.md:104-112; #2091 head docs/design/plugins/SessionStore.md:111.
Fix: State the mapping, for example account_required to auth_required and storage to failed, or carry the owner error in the details.
Hypotheses
selectable({use: modality})returnsdefault: Option<ModelId>and the requirement row says "the current default" (Provider.md:32,:155), but Modality owns each operation's persisted default in its own settings (Modality.md:42,:465), and Provider reads no other owner's state (Provider.md:208). Ifdefaultis meant to be null for modality uses, say so; otherwise the two defaults can disagree. Unconfirmed whether the author intends Provider to hold a modality default.ManagedAccount.md:11says the account record is written "with the account's own revision and lease", but #2080 FileStorage says its public face has no lease and the account composes exclusion fromupdate(#2080headFileStorage.md:141-143). If "lease" here means the account's own claim field, reword it; otherwise the dependency contract is missing an operation. Unconfirmed.
Checks
- Full main...head read; delta 375e5da...13f9b94 checked against the 19 round-1 threads.
node scripts/adr-check.mjs --base 1bc7d67dpasses (16 changed files, no ADR edits).git merge-tree --write-tree origin/main HEADis clean; no textual conflict with current main.- Cross-PR: #2091
creationRecord({id}) -> {origin, leader?}matchesProvider.md:141; #2099 usesTitleRequest {provider, text}andTitleErrorwith the shapes inDimOAuth.md:136-178; #2102 ModelProvider depends oninvokeand exposes the failure-fact gap above; #2080 has no public lease; #2029 is the rule source. Sibling branches #2080, #2092, #2093, #2099, #2102 still carry the old provider rows inservice-faces.md, so they must land before or be rebased on this PR as the stated order says. - CI for 13f9b94:
ci-oksuccess,verify (linux)success,macos-nativesuccess; windows, acp-registry, web, dependencies, scripts and static-checks skipped.
Unverified
- Whether #2094's line 6 and line 53 conflict resolution was coordinated outside this PR; the stated merge order does not include it.
- Whether
ProviderChunkdroppingMessageStart,TextEndandThinkingEndstill lets the target ModelProvider close itsstep/textandstep/thinkingblocks the waycrates/dim-agent-capabilities/src/output.rs:600-710does; #2102 does not state the mapping.
| ```rust | ||
| let AccountAvailability { signed_in, .. } = dim_account.availability(cancelled.clone()).await?; | ||
| if signed_in { | ||
| let mut changes = dim_account.subscribe(cancelled.clone()).await?; |
There was a problem hiding this comment.
Problem: this example calls subscribe(cancelled.clone()) and expects a value it can follow, but the binding in the same document takes (&Ctx, NotifyFn, CancelledFn) and returns () (DimOAuth.md:188), and ManagedAccount defines the same callback registration (ManagedAccount.md:89, :229). The value-returning Subscription is gone.
Failure scenario: Web copies a stream-shaped subscribe that no binding provides, while a binding generated from the appendix takes a callback.
Evidence: docs/design/plugins/DimOAuth.md:41-42, :188; docs/design/plugins/ManagedAccount.md:89, :193-194, :229.
Fix: rewrite the example with the notify callback and state that the registration ends with the calling row or the owner's close.
There was a problem hiding this comment.
Fixed in 7cc7e87. The example now registers the notify callback with the calling row, dim_account.subscribe(&self.ctx, Arc::new(|availability| ...), cancelled) (DimOAuth.md:41-54), which matches the binding subscribe(&self.ctx, NotifyFn, CancelledFn) (DimOAuth.md:200) and ManagedAccount's NotifyFn (ManagedAccount.md:193-194).
| | Dialogue, summary and suggestion → active invocation owner | `modelHost.invoke(request, mode, consume, cancelled, hooks?) → value`. Full `ModelRequest` with pinned tools, configuration, cached prefix and capability snapshot. Attempt contract below. | | ||
| | Session configuration → `providerService` (managed profile) | `configuration(explicit?, cwd?, preferences) → ModelSelection`; `applyPreferences(current, update) → ModelSelection`. Bind the existing Provider operations. | | ||
| | Session creation/adoption and Collaboration → `providerService` (managed profile) | `prepareStartup(request) → {model, admissionId?}`, `checkStartup(source) → void`, `retainStartup({sessionId, generation, model, admissionId?}) → void`, `releaseStartup({admissionId}) → void`. Reuse the pending startup binding ID. Retain on success for that Session generation; release on failure or caller unload. | | ||
| | Dialogue, summary and suggestion → `providerService` | `invoke(request, mode, consume, admit?, cancelled) → {accepted}`. Full `ModelRequest` with pinned tools, configuration, cached prefix and capability snapshot; retries and credential recovery stay with the owner, see [Provider](../plugins/Provider.md). | |
There was a problem hiding this comment.
Problem: admit? is optional here, but Provider requires it (Provider.md:159, :403-405). The retained Model invocation table at lines 55-58 still defines once/recovering, consume(next, cancelled) and hooks?, all replaced by Mode, Consumed, admit and Retrying (Provider.md:165). Line 58 also returns invalid_request where the target uses invalid.
Failure scenario: a caller or binding built from this contract omits admit, asks for a recovering mode, and passes a hooks object that does not exist; Provider and ModelProvider end up with two invoke shapes.
Evidence: docs/design/contracts/process-owner-operations.md:26, :55-58; docs/design/plugins/Provider.md:159, :165, :341, :403-405.
Fix: delete the table or rewrite it to Provider's exact shapes, make admit required, and name admit_all.
There was a problem hiding this comment.
Fixed in 7cc7e87. The row now takes a required admit and returns {accepted, chain?} (process-owner-operations.md:26). The Model invocation table now uses Mode, the direct consume and admit callbacks, Retrying and provider_failed {failure, chain} (process-owner-operations.md:55-59), so it no longer defines a second shape.
| The service has no timeout of its own; the budget is the consumer's. | ||
| - Errors are data `{code, message}`: `invalid_request`, `model_unavailable`, `failed`, | ||
| `cancelled` (§6). | ||
| Superseded: there is no `auxiliaryModel` service. A caller runs `providerService.invoke(request, Mode::Once, consume, None, cancelled)` and collects the text in its consumer. |
There was a problem hiding this comment.
Problem: the replacement call passes None for admit, but Provider makes admit a required callback and names admit_all for callers without a budget (Provider.md:165, :403-405).
Failure scenario: the only migration note for the deleted face documents a call that does not compile against the new appendix.
Evidence: docs/design/appserver/auxiliary-model.md:76; docs/design/plugins/Provider.md:165, :403-405.
Fix: pass admit_all and name it; do not show the old optional-callback shape.
There was a problem hiding this comment.
Fixed in 7cc7e87. The replacement call passes admit_all (auxiliary-model.md:76), and admit_all is the exported callback in the binding (Provider.md:347-350).
|
|
||
| - **Problem.** `modality.capabilities` must compute `options` and automatic resolution from the models Provider can select. Provider's model-selection port resolves one model, and the catalog reads are client management methods, so a process owner cannot enumerate the selectable set with its declared capabilities. | ||
| - **Existing mechanisms.** The single-model selection port cannot filter by an operation's capability. A new client method would expose management to the owner and duplicate the catalog. The Provider-side read-only contract is tracked separately by [#790](https://github.com/arcships/dim/issues/790). Delivered: the process host port `SelectableModelsHost` in `dim-agent-capabilities`, provided by Provider and by the configured model profile, whose `selectableModels` read enumerates the models execution would accept with their declared capabilities. | ||
| - **Existing mechanisms.** The single-model selection port cannot filter by an operation's capability. A new client method would expose management to the owner and duplicate the catalog. The Provider-side read-only contract is tracked separately by [#790](https://github.com/arcships/dim/issues/790). Delivered by the owner contract: `providerService.selectable` ([Provider](Provider.md)) enumerates the models execution would accept with their declared capabilities, in both profiles. |
There was a problem hiding this comment.
Problem: the paragraph immediately below still says Provider adds selectableForModality to the same port, and line 465 derives the options list from that read. Provider has one selectable({use}) (Provider.md:155) and the host ports are deleted (provider-management.md:1006).
Failure scenario: implementers keep or add a process host port that no owner provides, or derive media options from a reply shape that no longer exists.
Evidence: docs/design/plugins/Modality.md:296-297, :465; docs/design/plugins/Provider.md:155; docs/design/appserver/provider-management.md:1006.
Fix: replace the name and reply shape with selectable({use}), or mark the passage historical.
There was a problem hiding this comment.
Fixed in 7cc7e87. Modality.md:297 now names Provider's selectable({use}), Modality.md:465 derives options from it, and ImageUnderstanding.md:147 uses selectable with Use::Chat and Use::Modality.
| | [Migration](Migration.md) | on-demand import tasks, source mappings, progress and retry records; unloaded after settlement | — | — | [Delivery plan](../../plan/analysis/legacy-migration.md) | | ||
| | [Provider](Provider.md) (owner contract) | model owner of the product profile: provider and model records, selection, credentials, execution, temporary connections, the wire recorder | — | — | [#2019](https://github.com/arcships/dim/issues/2019) | | ||
| | [ConfiguredModels](ConfiguredModels.md) (owner contract) | model owner of the API-key profile: the model file, its credentials and execution | — | — | [#2019](https://github.com/arcships/dim/issues/2019) | | ||
| | [Managed account owners](ManagedAccount.md) (owner contract) | the account role: record, login, tokens, availability, catalog, request leases, client namespace | — | — | [#2019](https://github.com/arcships/dim/issues/2019) | |
There was a problem hiding this comment.
Problem: the new row says "request leases", and lines 15-16 say "leases", while ManagedAccount says the caller never holds a lease, an id to release or an expiry (ManagedAccount.md:96) and the contract replaced leases with the credential generation.
Failure scenario: a reader of the plugin index reintroduces a lease operation or a lease-shaped credential reply the account contract removed.
Evidence: docs/design/plugins/README.md:14-16; docs/design/plugins/ManagedAccount.md:96.
Fix: replace "request leases" and "leases" with "credential generation".
| #[error("cancelled")] Cancelled, | ||
| #[error("provider is unloading")] Closed, | ||
| #[error("{0}")] Failed(String), | ||
| #[error("{message}")] ProviderFailed { retryable: bool, message: String }, |
There was a problem hiding this comment.
Problem: invoke takes Mode::Dialogue { chain } but returns only {accepted} on success and ProviderFailed { retryable, message } on failure (Provider.md:159, :349). The updated chain totals and the runtime failure facts never return to the caller.
Failure scenario: ModelProvider writes the terminal step/model-output-end with the failure chain totals and the runtime failure kinds (#2102 ModelProvider.md:13, :86, :92). With this contract it can only write the chain it sent in, so the next turn retries with a stale budget, and the terminal loses kind, status and provider_code. The current code supplies those facts through HostError::Failed { model: ModelFailureFacts } (crates/dim-agent-capabilities/src/model_provider.rs:52-64, crates/dim-agent-types/src/events.rs:770). Retrying chunks can approximate attempts and delays but not the failure facts or a failure before the first retry. This is the failure scenario of round-1 P2 #4, still open after the type was shared.
Evidence: docs/design/plugins/Provider.md:159, :165, :186, :349, :386; #2102 head docs/design/plugins/ModelProvider.md:13, :86, :92; crates/dim-agent-capabilities/src/model_provider.rs:52-64; crates/dim-agent-types/src/events.rs:770-800.
Fix: return the updated FailureChain and a ModelFailure value with the request failure, in InvokeReply or in the provider_failed details, and state that ModelProvider writes them.
There was a problem hiding this comment.
Partially fixed in 7cc7e87. invoke now returns the runtime failure facts and a chain in provider_failed, and the reply carries a chain (Provider.md:159, :165, :179, :354, :392). Remaining: the terminal fact has no chain field, so the claim that ModelProvider writes both into step/model-output-end cannot hold, and the chain duplicates ModelFailure.attempts and waited_ms. I withdraw the round-2 request for a separate chain; the simplest fix is to drop it. See the review body, P2 #1.
| | `resolve` | The model one request resolves to | `{target?, cwd?}` | `Selection` | The caller cancels; no timeout | `invalid`, `not_found`, `unavailable`, `auth_required`, `cancelled`, `closed`, `failed` | | ||
| | `preferences` | Apply a patch to an adopted selection | `{selection, update}` | `Selection` | None; completes immediately | `invalid` | | ||
| | `selectable` | The models that can run a use, and the default | `{use: "chat" \| {modality}}` | `{models, default?}` | The caller cancels; no timeout | `invalid`, `cancelled`, `closed`, `failed` | | ||
| | `prepare_startup` | Admit a temporary connection under the calling row and select its model | `{target?, cwd?, preferences, connection?, limits?}` | `{selection}` | The caller cancels before admission | `invalid`, `invalid_connection`, `not_found`, `unavailable`, `auth_required`, `cancelled`, `closed`, `failed` | |
There was a problem hiding this comment.
Problem: the table says the reply is {selection}, while the appendix returns a bare ModelSelection (Provider.md:396), the caller example binds it bare (Provider.md:125), and the cross-owner contract says prepare_startup(request) -> ModelSelection (process-owner-operations.md:28).
Failure scenario: a generated binding wraps or unwraps the wrong level, so callers read a selection object from selection in one binding and none in another.
Evidence: docs/design/plugins/Provider.md:125, :156, :396; docs/design/contracts/process-owner-operations.md:28.
Fix: use the bare ModelSelection in all four places, or wrap all four.
There was a problem hiding this comment.
Fixed in 7cc7e87. The table, the caller example, the appendix and the cross-owner row now agree on a bare ModelSelection (Provider.md:125, :156, :402; process-owner-operations.md:28).
|
|
||
| `prepare_startup` admits the source under the calling row; the row's unload releases it, so a missed `retain_startup` or `release_startup` settles with the row. `retain_startup({session, model})` moves the source to the Session named by the caller and the model's metadata; the Session's close releases it, so a missed failure-path release settles with the Session. `release_startup({model})` is the optional early release for a creation that failed; it answers `not_found` once a Session retains the source. A member Session that inherits the leader's model retains the same source by value. A connection never crosses. `Selection` is the adopted provider, model, configuration, capability snapshot and metadata. `Credential` is [ManagedAccount](ManagedAccount.md)'s value: static credentials carry no generation; an account owner's carry the grant's. `invoke` calls the account owner's `credential`, sends, and on a refusal calls `rejected` with the refused generation before retrying within its own failure chain. | ||
|
|
||
| `invoke`'s `mode` is `Dialogue { chain? }` or `Once`. `Dialogue` continues the failure chain when given one and reports retry waits as `Retrying` chunks; `Once` makes exactly one request with no retry and no model substitution, which is what a caller sending one paid request needs (Report's model generation). `consume(chunk)` reports `Continue`, `End`, `CredentialRejected` (the provider refused the credential, so `invoke` calls the account owner's `rejected` once and retries) or `Failed { retryable }`; output accepted before a failure prevents replay, and the reply's `accepted` says whether any output was accepted. `admit` runs before each attempt and answers `Admitted` or `Rejected { message }`; a caller without its own budget passes `admit_all`, the binding's default that admits every attempt. Both callbacks are direct parameters, so the request data stays serde-only. A request for `openai-chatgpt` requires a client-origin Session: Provider reads the Session's creation record (`creationRecord`) and answers `invalid` for a non-client Session. |
There was a problem hiding this comment.
Problem: admit_all is called "the binding's default" and the examples pass it (Provider.md:94, :111; ConfiguredModels.md:43), but no definition, import or signature exists in either appendix.
Failure scenario: an implementer cannot tell whether to define a constant, a function, or a generated default, and a foreign-language binding cannot omit a required callback.
Evidence: docs/design/plugins/Provider.md:94, :111, :165, :399-406; docs/design/plugins/ConfiguredModels.md:43.
Fix: define admit_all as a public function or constant with its exact return type, or state that every caller supplies a function and remove the "default" wording.
There was a problem hiding this comment.
Fixed in 7cc7e87. admit_all is defined in the appendix as an exported function (Provider.md:347-350), and the prose no longer calls it the binding's implicit default (Provider.md:165).
| } | ||
| ``` | ||
|
|
||
| The `provider` client namespace keeps its published method names and request shapes; handlers call the operations above and the management operations. No management operation is also published on `providerService`. |
There was a problem hiding this comment.
Problem: Provider.md has no Supersedes section. The owner-redesign template in #2029 requires one, and every other owner document in this PR has one (ManagedAccount.md:231, ConfiguredModels.md:94, DimOAuth.md:125, ManagedOAuth.md:98, ManagedProviders.md:105). The previous head had one at the end of this file; this head removed it.
Failure scenario: the delivery has no owner-side list of the clauses this contract replaces, so a later change cannot tell which surfaces are retired and which still belong to the old Provider management page.
Evidence: docs/design/plugins/Provider.md section list; docs/templates/owner-redesign.md:46 at #2029 head; the five sibling sections above.
Fix: restore the section, listing the service-faces, provider-management, process-owner-operations, resource-owner-operations and auxiliary-model clauses this contract replaces, and the deleted names (modelHost, selectableModelsHost, modelSelectionHost, auxiliaryModel, providerConnectionResolver, modalityConnectionHost).
There was a problem hiding this comment.
Fixed in 7cc7e87. Provider.md now has a Supersedes section (Provider.md:420-429).
`invoke` returns the updated `FailureChain` on success and
`provider_failed { failure, chain }` on failure, so ModelProvider writes
the runtime `ModelFailure` facts and the retry totals into
`step/model-output-end`. Define the exported `admit_all`, and use the
bare `ModelSelection` for `prepare_startup` everywhere.
Restore the Supersedes section and update the retained pages the review
named: the model invocation table in the process-owner contract, the
DimOAuth subscribe example, the auxiliary-model migration note, the
provider-management relation paragraph, and Modality's and
ImageUnderstanding's selectable reads.
Refs #2019 · Refs #2015
|
已按评审修改,head 本轮评审逐条
自查 1–9 发现
绑定附录编译:更新后的六份附录在临时 crate(workspace crates + rutis 0.23) left for step 2
@yyhhyyyyyy 请复核。 |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
PR #2096 at 7cc7e87: review
Refs #2019 and #2015. This PR defines the target contracts for the model and provider owners: Provider, ConfiguredModels, the account owners, and the service-face, resource-face, owner-operation, management and auxiliary-model clauses that name their old surfaces. This round reviews the full main...head, not only 13f9b94...7cc7e87.
Verdict: REQUEST_CHANGES
Round status
Fixed in 7cc7e87, so the round-2 opinions are withdrawn: the second invoke contract (4675557419; process-owner-operations.md:26, :55-59 now match Provider's Mode, direct consume/admit, Retrying and provider_failed), the DimOAuth example (4675557417; DimOAuth.md:41-54 uses the NotifyFn callback), the old selectable reads in the consumer pages (the Modality and ImageUnderstanding thread; Modality.md:297, :465 and ImageUnderstanding.md:147 now use selectable), the prepare_startup reply shape (4675557445; four places now say bare ModelSelection), admit_all (4675557450; defined at Provider.md:347-350), the missing Supersedes section (4675557456; Provider.md:420-429), the auxiliary call's None for admit (4675557423; auxiliary-model.md:76), and the #2094 merge order (now in the PR body, and #2094 no longer changes provider-management line 6).
Partially fixed: the invoke failure facts (4675557438). The facts now return, but the separate FailureChain overreaches the terminal fact (P2 #1). I withdraw the round-2 part that asked for a separate chain; the facts alone are the right shape.
Still open from round 2, optional now: plugins/README.md:14-16 still says "request leases" and "leases" (P3 #6), and the dependency-error mapping is unchanged (Provider.md:141, :163, :171-179; ManagedAccount.md:106-109; P3 #11). The two round-2 hypotheses are still unverified.
P2
1. The returned FailureChain has no destination and duplicates ModelFailure
Problem: invoke returns {accepted, chain?} and provider_failed {failure, chain} (Provider.md:159, :165, :179, :354, :392), and both this document and process-owner-operations.md:59 say ModelProvider writes "both" into step/model-output-end. The terminal fact has no chain field: ModelOutputOutcome::Failed carries error, budget, presentation and failure: Option<Box<ModelFailure>> (crates/dim-agent-types/src/events.rs:818-848), and Completed carries only finish_reason. ModelFailure already carries attempts and waited_ms (events.rs:801-804), which the recovery loop fills from the incoming chain plus its own attempts (crates/dim-agent-capabilities/src/model_provider/recovery.rs:82-83, :199-200). The Loop already builds the next FailureChain from those two fields (crates/dim-agent-capabilities/src/agent_loop.rs:1642-1646). A completed request cannot carry a valid chain either: FailureChain is the failed request a continuation continues and requires from_request_id (events.rs:323-331), and a successful request has no failed request id for it.
Failure scenario: a delivery following "writes both" either adds a chain field to the terminal event that neither this contract nor #2102 owns, or writes only the failure facts while the contract says both. #2102's ModelProvider contract says the terminal carries "the failure chain totals" (ModelProvider.md:13, :86), which the failure facts already hold. The extra chain has no consumer, and the totals then have two sources that can disagree.
Evidence: docs/design/plugins/Provider.md:159, :165, :179, :354, :392; docs/design/contracts/process-owner-operations.md:59; crates/dim-agent-types/src/events.rs:323-331, :768-848; crates/dim-agent-capabilities/src/host.rs:17-55; crates/dim-agent-capabilities/src/model_provider/recovery.rs:82-83, :199-200; crates/dim-agent-capabilities/src/agent_loop.rs:1639-1646; #2102 head docs/design/plugins/ModelProvider.md:13, :86.
Fix: Drop chain from InvokeReply and ProviderFailed, and state that failure.attempts and failure.waited_ms are the updated totals ModelProvider writes and the Loop uses to build the next chain. If a chain value is really required, define the terminal field in #2102's contract and name the change here.
2. ConfiguredModels still advertises provider_failed {retryable}
Problem: Provider's error is now provider_failed {failure, chain} (Provider.md:159, :179, :392), and ConfiguredModels says its error kinds are Provider's (ConfiguredModels.md:5, :51), but its Errors section still lists provider_failed {retryable} (ConfiguredModels.md:57). The binding in the same document returns the shared ProviderError (ConfiguredModels.md:107-118), so the text and the type disagree.
Failure scenario: an API-key profile implementation built from its own error list emits or expects {retryable} while the managed profile serializes {failure, chain}. A caller that branches on the error details works on one profile and fails on the other, and a shared providerService test cannot cover both.
Evidence: docs/design/plugins/ConfiguredModels.md:5, :57, :107-118; docs/design/plugins/Provider.md:159, :179, :392.
Fix: Replace {retryable} with {failure, chain}, or drop the explicit shape and point to Provider's error kinds.
Optional (P3)
- docs/design/resource-faces.md:849 links
../plugins/ManagedAccount.md, which resolves todocs/plugins/ManagedAccount.md; the file isdocs/design/plugins/ManagedAccount.md. Drop the../. - docs/design/plugins/README.md:14-16 still says "request leases" and "leases"; ManagedAccount.md:96 says the caller never holds a lease. Round 2 asked for this; it is optional now.
- docs/design/appserver/auxiliary-model.md:10, :44, :58 still describe the service in the present tense in sections 1, 1.1 and 2, while the status line and section 4 say it is superseded. Sections 5 to 11 are marked; these three are not.
- docs/design/plugins/Provider.md:423 cites a
modelHostparagraph in process-owner-operations.md that is now only the line 3 name list, and :427 puts Modality section 9.4 in the Supersedes list; section 9.4 is the remainingmodalityTargetsread and has no connection resolution. Tighten the list so the delivery does not delete section 9.4. - docs/design/plugins/Provider.md:179 allows a retry when
failure.retry_forbiddenis false, while line 165 says accepted output prevents replay. Add "and no output was accepted", or carry that fact in the failure.
Checks
- Full main...head read (16 files). Delta 13f9b94...7cc7e87 checked against the nine round-2 threads; it changes Provider's invoke reply and error, its binding, process-owner's row and table, auxiliary-model's
admit_all, DimOAuth's example, Modality's read and options, ImageUnderstanding's read, provider-management section 3.7, and adds Provider's Supersedes section. node scripts/adr-check.mjs --base 1bc7d67dpasses (16 changed files, no ADR edits).git merge-tree --write-tree origin/main HEADis clean against current main c819cfd (#2130 merged).- Link and anchor scan of the 16 changed files: one broken relative link (resource-faces.md:849); every other local file and anchor resolves.
- Cross-PR: #2091's
creationRecord({id}) -> {origin, leader?}still matches Provider.md:141. #2102's terminal fact description supports P2 #1. #2094 is in the stated merge order and its current head does not change provider-management line 6; its line 53 row and this PR's row are compatible, but this PR must rebase after #2094 lands. #2080, #2092, #2093 and #2098 to #2103 still shareservice-faces.mdandplugins/README.md; the stated order keeps this PR before "the rest". - CI for 7cc7e87:
ci-oksuccess,verify (linux)success,macos-nativesuccess,changessuccess; windows, acp-registry, web, dependencies, scripts and static-checks skipped. The combined status endpoint reports pending with no status contexts.
Unverified
- Whether Provider's
selectableshould answerdefaultfor a modality use. Modality owns its operation defaults, but Modality.md:175 uses Provider's global default for automatic resolution, so the field may be intentional; the contract still does not say. - Whether ManagedAccount.md:11's "revision and lease" is the account's own claim field; unchanged from round 2.
- Whether #2102 will add a chain field to
step/model-output-end; its current head does not.
|
|
||
| `prepare_startup` admits the source under the calling row; the row's unload releases it, so a missed `retain_startup` or `release_startup` settles with the row. `retain_startup({session, model})` moves the source to the Session named by the caller and the model's metadata; the Session's close releases it, so a missed failure-path release settles with the Session. `release_startup({model})` is the optional early release for a creation that failed; it answers `not_found` once a Session retains the source. A member Session that inherits the leader's model retains the same source by value. A connection never crosses. `Selection` is the adopted provider, model, configuration, capability snapshot and metadata. `Credential` is [ManagedAccount](ManagedAccount.md)'s value: static credentials carry no generation; an account owner's carry the grant's. `invoke` calls the account owner's `credential`, sends, and on a refusal calls `rejected` with the refused generation before retrying within its own failure chain. | ||
|
|
||
| `invoke`'s `mode` is `Dialogue { chain? }` or `Once`. `Dialogue` continues the failure chain when given one and reports retry waits as `Retrying` chunks; `Once` makes exactly one request with no retry and no model substitution, which is what a caller sending one paid request needs (Report's model generation). `consume(chunk)` reports `Continue`, `End`, `CredentialRejected` (the provider refused the credential, so `invoke` calls the account owner's `rejected` once and retries) or `Failed { retryable }`; output accepted before a failure prevents replay, and the reply's `accepted` says whether any output was accepted. `admit` runs before each attempt and answers `Admitted` or `Rejected { message }`; a caller without its own budget passes the exported `admit_all`. Both callbacks are direct parameters, so the request data stays serde-only. A request for `openai-chatgpt` requires a client-origin Session: Provider reads the Session's creation record (`creationRecord`) and answers `invalid` for a non-client Session. A failed request returns `provider_failed` with the `ModelFailure` facts and the updated `FailureChain`; a completed request returns the updated chain in the reply, so ModelProvider writes both into `step/model-output-end`. |
There was a problem hiding this comment.
Problem: invoke returns a FailureChain in the reply and in provider_failed, and this line says ModelProvider writes both it and the ModelFailure facts into step/model-output-end. The terminal fact has no chain field: ModelOutputOutcome::Failed carries error, budget, presentation and failure: Option<Box<ModelFailure>> (crates/dim-agent-types/src/events.rs:818-848), and Completed carries only finish_reason. ModelFailure already carries attempts and waited_ms (events.rs:801-804), the recovery loop fills them from the incoming chain plus its own attempts (crates/dim-agent-capabilities/src/model_provider/recovery.rs:82-83, :199-200), and the Loop builds the next FailureChain from them (crates/dim-agent-capabilities/src/agent_loop.rs:1642-1646). A completed request cannot carry a valid chain either: FailureChain names the failed request a continuation continues and requires from_request_id (events.rs:323-331).
Failure scenario: a delivery following "writes both" either adds a terminal chain field that neither this contract nor #2102 owns, or writes only the facts while this line says both. #2102 says the terminal carries "the failure chain totals" (ModelProvider.md:13, :86), which the facts already hold; the extra chain has no consumer.
Fix: Drop chain from InvokeReply and ProviderFailed, and state that failure.attempts and failure.waited_ms are the updated totals. If a chain value is really required, define the terminal field in #2102's contract in the same change.
|
|
||
| ### Errors | ||
|
|
||
| [Provider](Provider.md)'s kinds, minus `invalid_connection` and the startup-only ones: `invalid` for a malformed request, `not_found` for a target missing from the file, `unavailable` for a media operation or a missing environment variable, `cancelled`, `closed`, `failed` and `provider_failed {retryable}`; `credential` has `not_found`, `unavailable`, `cancelled`, `closed` and `failed`. |
There was a problem hiding this comment.
Problem: Provider's error is provider_failed {failure, chain} now (Provider.md:159, :179, :392), and this document says its error kinds are Provider's (ConfiguredModels.md:5, :51), but this row still says provider_failed {retryable}. The binding below returns the shared ProviderError (ConfiguredModels.md:107-118), so the text and the type disagree.
Failure scenario: an API-key profile implementation built from this row emits or expects {retryable} while the managed profile serializes {failure, chain}; a caller that branches on the error details works on one profile and fails on the other.
Fix: Replace {retryable} with {failure, chain}, or drop the explicit shape and point to Provider's error kinds.
| | Settings sources and their CAS writes | `readBytes`, `stat`, `lock`, `readBytes {leaseId}`, `replace {leaseId}`, `unlock` | | ||
| | MCP auth store, managed OAuth and OAuth token stores | `readBytes`, `lock`, `readBytes {leaseId}`, `backup`, `replace {leaseId}`, `unlock` | | ||
| | MCP auth store | `readBytes`, `lock`, `readBytes {leaseId}`, `backup`, `replace {leaseId}`, `unlock` | | ||
| | Managed OAuth and OAuth token stores | `read`, `update`, `write`; the account owner answers [ManagedAccount](../plugins/ManagedAccount.md) | |
There was a problem hiding this comment.
../plugins/ManagedAccount.md resolves from docs/design/ to docs/plugins/ManagedAccount.md, which does not exist. Use plugins/ManagedAccount.md.
There was a problem hiding this comment.
Fixed in 9ca30e0. resource-faces.md:849 now links plugins/ManagedAccount.md; the target exists at docs/design/plugins/ManagedAccount.md, and the 16-file relative-link scan reports no broken links.
|
已按评审修改,head 跨 PR 对齐:
验证: |
|
补充提交,head |
|
补充说明(ADR 027 收回到决定层后):本 PR 的契约没有 |
yyhhyyyyyy
left a comment
There was a problem hiding this comment.
PR #2096 at 9ca30e0: review
Refs #2019 and #2015. This PR defines the target contracts for the model and provider owners: Provider, ConfiguredModels, the account owners (ManagedAccount, DimOAuth, ManagedOAuth, ManagedProviders), and the service-face, resource-face, owner-operation, management and auxiliary-model clauses that name their old surfaces. This round reads the full main...head, not only 7cc7e87...9ca30e0.
Verdict: REQUEST_CHANGES
Round status
Fixed in 9ca30e0, so the round-3 optional link finding is withdrawn: resource-faces.md:849 now links plugins/ManagedAccount.md, and docs/design/plugins/ManagedAccount.md exists. The 16-file relative-link scan reports no broken links or anchors.
The rest of the delta is accepted. Provider.md:53-54, :65-66 and :71 now use #2102's line_owner::<Prompt> and ConfigureRequest::Initial(ConfigureUpdate { sources: targets, model }), which matches #2102 head 3b48e12 and dim_agent_runtime::ConfigureUpdate (crates/dim-agent-runtime/src/contracts.rs:98-102). provider-management.md:53 now matches #2094 head 0677c71 except for the link target. The new DimOAuth.md:105 sentence is true for the tree: no TypeScript or JavaScript source references auth.json at origin/main, and #2080 FileStorage.md:217 says the TypeScript plugin no longer writes it. Its claim/release wording also matches #2080. What the sentence exposes is P2 #4.
Still open from round 3: P2 #1 (the FailureChain destination) and P2 #2 (ConfiguredModels' provider_failed {retryable}). The delta does not touch either.
P2
1. The returned FailureChain still has no destination and duplicates ModelFailure (round 3, still open)
Problem: invoke returns {accepted, chain?} and provider_failed {failure, chain} (Provider.md:161, :181, :356, :394), and this document and process-owner-operations.md:59 say ModelProvider writes "both" into step/model-output-end. The terminal fact has no chain field: ModelOutputOutcome::Failed carries error, budget, presentation and failure: Option<Box<ModelFailure>> (origin/main crates/dim-agent-types/src/events.rs:820-848), and Completed carries only finish_reason. ModelFailure already carries attempts and waited_ms (events.rs:801-804), which the recovery loop fills from the incoming chain plus its own attempts (crates/dim-agent-capabilities/src/model_provider/recovery.rs:81-83, :196-202). The Loop builds the next FailureChain from those two fields (crates/dim-agent-capabilities/src/agent_loop.rs:1642-1646). A completed request cannot carry a valid chain either: FailureChain is the failed request a continuation continues and requires from_request_id (events.rs:327-331), and a successful request has no failed request id for it.
Failure scenario: A delivery following "writes both" either adds a chain field to the terminal event that neither this contract nor #2102 owns, or writes only the failure facts while the contract says both. #2102's ModelProvider says the terminal carries "the failure chain totals" (ModelProvider.md:13, :86); the facts already hold those totals, so the extra chain has no consumer and the totals have two sources that can disagree.
Evidence: docs/design/plugins/Provider.md:161, :167, :181, :356, :394; docs/design/contracts/process-owner-operations.md:26, :59; origin/main crates/dim-agent-types/src/events.rs:327-331, :801-804, :820-848; crates/dim-agent-capabilities/src/model_provider/recovery.rs:81-83, :196-202; crates/dim-agent-capabilities/src/agent_loop.rs:1642-1646; #2102 head docs/design/plugins/ModelProvider.md:13, :62, :86.
Fix: Drop chain from InvokeReply and ProviderFailed, and state that failure.attempts and failure.waited_ms are the updated totals ModelProvider writes and the Loop uses to build the next chain. If a chain value is really required, define the terminal field in #2102's contract in the same change.
2. ConfiguredModels still advertises provider_failed {retryable} (round 3, still open)
Problem: Provider's error is provider_failed {failure, chain} (Provider.md:161, :181, :394), and ConfiguredModels says its error kinds are Provider's (ConfiguredModels.md:5, :51), but its Errors section still lists provider_failed {retryable} (ConfiguredModels.md:57). The binding in the same document returns the shared ProviderError (ConfiguredModels.md:107-118), so the text and the type disagree.
Failure scenario: An API-key profile implementation built from its own error list emits or expects {retryable} while the managed profile serializes {failure, chain}. A caller that branches on the error details works on one profile and fails on the other, and a shared providerService test cannot cover both.
Evidence: docs/design/plugins/ConfiguredModels.md:5, :57, :107-118; docs/design/plugins/Provider.md:161, :181, :394.
Fix: Use Provider's exact shape after P2 #1, or drop the explicit shape and point to Provider's error kinds.
3. Main's #2004 image routing contradicts the retained ImageUnderstanding text (new)
Problem: origin/main's ImageUnderstanding contract, changed by #2004 (merged as bf3a4e6), says a vision-capable conversational model, or a request whose model capability is unknown, receives image pixels, and only other models receive img: references (origin/main docs/design/plugins/ImageUnderstanding.md:12-19, :120-125). This head still says the conversational model never receives pixels (ImageUnderstanding.md:15), that a model accepting image input receives references too and sending pixels is "the defect this design removes" (:115-119), and states M2 as "the reference in place of pixels" (:152-158). git merge-tree --write-tree origin/main HEAD already conflicts in this file.
Failure scenario: A rebase that keeps this side makes the page state the opposite of Attachments A.1 and #2102's ModelProvider ("Provider::invoke adapts image references to the model's capability", ModelProvider.md:62). A delivery then routes every conversational image to a reference and the image_understand auxiliary call, re-disabling the vision path #2004 merged, and the page also contradicts the standalone failure main added for a target that does not take the image's format (origin/main ImageUnderstanding.md:127-135; auxiliary-model.md:184).
Evidence: origin/main docs/design/plugins/ImageUnderstanding.md:12-19, :120-135; this head docs/design/plugins/ImageUnderstanding.md:12-16, :115-119, :152-158; docs/design/plugins/ImageUnderstanding.md:147; #2102 head docs/design/plugins/ModelProvider.md:62; git merge-tree --write-tree origin/main HEAD conflict.
Fix: Rebase on origin/main and take its routing paragraphs at :12-19, :115-135 and the M2 text, changing only the execution host from auxiliaryModel to providerService.invoke. Keep the standalone format-failure outcome, and state which Provider error it maps to if invoke is now the executor.
4. The account owners' FileStorage requirements omit the claim/release their rotating refresh requires (new)
Problem: DimOAuth.md:105 now names the App Server's managed OAuth flow as a second writer of auth.json, and DimOAuth asks FileStorage for claim/release for the marker (DimOAuth.md:134). The other writers do not: ManagedOAuth.md:11 and :95 ask only for read and update, and :53 says its account record keeps its existing file, auth.json; ManagedAccount.md:157 asks read, update and write, and ManagedProviders.md:13 promises "one serialized refresh" while :102 asks only read, update and write. #2080 at 5351ea7 requires the Managed OAuth flow to claim the marker, refresh outside the file key, write with update(claim_id) and release (FileStorage.md:37, :146, :148, :181), and says every writer of auth.json holds the marker (:14, :217).
Failure scenario: A delivery of ManagedOAuth follows its requirement and uses update for the rotating refresh. #2080 forbids network I/O inside change (FileStorage.md:179), so the implementation either holds the file key across the HTTP refresh, blocking every other auth.json writer, or refreshes outside the key without a claim. Two processes then refresh the same rotating grant; the provider rotates one token and invalidates the other, and one process persists a dead grant or the user is signed out. The same gap exists for the ChatGPT account: its record is chatgpt-account.json (crates/dim-app-server/src/managed_provider/chatgpt.rs:203), it refreshes under a lease today (:742-794), and #2080's claim covers only auth.json, so its contract needs a decision rather than only read/update/write.
Evidence: docs/design/plugins/DimOAuth.md:105, :134; docs/design/plugins/ManagedOAuth.md:11, :53, :95; docs/design/plugins/ManagedAccount.md:157; docs/design/plugins/ManagedProviders.md:13, :102; #2080 head docs/design/plugins/FileStorage.md:14, :37, :146, :148, :181, :217; origin/main crates/dim-app-server/src/managed_oauth.rs:420, :1042-1094; crates/dim-app-server/src/managed_provider/chatgpt.rs:203, :742-794.
Fix: Add claim/release to ManagedOAuth.md's and ManagedAccount.md's FileStorage requirements and state that the rotating refresh runs under the claim as #2080's Managed OAuth flow does. Decide the ChatGPT account record's exclusion in #2080 or here: a published marker for chatgpt-account.json, or an explicit process-local rule. The #2080 writer list at :217 already names both Rust writers and the TypeScript plugin.
Optional (P3)
- The six new owner docs cite "Design rules §7" as PR #2029, which merged as 4d081fe. Point at
docs/architecture/rust-agent/principles.md§7 and, for the line-owner route, ADR 027. The forward dependency links have the same shape: provider-management.md:53 links #2094 and Provider.md:71 links #2102; after those land, use../plugins/ProviderSettings.mdandPromptAdoption.md. - docs/design/plugins/README.md:14-16 still says "request leases" and "leases", while ManagedAccount.md:96 says the caller never holds a lease.
- docs/design/appserver/auxiliary-model.md:10, :44 and :58 still describe the service in the present tense while the status and section 4 say it is superseded.
- docs/design/plugins/Provider.md:425 supersedes a
modelHostparagraph that no longer exists in process-owner-operations.md, and :429 lists Modality §9.4, which is the retainedmodalityTargetsread and has no connection resolution. - docs/design/plugins/Provider.md:181 allows a retry when
failure.retry_forbiddenis false, while :167 says accepted output prevents replay. Add "and no output was accepted", or carry that fact in the failure. - docs/design/plugins/ManagedAccount.md:11 still says the account record is written "with the account's own revision and lease"; #2080 FileStorage.md:144 says the public face has no lease. Use "claim" if that is the account marker.
- docs/design/plugins/DimOAuth.md:105 names the current implementation files in a contract and says "the writers are" even though the migration import also writes
auth.json(crates/dim-migration/src/accounts.rs:13, :184). Cite #2080's account-marker exception and say "the ongoing writers".
Checks
- Full main...head read (16 files); the delta checked against the round-3 threads.
node scripts/adr-check.mjs --base 1bc7d67dpasses (16 changed files, no ADR edits).- Relative-link and anchor scan of the 16 changed files: no broken links.
git merge-tree --write-tree origin/main HEADis clean except for one content conflict in docs/design/plugins/ImageUnderstanding.md against origin/main bf3a4e6.- CI for 9ca30e0:
ci-ok,verify (linux)andmacos-nativesuccess; windows, acp-registry, web, dependencies, scripts and static-checks skipped. The combined status endpoint reports pending with no contexts. - Cross-PR: #2080 at 5351ea7 still defines
claim/releaseand the Managed OAuth flow. #2091 at 8f9f5e1 keepscreationRecord({id}) -> {origin, leader?}(the PR body's f7425d5 is stale). #2094 at 0677c71 matches the new settings row. #2102 at 3b48e12 matches the Prompt call and the terminal-fact text. #2099 at 8f440bd usesaccount.title(TitleRequest { provider, text })(the PR body's 3501002 is stale).
Unverified
- Whether #2102's
ConfigureRequest::Initialis valid on an already-open line for a model change; the target text calls it the initial targets and model. If it is open-only, Provider's second example needs the model-change variant #2102 will define. - Whether Provider's
selectabledefaultfor a modality use is intended (unchanged hypothesis from round 2). - Whether ManagedAccount.md:11's "lease" is the account's claim field (unchanged hypothesis).
- Whether #2080 will extend the account marker to
chatgpt-account.json; if not, P2 #4's fix needs a decision in #2080.
| ([Modality](Modality.md) A.1), resolved by its owner and executed through the existing | ||
| `auxiliaryModel` host. The conversational model never receives image pixels, and the image's | ||
| ([Modality](Modality.md) A.1), resolved by its owner and executed through | ||
| `providerService.invoke`. The conversational model never receives image pixels, and the image's |
There was a problem hiding this comment.
Problem: This retained claim contradicts origin/main. #2004 (merged as bf3a4e6) changed the routing: a vision-capable model, or one whose capability is unknown, receives pixels; only a model that cannot take images receives img: references (origin/main ImageUnderstanding.md:12-19, :120-125). This line and :115-119, :152-158 still say the opposite, and git merge-tree --write-tree origin/main HEAD already conflicts here.
Failure scenario: A rebase that keeps this side makes the contract state the opposite of Attachments A.1 and #2102's ModelProvider ("Provider::invoke adapts image references to the model's capability", ModelProvider.md:62). A delivery routes every conversational image to a reference and the auxiliary call, re-disabling the vision path #2004 merged, and the page contradicts the standalone format failure main added (origin/main ImageUnderstanding.md:127-135).
Fix: Rebase on main and take its routing paragraphs at :12-19, :115-135 and the M2 text, changing only the execution host from auxiliaryModel to providerService.invoke.
| ## Exceptions with reasons | ||
|
|
||
| - The bearer's boundary is [ManagedAccount](ManagedAccount.md#the-bearers-boundary); DimOAuth's replies and errors omit it. | ||
| - The account file is guarded by the published `auth.json.lock` marker protocol. The writers are this owner and the App Server's managed OAuth flow, both Rust (`crates/dim-oauth/src/store.rs`, `crates/dim-app-server/src/managed_oauth.rs`); no TypeScript source writes `auth.json`. The marker is FileStorage's claim protocol for this file ([#2080](https://github.com/arcships/dim/pull/2080)), not a cross-language exception. |
There was a problem hiding this comment.
Problem: The sentence is consistent with #2080 on the TypeScript point, but it names a second writer whose contract asks for no claim/release. DimOAuth.md:134 asks for claim/release; ManagedOAuth.md:11 and :95 ask only for read and update, and :53 says the record keeps its existing file auth.json; ManagedAccount.md:157 asks read/update/write, and ManagedProviders.md:13, :102 promises one serialized refresh with the same read/update/write requirement. #2080 at 5351ea7 requires the Managed OAuth refresh to claim the marker, refresh outside the file key, update with claim_id and release (FileStorage.md:37, :146, :148, :181), and says every writer holds the marker (:14, :217).
Failure scenario: A delivery of ManagedOAuth follows this requirement and uses update for the rotating refresh. #2080 forbids network I/O in change, so it either holds the file key across the HTTP wait, blocking every other auth.json writer, or refreshes without a claim; two processes rotate the same grant, one token is invalidated, and the user is signed out. The ChatGPT account has the same gap: its record is chatgpt-account.json (crates/dim-app-server/src/managed_provider/chatgpt.rs:203), it refreshes under a lease today (:742-794), and #2080's claim covers only auth.json.
Fix: Add claim/release to ManagedOAuth.md and ManagedAccount.md's FileStorage requirements, state that the refresh runs under the claim as #2080's Managed OAuth flow does, and decide the ChatGPT account record's exclusion in #2080 or here. The #2080 writer list at :217 already names both Rust writers and the TypeScript plugin.
|
Closing as part of abandoning the owner-split experiment. |
Refs #2019 · Refs #2015
Summary
Merge order: #2029 → #2080 → #2091/#2092/#2093 → #2094 → this PR → the rest. The retained pages for other owners (SessionTitle, Web) are updated by their own contracts (#2099); this PR changes only the model and provider owners' paragraphs.
The target contracts for the model and provider board under design rules §7: responsibility splits, caller compositions, operations with cancellation and error kinds, resource flows, exceptions, rule checks, requirements raised to other owners, and Rust bindings.
providerclient protocol; handlers call the same operations.providerServiceoperations from the API-key model file, without records, management, startup or recording.rejecteddecision after a refusal; DimOAuth adds relay search and title.chatgptAccount; the host binding, thedyn ManagedProviderobject port and themanagedSearchface are retired, so no owner returns another owner's data.recordingvalue per request; the process-global recorder function is removed.Modality's
modalityTargets.resolveis unchanged; the media adapter resolvesmedia_routeand reads the credential for the model target. ImageUnderstanding is a consumer and migrates toproviderService.invoke.Kinds of pre-migration surfaces that disappear:
modelSelectionHost,selectableModelsHost,auxiliaryModel,providerConnectionResolver,modelHost,modalityConnectionHost,managedSearch, the account data forwarding methods, and the process-global recording function.Delivery part (deletion list, caller migration, implementation task, acceptance): 目标契约:交付部分.
Merge order
#2029 → #2080 → #2091/#2092/#2093 → #2094 → #2096 → the rest.
Sibling heads this change is aligned with: #2091
f7425d55c, #20940677c7155, #20993501002ac, #21023b48e1248. A paragraph that depends on a sibling names that PR; its head is the one above.