feat(core): Sweep interrupted Instance AI runs to a terminal state (no-changelog) (#34183)

Co-authored-by: Danny Martini <danny@n8n.io>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Raúl Gómez Morales
2026-07-16 12:37:28 +02:00
committed by GitHub
parent a844d0336e
commit 865142f5da
23 changed files with 659 additions and 4 deletions
+2 -1
View File
@@ -62,7 +62,7 @@ Auto-generated from the PostgreSQL migrations in @n8n/db. Do not edit by hand.
| [public.insights_raw](public.insights_raw.md) | 5 | | BASE TABLE |
| [public.installed_nodes](public.installed_nodes.md) | 4 | | BASE TABLE |
| [public.installed_packages](public.installed_packages.md) | 6 | | BASE TABLE |
| [public.instance_ai_checkpoints](public.instance_ai_checkpoints.md) | 8 | | BASE TABLE |
| [public.instance_ai_checkpoints](public.instance_ai_checkpoints.md) | 9 | | BASE TABLE |
| [public.instance_ai_events](public.instance_ai_events.md) | 7 | | BASE TABLE |
| [public.instance_ai_iteration_logs](public.instance_ai_iteration_logs.md) | 6 | | BASE TABLE |
| [public.instance_ai_mcp_registry_connections](public.instance_ai_mcp_registry_connections.md) | 7 | | BASE TABLE |
@@ -819,6 +819,7 @@ erDiagram
"public.instance_ai_checkpoints" {
timestamp_3__with_time_zone createdAt
timestamp_3__with_time_zone expiredAt
varchar_64_ hostRunId
varchar_255_ key
varchar_255_ resourceId
varchar_255_ runId
@@ -6,6 +6,7 @@
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| createdAt | timestamp(3) with time zone | CURRENT_TIMESTAMP(3) | false | | | |
| expiredAt | timestamp(3) with time zone | | true | | | Soft-delete timestamp: null means live; non-null marks the row as a tombstone. |
| hostRunId | varchar(64) | | true | | | Host (Instance AI) run id; distinct from the agent-SDK runId parsed from the checkpoint key. |
| key | varchar(255) | | false | [public.instance_ai_pending_confirmations](public.instance_ai_pending_confirmations.md) | | Opaque checkpoint key from the agent runtime. |
| resourceId | varchar(255) | | true | | | Resource ID recorded by the agent runtime. |
| runId | varchar(255) | | true | | | Run ID parsed from the checkpoint key when available. |
@@ -45,6 +46,7 @@ erDiagram
"public.instance_ai_checkpoints" {
timestamp_3__with_time_zone createdAt
timestamp_3__with_time_zone expiredAt
varchar_64_ hostRunId
varchar_255_ key
varchar_255_ resourceId
varchar_255_ runId
@@ -70,6 +70,7 @@ erDiagram
"public.instance_ai_checkpoints" {
timestamp_3__with_time_zone createdAt
timestamp_3__with_time_zone expiredAt
varchar_64_ hostRunId
varchar_255_ key
varchar_255_ resourceId
varchar_255_ runId
@@ -70,6 +70,7 @@ erDiagram
"public.instance_ai_checkpoints" {
timestamp_3__with_time_zone createdAt
timestamp_3__with_time_zone expiredAt
varchar_64_ hostRunId
varchar_255_ key
varchar_255_ resourceId
varchar_255_ runId
+2 -1
View File
@@ -62,7 +62,7 @@ Auto-generated from the SQLite migrations in @n8n/db. Do not edit by hand.
| [insights_raw](insights_raw.md) | 5 | | table |
| [installed_nodes](installed_nodes.md) | 4 | | table |
| [installed_packages](installed_packages.md) | 6 | | table |
| [instance_ai_checkpoints](instance_ai_checkpoints.md) | 8 | | table |
| [instance_ai_checkpoints](instance_ai_checkpoints.md) | 9 | | table |
| [instance_ai_events](instance_ai_events.md) | 7 | | table |
| [instance_ai_iteration_logs](instance_ai_iteration_logs.md) | 6 | | table |
| [instance_ai_mcp_registry_connections](instance_ai_mcp_registry_connections.md) | 7 | | table |
@@ -806,6 +806,7 @@ erDiagram
"instance_ai_checkpoints" {
datetime_3_ createdAt
datetime_3_ expiredAt
VARCHAR_64_ hostRunId
varchar_255_ key PK
varchar_255_ resourceId
varchar_255_ runId
@@ -6,7 +6,7 @@
<summary><strong>Table Definition</strong></summary>
```sql
CREATE TABLE "instance_ai_checkpoints" ("key" varchar(255) PRIMARY KEY NOT NULL, "runId" varchar(255), "threadId" varchar NOT NULL, "resourceId" varchar(255), "state" text, "createdAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), "updatedAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), "expiredAt" datetime(3), CONSTRAINT "instance_ai_checkpoints_state_tombstone_check" CHECK (("expiredAt" IS NOT NULL AND "state" IS NULL) OR "expiredAt" IS NULL), CONSTRAINT "FK_2b23f3f24a70bebb990203b011e" FOREIGN KEY ("threadId") REFERENCES "instance_ai_threads" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)
CREATE TABLE "instance_ai_checkpoints" ("key" varchar(255) PRIMARY KEY NOT NULL, "runId" varchar(255), "threadId" varchar NOT NULL, "resourceId" varchar(255), "state" text, "createdAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), "updatedAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), "expiredAt" datetime(3), "hostRunId" VARCHAR(64), CONSTRAINT "instance_ai_checkpoints_state_tombstone_check" CHECK (("expiredAt" IS NOT NULL AND "state" IS NULL) OR "expiredAt" IS NULL), CONSTRAINT "FK_2b23f3f24a70bebb990203b011e" FOREIGN KEY ("threadId") REFERENCES "instance_ai_threads" ("id") ON DELETE CASCADE ON UPDATE NO ACTION)
```
</details>
@@ -17,6 +17,7 @@ CREATE TABLE "instance_ai_checkpoints" ("key" varchar(255) PRIMARY KEY NOT NULL,
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| createdAt | datetime(3) | STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW') | false | | | |
| expiredAt | datetime(3) | | true | | | |
| hostRunId | VARCHAR(64) | | true | | | |
| key | varchar(255) | | false | [instance_ai_pending_confirmations](instance_ai_pending_confirmations.md) | | |
| resourceId | varchar(255) | | true | | | |
| runId | varchar(255) | | true | | | |
@@ -53,6 +54,7 @@ erDiagram
"instance_ai_checkpoints" {
datetime_3_ createdAt
datetime_3_ expiredAt
VARCHAR_64_ hostRunId
varchar_255_ key PK
varchar_255_ resourceId
varchar_255_ runId
@@ -75,6 +75,7 @@ erDiagram
"instance_ai_checkpoints" {
datetime_3_ createdAt
datetime_3_ expiredAt
VARCHAR_64_ hostRunId
varchar_255_ key PK
varchar_255_ resourceId
varchar_255_ runId
@@ -76,6 +76,7 @@ erDiagram
"instance_ai_checkpoints" {
datetime_3_ createdAt
datetime_3_ expiredAt
VARCHAR_64_ hostRunId
varchar_255_ key PK
varchar_255_ resourceId
varchar_255_ runId