Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Process control: one owner for admission, shutdown and management methods - #2480

Draft
eric8810 wants to merge 125 commits into
mainfrom
dim/2021-process
Draft

eric8810 wants to merge 125 commits into
mainfrom
dim/2021-process

Conversation

@eric8810

@eric8810 eric8810 commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Refs #2021

Part A of the connection, entry and UI split (#2021). Owner pages and tests follow in this branch.

  • ServerControl merges into ProcessActivity: one plugin, one face with activated, closing, hold, release, holds, shutdown(force) → completion and fault.
  • take_hold/the RAII hold and pause leave the face; every caller takes hold() and releases the id. Agents keeps the Session pause guards its quiesce froze.
  • Idle shutdown is Connection's close_for_idle: the Session count and process holds are read first, and the refusal or the decision is committed in the admission lock. A committed decision is not withdrawn when a Session is not quiescent.
  • ManagementMethods serves its table: call does the lookup, the admission and the withdrawn-owner answer; listed/holds replace the Deref object. The table's register operation is served by the table the owning part provides, so ForeignMethods is gone.
  • reservedMethods.check is the one reservation check; ReservedMethods::check_type is gone.
  • localId leaves the catalog: LocalIdDispatch and its row are removed; the handshake keeps the rutis_bridge::LocalId value.

Allowlist entries removed from xtask/access-layer.json: ForeignMethods, ReservedMethods::check_type, ProcessActivity::pause, ProcessActivity::take_hold, LocalIdDispatch.

Remove the Store wrapper and its forwarding methods; SessionStore now serves
the store host face and owns the Rust binding. Callers inject the owner type,
and the plugin registers one name for it.

Refs #2018
Drop the SqliteDispatch adapter; the engine type itself implements the host
face, so the plugin registers the same owner it provides to Rust callers.

Refs #2018
Remove the SessionMetadata wrapper and its separate face; SessionStore serves
title and setTitle, and Agents and SessionTitle read the same owner.

Refs #2018
The `prompt-suggestion` source reached PromptSuggestion through a
hand-written `HostDispatch` wrapper (`PromptSuggestionSettingsHost`), a
second interface beside the owner's read. The App Server's owner now serves
`promptSuggestionSettings.read` on the wire and the same read through the
`PromptSuggestionSettingsRead` port, the wrapper is deleted, and the Session
part declares the port instead of the wrapper type.

Refs #2017
Rename the SessionFiles wrapper and its trait to a SessionFilesHost port,
delegate its operations, and migrate the eight consumers plus the runtime
fixture call sites. App Server's file owner implements the port and the plugin
provides the port handle.

Refs #2018
The process owner's operations — declare, publish, sources, subscribe,
unsubscribe and list — are one #[rutis::service] face at host_key
"eventHub"; declare and publish take the calling row from the binding,
and a subscription's origin is request data.

eventSubscriptions, the hand-written bridges and the eventhub management
namespace are removed, with the access-layer entries they held. The events
tool calls the owner's subscription operations, and scenario-eval reads and
writes them through the face.
ServerControl and ProcessActivity were two names for one plugin and
lifecycle, and the idle-shutdown decision reached across Connection,
Agents and the process owner while holding the admission lock.

ProcessActivity now owns publication, closing, holds, the shutdown
completion and the first listener fault. The process activity face keeps
the id forms hold/release, adds closing/shutdown/fault, and Agents keeps
the Session pause guards its quiesce froze. Connection commits an idle
decision with close_for_idle in one lock; the Session count and process
holds are read before it.

ManagementMethods now serves its table: call performs the lookup,
admission and withdrawn-owner answer, listed/holds replace the Deref
object, and the table's register operation belongs to the table itself
instead of a second ForeignMethods type. reservedMethods.check is the one
reservation check; localId's face is gone.

Refs #2021
Move the remaining App Server, image, attachment, MCP and flow-test callers
from the removed SessionFiles wrapper to the SessionFilesHost port.

Refs #2018
The execution switches reached HostPlatform, the `settings` tool and the
snapshot branch through a hand-written `HostDispatch` wrapper
(`ExecutionSettingsHost`) that also carried the document type. The App Server's
owner now serves `executionSettings.read` over the same value, the port is the
`ExecutionSettingsRead` trait, and the document type takes the contract's name
`Switches`. Assemblies without a stored source build the same value through
`execution_settings::fixed`.

Refs #2017
Update the App Server owner page, the service-face inventory, the process
owner operations, the single-tree rows and the Session boundary's foreign
register note. The transport flow test now drives holds, closing and the
shutdown completion through the face.

Refs #2021
The sessions service was a hand-written HostDispatch that decoded one
request object per call and wrapped every reply in an envelope. It is now
a #[rutis::service] whose operations take typed requests and reply with the
typed SessionsReply envelope, so the face is data on both sides and the
dispatch is generated.

permissionDefaults moves from sessionPermissions to sessions: it is Agents'
own creation default, not a Session's dispatched state. sessionPermissions
keeps the per-Session permission read until that read has a landing of its
own; its Ctx field is no longer outward.

Removes the SessionPermissions::0 and SessionsService access-layer entries.
The owner now serves twelve operations on FileStorage itself:
add_root, root_path, stat, read, write, import, update,
create_directory, list, remove, claim and release. Reads are stateless
offset reads, write pulls its source by callback, update runs its change
under the file's key, and claim/release hold the published auth.json.lock
marker for an account row.

Delete the FsHost wrapper and its HostDispatch, the FileLease and
FileReader handles, FilePath, FsPermissions and FsRemove, the old
FileStorage object methods, and the fileStorage catalog row. Keep the
fsHost name on the FileStorage type. Replace FileStorageError's public
surface with FileError's eight codes.

Migrate the Hooks project read, ModelLog's root path, UiResources'
publish/page reads and UiExtensions' copy and read paths to the
operations. Update the owner page and the flow test.

Refs #2016
The port still serves sessionFiles through a hand-written HostDispatch; list
the new real type rather than dropping the entry by renaming. Converting it to
a service data face stays for the debug phase.

Refs #2018
Settings and WorkflowFiles use add_root, root_path, read, write,
create_directory and the compare-and-set update, with the document
revision checked inside change. SessionStore reads and writes Session
files through read, write, import, list, stat and remove. HostPlatform
and its exec-shell face read through read and replace through update.

Refs #2016
Make the internal error and result crate-private, correct the streaming
replacement's error kinds and cleanup, and point Hooks' owner page at
read.

Refs #2016
CollaborationConfig was a #[rutis::service] whose two public fields existed
for Rust alone, and collaborationDirectory.relations had no product caller.
The configuration stays the Session value the part declares, and a typed
session operation, collaborationSession.agentDescriptions, answers the two
texts for a reader of another language. The process keeps the member
relations to itself.

collaborationSession.approvalDestination was a hand-written HostDispatch
that decoded its own request object; it is now a #[rutis::service] operation
taking {memberSessionId}, so the Session face is data on both sides.

Removes the CollaborationConfig field, CollaborationDirectory::record and
CollaborationSession host-dispatch access-layer entries.
…h faces

The process owner answers create, update, list, get, delete, setEnabled,
runNow and history as one #[rutis::service] face; the schedule tool and the
schedule management namespace both call those operations, and the tool's
caller fills the target instead of a caller field.

The loop records lose their catalog name: the Session part receives the
owner and calls its Rust operations, and session.loop.* stays the client
transport. schedule.watch, its watchers, the settings-changed notice, the
Scheduler Session notifications and the ProcessHold objects are removed;
delivery admission is now a hold id per unsettled record.
Add the capabilities ProviderService face with the nine owner operations
(resolve, preferences, selectable, invoke, prepareStartup, retainStartup,
releaseStartup, mediaRoute, credential) and implement it for Provider and
ConfiguredModels.

Retire ModelSelectionHost, SelectableModelsHost and AuxiliaryModel with their
provide points and hand-written dispatchers. Migrate Modality, Agents, Rpc,
Collaboration, SessionTitle, ImageUnderstanding, scenario evaluation, the
TypeScript declarations and runtime fixtures, and remove the three access-layer
entries. Startup declaration types move to the face so the operations share one
definition.

Refs #2019
The three prompt texts reached PromptSources, Skills and the summary strategy
through three hand-written `HostDispatch` wrappers, and the Permission
decision read the user's command rules through a fourth. The App Server's
`prompts` owner now serves `promptSettings.base/summary/skills` while the
capabilities traits stay the Rust port, and the `permissionRules.rules` owner
serves the rules the decision reads through `ReadCommandRules`. The wrappers,
their face names and the `commandRules` service are deleted.

Refs #2017
Regenerate branch service declarations, drop the temporary providerOwner
catalog name, and settle the test fixtures against the new faces.

Refs #2019
Use the owner's account watch before an account read, wake consumers on any
watch move, validate invoke requests at the owner boundary, keep one credential
recovery under `once`, and link invocation cancellation to the owner lifetime.
Update the flow fixtures and the Web replacement expectation to the owner-face
contract.

Refs #2019
# Conflicts:
#	crates/dim-agent-scheduler/tests/data_faces_flow.rs
#	xtask/access-layer.json
# Conflicts:
#	xtask/access-layer.json
Keep the train's Settings, FileStorage, SessionStore, Timeline, EventHub
and Agents faces. The scheduler and EventHub already carry their own
admission guards on the id API, so their hold call sites take the train's
form and this branch's local guard is gone. The process activity and
serverControl catalog rows stay removed, and the five retired allowlist
entries stay deleted.
The table no longer hands out providers: call dispatches through the
namespace that holds the name, and call_with_withdrawn adds the owner's
answer for a withdrawn namespace. Uploads and the flow tests that admitted
calls through a provider now use the table's own operation.

Refs #2021
Route the remaining provider lookups through the table's call operation:
the management owner's call is public for the in-process binding and the
flow tests, the report part registers through the caller's operation, and
the test fixtures build the new owner fields.
… loader

The access-layer rule counts pub(crate) methods on a service type as a
Rust-only face, so publication, readiness, shutdown intent and settlement
are free functions over the owner. The management table declares the loader
it reads rows from, and the provider service is no longer marked internal:
the train made it a data face.

The foreign register operation stays one hand-written dispatcher on the
table owner, replacing the deleted ForeignMethods entry: the generated face
cannot pass a bridge function together with the call channel's cancel and
progress callbacks.
A daemon.shutdown reply is written by the connection's reply task after the
host settled, so the coordinator joins those writers after the settlement
instead of before the teardown they report. The management table reads the
loader as an optional service, so a fixture that mounts the table alone
still composes; a withdrawn namespace without one answers reloading.

Refs #2021
The coordinator joins admitted shutdown commands before deciding graceful
or forced, so a force request in the same read is never lost, while the
reply writers wait for the settlement on their own tracker. Shutdown
frames are still served after admission stops. An idle refusal reads the
connection and Session counts before process work, so a busy daemon answers
with its counts.

Refs #2021
@eric8810

eric8810 commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator Author

Local verification after merging dim/owner-split-train (f464ee485). Head 548b4990c.

Passed:

  • cargo fmt --all -- --check
  • cargo check --workspace --all-targets --locked
  • cargo run -p xtask -- check (access layer, service declarations, plugin locks, comments, i18n, retired names)
  • cargo run -p xtask -- types and graph (no pending generated change)
  • cargo clippy --workspace --all-targets --locked -- -D warnings

Affected tests passed:

  • transport_flow: shutdown (12), management (8), process (15), connection (18)
  • dim-app-server --lib (153/154; one Agents publication test passes alone — load flake)
  • app_server_flow: attachments (8), hooks_settings (4), compaction_settings (4), provider_flow (81), mcp_session_flow (49), mcp_oauth_flow (9), settings_flow (25)
  • dim-agent-runtime, dim-report, dim-agent-capabilities (755), dim-event-hub (58), dim-agent-scheduler (89/90; one cross-crate name test passes alone — load flake)
  • dim-workflow workflow_flow fails with the recorded base failure (missing fixture); not re-debugged.

Two regressions found and fixed on the way: the forced shutdown reply raced the graceful request (now the coordinator joins admitted shutdown commands before deciding and reply writers wait for the settlement on their own tracker), and the idle refusal answered for process work before the connection/Session counts.

One allowlist deviation to review: ForeignMethods is deleted as a type, but the foreign register operation still needs one hand-written HostDispatch (MethodRegistration) because the generated service cannot pass a bridge function together with the call channel's cancel and progress callbacks. The entry was renamed, not removed, so the list is 44 instead of the 43 that deleting all five assigned entries would give. The other four entries (ReservedMethods::check_type, ProcessActivity::pause, ProcessActivity::take_hold, LocalIdDispatch) are gone.

@eric8810

eric8810 commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator Author

#2021 改了 processActivity 的决定:用 keep(work) 代替 hold / release 的 id(https://github.com/arcships/dim/issues/2021#issuecomment-7442146346)。请按迁移表改:

  • Agents 和 sessions 里手写的 release 全部换成 keep 包住的那一段;
  • unload_idle 目前在 future 被丢掉时会漏掉 release,换成 keep 后这个问题就不存在了;
  • 删掉 hold、release 和 foreign 表;
  • README 那句 "A lost owner or failed release leaves the process busy…" 一起删掉。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant