Repository navigation
Let runs on unreachable remote hosts be cancelled - #745
JoeZhang-0x000 wants to merge 1 commit into
Conversation
When an SSH, Slurm, or OpenResearch host dropped off the network, the supervisor retried forever: the run stayed "running", and a cancel stayed "cancelling" because it could never be delivered. - Once a requested cancel stays undelivered while the host is unreachable for 30s, the run is cancelled locally with a note that the remote job may still be running. The supervisor keeps delivering the real cancel for 30 minutes in case the host returns; platform boxes are still deleted. - Each supervisor round-trip to the host is bounded at 30s, so a dead multiplexed connection cannot stall the loop for ssh's ~90s keepalive. - The dashboard shows a live run whose monitoring is unavailable as "Unreachable" rather than "Running". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[Medium impact] The changes affect remote-run cancellation and status display for SSH and Slurm workflows. Fix host reachability checks and restart recovery for pending remote cancels before merging. FindingsFix with agent prompt### Issue 1
src/commands/supervise.rs:858-860
`observed.is_ok()` does not tell whether the SSH host is reachable. If Docker is down while its containers keep running, both inspection and cancellation return errors even though SSH works. After 30 seconds, this branch marks the run `cancelled` and stops watching it, removing the Stop action while the job still runs.
Distinguish connection failures from remote command failures before starting this clock. A reachable host that cannot complete cancellation should keep being retried.
### Issue 2
src/commands/supervise.rs:97-100
`deliver_late_cancel` loses all remaining retries if the supervisor exits after the local cancellation. The run is already `cancelled`, so `list_active_runs` excludes it, a restarted supervisor immediately exits, and the cancel API returns `alreadyTerminal`. A host that returns within the promised 30-minute window receives no cancel after a supervisor crash or laptop restart, leaving the remote job running.
Save the pending remote cancel and its deadline, and let recovery resume it independently of the local run status.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds local cancellation for unreachable SSH-backed and Slurm runs, bounded remote calls, and a 30-minute window for retrying the remote cancel.
Acknowledged scope:
|
| let cancel_owed = !cancel_sent && local_cancel_requested(store, run_id); | ||
| let give_up = undelivered.give_up(cancel_owed, observed.is_ok(), std::time::Instant::now()); | ||
| if let (true, Err(err)) = (give_up, &observed) { |
There was a problem hiding this comment.
Reachable jobs appear cancelled
observed.is_ok() does not tell whether the SSH host is reachable. If Docker is down while its containers keep running, both inspection and cancellation return errors even though SSH works. After 30 seconds, this branch marks the run cancelled and stops watching it, removing the Stop action while the job still runs.
Distinguish connection failures from remote command failures before starting this clock. A reachable host that cannot complete cancellation should keep being retried.
Knowledge Base Used: Remote jobs, hosts, and supervision
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/commands/supervise.rs
Line: 858-860
Comment:
**Reachable jobs appear cancelled**
`observed.is_ok()` does not tell whether the SSH host is reachable. If Docker is down while its containers keep running, both inspection and cancellation return errors even though SSH works. After 30 seconds, this branch marks the run `cancelled` and stops watching it, removing the Stop action while the job still runs.
Distinguish connection failures from remote command failures before starting this clock. A reachable host that cannot complete cancellation should keep being retried.
**Knowledge Base Used:** [Remote jobs, hosts, and supervision](https://app.greptile.com/alphaxiv/-/custom-context/knowledge-base/alphaxiv/openresearch/-/docs/remote-job-supervision.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| let deadline = std::time::Instant::now() + LATE_CANCEL_WINDOW; | ||
| while std::time::Instant::now() < deadline { | ||
| tokio::time::sleep(LATE_CANCEL_INTERVAL).await; | ||
| if attempt().await { |
There was a problem hiding this comment.
Cancel retries disappear after restart
deliver_late_cancel loses all remaining retries if the supervisor exits after the local cancellation. The run is already cancelled, so list_active_runs excludes it, a restarted supervisor immediately exits, and the cancel API returns alreadyTerminal. A host that returns within the promised 30-minute window receives no cancel after a supervisor crash or laptop restart, leaving the remote job running.
Save the pending remote cancel and its deadline, and let recovery resume it independently of the local run status.
Knowledge Base Used:
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/commands/supervise.rs
Line: 97-100
Comment:
**Cancel retries disappear after restart**
`deliver_late_cancel` loses all remaining retries if the supervisor exits after the local cancellation. The run is already `cancelled`, so `list_active_runs` excludes it, a restarted supervisor immediately exits, and the cancel API returns `alreadyTerminal`. A host that returns within the promised 30-minute window receives no cancel after a supervisor crash or laptop restart, leaving the remote job running.
Save the pending remote cancel and its deadline, and let recovery resume it independently of the local run status.
**Knowledge Base Used:**
- [Remote jobs, hosts, and supervision](https://app.greptile.com/alphaxiv/-/custom-context/knowledge-base/alphaxiv/openresearch/-/docs/remote-job-supervision.md)
- [Experiment rental lifecycle](https://app.greptile.com/alphaxiv/-/custom-context/knowledge-base/alphaxiv/openresearch/-/docs/experiment-rental-lifecycle.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.|
thanks for this, and for the clear write-up in #744. the in #862 a run on an unreachable host shows as unreachable instead of |
Closes #744
Summary
When an SSH, Slurm, or OpenResearch host drops off the network, the supervisor retried forever: the run stayed
running, and a cancel stayedcancellingbecause it could never be delivered.UNDELIVERED_CANCEL_GRACE), the run is markedcancelled. Its result notes that the remote job may still be running and where its run dir is. Existing result notes are kept, and the new note is appended.backend.monitoringErroris set now displays as Unreachable instead of Running (badge and lineage view). The Stop button is unchanged. The new label is translated in all 9 catalogs.A host that is reachable but refuses the cancel is still retried, never assumed stopped. An unreachable run is never ended unless someone asked to cancel it, so a long job survives a network blip.
Changed files:
src/commands/supervise.rs,ui/src/api.ts,ui/src/components/{StatusBadge,ExperimentLineage}.tsx,ui/src/components/experimentLineageModel.ts,ui/messages/*.json, regeneratedui/dist.Test plan
cargo fmt --all --check,cargo clippy --all-targets -- -D warnings,cargo test --locked(1179 unit tests plus integration tests, all passing)an_undelivered_cancel_gives_up_only_while_the_host_stays_unreachable,an_unreachable_cancel_ends_the_run_and_keeps_its_notespnpm build(includes typecheck), 394 UI unit tests;ui/distregenerated10.255.255.1. Cancel through the API ended one ascancelledin 59s. The other showed Unreachable in the dashboard, and pressing Stop ended it in 75s.cancelling. Restarting their supervisors with this build cancelled all 7 within ~70s.Notes for reviewers
/tmp/orx-ssh-<uid>-<hash>/<digest>.config) cached in memory. If macOS cleans that file out of/tmp, every ssh call then fails withCan't open user config file …, even though the host is reachable.🤖 Generated with Claude Code