Skip to content

fix(desktop): restore omitted release behaviors - #5247

Merged
liruifengv merged 3 commits into
mainfrom
fix/restore-release-1-1-4-changes
Nov 23, 2026
Merged

liruifengv merged 3 commits into
mainfrom
fix/restore-release-1-1-4-changes

Conversation

@liruifengv

Copy link
Copy Markdown
Collaborator

Requirement or Bug

Desktop 1.1.4 shipped four product changes that never reached the old repository's main branch and were therefore absent from the monorepo import: rejected AgentSwarm calls were hidden, Swarm activation showed a high-usage notice, model-switch confirmations became session-aware, and the quick model menu deferred model/effort changes until dismissal.

This PR restores the behavior of the four omitted PRs in the current architecture:

Bug Reproduction Steps

  1. Open the quick model menu and select another model. Before this PR, the menu applies and closes immediately instead of allowing model and thinking-level changes to be staged together.
  2. With Swarm mode off, let the agent attempt AgentSwarm. Before this PR, the rejected call can remain visible as a pending or failed Swarm card even though no sub-agent started.
  3. Enable Swarm mode under Always Ask. Before this PR, the desktop client opens a blocking confirmation instead of enabling directly and showing the high-usage warning.
  4. Return session_type or warning in model_switch_confirm, or return effort_switch_confirm. Before this PR, the renderer does not honor the session-aware fields or load the effort configuration.
  5. Configure a model or effort switch rule for a new or existing session. Before this PR, draft/new sessions bypass model confirmation, warnings are ignored, and managed effort changes cannot show the configured confirmation.

Root Cause

kimi-code-app#990 was named chore: sync release 1.1.4 back to main, but it only changed release metadata, changelogs, the package version, the lockfile, and the core submodule pointer. It did not copy any product source from the four PRs above. Later release branches and the monorepo snapshot inherited main, so the missing behavior remained absent.

This is a fundamental restoration rather than a workaround. The old patches were not cherry-picked verbatim because the current monorepo now uses conversation projections, active-host model catalogs, and the browser-overlay menu protocol; each behavior was reconnected to the current owner of that responsibility.

Code Changes

Core structure

flowchart TD
    Cloud[Cloud client configs] --> Loader[Shared client-config loader]
    Loader --> ModelStore[Model-switch store]
    Loader --> EffortStore[Effort-switch store]
    ModelStore --> ModelGate[Session-aware model gate]
    EffortStore --> EffortGate[Managed effort gate]
    ModelGate --> Dialog[Shared confirmation dialog]
    EffortGate --> Dialog
    Composer[Quick model menu] --> Draft[Model and effort draft]
    Draft -->|outside dismissal or Cmd/Ctrl+Enter| ModelGate
    Draft -->|after successful model switch| EffortGate
    Conversation[Conversation projection] --> SwarmFilter[Hide pre-start Swarm rejections]
    ModeStore[Mode store] --> SwarmNotice[High-usage notice]
Loading

The shared loader owns concurrent config reads and stale-request protection for both cloud configurations. The production client and test workspace rig share the same hook and mode-action wiring, while the CLI and desktop contracts remain independent because they live on opposite dependency boundaries.

Restored behavior

  • Filter AgentSwarm calls from conversation projection only when they are still pending with Swarm mode off or fail before any sub-agent reference exists. Calls with started sub-agents and cancellations remain visible.
  • Add an idempotent Swarm enable path in the mode store. Every desktop enable entry point now turns Swarm on directly and emits the localized high-usage warning; disabling remains silent.
  • Parse and match session_type, wildcard model IDs, localized hints, and localized warnings. Existing sessions use compact/continue/cancel; new and draft sessions use confirm/cancel. Config loading is awaited before a selection is matched, with generation and session guards.
  • Load effort_switch_confirm, display configured effort descriptions, and gate managed OAuth effort changes through the configured confirmation. Cancellation, session changes, model changes, and stale config loads leave the current effort unchanged.
  • Stage quick-menu model and effort selections locally. Native model rows use keepOpen; outside dismissal and Cmd/Ctrl+Enter commit, while Escape and programmatic closure cancel the draft. The fallback menu handles the same keyboard contract itself.
  • Replace the quick menu's unconditional cache note with configured effort guidance. The existing cache-note translations remain available to other settings surfaces.
  • Consolidate the three fallback model-row templates into one entry projection and share duplicate client config loading, mode hooks, and mode actions without changing behavior.

Reading guide

  1. packages/app-core/src/client/conversationToTurns.ts shows the current pre-start Swarm rejection boundary.
  2. packages/app-core/src/lib/modelSwitchConfirm.ts and packages/app-core/src/lib/effortSwitch.ts define the cloud config contracts and matching rules.
  3. packages/app-client/src/stores/clientConfigLoader.ts owns shared loading; useKimiWebClient.ts applies model and effort gates.
  4. packages/app-components/src/composer/Composer.vue and modelMenuDraft.ts implement deferred quick-menu selection.
  5. apps/desktop/src/renderer/lib/browserOverlayMenu.ts and apps/desktop/src/shared/browser-overlay.ts carry native-menu dismissal and keyboard semantics.
  6. Tests can be read after these files; localization and baseline changes are mechanical.

Release metadata

Changesets were intentionally omitted at the requester's explicit instruction. This differs from the default requirement in CONTRIBUTING.md; a maintainer should resolve that release-process exception before merge if a changeset is required.

