Carry organ contracts on worker launches

This commit is contained in:
Meta Vens 2026-05-27 16:13:05 +01:00
commit a4674df1b1
10 changed files with 280 additions and 17 deletions

View file

@ -13,6 +13,7 @@ use epiphany_core::EpiphanyRoleResultRoleId;
use epiphany_core::EpiphanyRoleWorkerLaunchDocument;
use epiphany_core::EpiphanyWorkerLaunchDocument;
use epiphany_core::build_reorient_job_launch_request;
use epiphany_core::default_launch_organ_contract;
use epiphany_state_model::EpiphanyInvestigationCheckpoint;
use epiphany_state_model::EpiphanyJobKind as CoreEpiphanyJobKind;
use epiphany_state_model::EpiphanyThreadState;
@ -442,6 +443,11 @@ pub fn build_epiphany_role_launch_request(
churn: state.churn.clone(),
});
let output_contract_id = launch_document.output_contract_id().to_string();
let organ_launch_contract = default_launch_organ_contract(
authority_scope,
launch_document.document_kind(),
&output_contract_id,
);
Ok(EpiphanyJobLaunchRequest {
expected_revision,
@ -455,6 +461,7 @@ pub fn build_epiphany_role_launch_request(
instruction,
launch_document,
output_contract_id,
organ_launch_contract,
max_runtime_seconds,
})
}
@ -517,6 +524,11 @@ pub fn build_epiphany_job_launch_request(
output_contract_id: String,
max_runtime_seconds: Option<u64>,
) -> EpiphanyJobLaunchRequest {
let organ_launch_contract = default_launch_organ_contract(
&authority_scope,
launch_document.document_kind(),
&output_contract_id,
);
EpiphanyJobLaunchRequest {
expected_revision,
binding_id,
@ -529,6 +541,7 @@ pub fn build_epiphany_job_launch_request(
instruction,
launch_document,
output_contract_id,
organ_launch_contract,
max_runtime_seconds,
}
}

View file

@ -221,6 +221,7 @@ pub async fn launch_epiphany_job_on_thread(
instruction: request.instruction.clone(),
launch_document: request.launch_document.clone(),
output_contract_id: request.output_contract_id.clone(),
organ_launch_contract: request.organ_launch_contract.clone(),
max_runtime_seconds: request.max_runtime_seconds,
runtime_job_id: backend_job_id.clone(),
},
@ -679,6 +680,7 @@ fn open_epiphany_runtime_spine_job(
instruction: request.instruction.clone(),
launch_document: request.launch_document.clone(),
output_contract_id: request.output_contract_id.clone(),
organ_launch_contract: request.organ_launch_contract.clone(),
created_at: now,
},
)