From a29d2cb5efb988aa201c2e0726a3f3a5e738c126 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Thu, 5 Nov 2026 12:49:36 +0100 Subject: [PATCH] docs(server): the handle-less recreate gap spans the agent.create.before hook --- packages/server/src/server/agent/agent-loading.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/server/src/server/agent/agent-loading.ts b/packages/server/src/server/agent/agent-loading.ts index b846635a9b..81afde5c36 100644 --- a/packages/server/src/server/agent/agent-loading.ts +++ b/packages/server/src/server/agent/agent-loading.ts @@ -134,8 +134,10 @@ export async function ensureAgentLoaded( } // Known gap: `record` was read before this create, and createAgent deletes the stored // state outside the agent's lifecycle lane. A setMetadata that saves between the read and - // the delete is overwritten by this stale metadata. The fix is to read and delete the - // stored record inside the lane (createAgentInternal), which is a lifecycle change. + // the delete is overwritten by this stale metadata. That window spans everything from the + // read to the delete, including the agent.create.before hook, which a plugin can hold + // open. The fix is to read and delete the stored record inside the lane + // (createAgentInternal), which is a lifecycle change. snapshot = await deps.agentManager.createAgent(config, agentId, { labels: record.labels, metadata: record.metadata,