Skip to content

feat(desktop): hide CLI projects by default - #5164

Open
liruifengv wants to merge 5 commits into
mainfrom
feat/hide-cli-projects
Open

liruifengv wants to merge 5 commits into
mainfrom
feat/hide-cli-projects

Conversation

@liruifengv

@liruifengv liruifengv commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

Desktop and Web currently mix projects and sessions created by Kimi Code CLI into the sidebar. This PR hides those implicit projects by default, adds a desktop and mobile opt-in with CLI labels, and prevents Desktop from changing a CLI project's primary directory.

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

Reuse the existing AppWorkspace.kind classification instead of adding provenance to session storage or changing KAP. implicit identifies projects entered from a terminal, while Desktop-created projects remain managed.

AppWorkspace.kind
  implicit
    ├── hidden by default in workspacesStore
    ├── shown after the persisted opt-in
    │     └── WorkspaceView carries kind → CLI badge
    └── edited in Desktop
          └── primary promotion is unavailable

  managed
    └── existing visibility and editing behavior is unchanged
  • Filter implicit workspaces in workspacesStore, so grouped, flat, pinned, completed, mobile, search, and jump-list projections all follow the same setting.
  • Persist the opt-in as kimi-web.show-cli-workspaces. Desktop exposes it under Agent & Sessions → CLI projects; mobile exposes it under Settings → App.
  • Skip hidden projects only when startup automatically selects the most recent session. Explicit session links and an already-open session retain their existing behavior.
  • Add CLI badges to grouped projects, the project directory, completed groups, mobile groups, and workspace hover cards.
  • Disable primary-directory promotion for implicit projects in the Desktop editor. Renaming and managing additional directories remain available; KAP and its setPrimary endpoint are unchanged.
  • Document the default visibility and opt-in in the English and Chinese Web guides.

Screenshots / Recordings

The new CLI projects module is the last section under Agent & Sessions, with the opt-in enabled for this example.

CLI projects settings

An implicit project created through the real session API appears in the sidebar with its CLI badge.

CLI project badge in the sidebar

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
CLI-created projects and sessions in the sidebar Implicit projects and their sessions were visible everywhere Hidden by default across desktop, Web, and mobile projections Desktop and Web users with projects created by Kimi Code CLI Enable Show CLI projects on desktop or mobile
Startup's automatic recent-session selection The newest session was selected even when its project was hidden The newest visible session is selected Users who previously landed on a CLI session after restart Enable CLI projects; explicit session links still work
Project origin label No source badge was shown Enabled implicit projects show a CLI badge None N/A
Primary-directory editing for CLI projects Desktop could promote an additional directory to primary The promotion control is unavailable for implicit projects in Desktop Desktop users who changed a CLI project's primary directory through the editor None; intentional product restriction, and the KAP endpoint remains available to other callers
Managed projects Existing visibility and editor behavior Unchanged Desktop and Web users with managed projects N/A

Maintainer sign-off is requested for the intentional fixed-primary restriction because it has no Desktop escape hatch.

The visibility setting is covered by store and view-projection tests, including grouped, flat, pinned, and mobile views. Startup selection has a regression test with a newer hidden CLI session and an older managed session. Component tests cover the CLI badge, desktop and mobile settings, and the fixed-primary editor. Managed-project behavior is preserved by the existing test suites.

Verification
  • 415 focused unit and component tests passed, including workspace stores/views, project editing, settings, hover cards, and project pickers.
  • 2 real Electron E2E tests passed, including creation of an implicit project and capture of its CLI badge and settings.
  • 32 focused tests for the shared settings and mobile row components passed.
  • pnpm --filter kimi-code-app run typecheck passed.
  • pnpm lint passed.
  • pnpm run check:duplication main passed.
  • pnpm -C docs run build passed.
  • git diff --check passed.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e80f8c0

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

This PR includes changesets to release 1 package
Name Type
kimi-code-app 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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T07:48:21.184081Z a5ddb71 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

liruifengv added a commit that referenced this pull request Nov 20, 2026
@pkg-pr-new

pkg-pr-new Bot commented Nov 20, 2026 •

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

commit: e80f8c0

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2953338fae

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

sessionCount: w.sessionCount,
}));
const views = mergedWorkspaces.value
.filter((w) => showCliWorkspaces.value || w.kind !== 'implicit')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Distinguish CLI provenance before hiding implicit workspaces

