Go-live runtime sync and control plane hardening (#1)

* Implement Mika runtime sync and go-live controls

* Add CI validation workflow

* Align CI with validated runtime checks

* Fix Mika CI install workflow
This commit is contained in:
Felipe Domingues 2026-04-30 20:41:06 -03:00 committed by GitHub
parent cb54fa4666
commit d87ea2657c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 4019 additions and 95 deletions

View file

@ -23,6 +23,7 @@ import {
useUpdateCronjobStatus,
} from "@/hooks/use-cronjobs";
import { useAvailableMcps, useUserIntegrations } from "@/hooks/use-integrations";
import { syncAgentRuntime } from "@/lib/sync-agent-runtime";
interface Props {
job: ScheduledJob;
@ -45,6 +46,8 @@ export function CronjobCard({ job }: Props) {
const isActive = job.status === "active";
const isAutoPaused = job.status === "auto_paused";
const hasRuntimeError = job.runtime_state === "error" || job.runtime_last_status === "error";
const runtimeErrorText = job.runtime_last_delivery_error ?? job.runtime_last_error;
async function toggle() {
try {
@ -53,6 +56,11 @@ export function CronjobCard({ job }: Props) {
status: isActive ? "paused" : "active",
});
toast.success(isActive ? "Automação pausada." : "Automação ativada.");
const { error: syncError } = await syncAgentRuntime(job.agent_instance_id, "cronjobs");
if (syncError) {
toast.warning("Status salvo, mas o runtime do agente não sincronizou.");
}
} catch (e) {
toast.error(e instanceof Error ? e.message : "Erro ao atualizar.");
}
@ -63,6 +71,11 @@ export function CronjobCard({ job }: Props) {
await deleteMut.mutateAsync(job.id);
toast.success("Automação excluída.");
setConfirmDelete(false);
const { error: syncError } = await syncAgentRuntime(job.agent_instance_id, "cronjobs");
if (syncError) {
toast.warning("Automação removida, mas o runtime do agente não sincronizou.");
}
} catch (e) {
toast.error(e instanceof Error ? e.message : "Erro ao excluir.");
}
@ -76,11 +89,15 @@ export function CronjobCard({ job }: Props) {
<h3 className="font-semibold truncate">{job.name}</h3>
{isActive && <Badge variant="success">Ativa</Badge>}
{job.status === "paused" && <Badge variant="secondary">Pausada</Badge>}
{job.status === "error" && <Badge variant="destructive">Erro</Badge>}
{isAutoPaused && (
<Badge variant="destructive" className="gap-1">
<AlertTriangle className="h-3 w-3" /> Auto-pausada
</Badge>
)}
{hasRuntimeError && !isAutoPaused && (
<Badge variant="destructive">Runtime com erro</Badge>
)}
</div>
<p className="text-sm text-muted-foreground mt-1 line-clamp-2">
{job.human_readable}
@ -92,6 +109,10 @@ export function CronjobCard({ job }: Props) {
<p className="text-xs text-destructive">{job.auto_paused_reason}</p>
)}
{hasRuntimeError && runtimeErrorText && (
<p className="text-xs text-destructive">{runtimeErrorText}</p>
)}
{missingMcps.length > 0 && isActive && (
<div className="rounded-md border border-amber-500/40 bg-amber-500/10 p-2 text-xs">
<span className="text-amber-700 dark:text-amber-400 font-medium">