From ac2cd317ce95ad754ff32d80e452e93535af0a0e Mon Sep 17 00:00:00 2001 From: "t3-code[bot]" <269035359+t3-code[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2026 13:10:57 +0000 Subject: [PATCH] docs(cursor): document turn settlement invariants --- apps/server/src/provider/Layers/CursorAdapter.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/server/src/provider/Layers/CursorAdapter.ts b/apps/server/src/provider/Layers/CursorAdapter.ts index 98dc25889c..759f0cba09 100644 --- a/apps/server/src/provider/Layers/CursorAdapter.ts +++ b/apps/server/src/provider/Layers/CursorAdapter.ts @@ -1011,6 +1011,7 @@ export function makeCursorAdapter( threadId: input.threadId, }); } + // A prompt sent while another is in flight steers the active turn. const startsTurn = ctx.promptsInFlight === 0; if (startsTurn) { ctx.callbackLifecycle.generation += 1; @@ -1018,6 +1019,7 @@ export function makeCursorAdapter( ctx.activeTurnId = candidateTurnId; ctx.lastPlanFingerprint = undefined; } + // Count it immediately so an older prompt cannot settle the shared turn. ctx.promptsInFlight += 1; return { generation: ctx.callbackLifecycle.generation, @@ -1038,6 +1040,7 @@ export function makeCursorAdapter( if (promptFinalized) return false; promptFinalized = true; ctx.promptsInFlight = Math.max(0, ctx.promptsInFlight - 1); + // Only the final prompt for this generation may settle and complete the turn. if (ctx.promptsInFlight !== 0 || ctx.callbackLifecycle.generation !== generation) { return false; }