Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): runtime update status stuck on "Updating..." until page refresh

Gener58b856d443ef
diff --git a/src/web/src/app/(app)/w/[slug]/runtimes/page.tsx b/src/web/src/app/(app)/w/[slug]/runtimes/page.tsx
index d7c79f695..7dee10855 100644
--- a/src/web/src/app/(app)/w/[slug]/runtimes/page.tsx
+++ b/src/web/src/app/(app)/w/[slug]/runtimes/page.tsx
@@ -226,6 +226,21 @@ export default function RuntimesPage() {
}
};
+ // Clear updatingDaemons when runtimes reload shows update completed
+ useEffect(() => {
+ if (updatingDaemons.size === 0) return;
+ const stillUpdating = new Set<string>();
+ for (const rt of runtimes) {
+ const key = rt.daemon_id || rt.id;
+ if (updatingDaemons.has(key) && rt.pending_update_version) {
+ stillUpdating.add(key);
+ }
+ }
+ if (stillUpdating.size < updatingDaemons.size) {
+ setUpdatingDaemons(stillUpdating);
+ }
+ }, [runtimes]); // eslint-disable-line react-hooks/exhaustive-deps
+
// Group runtimes by machine
const machines = new Map<
string,
diff --git a/src/web/src/app/api/daemon/tasks/poll/route.ts b/src/web/src/app/api/daemon/tasks/poll/route.ts
index e1695450c..8de6ba6c9 100644
--- a/src/web/src/app/api/daemon/tasks/poll/route.ts
+++ b/src/web/src/app/api/daemon/tasks/poll/route.ts
@@ -101,6 +101,12 @@ export const POST = withAuth(async (req: NextRequest, ctx) => {
if (machineRow?.pendingUpdateVersion && body.cli_version) {
if (semverGte(body.cli_version, machineRow.pendingUpdateVersion)) {
await queries.machine.clearPendingUpdateVersion(db, body.daemon_id);
+ broadcastToUser(ctx.userId, {
+ type: "runtime.status",
+ daemonId: body.daemon_id,
+ workspaceId: ctx.workspaceId,
+ status: "online",
+ }).catch(() => {});
} else {
pendingUpdate = { version: machineRow.pendingUpdateVersion };
}