When this setting is off, the filter treats every implicit workspace as CLI-created. However, POST /api/v1/sessions with only cwd intentionally creates an implicit workspace for external-agent handoffs (packages/kap-server/docs/kap.md:34-36,45), and mergeWorkspaces also synthesizes an implicit workspace when listWorkspaces fails. Those sessions now disappear from every desktop/web session view and boot auto-selection even though they are not necessarily CLI projects; track CLI provenance separately or preserve these cases instead of filtering solely on kind.

AGENTS.md reference: AGENTS.md:L203-L205

Useful? React with 👍 / 👎.

sessionCount: w.sessionCount,
}));
const views = mergedWorkspaces.value
.filter((w) => showCliWorkspaces.value || w.kind !== 'implicit')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep deep-linked hidden sessions bound to their workspace

When a user opens an implicit session through a /sessions/<id> deep link while CLI projects are hidden, boot still selects that session, but this filter removes its workspace from workspaceById and makes activeWorkspaceId fall back to another managed project or null. The chat header and project tools then use the wrong workspace, and filesStore.workspaceMachineApi can route host-file reads to the fallback project's host or the local machine for a remote session. Keep canonical active-workspace metadata separate from sidebar visibility.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4620566d7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +46 to +48
<span :class="props.mobile ? 'srow-main' : 'rlabel'">
<span :class="props.mobile ? 'srow-label' : undefined">{{ t('settings.runningSendMode') }}</span>
<span :class="props.mobile ? 'srow-sub' : 'hint'">{{ t('settings.runningSendModeHint') }}</span>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve inner styles in the extracted setting

When “Send while running” is rendered in either settings view, the .rlabel/.hint and .srow-main/.srow-* elements now live inside this child component, so the parents' scoped CSS cannot match them; only the child root receives the parent scope attribute. Consequently the desktop title and hint lose their column typography, while the mobile label no longer occupies a full flex row and can squeeze the segmented control on narrow screens. Define these inner styles in this component or explicitly pierce the parent scope.

AGENTS.md reference: AGENTS.md:L207-L209

Useful? React with 👍 / 👎.

Comment on lines +33 to +35
<span :class="props.flat ? 'srow-main' : undefined">
<span
class="t text-row-label"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore flex sizing for grouped mobile session titles

In grouped mobile view, this wrapper receives no srow-main class, so it remains a flex item with the default automatic minimum width, while the nested title's flex: 1 has no effect because its parent is not a flex container. A long session title therefore refuses to shrink and can push the attention count, timestamp, and options button outside the sheet instead of ellipsizing as the previous direct flex child did. Apply the shrink/flex rules to this wrapper in grouped mode as well, or omit the wrapper there.

AGENTS.md reference: AGENTS.md:L207-L209

Useful? React with 👍 / 👎.

Comment on lines +229 to +230
const mostRecent = sessionsStore().sessions.find((session) =>
workspacesStore().visibleWorkspaceIds.has(workspacesStore().workspaceIdForSession(session)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Paginate past hidden groups before auto-selecting

For users with at least 50 more-recent implicit workspace groups before their first managed project, the initial grouped request contains only hidden sessions, so this lookup returns no candidate and boot leaves them on a new-project draft. drainRemainingSessionGroups later adds the managed sessions in the background but never reruns auto-selection; before this filter, the newest session in that first page was always selectable. Either request only visible workspace IDs, continue paging until a visible candidate is found, or perform selection after the background drain.

AGENTS.md reference: AGENTS.md:L191-L193

Useful? React with 👍 / 👎.

Comment on lines +151 to +155
.kmenu {
position: absolute;
right: 12px;
top: 44px;
z-index: var(--z-dropdown);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep workspace menu positioning in the parent scope

When a user opens the options menu on a mobile workspace header, that Menu is still rendered by MobileSwitcherSheet, but the shared .kmenu positioning rule now lives in this child component's scoped stylesheet and cannot match it. The remaining parent .wsmenu rule supplies only top, right, and width, so without position: absolute and the dropdown z-index those offsets are ignored and the menu participates in the workspace header's flex layout instead of overlaying it. Keep the positioning rule in the switcher or move it to a genuinely shared style.

AGENTS.md reference: AGENTS.md:L207-L209

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5ddb71005

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

font-variant-numeric: tabular-nums;
color: var(--color-text-faint);
}
.att {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore collapsed-workspace attention badge styles

When a collapsed mobile workspace has pending approvals or questions, MobileSwitcherSheet still renders its own .att span, but this shared rule was moved into MobileSessionRow's scoped stylesheet and therefore cannot match the parent-owned span. The count consequently appears as an unstyled number instead of the warning pill; keep this rule in the switcher or in genuinely shared CSS.

AGENTS.md reference: AGENTS.md:L207-L209

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
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