@@ -190,13 +190,14 @@ export class LegacyPostgresWaitpointCoordinator implements WaitpointCoordinator
190190 idempotencyKey,
191191 idempotencyKeyExpiresAt,
192192 } : CreateDateTimeWaitpointParams ) : Promise < CreateWaitpointResult > {
193- // Co-location invariant: a DATETIME wait waitpoint lives on the same run-ops DB as the run
194- // that blocks on it. The minted waitpoint id is always a cuid, so without `coLocateWithRunId`
195- // the upsert would always route to LEGACY and a run-ops run on NEW would hang. The
196- // (env,idempotencyKey) dedup is within the owning run/tree, so the dedup probe + rotation
197- // target the SAME store. With no run id the lookup falls back to a cross-DB NEW-then-LEGACY
198- // scan and the upsert routes by id-shape. Always routed through the run store (never a caller
199- // tx) so it can never bypass residency onto the wrong DB.
193+ // Co-location invariant: a DATETIME wait waitpoint lives on the same run-ops DB as the run that
194+ // blocks on it (so the block edge's local `Waitpoint` join resolves and completion/resume stay
195+ // local). The minted waitpoint id is always a cuid, so without `coLocateWithRunId` the upsert
196+ // would always route to LEGACY and a run-ops run on NEW would hang. The (env,idempotencyKey) dedup
197+ // is within the owning run/tree (co-resident on one DB), so the dedup probe + rotation target the
198+ // SAME store. With no run id (a standalone token has no owning run yet) the lookup falls back to
199+ // a cross-DB NEW-then-LEGACY scan and the upsert routes by id-shape. Always routed through the
200+ // run store (never a caller tx) so it can never bypass residency onto the wrong DB.
200201 const colocate = runId ? { coLocateWithRunId : runId } : undefined ;
201202 const existingWaitpoint = idempotencyKey
202203 ? await this . runStore . findWaitpoint (
@@ -272,12 +273,12 @@ export class LegacyPostgresWaitpointCoordinator implements WaitpointCoordinator
272273 tags,
273274 standaloneResidency,
274275 } : CreateManualWaitpointParams ) : Promise < CreateWaitpointResult > {
275- // Co-location invariant (see createDateTimeWaitpoint): when a `runId` is supplied the
276- // waitpoint co-locates with that run's DB and the (env,idempotencyKey) dedup is per-run. A
277- // standalone token passes no run id — it is created without an owner, blocked later by
278- // whichever run waits on it (possibly cross-DB, resolved by the run-co-resident block edge +
279- // completion fan-out). With no owner it reads the env mint kind via `standaloneResidency` so
280- // a minted-new env keeps its tokens on NEW; unset, it routes by id-shape. No tx here.
276+ // Co-location invariant (see createDateTimeWaitpoint): when a `runId` is supplied the waitpoint
277+ // co-locates with that run's DB and the (env,idempotencyKey) dedup is per-run (co-resident) . A
278+ // standalone token (api.v1.waitpoints.tokens.ts) passes no run id — it is created without an
279+ // owner, blocked later by whichever run waits on it (possibly cross-DB, resolved by the
280+ // run-co-resident block edge + completion fan-out). With no owner it reads the env mint kind via
281+ // `standaloneResidency` so a minted-new env keeps its tokens on NEW; unset, it routes by id-shape. No tx here.
281282 const colocate = runId
282283 ? { coLocateWithRunId : runId }
283284 : standaloneResidency
0 commit comments