MoonshotAI / MoonshotAI/kimi-code

[BUG] Auto-generated session title overwrites the Fork: marker on forked sessions, producing duplicate titles

Open
#3,918 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

Problem

After forking a session, the new session is titled Fork: <source title>. Once the first message is sent in the forked session and auto title generation runs, the generated title replaces the whole title — the Fork: marker is lost. Since a forked session starts from the same context as its source, the generated title tends to be identical or very similar to the source session's title, leaving two same-named sessions in the session list that cannot be told apart.

Steps to reproduce

  1. Open a session that already has a title (e.g. Fix login bug).
  2. Fork it via /fork or kimi --resume --fork; the new session shows as Fork: Fix login bug.
  3. Send a message in the forked session and wait for auto title generation to complete.

Expected

The forked session keeps its fork marker (keeps the Fork: prefix, or the generated title still carries a fork indicator), so it stays distinguishable from the source session in the list.

Actual

The auto-generated title replaces the whole title and drops the Fork: prefix; both sessions show the same title.

Root cause

  • packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts: on fork, the title is set to Fork: ${sourceTitle} and, when no explicit title is passed, titleKind is recorded as 'replaceable'.
  • packages/agent-core-v2/src/session/sessionTitle/sessionTitleService.ts, generateTitleOnce(): generation is skipped only for titleKind === 'custom' or 'generated'; 'replaceable' titles — including the Fork: one — proceed to generation.
  • packages/agent-core-v2/src/session/sessionMetadata/sessionMetadataService.ts, setGeneratedTitleIfUncustomized(): likewise only guards 'custom', so the Fork: title is overwritten outright.
  • Nothing in the flow checks meta.forkedFrom or preserves the Fork: prefix.

Suggested fix (options)

  • Skip auto title generation when meta.forkedFrom !== undefined; or
  • When applying a generated title to a session with forkedFrom, keep the Fork: prefix; or
  • Give the forked title its own titleKind that is not auto-replaced unless forced.

Note: whether force: true (manual regeneration) should overwrite the Fork: marker is a product decision and can be defined separately — this issue only concerns non-forced automatic generation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts to trace how forked titles and titleKind are set. Then read generateTitleOnce() in sessionTitleService.ts and setGeneratedTitleIfUncustomized() in sessionMetadataService.ts. Confirm that non-forced automatic generation preserves the fork distinction, and add or update coverage for the fork-and-generate flow if tests are found nearby.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.