Skip to content

Commit 4ce5998

Browse files
committed
fix(webapp): match writer basin in session-stream wait race-check
When the session row is absent (externalId addressing before the row is upserted), the race-check resolved to the legacy basin while the writer side resolves to the org's basin. Fall back to the org so both sides land in the same place — matches the PUT/GET sister routes.
1 parent 9cb611d commit 4ce5998

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

apps/webapp/app/routes/api.v1.runs.$runFriendlyId.session-streams.wait.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,13 @@ const { action, loader } = createActionApiRoute(
123123
// and remove the pending registration.
124124
if (!result.isCached) {
125125
try {
126-
// Session streams are hardcoded v2 by the append-side writer
127-
// and SSE subscribe, so the race-check reader matches. Basin
128-
// comes from `session` only — the writer side passes the same
129-
// and we have to read from the same basin to find the record.
126+
// Match the writer's basin resolution exactly: session if the
127+
// row exists, otherwise the org so we look at the same basin a
128+
// fresh row would be stamped with. Mirrors the PUT/GET sister
129+
// routes in `realtime.v1.sessions.$session.$io.ts`.
130130
const realtimeStream = getRealtimeStreamInstance(authentication.environment, "v2", {
131131
session: maybeSession,
132+
organization: maybeSession ? null : authentication.environment.organization,
132133
});
133134

134135
if (realtimeStream instanceof S2RealtimeStreams) {

0 commit comments

Comments
 (0)