Hmbown/CodeWhale · error
tracked SSH Fleet worker
Error message
tracked SSH Fleet worker {worker_id} has no host adapter What it means
stop_worker looks up which host (local or SSH) a worker streams through; SSH-hosted workers must still be tracked in the matching SshHostAdapter in self.ssh_adapters. If the worker records an SSH key but no adapter is registered under that key, state is inconsistent and the stop request fails rather than leaking a running remote worker.
Solutions
- Re-register the SSH adapter under the key the worker is tracked with before stopping it.
- Inspect worker metadata to confirm the ssh key; if it is stale, clean up the worker record instead of calling stop_worker.
- Ensure worker registration always happens after its host adapter is added to ssh_adapters.
Example fix
// before: stop with missing adapter
manager.stop_worker("worker-7")?; // panics into error
// after: ensure adapter exists first
if !manager.has_ssh_adapter(&key) { manager.add_ssh_adapter(key.clone(), adapter)?; }
manager.stop_worker("worker-7")?; Defensive patterns
Strategy: validation
Validate before calling
fn ssh_adapter_tracked(manager: &FleetManager, worker_id: &str) -> bool {
manager
.worker_ssh_key(worker_id)
.map(|key| manager.has_ssh_adapter(&key))
.unwrap_or(true) // local-hosted workers are fine
} Try / catch
match manager.stop_worker(worker_id) {
Err(e) if e.to_string().contains("no host adapter") => {
log::warn!("SSH adapter for {worker_id} is gone; marking worker lost");
manager.mark_worker_lost(worker_id)?;
}
other => other?,
} Prevention
- Register a worker's SSH host adapter before (or atomically with) the worker itself.
- Tear down tracked workers when an SSH adapter disconnects, so state stays consistent.
- Clean up stale worker records pointing at removed adapters.
When it happens
Trigger: Calling `stop_worker(worker_id)` for a tracked worker whose WorkerStreamHost is Ssh(key) but where `self.ssh_adapters.get_mut(&key)` finds no adapter (adapter dropped, key renamed, or worker registered before its adapter).
Common situations: SSH adapter disconnected/reconnected under a different key while workers stayed tracked; a worker was registered with an ssh key never added to ssh_adapters; stale ledger state referencing a removed host adapter.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- scheduling Fleet run
- SSH Fleet workers do not yet support nested workspace.root…
- write-capable Fleet worker
- agent profile cannot be empty
- agent profile must be a simple token
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/c7e20f88c07062f7.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/fleet/executor.rs:873
.map(|stream| stream.started_at.elapsed())
}
/// Stop a tracked worker at the host boundary.
///
/// Operator controls run in a separate process from the foreground Fleet
/// manager, so they communicate cancellation through the durable ledger.
/// The manager calls this method after observing that terminal state; the
/// executor is the only owner that can reliably reach the live local/SSH
/// adapter handle.
pub fn stop_worker(&mut self, worker_id: &str) -> Result<()> {
let ssh_key = match self.streams.get(worker_id).map(|stream| &stream.host) {
Some(WorkerStreamHost::Local) => None,
Some(WorkerStreamHost::Ssh(key)) => Some(key.clone()),
None => return Ok(()),
};
if let Some(key) = ssh_key {
let adapter = self.ssh_adapters.get_mut(&key).ok_or_else(|| {
anyhow::anyhow!("tracked SSH Fleet worker {worker_id} has no host adapter")
})?;
adapter.stop_worker(worker_id)?;
} else {
self.adapter.stop_worker(worker_id)?;
}
Ok(())
}
/// Stop tracking a terminal worker so the scheduler can reuse the same
/// logical worker id for the next queued task.
pub fn forget_worker(&mut self, worker_id: &str) {
let Some(stream) = self.streams.remove(worker_id) else {
return;
};
match stream.host {
WorkerStreamHost::Local => {
let _ = self.adapter.cleanup_worker(worker_id);
}View on GitHub (pinned to 73e0f67d83)