Cut model-turn display cargo
This commit is contained in:
parent
ab9cad4462
commit
dbb00c2bf9
5 changed files with 12 additions and 50 deletions
|
|
@ -228,7 +228,6 @@ pub use runtime_spine::RepoFrontierVerdictModelingLaunchAuthority;
|
|||
pub use runtime_spine::RuntimeSpineHeartbeatJobOptions;
|
||||
pub use runtime_spine::RuntimeSpineInitOptions;
|
||||
pub use runtime_spine::RuntimeSpineJobOptions;
|
||||
pub use runtime_spine::RuntimeSpineSessionClosureOptions;
|
||||
pub use runtime_spine::abandon_unactivated_runtime_worker_process;
|
||||
pub use runtime_spine::activate_runtime_worker_process;
|
||||
pub use runtime_spine::bind_runtime_repository_domain;
|
||||
|
|
|
|||
|
|
@ -612,11 +612,6 @@ pub struct RuntimeSpineInitOptions {
|
|||
pub created_at: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct RuntimeSpineSessionClosureOptions {
|
||||
pub session_id: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct ModelPassFailureTerminalOptions {
|
||||
pub decision_context_id: String,
|
||||
|
|
@ -883,28 +878,28 @@ pub fn bind_runtime_to_swarm(
|
|||
|
||||
pub fn close_runtime_session(
|
||||
store_path: impl AsRef<Path>,
|
||||
options: RuntimeSpineSessionClosureOptions,
|
||||
session_id: &str,
|
||||
) -> Result<EpiphanyRuntimeSession> {
|
||||
validate_non_empty(&options.session_id, "session id")?;
|
||||
if options.session_id == EPIPHANY_RUNTIME_ROOT_SESSION_ID {
|
||||
validate_non_empty(session_id, "session id")?;
|
||||
if session_id == EPIPHANY_RUNTIME_ROOT_SESSION_ID {
|
||||
return Err(anyhow!(
|
||||
"runtime root session {:?} is long-lived and cannot be generically completed",
|
||||
options.session_id
|
||||
session_id
|
||||
));
|
||||
}
|
||||
let mut cache = runtime_spine_cache(store_path.as_ref())?;
|
||||
cache.pull_all_backing_stores()?;
|
||||
require_identity(&cache)?;
|
||||
let mut session = cache
|
||||
.get::<EpiphanyRuntimeSession>(&options.session_id)?
|
||||
.ok_or_else(|| anyhow!("runtime session {:?} does not exist", options.session_id))?;
|
||||
.get::<EpiphanyRuntimeSession>(session_id)?
|
||||
.ok_or_else(|| anyhow!("runtime session {session_id:?} does not exist"))?;
|
||||
if session.status == EpiphanyRuntimeSessionStatus::Completed {
|
||||
return Ok(session);
|
||||
}
|
||||
let session_job_ids = cache
|
||||
.get_all::<EpiphanyRuntimeModelExecutionBinding>()?
|
||||
.into_iter()
|
||||
.filter(|binding| binding.session_id == options.session_id)
|
||||
.filter(|binding| binding.session_id == session_id)
|
||||
.map(|binding| binding.job_id)
|
||||
.collect::<BTreeSet<_>>();
|
||||
let open_job_ids = cache
|
||||
|
|
@ -919,7 +914,7 @@ pub fn close_runtime_session(
|
|||
if !open_job_ids.is_empty() {
|
||||
return Err(anyhow!(
|
||||
"runtime session {:?} has open jobs: {}",
|
||||
options.session_id,
|
||||
session_id,
|
||||
open_job_ids.join(", ")
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -595,12 +595,7 @@ async fn run_worker_launch(
|
|||
)
|
||||
}
|
||||
};
|
||||
epiphany_core::close_runtime_session(
|
||||
&options.store_path,
|
||||
epiphany_core::RuntimeSpineSessionClosureOptions {
|
||||
session_id: openai_options.session_id.clone(),
|
||||
},
|
||||
)?;
|
||||
epiphany_core::close_runtime_session(&options.store_path, &openai_options.session_id)?;
|
||||
|
||||
Ok(json!({
|
||||
"store": options.store_path,
|
||||
|
|
|
|||
|
|
@ -86,14 +86,8 @@ pub struct EpiphanyOpenAiRuntimeOptions {
|
|||
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct EpiphanyOpenAiRuntimeRunSummary {
|
||||
pub store: String,
|
||||
pub session_id: String,
|
||||
pub job_id: String,
|
||||
pub request_id: String,
|
||||
pub event_count: usize,
|
||||
pub verdict: String,
|
||||
pub summary: String,
|
||||
pub receipt_id: Option<String>,
|
||||
pub tool_intent_ids: Vec<String>,
|
||||
}
|
||||
|
||||
|
|
@ -204,14 +198,8 @@ pub fn record_model_turn_events(
|
|||
)?;
|
||||
|
||||
Ok(EpiphanyOpenAiRuntimeRunSummary {
|
||||
store: store_path.display().to_string(),
|
||||
session_id: options.session_id.clone(),
|
||||
job_id: options.job_id.clone(),
|
||||
request_id: provider_request.request_id,
|
||||
event_count: events.len(),
|
||||
verdict: verdict.to_string(),
|
||||
summary,
|
||||
receipt_id: receipt.map(|item| item.request_id),
|
||||
tool_intent_ids: tool_intents
|
||||
.into_iter()
|
||||
.map(|intent| intent.intent_id)
|
||||
|
|
@ -3053,14 +3041,8 @@ mod tests {
|
|||
let provider_failure_store = temp.path().join("provider-failure.cc");
|
||||
std::fs::copy(&store, &provider_failure_store)?;
|
||||
let provider_failure_summary = EpiphanyOpenAiRuntimeRunSummary {
|
||||
store: provider_failure_store.display().to_string(),
|
||||
session_id: "openai-worker-session-modeling-checkpoint-worker".to_string(),
|
||||
job_id: "openai-worker-worker-job-1".to_string(),
|
||||
request_id: model_request.request_id.clone(),
|
||||
event_count: 1,
|
||||
verdict: "failed".to_string(),
|
||||
summary: "Provider refused the model pass.".to_string(),
|
||||
receipt_id: None,
|
||||
tool_intent_ids: Vec::new(),
|
||||
};
|
||||
complete_worker_job_from_assistant_text(
|
||||
|
|
@ -3093,9 +3075,7 @@ mod tests {
|
|||
let contract_failure_store = temp.path().join("contract-failure.cc");
|
||||
std::fs::copy(&store, &contract_failure_store)?;
|
||||
let contract_failure_summary = EpiphanyOpenAiRuntimeRunSummary {
|
||||
store: contract_failure_store.display().to_string(),
|
||||
verdict: "pass".to_string(),
|
||||
receipt_id: Some(model_request.request_id.clone()),
|
||||
..provider_failure_summary.clone()
|
||||
};
|
||||
complete_worker_job_from_assistant_text(
|
||||
|
|
@ -3126,14 +3106,8 @@ mod tests {
|
|||
);
|
||||
|
||||
let openai_summary = EpiphanyOpenAiRuntimeRunSummary {
|
||||
store: store.display().to_string(),
|
||||
session_id: "openai-worker-session-modeling-checkpoint-worker".to_string(),
|
||||
job_id: "openai-worker-worker-job-1".to_string(),
|
||||
request_id: model_request.request_id.clone(),
|
||||
event_count: 2,
|
||||
verdict: "pass".to_string(),
|
||||
summary: "OpenAI model request completed.".to_string(),
|
||||
receipt_id: Some(model_request.request_id.clone()),
|
||||
tool_intent_ids: Vec::new(),
|
||||
};
|
||||
let assistant_text = serde_json::json!({
|
||||
|
|
|
|||
|
|
@ -10,9 +10,8 @@ use epiphany_core::{
|
|||
PERSONA_MODEL_STAGE_RECEIPT_SCHEMA_VERSION, PERSONA_MODEL_TERMINAL_RECEIPT_SCHEMA_VERSION,
|
||||
PersonaInterpreterEffectDocument, PersonaInterpreterInput, PersonaModelStageReceipt,
|
||||
PersonaModelTerminalReceipt, PersonaProjectorInput, PersonaTranscriptMessage, PersonaTurnInput,
|
||||
RuntimeSpineSessionClosureOptions, build_persona_interpreter_prompt,
|
||||
build_persona_projector_prompt_with_transcript, build_persona_turn_prompt,
|
||||
close_runtime_session, model_pass_failure_for_request,
|
||||
build_persona_interpreter_prompt, build_persona_projector_prompt_with_transcript,
|
||||
build_persona_turn_prompt, close_runtime_session, model_pass_failure_for_request,
|
||||
parse_and_validate_persona_interpreter_effect_set, persona_interpreter_effect_set_json_schema,
|
||||
runtime_spine_cache, terminalize_model_pass_failure_session,
|
||||
};
|
||||
|
|
@ -117,7 +116,7 @@ fn close_persona_session_if_active(
|
|||
session.status == epiphany_core::EpiphanyRuntimeSessionStatus::Active
|
||||
})
|
||||
{
|
||||
close_runtime_session(store_path, RuntimeSpineSessionClosureOptions { session_id })?;
|
||||
close_runtime_session(store_path, &session_id)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue