fix(phase_runner): re-mint pairing code on every launch
Pairing codes are single-use / expiring — a mission that reuses an existing runtime container on a retry needs a fresh code, not the stale one from the initial launch. Drop the runtime_endpoint gate so ensure_container always fires, and its fast path re-mints via /admin/paircode/new for existing containers.
This commit is contained in:
@@ -167,11 +167,10 @@ async fn launch_phase(
|
|||||||
// Provision the per-mission runtime container if not bound.
|
// Provision the per-mission runtime container if not bound.
|
||||||
// Idempotent — on_launch sets this on initial launch, but pre-C3
|
// Idempotent — on_launch sets this on initial launch, but pre-C3
|
||||||
// missions or retries against a torn-down container land here.
|
// missions or retries against a torn-down container land here.
|
||||||
let mission = cm_db::repo::missions::get(pool, mission_id, workspace_id)
|
// Always call ensure_container — the fast path re-mints a fresh
|
||||||
.await
|
// one-time pairing code even for existing containers. Old codes
|
||||||
.map_err(|e| format!("load mission for runtime binding: {e}"))?;
|
// expire / are single-use, so a launch that reuses a container
|
||||||
if let Some(m) = mission {
|
// still needs a fresh code for the topology_worker's next /pair.
|
||||||
if m.runtime_endpoint.is_none() {
|
|
||||||
if let Some(prov) = crate::mission_runtime::MissionRuntimeProvisioner::from_env() {
|
if let Some(prov) = crate::mission_runtime::MissionRuntimeProvisioner::from_env() {
|
||||||
match prov.ensure_container(mission_id).await {
|
match prov.ensure_container(mission_id).await {
|
||||||
Ok(ec) => {
|
Ok(ec) => {
|
||||||
@@ -186,7 +185,9 @@ async fn launch_phase(
|
|||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
eprintln!("phase_runner: bind runtime container for {mission_id} failed: {e}");
|
eprintln!(
|
||||||
|
"phase_runner: bind runtime container for {mission_id} failed: {e}"
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"phase_runner: runtime container {name} → {} (paired={}) for mission {mission_id}",
|
"phase_runner: runtime container {name} → {} (paired={}) for mission {mission_id}",
|
||||||
@@ -195,9 +196,9 @@ async fn launch_phase(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => eprintln!("phase_runner: provision runtime container for {mission_id} failed (continuing): {e}"),
|
Err(e) => eprintln!(
|
||||||
}
|
"phase_runner: provision runtime container for {mission_id} failed (continuing): {e}"
|
||||||
}
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user