Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
772a115
Share SSH monitoring connections and persist host retry backoff
sox8502 Oct 22, 2026
ee67264
Fix explicit reconnect, growing logs, and long SSH setup
sox8502 Oct 22, 2026
97df5cd
Require idle SSH monitors before dev-slot data cleanup
sox8502 Oct 22, 2026
d2ee43a
Merge remote-tracking branch 'origin/main' into daniel/or-558-shared-ssh
sox8502 Oct 22, 2026
39cb2e4
Show SSH connection and run monitoring diagnostics
sox8502 Oct 22, 2026
aca6872
Preserve quoted SSH known-hosts filename lists
sox8502 Oct 22, 2026
b06a279
Merge remote-tracking branch 'origin/main' into daniel/or-558-shared-ssh
sox8502 Oct 22, 2026
6d046a0
Merge remote-tracking branch 'origin/main' into daniel/or-558-shared-ssh
sox8502 Oct 22, 2026
18157f6
Include shared SSH log files in run artifact cleanup
sox8502 Oct 22, 2026
575f8fa
Support Python 3.6 remote SSH helpers
sox8502 Oct 22, 2026
74d4901
Merge remote-tracking branch 'origin/main' into daniel/or-558-shared-ssh
sox8502 Oct 22, 2026
cc13526
Finish Slurm runs despite unavailable logs
sox8502 Oct 22, 2026
55af17d
Validate SSH log chunks during concurrent rewrites
sox8502 Oct 22, 2026
778114b
Merge origin/main and preserve shared SSH monitoring compatibility
sox8502 Oct 23, 2026
6025952
Detect full-prefix log rewrites and isolate legacy SSH monitors
sox8502 Oct 23, 2026
1e6c37d
Preserve whitespace in interactive SSH credentials
sox8502 Oct 23, 2026
21906b7
Reuse verified log digests and ignore unrelated obsolete SSH routes
sox8502 Oct 23, 2026
ca8fb01
Merge latest main and rebuild the reviewed dashboard
sox8502 Oct 23, 2026
99e8a39
Keep pinned SSH connections stable across unrelated config edits
sox8502 Oct 23, 2026
5cfb903
Merge current main and migrate saved SSH connection bindings
sox8502 Oct 23, 2026
cde56e5
Merge current main and isolate Slurm status read failures
sox8502 Oct 23, 2026
13b0bdf
Merge current main and close SSH retry and Slurm completion gaps
sox8502 Oct 23, 2026
6bee71f
Stream large SSH command input through bounded upload frames
sox8502 Oct 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Include shared SSH log files in run artifact cleanup
  • Loading branch information
