MoonshotAI / MoonshotAI/kimi-cli
Session becomes extremely slow in v1.37.0 after extensive MATLAB work
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
Bug Report: Session Becomes Extremely Slow in v1.37.0
Summary
After upgrading to kimi-cli v1.37.0, a specific session becomes extremely slow (several seconds per token, even loading animation is laggy), while other sessions and the CLI itself remain fast.
Environment
- OS: Windows 10/11
- kimi-cli version: 1.37.0 (upgraded from 1.30.0)
- Python: 3.13.3
- Model: kimi-code/kimi-for-coding
Problem Description
Symptoms
- Token generation is extremely slow (several seconds per token)
- Loading animation stutters/lags
- Only affects one specific session; other sessions work fine
kimi --versionresponds instantly (not a system performance issue)
Session Details
The affected session was used for:
- MATLAB development (7R robotic arm kinematics)
- Bayesian optimization tasks
- Multiple background MATLAB training jobs
Investigation Results
We performed extensive debugging:
-
Context files: Cleaned from 66MB → 63KB (99.9% reduction)
- Deleted all
context_X.jsonlfiles - Cleared
wire.jsonl - No improvement
- Deleted all
-
Task logs: Cleaned from ~60MB → 2MB (96% reduction)
- Cleared huge
output.logfiles (44MB, 10MB, 4MB) - No improvement
- Cleared huge
-
Additional directories: Removed from
state.json- Removed
D:\Document\code\Matlab\7Rmatlabfromadditional_dirs - No improvement
- Removed
-
AGENTS.md files: Temporarily renamed 3 large AGENTS.md files in project
- Total ~22KB of project documentation
- No improvement
-
Moved entire MATLAB directory: Eliminated any file scanning issues
- No improvement
Key Finding: Encoding Corruption
In context.jsonl, we found encoding corruption:
{"role":"user","content":"���"} // Should be "你好"
The file contains invalid UTF-8 sequences, suggesting encoding issues during session persistence.
Current Session State
context.jsonl: 109 lines, ~63KBstate.json: 1.5KBwire.jsonl: ~23KB (cleared)- Tasks directory: ~2MB (cleaned)
- Total: Well under normal limits
Reproduction Steps
- Create a session with extensive MATLAB/technical work
- Run multiple background tasks that generate large outputs
- Upgrade from v1.30.0 to v1.37.0
- Resume the session
- Observe extreme slowness in token generation
Expected Behavior
Session should remain responsive regardless of history, or provide tools to properly clean/reset session without losing core state.
Actual Behavior
Session becomes unusably slow despite all cleanup efforts.
Workaround
Downgrading to v1.30.0 resolves the issue (confirmed by user).
Additional Context
- The session was working fine in v1.30.0
- Only this specific session is affected; other sessions work normally
- System resources are normal (CPU 13-19%, plenty of RAM)
Possible Causes
- v1.37.0 streaming/rendering changes: New version may have introduced performance regression with certain session states
- Encoding handling: Corrupted UTF-8 in context.jsonl may cause parsing overhead
- Background task scanning: Even with cleaned logs, task metadata scanning may be inefficient
Attachments
N/A (session contains sensitive project data)
Checklist
- I have searched existing issues
- I have provided detailed environment info
- I have tested with a fresh session (works fine)
- Downgrading resolves the issue
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the slowdown when resuming the affected session on v1.37.0, comparing it with v1.30.0 and a fresh session. Inspect the session artifacts named in the report—context.jsonl, state.json, wire.jsonl, and task logs—especially the corrupted UTF-8 entry, then identify whether cleanup or encoding state correlates with latency. Done means a reproducible cause and a responsive resumed session without losing core state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matlab, python
- Domain
- cli, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100