Skip to content

feat: /fork no longer switches to the forked session - #2565

Merged
7Sageer merged 2 commits into
mainfrom
feat/fork-stay-current-session
Aug 4, 2026
Merged

feat: /fork no longer switches to the forked session#2565
7Sageer merged 2 commits into
mainfrom
feat/fork-stay-current-session

Conversation

@7Sageer

@7Sageer 7Sageer commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — the problem is explained below.

Problem

/fork currently switches to the forked session, and switching closes the source session — canceling any in-flight turn and force-stopping all of its background tasks (dev servers, builds, watchers). Forking to explore a side direction should not destroy work still running in the original session.

This PR is the lighter of two candidate fixes. The alternative is to detach (rather than close) the previous session on every session switch (/new, /sessions, /fork), which fixes task-killing on all paths but keeps every switched-away session resident in-process. This PR changes only /fork semantics: create the copy, stay in the current session.

What changed

  • /fork creates the fork but no longer switches to it. The current session keeps running untouched — background tasks, in-flight turns, and pending interactions all survive. The status message now points to /sessions for switching to the fork.
  • Slash-command registry description, message-flow tests (assert the source session is not closed and stays current), and bilingual docs (sessions guide, use cases, getting started, slash-commands reference) updated to match.

Trade-offs to be aware of:

  • Fork semantics change from "create a branch and check it out" to "create a branch and stay put" (think git branch vs git checkout -b). Switching to the fork takes one explicit step via /sessions.
  • Only /fork is fixed: /new and /sessions still close the previous session and stop its background tasks. That needs the detach approach, which can follow separately.
  • Worth calling out in release notes: forking mid-turn no longer cancels the running turn (the implicit close used to abort it).

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

Forking used to switch to the new session, which closed the source
session and force-stopped its background tasks (and canceled any
in-flight turn). /fork now creates the copy and stays in the current
session; the fork can be opened explicitly via /sessions.
@changeset-bot

changeset-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5d8ff30

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Aug 3, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@5d8ff30
npx https://pkg.pr.new/@moonshot-ai/kimi-code@5d8ff30

commit: 5d8ff30

@7Sageer
7Sageer merged commit 54c04bf into main Aug 4, 2026
14 checks passed
@7Sageer
7Sageer deleted the feat/fork-stay-current-session branch August 4, 2026 07:24
@github-actions github-actions Bot mentioned this pull request Aug 4, 2026
mbuckaway pushed a commit to mbuckaway/kimi-code that referenced this pull request Aug 4, 2026
* feat: /fork no longer switches to the forked session

Forking used to switch to the new session, which closed the source
session and force-stopped its background tasks (and canceled any
in-flight turn). /fork now creates the copy and stays in the current
session; the fork can be opened explicitly via /sessions.

* fix(tui): release fork runtime when staying current
daofazhiran pushed a commit to daofazhiran/kimi-code that referenced this pull request Aug 4, 2026
* feat: /fork no longer switches to the forked session

Forking used to switch to the new session, which closed the source
session and force-stopped its background tasks (and canceled any
in-flight turn). /fork now creates the copy and stays in the current
session; the fork can be opened explicitly via /sessions.

* fix(tui): release fork runtime when staying current
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