fix(panel): treat the "active" agent state as up so Spawn is hidden while running

The agent card gated Spawn on [running, ready, starting, waiting_long], omitting the "active" state that the status badge renders as a first-class green state — so an agent shown as "active" still offered Spawn instead of View/Stop. Gate on the terminal/down states instead, so every up state (active, running, idle, paused, …) hides Spawn and shows View Details + Stop.
This commit is contained in:
Renn F
2026-06-21 09:41:08 +02:00
parent 61d6cde40f
commit 0a1aa3e7a5
+7 -1
View File
@@ -28,7 +28,13 @@ interface AgentCardProps {
export function AgentCard({ agent, agentStatus, usageRow }: AgentCardProps) {
const stopAgent = useStopAgent();
const state = agentStatus?.state || "stopped";
const isActive = ["running", "ready", "starting", "waiting_long"].includes(state);
// "Up" = anything that isn't a terminal/down state. Spawn is offered ONLY when
// the agent is down; an up agent (active / running / idle / paused / …) shows
// View Details + Stop instead. We list the DOWN states rather than the up ones
// so a new "up" state the backend adds defaults to non-spawnable — the safe
// side, since spawning an already-running agent is exactly the bug to avoid.
// (The badge renders "active" as a first-class state, so it MUST count as up.)
const isActive = !["stopped", "offline", "terminated", "error"].includes(state);
const handleStop = async (graceful: boolean) => {
try {