Skip to content

fix: guard workspace mutation against stale session effect#24543

Open
alfredocristofano wants to merge 3 commits into
anomalyco:devfrom
alfredocristofano:contrib/cristofano-session-race-fix
Open

fix: guard workspace mutation against stale session effect#24543
alfredocristofano wants to merge 3 commits into
anomalyco:devfrom
alfredocristofano:contrib/cristofano-session-race-fix

Conversation

@alfredocristofano
Copy link
Copy Markdown

Issue for this PR

Closes #24542

Type of change

  • Bug fix

What does this PR do?

Fixes a race condition in the session route where an async effect could mutate workspace state for the wrong session if the user navigated away while the operation was in-flight.

The effect now captures currentSessionID before the async sdk.client.session.get() call and guards the mutation with if (route.sessionID !== currentSessionID) return after the await. All references within the effect and catch handler use currentSessionID for consistency.

How did you verify your code works?

Verified the guard correctly short-circuits when the session has changed during the async operation, preventing workspace state from leaking into the wrong session.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race condition in session route mutates workspace for wrong session

1 participant