fix: dev pod state logic should prioritize actual pod status over replica spec
Some checks failed
Build & Release / build (push) Has been cancelled

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
ryan
2026-04-05 00:31:22 +00:00
parent 1d5e1fb470
commit 53fb8b3ae0

View File

@@ -29,11 +29,14 @@ export async function devpodRoutes(app: FastifyInstance) {
}));
// Determine overall state
const hasRunningPods = pods.some((p: any) => p.ready);
const hasFailedPods = pods.some((p: any) => p.status === "Failed");
let state: "stopped" | "running" | "starting" | "error";
if (replicas === 0) state = "stopped";
else if (readyReplicas > 0 && pods.some((p: any) => p.ready)) state = "running";
else if (pods.some((p: any) => p.status === "Failed")) state = "error";
else state = "starting";
if (hasRunningPods) state = "running";
else if (hasFailedPods) state = "error";
else if (replicas === 0 && pods.length === 0) state = "stopped";
else if (pods.length > 0) state = "starting";
else state = "stopped";
return reply.send({ state, replicas, readyReplicas, image, pods });
});