Commit Graph

7521 Commits

Author SHA1 Message Date
Robin Braumann
dcf535a1c6
feat(core): Handle a busy agent session on each surface (no-changelog)
Each starter now reacts to a busy session in its own way:

- An integration message gets a busy notice. The bridge deletes its
  stored attachments and does not run the message.
- An integration button resume waits for the session for 5 seconds.
  Then it posts "This action has already been handled". A Preview
  resume waits the same time and then gets `turn_already_running`.
- A workflow-tool resume tries again with a backoff from 1 s to 30 s.
  It stops when the run is no longer suspended.
- A background wake skips without a failure count. The turn that holds
  the session requests a new wake when it settles.
- A busy sub-agent resume is retryable, so the parent stays suspended.

The session lease replaces the in-process HITL guard and the running
check of the wake, so this removes both and `existsRunningByThread`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 12:26:12 +02:00
Robin Braumann
9bf56b68c8
feat(core): Wait for the session before a resume starts (no-changelog)
A turn can now wait a short time while another turn holds the session.
Callers set the wait with sessionWaitMs; the default is no wait.

Before each start attempt, a resume checks that its checkpoint is still
suspended. A resume that another resume already handled gets
AgentResumeAlreadyHandledError and records nothing.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 12:08:54 +02:00
Robin Braumann
9df57538bd
feat(core): Admit Preview turns with the session lease (no-changelog)
Remove the Preview admission lock and its running-execution check. The
session lease now admits Preview turns like all other turns, so the
automatic Preview continuation no longer needs its own admission path.

Stop no longer takes a lock. When a stopped turn suspended, settle
cancels the suspension while the turn still holds the lease, then
finalizes. The checkpoint compare-and-set decides between a cancel and a
resume.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 12:01:16 +02:00
Robin Braumann
b6f2869f06
feat(core): Take the session lease when an agent turn starts (no-changelog)
Take the session lease in the transaction that records the running
execution. All four start paths use this point: chat turns, failed starts,
foreground sub-agents, and workflow agents. A turn on a busy session gets
AgentTurnAlreadyRunningError and nothing is recorded.

The execution heartbeat renews the lease. Finalization releases it. When
a start takes over an expired lease, it marks the previous execution as
interrupted. The lease signal is combined with the abort signal of the
turn, so a lost lease stops the run.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 11:56:42 +02:00
Robin Braumann
06ceed90e4
feat(core): Add agent session lease service (no-changelog)
Add the repository and service that take, renew, and release the lease
of an agent session. The lease uses the database clock. A lease that is
not renewed can be taken over by another main after two minutes.

The service keeps a registry of the leases that this main holds. It
aborts the local turn after two failed renewals, and it refuses a session
while an older local turn on that session is still settling.

Move AgentTurnAlreadyRunningError to its own file, so the lease can
throw it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 11:56:34 +02:00
Robin Braumann
04805d2203
feat(core): Add agent session lease table (no-changelog)
Add the agent_session_lease table with one row for each agent session.
A turn will take the lease in the transaction that records its execution,
so that only one turn runs on a session at a time.

The row keeps its epoch after release and after session deletion, so the
epoch of a thread ID only increases.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 11:56:07 +02:00
Robin Braumann
6fa50f6495
fix(core): Keep agent chat session pointer across restarts (no-changelog)
Store the active session of an integration conversation in the database
instead of the cache. The default cache is in memory. A restart sent each
conversation that used /new or an idle timeout back to its first session.