sox8502 committed Oct 22, 2026
commit 18157f60140d3ce6ff1b5b1a4b7ba07e92b09994
84 changes: 82 additions & 2 deletions src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,13 @@ const ORPHAN_PASS_BUDGET: Duration = Duration::from_secs(5);
const SUBMISSION_HANDLE: (&str, &str) = ("submission-handles", ".json");
const SUPERVISOR_LOCK: (&str, &str) = ("run-logs", ".supervisor.lock");
/// Per-run files as (data-dir root, name suffix); the supervisor lock goes last so it excludes until the end.
const RUN_ARTIFACTS: [(&str, &str); 7] = [
const RUN_ARTIFACTS: [(&str, &str); 11] = [
("local-runs", ""),
("run-logs", ".log"),
("run-logs", ".cursor.json"),
("run-logs", ".pending.json"),
("run-logs", ".cursor.lock"),
("run-logs", ".supervisor.shared-ssh.lock"),
("run-logs", ".supervisor.log"),
("run-logs", ".supervisor.log.1"),
("run-logs", ".cancel.lock"),
Expand Down Expand Up @@ -1856,6 +1860,11 @@ impl Store {
}

fn remove_run_artifacts(&self, run_id: &str) -> Result<()> {
for entry in artifact_entries(&self.data_dir.join("run-logs"))? {
if entry.file_name().to_str().and_then(log_generation_run_id) == Some(run_id) {
remove_run_artifact(&entry.path())?;
}
}
for artifact in RUN_ARTIFACTS {
remove_run_artifact(&self.run_artifact_path(artifact, run_id))?;
}
Expand Down Expand Up @@ -1913,9 +1922,17 @@ impl Store {
for (root, suffix) in RUN_ARTIFACTS {
for entry in artifact_entries(&self.data_dir.join(root))? {
let name = entry.file_name();
let Some(id) = name.to_str().and_then(|name| name.strip_suffix(suffix)) else {
let Some(name) = name.to_str() else {
continue;
};
let Some(id) = name.strip_suffix(suffix) else {
continue;
};
let id = if root == "run-logs" && suffix == ".log" {
log_generation_run_id(name).unwrap_or(id)
} else {
id
};
if uuid::Uuid::parse_str(id).is_ok() && !retained_runs.contains(id) {
candidates.insert(id.to_string());
}
Expand Down Expand Up @@ -3801,6 +3818,12 @@ pub fn now_ms() -> i64 {
.unwrap_or(0)
}

fn log_generation_run_id(name: &str) -> Option<&str> {
let (run, generation) = name.strip_suffix(".log")?.split_once('.')?;
uuid::Uuid::parse_str(generation).ok()?;
Some(run)
}

fn artifact_entries(path: &Path) -> Result<Vec<std::fs::DirEntry>> {
match std::fs::read_dir(path) {
Ok(entries) => Ok(entries.collect::<std::io::Result<Vec<_>>>()?),
Expand Down Expand Up @@ -3989,6 +4012,63 @@ mod tests {
std::fs::remove_dir_all(dir).unwrap();
}

#[test]
fn shared_ssh_log_cleanup_preserves_retained_runs_and_removes_deleted_generations() {
let dir =
std::env::temp_dir().join(format!("orx-ssh-log-cleanup-{}", uuid::Uuid::new_v4()));
let store = Store::open_at(dir.clone()).unwrap();
let deleted = uuid::Uuid::new_v4().to_string();
let retained = uuid::Uuid::new_v4().to_string();
project_with_run_artifacts(&store, "deleted", &deleted, &"a".repeat(64));
project_with_run_artifacts(&store, "retained", &retained, &"b".repeat(64));
let suffixes = [
"cursor.json".to_string(),
"pending.json".to_string(),
"cursor.lock".to_string(),
"supervisor.shared-ssh.lock".to_string(),
format!("{}.log", uuid::Uuid::new_v4()),
format!("{}.log", uuid::Uuid::new_v4()),
];
for run in [&deleted, &retained] {
for suffix in &suffixes {
std::fs::write(dir.join("run-logs").join(format!("{run}.{suffix}")), "log")
.unwrap();
}
}
let orphan = dir.join("run-logs").join(format!(
"{}.{}.log",
uuid::Uuid::new_v4(),
uuid::Uuid::new_v4()
));
std::fs::write(&orphan, "interrupted generation").unwrap();
let unrelated = dir.join("run-logs").join(format!("{deleted}.notes.log"));
std::fs::write(&unrelated, "unrecognized file").unwrap();
store.cleanup_orphaned_run_artifacts().unwrap();
assert!(!orphan.exists());
for run in [&deleted, &retained] {
for suffix in &suffixes {
assert!(dir
.join("run-logs")
.join(format!("{run}.{suffix}"))
.is_file());
}
}
store.delete_local_project("deleted").unwrap();
for suffix in &suffixes {
assert!(!dir
.join("run-logs")
.join(format!("{deleted}.{suffix}"))
.exists());
assert!(dir
.join("run-logs")
.join(format!("{retained}.{suffix}"))
.is_file());
}
assert!(unrelated.is_file());
drop(store);
std::fs::remove_dir_all(dir).unwrap();
}

#[test]
fn orphan_cleanup_skips_malformed_rows_and_keeps_every_snapshot() {
let dir = std::env::temp_dir().join(format!("orx-malformed-{}", uuid::Uuid::new_v4()));
Expand Down