fix: provide subworker control service

This commit is contained in:
2026-08-26 10:16:10 +09:00
parent 260259d461
commit eac07cf5a8
2 changed files with 59 additions and 0 deletions
+8
View File
@@ -975,6 +975,14 @@ where
if feature_config.sub_worker.enabled {
worker.register_worker_orchestration_instruction();
if !feature_config.worker.enabled {
feature_registry.add_module(
crate::feature::builtin::manage_worker::sub_worker_control_feature(
worker.workspace_client_handle(),
spawned_registry.clone(),
),
);
}
}
let host_worker_observation_provider = worker.worker_observation_provider();
@@ -356,6 +356,57 @@ pub fn manage_worker_feature(
}
}
#[derive(Clone)]
pub struct SubWorkerControlFeature {
control: Arc<dyn WorkerControlService>,
}
impl std::fmt::Debug for SubWorkerControlFeature {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter
.debug_struct("SubWorkerControlFeature")
.finish_non_exhaustive()
}
}
pub fn sub_worker_control_feature(
client: Arc<dyn WorkspaceClient>,
registry: Arc<SpawnedWorkerRegistry>,
) -> SubWorkerControlFeature {
let workspace_id = client.workspace_id().unwrap_or_default().to_string();
SubWorkerControlFeature {
control: Arc::new(WorkspaceWorkerControlService {
client,
workspace_id,
registry: Some(registry),
}),
}
}
impl FeatureModule for SubWorkerControlFeature {
fn descriptor(&self) -> FeatureDescriptor {
FeatureDescriptor::builtin("sub_worker", "SubWorker")
.with_description("Parent-owned SubWorker control authority.")
.with_provided_service(ServiceDeclaration::new(
ServiceId::builtin(WORKER_CONTROL_SERVICE_ID),
WORKER_LIFECYCLE_SERVICE_VERSION,
"Known-SubWorker discovery and permission-fenced control operations",
))
}
fn install(&self, context: &mut FeatureInstallContext<'_>) -> Result<(), FeatureInstallError> {
context.services().provide(
ServiceDeclaration::new(
ServiceId::builtin(WORKER_CONTROL_SERVICE_ID),
WORKER_LIFECYCLE_SERVICE_VERSION,
"Known-SubWorker discovery and permission-fenced control operations",
),
self.control.clone(),
)?;
Ok(())
}
}
impl FeatureModule for ManageWorkerFeature {
fn descriptor(&self) -> FeatureDescriptor {
let mut descriptor = FeatureDescriptor::builtin(FEATURE_ID, FEATURE_NAME)