Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
revert(runtimes): remove runtime delete functionality
Jiayuan87e76078ce02
diff --git a/apps/web/features/runtimes/components/runtime-detail.tsx b/apps/web/features/runtimes/components/runtime-detail.tsxindex 4e66f1cc5f..9c0919ac6e 100644--- a/apps/web/features/runtimes/components/runtime-detail.tsx+++ b/apps/web/features/runtimes/components/runtime-detail.tsx@@ -1,38 +1,10 @@-"use client";--import { useState } from "react";-import { Trash2 } from "lucide-react";import type { AgentRuntime } from "@/shared/types";-import { Button } from "@/components/ui/button";-import {- Dialog,- DialogContent,- DialogHeader,- DialogTitle,- DialogDescription,- DialogFooter,-} from "@/components/ui/dialog";import { formatLastSeen } from "../utils";-import { useRuntimeStore } from "../store";import { RuntimeModeIcon, StatusBadge, InfoField } from "./shared";import { PingSection } from "./ping-section";import { UsageSection } from "./usage-section";export function RuntimeDetail({ runtime }: { runtime: AgentRuntime }) {- const [showDelete, setShowDelete] = useState(false);- const [deleting, setDeleting] = useState(false);- const deleteRuntime = useRuntimeStore((s) => s.deleteRuntime);-- const handleDelete = async () => {- setDeleting(true);- try {- await deleteRuntime(runtime.id);- } finally {- setDeleting(false);- setShowDelete(false);- }- };-return (<div className="flex h-full flex-col">{/* Header */}@@ -49,17 +21,7 @@ export function RuntimeDetail({ runtime }: { runtime: AgentRuntime }) {<h2 className="text-sm font-semibold truncate">{runtime.name}</h2></div></div>- <div className="flex items-center gap-2">- <StatusBadge status={runtime.status} />- <Button- variant="ghost"- size="icon-xs"- onClick={() => setShowDelete(true)}- className="text-muted-foreground hover:text-destructive"- >- <Trash2 className="h-3.5 w-3.5" />- </Button>- </div>+ <StatusBadge status={runtime.status} /></div>{/* Content */}@@ -123,36 +85,6 @@ export function RuntimeDetail({ runtime }: { runtime: AgentRuntime }) {/></div></div>-- {/* Delete confirmation dialog */}- <Dialog open={showDelete} onOpenChange={setShowDelete}>- <DialogContent>- <DialogHeader>- <DialogTitle>Delete Runtime</DialogTitle>- <DialogDescription>- Are you sure you want to delete "{runtime.name}"? This- will remove the runtime and its usage data. This action cannot be- undone.- </DialogDescription>- </DialogHeader>- <DialogFooter>- <Button- variant="outline"- onClick={() => setShowDelete(false)}- disabled={deleting}- >- Cancel- </Button>- <Button- variant="destructive"- onClick={handleDelete}- disabled={deleting}- >- {deleting ? "Deleting..." : "Delete"}- </Button>- </DialogFooter>- </DialogContent>- </Dialog></div>);}diff --git a/apps/web/features/runtimes/store.ts b/apps/web/features/runtimes/store.tsindex 6256b30cb2..03e9f71664 100644--- a/apps/web/features/runtimes/store.ts+++ b/apps/web/features/runtimes/store.ts@@ -18,8 +18,6 @@ interface RuntimeActions {patchRuntime: (id: string, updates: Partial<AgentRuntime>) => void;/** Replace the full runtimes list (used on daemon:register events). */setRuntimes: (runtimes: AgentRuntime[]) => void;- /** Delete a runtime by ID (calls API). */- deleteRuntime: (id: string) => Promise<void>;}type RuntimeStore = RuntimeState & RuntimeActions;@@ -69,16 +67,4 @@ export const useRuntimeStore = create<RuntimeStore>((set, get) => ({: runtimes[0]?.id ?? "",});},-- deleteRuntime: async (id) => {- await api.deleteRuntime(id);- const remaining = get().runtimes.filter((r) => r.id !== id);- const { selectedId } = get();- set({- runtimes: remaining,- selectedId: selectedId === id- ? remaining[0]?.id ?? ""- : selectedId,- });- },}));diff --git a/apps/web/shared/api/client.ts b/apps/web/shared/api/client.tsindex 8f7a07f6a5..dbde31953e 100644--- a/apps/web/shared/api/client.ts+++ b/apps/web/shared/api/client.ts@@ -283,10 +283,6 @@ export class ApiClient {return this.fetch(`/api/runtimes/${runtimeId}/activity`);}- async deleteRuntime(runtimeId: string): Promise<void> {- await this.fetch(`/api/runtimes/${runtimeId}`, { method: "DELETE" });- }-async pingRuntime(runtimeId: string): Promise<RuntimePing> {return this.fetch(`/api/runtimes/${runtimeId}/ping`, { method: "POST" });}diff --git a/server/cmd/server/router.go b/server/cmd/server/router.goindex 956b55351a..dc488e83b7 100644--- a/server/cmd/server/router.go+++ b/server/cmd/server/router.go@@ -162,7 +162,6 @@ func NewRouter(pool *pgxpool.Pool, hub *realtime.Hub, bus *events.Bus) chi.Router.Route("/api/runtimes", func(r chi.Router) {r.Get("/", h.ListAgentRuntimes)- r.Delete("/{runtimeId}", h.DeleteAgentRuntime)r.Get("/{runtimeId}/usage", h.GetRuntimeUsage)r.Get("/{runtimeId}/activity", h.GetRuntimeTaskActivity)r.Post("/{runtimeId}/ping", h.InitiatePing)diff --git a/server/internal/handler/runtime.go b/server/internal/handler/runtime.goindex 40535e4584..bccf4051eb 100644--- a/server/internal/handler/runtime.go+++ b/server/internal/handler/runtime.go@@ -192,26 +192,6 @@ func (h *Handler) GetRuntimeTaskActivity(w http.ResponseWriter, r *http.Request)writeJSON(w, http.StatusOK, resp)}-func (h *Handler) DeleteAgentRuntime(w http.ResponseWriter, r *http.Request) {- runtimeID := chi.URLParam(r, "runtimeId")- workspaceID := resolveWorkspaceID(r)-- if _, ok := h.requireWorkspaceMember(w, r, workspaceID, "runtime not found"); !ok {- return- }-- err := h.Queries.DeleteAgentRuntime(r.Context(), db.DeleteAgentRuntimeParams{- ID: parseUUID(runtimeID),- WorkspaceID: parseUUID(workspaceID),- })- if err != nil {- writeError(w, http.StatusInternalServerError, "failed to delete runtime")- return- }-- w.WriteHeader(http.StatusNoContent)-}-func (h *Handler) ListAgentRuntimes(w http.ResponseWriter, r *http.Request) {workspaceID := resolveWorkspaceID(r)if _, ok := h.requireWorkspaceMember(w, r, workspaceID, "workspace not found"); !ok {diff --git a/server/pkg/db/generated/runtime.sql.go b/server/pkg/db/generated/runtime.sql.goindex d213607fac..d871d72dbd 100644--- a/server/pkg/db/generated/runtime.sql.go+++ b/server/pkg/db/generated/runtime.sql.go@@ -11,21 +11,6 @@ import ("github.com/jackc/pgx/v5/pgtype")-const deleteAgentRuntime = `-- name: DeleteAgentRuntime :exec-DELETE FROM agent_runtime-WHERE id = $1 AND workspace_id = $2-`--type DeleteAgentRuntimeParams struct {- ID pgtype.UUID `json:"id"`- WorkspaceID pgtype.UUID `json:"workspace_id"`-}--func (q *Queries) DeleteAgentRuntime(ctx context.Context, arg DeleteAgentRuntimeParams) error {- _, err := q.db.Exec(ctx, deleteAgentRuntime, arg.ID, arg.WorkspaceID)- return err-}-const getAgentRuntime = `-- name: GetAgentRuntime :oneSELECT id, workspace_id, daemon_id, name, runtime_mode, provider, status, device_info, metadata, last_seen_at, created_at, updated_at FROM agent_runtimeWHERE id = $1diff --git a/server/pkg/db/queries/runtime.sql b/server/pkg/db/queries/runtime.sqlindex 65e06f099d..6aabb65765 100644--- a/server/pkg/db/queries/runtime.sql+++ b/server/pkg/db/queries/runtime.sql@@ -51,7 +51,3 @@ SET status = 'offline', updated_at = now()WHERE status = 'online'AND last_seen_at < now() - make_interval(secs => @stale_seconds::double precision)RETURNING id, workspace_id;---- name: DeleteAgentRuntime :exec-DELETE FROM agent_runtime-WHERE id = $1 AND workspace_id = $2;