fix(missions): give the uncapturable marker a real file

The marker registered an artifact at a path with nothing behind it, so any
reader following it would get a bare 404. `_outputs` survives teardown even
when the checkout does not, so the file can and should be written — and it
says plainly what happened rather than leaving an operator to infer it from
an empty response.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
Omar Sobh
2026-08-02 12:03:37 -07:00
co-authored by Claude Opus 5
parent e089360ac8
commit 3a383aede6
+11
View File
@@ -333,6 +333,17 @@ pub async fn record_uncapturable(
mission_id: Uuid,
phase_id: Uuid,
) -> Result<(), String> {
// Write a real file behind the artifact. `_outputs` survives teardown, so
// it is still writable even though the checkout is gone — and an artifact
// row pointing at a path with nothing behind it turns every reader into a
// 404 with no explanation.
let dir = outputs_root(mission_id).join(phase_id.to_string());
if std::fs::create_dir_all(&dir).is_ok() {
let _ = std::fs::write(
dir.join("diff.patch"),
"The mission checkout was removed before this phase's changes could be\n captured. Nothing was lost that had already been captured; this phase\n simply finished after its working tree had been reaped.\n",
);
}
let rel = format!("_outputs/{mission_id}/{phase_id}/diff.patch");
cm_db::repo::missions::register_artifact(
pool,