Repository navigation
fix: hold a fork back from the session list until its session/fork response is out - #642
Merged
nikita-ashihmin merged 1 commit intoOct 16, 2026
Conversation
…sponse is out `session/fork` calls `thread/fork` and then sets the session up. Meanwhile the list subscription got `thread/started` of the fork and sent `_session/list/changes` with it before the fork response. A client then met an unknown session and listed it as a session of its own. JetBrains Air refused the fork after that (IJAI-4105). The subscriptions now keep the rows of a fork held until the response is out. A row is held by `forkedFrom` and, once `thread/fork` answers, by the fork thread id. The id matters because a row of a `thread/list` scan has no `forkedFromId`. `SessionForkOrigins` also learns the parent of the fork at once, so every row of the fork carries `forkedFrom` without a rollout read.
nikita-ashihmin
deleted the
nikita.ashikhmin/fork-response-before-list-change
branch
October 16, 2026 18:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
session/forkcallsthread/forkand then sets the session up. MeanwhileSessionListSubscriptionsgetsthread/startedof the fork and sends_session/list/changeswith it before the fork response. The client meets an unknown session and lists it as a session of its own. JetBrains Air then refuses the fork (IJAI-4105).Fix
SessionIndexService.forking(...)wrapsforkSession(v1, and v2 through it). AsetTimeout(0)releases the rows after the SDK has written the response.SessionListSubscriptionskeeps the rows of a fork inheldwhile its fork is in flight:forkedFrom;thread/forkanswers (forkCreated). A row of athread/listscan hasforkedFromId: null, so the id is needed.SessionForkOrigins.rememberrecords the parent of a fork that this adapter made, so its rows carryforkedFromwithout a rollout read.Tests
holds the row of a fork back until the response of its session/fork is out(SessionListSubscriptions.test.ts). It fails without the fix. It usespath.resolve("/repo")so that it also passes on Windows.