kimi-code icon indicating copy to clipboard operation
kimi-code copied to clipboard

[Bug] /model sent before the first session is consumed as the first message and reports a switch without opening the picker

Open NashCC1550 opened this issue 2 months ago • 2 comments

What version of Kimi Code is running?

Observed on 2026-09-15; kimi --version currently reports 2.1.1. Not yet re-verified on 2.1.1.

Which model were you using?

Whatever the fresh session shows in the footer — the failure does not depend on a particular model.

What platform is your computer?

Darwin 27.0.0 arm64 arm

What issue are you seeing?

On a brand-new session the screen says there is no session yet and that one will be created on the first message. Sending /model at that moment does not open "Select a model". The slash text is accepted as the first user message, and the UI then prints a "Switched to ..." line for the current model, which looks like a successful switch. The picker never appeared, so any following filter text is not treated as type-to-search.

What steps can reproduce the bug?

  1. Start kimi so the first screen is an empty session (no prior conversation in that terminal).
  2. Before any normal chat message, submit the line /model.
  3. Expected: a picker titled Select a model.
  4. Observed: no picker; a "Switched to " line appears and the session now exists.

What is the expected behavior?

/model is a slash command. Before the first real message it should open the model picker, or be rejected with an error saying slash commands are not available yet. It should not create the session and should not print a switch confirmation for a picker that never opened.

Additional information

Waiting until the composer is clearly ready and then sending /model does open the picker — the problem is specific to the early submit.

Possibly related: #3830 (settings in a new-session draft not reaching the first turn) — same "before the session exists" window, different symptom.

NashCC1550 avatar Sep 26 '26 04:09 NashCC1550

Re-tested on 2.1.1 (still the latest release), macOS arm64, driving the TUI through a pty and submitting /model at fixed delays after launch:

Delay before /model + Enter Picker opened "Switched to …" printed Session created
0.3 s no no no
1.0 s no no no
4.0 s yes (Select a model (type to search)) no no

So the symptom has changed: an early /model is no longer consumed as the first message and no longer prints a false switch confirmation. Instead it is silently dropped — at 1.0 s the text /model is still sitting in the composer, no picker appears, and nothing tells the user the command was ignored. Once the composer is ready it works as expected.

Expected behaviour is unchanged from the original report: either open the picker, or show an explicit "not ready yet" message, rather than ignoring the submit.

NashCC1550 avatar Oct 07 '26 01:10 NashCC1550

The 2.1.1 PTY results narrow the remaining problem to early submission: /model works after 4 seconds, while at 1 second the input remains in the composer and submission is silently dropped. The earlier false “switched” result and new-session behavior were not reproduced in that retest.

I propose investigating the startup readiness boundary and fixing command admission so an early /model submission either remains available until the command handler is ready, or receives an explicit not-ready response while preserving the input. It must not be treated as the first chat message, create a session, or report a model switch without an actual selection. I would keep this scoped to startup command handling and add the smallest regression coverage in the existing test suite for early submission and the ready path, using the reported PTY timings to guide validation rather than treating fixed delays as a readiness signal.

This is a proposed direction based on the reported results; I have not reproduced the PTY scenario or confirmed a code-level root cause. Could a maintainer approve this bug-fix scope with /approve before implementation?

Dante-dan avatar Oct 07 '26 02:10 Dante-dan