Screenshots / Recordings

Not captured. Browser automation was not authorized for this task. The changed dialog states, fallback/native menu contracts, keyboard behavior, and client gates are covered by component and protocol tests instead.

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
Rejected AgentSwarm cards A pre-start rejection can appear as pending or failed Calls with no sub-agent refs are hidden; started and cancelled calls remain Desktop and web users who inspected rejected tool cards None; the rejection was not an executed Swarm
Swarm activation Always Ask can show a blocking confirmation Swarm turns on directly and shows a high-usage warning Desktop and web users in Always Ask who expected a confirmation None; disabling Swarm remains available
Model-switch cloud rules session_type, warning, and wildcards are ignored by the renderer Rules honor old/new/all sessions, warnings, and * Cloud-config operators and desktop/web users Add a valid session_type; disable the config to bypass confirmation
Existing-session model dialog Offers Start new session, Compact, Continue, and Cancel Offers Compact, Continue, and Cancel Existing-session users of the Start new session action Start a new session first, then choose the model
New/draft model switch Switches directly Shows Confirm/Cancel when a new-session rule matches Users changing the model before the first prompt Disable the matching cloud rule or cancel
Quick model menu Selection applies and closes immediately Model and effort stay staged until outside dismissal or Cmd/Ctrl+Enter; Escape cancels Desktop and web users of the quick menu Escape preserves the current model and effort
Quick-menu cache note A static cache warning is always shown Configured effort guidance is shown when available Users who relied on the unconditional quick-menu warning Configure effort guidance; other settings surfaces retain the cache note
Managed effort switch Applies immediately Can show configured guidance and Confirm/Cancel Managed OAuth model users Cancel, or disable the matching cloud rule
Malformed legacy cloud rule A rule without session_type can be interpreted by the old renderer Invalid rules are ignored, matching the current server schema Stale hand-written cloud payloads Add session_type: old, new, or all

Affected modules and coverage:

  • Conversation projection: rejected, running, started, and cancelled AgentSwarm calls in packages/app-core/test/conversation.test.ts.
  • Swarm activation: live sessions, drafts, idempotent enable, and silent disable in packages/app-client/test/mode-store.test.ts.
  • Model and effort config contracts: parsing, wildcards, session matching, localization, loading races, cancellation, compaction, and session changes in packages/app-core/test/modelSwitchConfirm.test.ts and packages/app-client/test/modelSwitchConfirm*.test.ts.
  • Confirmation UI: old-session choices, new-session actions, effort title, hints, and warnings in packages/app-components/test/modelSwitchConfirmDialog.test.ts.
  • Quick menu: ordered model/effort application, cancelled model confirmation, session changes, fallback keyboard handling, native dismissal, and configured descriptions in packages/app-components/test/composerModelMenuDraft.test.ts.
  • Native overlay protocol: dismissal callback, keepOpen, note sizing, and Cmd/Ctrl+Enter in the desktop main/renderer tests.

No CLI, KAP, SDK, persisted-session, or provider wire contract is changed. Existing conversation data is only projected differently for the narrow pre-start Swarm rejection case.

Validation performed
  • pnpm exec vitest run --reporter=agent ... — 13 affected test files, 221 tests passed.
  • pnpm --filter kimi-code-app run typecheck — desktop main-process TypeScript and renderer Vue TypeScript passed.
  • pnpm lint — comment checks, oxlint, import boundaries, guards, ratchet, test-double, quarantine, and instruction checks passed.
  • pnpm run check:duplication origin/main — passed with no new clones after sharing the client config loader, workspace hooks/actions, and model-row projection.
  • Read-only public-diff audit — no internal endpoints, accounts, credentials, private paths, or environment-specific identifiers found.
  • Platform checked locally: macOS. Windows runtime behavior was not exercised.
  • Full build and browser/Electron automation were not run.

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; changesets were explicitly omitted by the requester.
  • Ran gen-docs skill; no documentation update is needed because the existing pages document CLI behavior rather than these restored desktop interactions.

@changeset-bot

changeset-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d853117

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 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-23T04:28:34.896939Z d853117 PR opened
ℹ️ 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.

@pkg-pr-new

pkg-pr-new Bot commented Nov 23, 2026

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

commit: d853117

@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: d8531177ee

ℹ️ 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".

@liruifengv
liruifengv merged commit 225868a into main Nov 23, 2026
26 checks passed
@liruifengv
liruifengv deleted the fix/restore-release-1-1-4-changes branch November 23, 2026 04:59
RealKai42 added a commit that referenced this pull request Nov 23, 2026
…5274)

#5093 drops the leading slash from / menu names and turns the empty
composer placeholder into @ and / hints. #5247 stages quick model menu
choices until an outside click or Cmd/Ctrl+Enter, and Escape discards
them. Three journeys still expected the old names, the old placeholder
and a menu that applies on click, so they failed on main.

Locate / menu options by their visible names, expect the new default
placeholder, and commit each quick model menu choice before checking the
model pill: once with an outside click and otherwise with Cmd/Ctrl+Enter.
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 24, 2026
Record MoonshotAI#5247 ported and MoonshotAI#5258, MoonshotAI#5259 and MoonshotAI#5266 equivalent to the fork's
own sidebar, composer and tool-duration implementations, each with an
executable probe.
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.

2 participants