@@ -485,6 +485,9 @@ function bindRouteReasoningReplayScope(args: {
485485 : undefined ,
486486 ) ;
487487 if ( adapterName === "cursor" ) {
488+ // The final route owner is authoritative for Cursor and supersedes the account-derived
489+ // seed assigned before route binding. A Cursor conversation must be scoped to the exact
490+ // provider/destination/adapter/model/credential that serves it.
488491 if ( continuationOwner ) parsed . _cursorIdentityScope = providerContinuationRouteScope ( continuationOwner ) ;
489492 else if ( ! parsed . _cursorIdentityScope ?. startsWith ( "cursor-unowned:" ) ) {
490493 // Prevent the adapter's token-only fallback from recreating a provider-private id after the
@@ -2344,8 +2347,9 @@ async function handleResponsesInner(
23442347 ? `${ route . providerName } -${ route . codexAccountNamespace } `
23452348 : formatCodexProviderForLog ( route . providerName , codexLogAccountId ( authCtx ) , config ) ;
23462349 logCtx . accountLogLabel = codexAuthContextLogLabel ( authCtx , config ) ;
2347- // Prefer Codex pool account as the Cursor thread namespace when present. Cursor routes without
2348- // codexAccountMode still get a credential-derived scope inside the Cursor adapter.
2350+ // Seed an account-derived scope before final adapter binding. Cursor never treats it as
2351+ // authoritative: bindRouteReasoningReplayScope replaces it with the exact route owner or a
2352+ // per-request fail-closed sentinel after the final provider and credential are known.
23492353 const identityScope = codexLogAccountId ( authCtx ) ;
23502354 if ( identityScope ) parsed . _cursorIdentityScope = identityScope ;
23512355 subagentFallbackAccountId = authCtx . kind === "pool" || authCtx . kind === "main-pool"
0 commit comments