missions: topology_worker dials per-mission runtime endpoint (C3 slice 3)
ci / gates (push) Successful in 6s
ci / frontend (push) Successful in 28s
ci / rust (push) Failing after 1m23s
ci / e2e (push) Skipped
ci / publish (push) Skipped

When a topology_run is bound to a mission whose runtime_endpoint is
set, the worker constructs ZeroClawDriveExecutor against that URL
instead of the env-derived shared gateway. Falls back to shared for
non-mission runs and pre-C3 missions.

With slices 1-3 combined, a mission launched after this deploy will:
  1. get its per-mission container spawned during on_launch
  2. have its checkout dropped into /var/lib/clawmates-missions/<id>
     which is bind-mounted to /mission inside that container
  3. run its agents against ZEROCLAW_WORKSPACE=/mission/repo — so
     they can see and edit only this missions repo, no bleed-over.
This commit is contained in:
Omar Sobh
2026-07-21 22:31:42 -07:00
parent 7649b213ad
commit 82966a8004
2 changed files with 23 additions and 12 deletions
+20 -5
View File
@@ -148,11 +148,26 @@ async fn run_job(
.and_then(|c| serde_json::from_value(c).ok())
.unwrap_or_default();
// Missions-era runs drive through the shared, env-derived ZeroClaw
// gateway — per-claw provisioning happens ahead of time via
// `RuntimeProvisioner` (see `mission_orchestrator::on_launch`), so
// there's no per-run container/gateway resolution left to do here.
let leaf_result = ZeroClawDriveExecutor::from_env();
// C3: prefer the mission's per-run runtime endpoint when set on
// the missions row; else fall back to the shared env-derived
// gateway (pre-C3 missions + non-mission runs). This is what
// isolates agents' workspace filesystem to that mission's repo.
let mission_endpoint: Option<String> = sqlx::query_scalar::<_, Option<String>>(
"SELECT m.runtime_endpoint
FROM topology_runs r
JOIN missions m ON m.id = r.mission_id
WHERE r.id = $1",
)
.bind(id)
.fetch_optional(pool)
.await
.ok()
.flatten()
.flatten();
let leaf_result = match mission_endpoint {
Some(url) => ZeroClawDriveExecutor::from_env_for_gateway(url),
None => ZeroClawDriveExecutor::from_env(),
};
let leaf = match leaf_result {
Ok(e) => e,
Err(e) => {