The pointer is a key in the metadata of the agents_resources row for the
base thread ID. Session deletion does not remove that row.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 10:57:00 +02:00
Robin Braumann
75cb1b32f1
refactor(core): Split agent chat bridge inbound handling (no-changelog) 2026-09-23 10:30:30 +02:00
Robin Braumann
d56ea96651
refactor(core): Share agent service types (no-changelog) 2026-09-23 10:24:47 +02:00
Robin Braumann
dbf56c723d
refactor(core): Reuse agent lookup in task controller (no-changelog) 2026-09-22 21:48:02 +02:00
Robin Braumann
cd1cacbe54
refactor(core): Share agent service helpers (no-changelog) 2026-09-22 21:24:53 +02:00
Robin Braumann
73a2ed95ed
Merge reattach-chat-owner-on-reload into cleanup-agent-services 2026-09-22 21:24:43 +02:00
Robin Braumann
978d48d89d
refactor(core): Simplify agent service functions (no-changelog) 2026-09-22 21:00:12 +02:00
Robin Braumann
f5454976d8
fix: serialize automatic preview continuation admission 2026-09-22 19:47:09 +02:00
Robin Braumann
b048286161
Merge remote-tracking branch 'origin/master' into reattach-chat-owner-on-reload
# Conflicts:
#	packages/cli/src/modules/agents/agent-execution-orchestrator.service.ts
#	packages/frontend/editor-ui/src/features/agents/composables/useAgentChatStream.ts
2026-09-22 19:42:11 +02:00
Kai
8012f017bc
feat(API): Create projects with source IDs and package metadata (#39218) 2026-09-22 16:41:52 +00:00
ocdejong
5131af5ab7
feat(core): Report crashed executions to OTel through an execution-crashed event (#38853)
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-22 15:36:32 +00:00
Robin Braumann
5ed678ae54
fix(core): Make agent session admission atomic (no-changelog) (#39307) 2026-09-22 15:22:16 +00:00
Uddish Verma
86a8ffe96a
refactor(API): Migrate GET and POST /workflows/{workflowId}/test-runs to the decorator pattern (no-changelog) (#39163)
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-22 15:14:03 +00:00
Robin Braumann
22abba87c8
fix: address preview chat recovery races 2026-09-22 17:13:08 +02:00
Pierantonio Cangianiello
4f680fdfcb
refactor(core): Extract the webhook Buffer body codec into n8n-core (no-changelog) (#39301)
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-22 15:09:39 +00:00
Anne Aguirre
d9f65684f8
feat(ai-builder): Add approval settings for agent channel actions (#39059) 2026-09-22 15:06:36 +00:00
Jaakko Husso
dec7c712c7
fix(core): Gate the AI Assistant project list on the team-projects license (#39235)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-22 14:51:46 +00:00
Guillaume Jacquart
36688eface
feat(core): Seal credential type writes behind the credentials repository (no-changelog) (#39106) 2026-09-22 14:42:34 +00:00
Sam Wooler
428bab3201
feat(API): Migrate users write endpoints to the decorator pattern (#39120)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 14:38:03 +00:00
Robin Braumann
93c79ab7fb
fix: keep automatic preview resumes controllable 2026-09-22 16:38:01 +02:00
Robin Braumann
1707fcd465
fix: recover running preview chat after reload 2026-09-22 16:21:39 +02:00
Michael Drury
da06957d53
fix: Increase default Agent iteration limits (no-changelog) (#39299) 2026-09-22 14:14:10 +00:00
José Braulio González Valido
8325f12c33
fix(ai-builder): Read the eval credential allowlist on every list call (no-changelog) (#39249)
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-22 14:10:36 +00:00
n8n-cat-bot[bot]
f86d227dc5
chore: Migrate DELETE /api/v1/projects/:projectId/folders/:folderId to @PublicApiController + Zod (#38617)
Co-authored-by: n8n-cat-bot[bot] <n8n-cat-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Ali Elkhateeb <ali.elkhateeb@n8n.io>
2026-09-22 14:07:41 +00:00
Rúben Castro
fb0c332006
fix(core): Summarize saved credential type policies against known credential types (no-changelog) (#39191)
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 13:58:58 +00:00
Veljko Terzic
f89687fd87
feat(core): Run the insights pruning as a durable system task (no-changelog) (#39173)
Co-authored-by: Lorent Lempereur <lorent.lempereur@n8n.io>
2026-09-22 13:51:40 +00:00
n8n-cat-bot[bot]
cae5062e3a
refactor(API): Migrate GET /discover to the decorator pattern (no-changelog) (#39162)
Co-authored-by: n8n-cat-bot[bot] <n8n-cat-bot[bot]@users.noreply.github.com>
Co-authored-by: Uddish Verma <uddish.verma@n8n.io>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-22 13:23:51 +00:00
MHMD
fc68bb6a8f
feat(core): Add feature flag for granular credential sharing work (#39293) 2026-09-22 13:22:12 +00:00
Veljko Terzic
4d8c29adbe
feat(core): Run the agent checkpoint pruning as a durable system task (no-changelog) (#39269) 2026-09-22 13:10:30 +00:00
Sam Wooler
6433934db7
feat(API): Migrate GET /users endpoints to the decorator pattern (#38599)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 12:49:05 +00:00
Matsu
1bb166dbaa
chore: Enforce extraneous dependencies in Oxlint (no-changelog) (#39281) 2026-09-22 12:48:49 +00:00
Ricardo Espinoza
b42f1dc56f
feat(core): Apply AI preferences on every Instance AI turn (no-changelog) (#39004)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Roman Makowiak <roman.makowiak@n8n.io>
2026-09-22 12:28:35 +00:00
Robin Braumann
dda9a56cb7
fix(core): Resume only private sessions in Preview (#39151) 2026-09-22 11:46:51 +00:00
Tomi Turtiainen
518a24dd64
refactor(engine): Split execution response endpoints (#39261) 2026-09-22 11:44:49 +00:00
Anne Aguirre
43d7cc755e
fix(core): Use Sessions tab terminology in n8n Assistant (#39265) 2026-09-22 11:41:11 +00:00
José Braulio González Valido
5b149495c5
feat(ai-builder): Grade token consumption and memory compaction in Instance AI evals (no-changelog) (#38974)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-22 11:12:10 +00:00
Konstantin Tieber
7f3be81d6c
chore(core): Add integration tests for instance-reporting retries (#39158) 2026-09-22 10:06:26 +00:00
Matsu
196ed7f450
refactor(core): Enforce persistence boundaries in code (no-changelog) (#39170) 2026-09-22 13:14:00 +03:00
Rúben Castro
cff3a1c9db
feat(core): Add credential type policy instance and project endpoints (no-changelog) (#39111)
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 09:33:06 +00:00
Robin Braumann
5ba266db25
feat(core): Scope agent preview sessions to their owner (#39100) 2026-09-22 09:22:44 +00:00
Mike Repeć
3f76dccc32
fix(core): Restore pubsub subscriptions after Redis reconnect and detect half-open subscriber connections (#39174) 2026-09-22 08:28:01 +00:00
Veljko Terzic
48cea71beb
feat(core): Run the insights compaction as a durable system task (no-changelog) (#39096)
Some checks failed
Build: Benchmark Image / build (push) Waiting to run
CI: Master (Build, Test, Lint) / Build for Github Cache (push) Waiting to run
CI: Master (Build, Test, Lint) / Unit tests (24.18.1) (push) Waiting to run
CI: Master (Build, Test, Lint) / Unit tests (26.5.1) (push) Waiting to run
CI: Master (Build, Test, Lint) / Lint (push) Waiting to run
CI: Master (Build, Test, Lint) / Performance (push) Waiting to run
CI: Master (Build, Test, Lint) / Verify single-instance deps (npm-install) (push) Waiting to run
CI: Master (Build, Test, Lint) / Notify Slack on failure (push) Blocked by required conditions
Util: Publish API Schema / Cloudflare Pages (push) Has been cancelled
2026-09-22 08:05:17 +00:00
Robin Braumann
6a678f02a0
fix(core): Remove checkpoints when deleting agent sessions (#39175) 2026-09-22 07:47:55 +00:00
n8n-cat-bot[bot]
f840c58934
chore: Migrate PATCH /api/v1/projects/:projectId/folders/:folderId to @PublicApiController + Zod (#38618)
Co-authored-by: n8n-cat-bot[bot] <n8n-cat-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Ali Elkhateeb <ali.elkhateeb@n8n.io>
2026-09-22 07:45:49 +00:00