Skip to content

fix: hold a fork back from the session list until its session/fork response is out - #642

Merged
nikita-ashihmin merged 1 commit into
mainfrom
nikita.ashikhmin/fork-response-before-list-change
Oct 16, 2026
Merged

nikita-ashihmin merged 1 commit into
mainfrom
nikita.ashikhmin/fork-response-before-list-change

Conversation

@nikita-ashihmin

Copy link
Copy Markdown
Collaborator

Problem

session/fork calls thread/fork and then sets the session up. Meanwhile SessionListSubscriptions gets thread/started of the fork and sends _session/list/changes with 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(...) wraps forkSession (v1, and v2 through it). A setTimeout(0) releases the rows after the SDK has written the response.
  • SessionListSubscriptions keeps the rows of a fork in held while its fork is in flight:
    • by forkedFrom;
    • by the fork thread id once thread/fork answers (forkCreated). A row of a thread/list scan has forkedFromId: null, so the id is needed.
  • SessionForkOrigins.remember records the parent of a fork that this adapter made, so its rows carry forkedFrom without 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 uses path.resolve("/repo") so that it also passes on Windows.

…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
nikita-ashihmin merged commit 59974c7 into main Oct 16, 2026
6 checks passed
@nikita-ashihmin
nikita-ashihmin deleted the nikita.ashikhmin/fork-response-before-list-change branch October 16, 2026 18:38
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.

1 participant