Fix zombie agent detection and surface stopped agent cleanup (#380)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Wes
2026-04-21 15:56:00 -06:00
committed by GitHub
parent 4079e483a4
commit 3df7e7107f
5 changed files with 27 additions and 16 deletions

View File

@@ -129,11 +129,8 @@ pub fn validate_imeta_tags(tags: &[Vec<String>], media_base_url: &str) -> Result
return Err("imeta duration must be a valid float".into());
}
}
"bitrate" => {
// NIP-71 standard field: bits/sec as integer, positive
if value.parse::<u64>().map_or(true, |b| b == 0) {
return Err("imeta bitrate must be a positive integer".into());
}
"bitrate" if value.parse::<u64>().map_or(true, |b| b == 0) => {
return Err("imeta bitrate must be a positive integer".into());
}
"image" => {
// NIP-71 poster frame — must be a local media URL with an image extension.

View File

@@ -703,15 +703,11 @@ fn validate_diff_event(event: &Event) -> Result<(), String> {
return Err("parent-commit SHA must be at least 7 hex characters".to_string());
}
}
"branch" => {
if parts.len() < 3 || parts[1].is_empty() || parts[2].is_empty() {
return Err("branch tag requires both source and target".to_string());
}
"branch" if (parts.len() < 3 || parts[1].is_empty() || parts[2].is_empty()) => {
return Err("branch tag requires both source and target".to_string());
}
"pr" => {
if parts[1].parse::<u32>().map(|n| n == 0).unwrap_or(true) {
return Err("pr number must be a positive integer".to_string());
}
"pr" if parts[1].parse::<u32>().map(|n| n == 0).unwrap_or(true) => {
return Err("pr number must be a positive integer".to_string());
}
_ => {}
}

View File

@@ -321,7 +321,7 @@ pub fn sync_managed_agent_processes(
continue;
};
if process_is_running(pid) {
if process_is_running(pid) && process_belongs_to_us(pid) {
continue;
}
@@ -601,7 +601,7 @@ pub fn start_managed_agent_process(
}
if let Some(pid) = record.runtime_pid {
if process_is_running(pid) {
if process_is_running(pid) && process_belongs_to_us(pid) {
record.updated_at = now_iso();
record.last_error = None;
return Ok(());

View File

@@ -186,6 +186,24 @@ export function ManagedAgentsSection({
</div>
) : null}
{!isLoading && stoppedCount > 0 ? (
<div className="flex items-center justify-between rounded-xl border border-border/60 bg-muted/30 px-4 py-2.5">
<p className="text-sm text-muted-foreground">
{stoppedCount} stopped {stoppedCount === 1 ? "agent" : "agents"}
</p>
<Button
className="text-destructive"
disabled={isActionPending}
onClick={onBulkRemoveStopped}
size="sm"
variant="ghost"
>
<Trash2 className="mr-1.5 h-3.5 w-3.5" />
Remove stopped
</Button>
</div>
) : null}
{error ? (
<p className="rounded-2xl border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive">
{error.message}

View File

@@ -1,3 +1,3 @@
[toolchain]
channel = "stable"
channel = "1.95.0"
profile = "default"