Skip to content

Commit 1a880fd

Browse files
committed
fix(webapp): hardcode v2 for session-streams wait race-check
The race-check in api.v1.runs.$runFriendlyId.session-streams.wait was selecting the realtime stream instance via run.realtimeStreamsVersion, but session streams are always v2 (S2) — the writer (appendPartToSessionStream) and the SSE subscribe both hardcode v2. For a v1 run the race-check silently fell back to a non-S2 instance, the instanceof check missed, and the optimization was skipped. Hardcode v2 for parity with the rest of the session surface.
1 parent faf7888 commit 1a880fd

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,12 @@ const { action, loader } = createActionApiRoute(
123123
// and remove the pending registration.
124124
if (!result.isCached) {
125125
try {
126-
const realtimeStream = getRealtimeStreamInstance(
127-
authentication.environment,
128-
run.realtimeStreamsVersion
129-
);
126+
// Session streams are always v2 (S2) — the writer in
127+
// `appendPartToSessionStream` and the SSE subscribe both
128+
// hardcode "v2", so the race-check reader has to match.
129+
// Don't fall through to the run's own `realtimeStreamsVersion`,
130+
// which only describes the run's run-scoped streams.
131+
const realtimeStream = getRealtimeStreamInstance(authentication.environment, "v2");
130132

131133
if (realtimeStream instanceof S2RealtimeStreams) {
132134
const records = await realtimeStream.readSessionStreamRecords(

0 commit comments

Comments
 (0)