MoonshotAI / MoonshotAI/kimi-cli
Yolo mode incorrectly conflates auto-approve with non-interactive, blocking AskUserQuestion
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.4k
- Forks
- 1.3k
- Avg merge
- 9h 47m
- Merged PRs (30d)
- 2
Description
What feature would you like to see?
│ 2 + │
│ 3 + > 修复时间:2026-04-25 │
│ 4 + > 修复者:用户 + Kimi Code CLI │
│ 5 + > 涉及版本:kimi-cli(本地安装版) │
│ 6 + │
│ 7 + --- │
│
│ 35 + markdown │ │ 36 + ## Problem Summary │ │ 37 + │ │ 38 + The current implementation of **yolo mode** conflates two orthogonal concepts: │ │ 39 + │ │ 40 + 1. **Auto-approve** — skip user confirmation before executing tools (the intended purpose of yolo) │ │ 41 + 2. **Non-interactive** — assume the user cannot respond to questions │ │ 42 + │ │ 43 + This causes `AskUserQuestion` to be **hard-blocked** when yolo is enabled, even if the user is ac… │ │ 44 + │ │ 45 + ## Current Behavior │ │ 46 + │ │ 47 + When yolo mode is active: │ │ 48 + - A system reminder is injected: "You are running in non-interactive mode. The user cannot answer… │ │ 49 + - `AskUserQuestion` tool calls are auto-dismissed with: │ │ 50 + │
│ 51 + Non-interactive mode, auto-dismissed. │
│ 52 + {"answers": {}, "note": "Running in non-interactive (yolo) mode. Make your own decision."} │
│ 53 + │ │ 54 + │ │ 55 + This is incorrect because: │ │ 56 + - The user **is** present at the terminal and **can** provide clarifications │ │ 57 + - Yolo should only mean "I trust the AI to execute tools without asking me every time" │ │ 58 + - It should **not** mean "I never want to answer the AI's questions, even when it needs clarifica… │ │ 59 + │ │ 60 + ## Expected Behavior │ │ 61 + │ │ 62 + - Yolo mode = auto-approve tool executions │ │ 63 + - `AskUserQuestion` should remain functional in yolo mode │ │ 64 + - The AI should be allowed (and encouraged) to ask for user intent when facing ambiguous or risky… │ │ 65 + │ │ 66 + ## Root Cause Analysis │ │ 67 + │ │ 68 + Three locations in the codebase incorrectly bind yolo to non-interactive behavior: │ │ 69 + │ │ 70 + ### 1. System prompt injection (`soul/dynamic_injections/yolo_mode.py`) │ │ 71 +python │
│ 72 + _YOLO_PROMPT = ( │
│ 73 + "You are running in non-interactive mode. The user cannot answer questions " │
│ 74 + "or provide feedback during execution.\n" │
│ 75 + "- Do NOT call AskUserQuestion. ..." │
│ 76 + ) │
│ 77 + │ │ 78 + │ │ 79 + ### 2. Hard-coded interception (`tools/ask_user/__init__.py`) │ │ 80 +python │
│ 81 + async def call(self, params: Params) -> ToolReturnValue: │
│ 82 + if self._is_yolo and self._is_yolo(): │
│ 83 + return ToolReturnValue( │
│ 84 + is_error=False, │
│ 85 + output='{"answers": {}, "note": "Running in non-interactive (yolo) mode. Make your ow… │
│ 86 + message="Non-interactive mode, auto-dismissed.", │
│ 87 + ... │
│ 88 + ) │
│ 89 + │ │ 90 + │ │ 91 + ### 3. Binding in KimiSoul (`soul/kimisoul.py`) │ │ 92 +python │
│ 93 + ask_tool.bind_approval(self._approval.is_yolo) │
│ 94 + │ │ 95 + │ │ 96 + ## Proposed Fix │ │ 97 + │ │ 98 + ### Option A: Decouple the concepts (recommended) │ │ 99 + │ │ 100 + 1. **Update `soul/dynamic_injections/yolo_mode.py`** │ │ 101 + - Remove "non-interactive" language │ │ 102 + - Remove the prohibition on `AskUserQuestion` │ │ 103 + - Encourage the AI to communicate with the user for risky operations │ │ 104 + │ │ 105 + 2. **Remove interception from `tools/ask_user/__init__.py`** │ │ 106 + - Delete the yolo check in `__call__` │ │ 107 + - Remove `bind_approval` and `_is_yolo` │ │ 108 + │ │ 109 + 3. **Clean up binding in `soul/kimisoul.py`** │ │ 110 + - Remove the `AskUserQuestion` yolo binding │ │ 111 + - Update `is_yolo` docstring to remove "non-interactive" │ │ 112 + │ │ 113 + ### Option B: Add a separate configuration toggle │ │ 114 + │ │ 115 + Keep current behavior as default but add `yolo_allow_questions: bool` config. More complex and le… │ │ 116 + │ │ 117 + ## Patch / Diff │ │ 118 + │ │ 119 + See the attached PR or the following summary of changes: │ │ 120 + │ │ 121 + **`soul/dynamic_injections/yolo_mode.py`**: │ │ 122 + - Replaced the entire `_YOLO_PROMPT` with a message that: │ │ 123 + - States the AI is in yolo mode with auto-execution rights │ │ 124 + - Encourages communication with user for risky operations │ │ 125 + - Explicitly allows `AskUserQuestion` to clarify user intent │ │ 126 + │ │ 127 + **`tools/ask_user/__init__.py`**: │ │ 128 + - Removed `__init__`, `bind_approval`, and the yolo interception block from `__call__` │ │ 129 + - `AskUserQuestion` now proceeds normally regardless of yolo state │ │ 130 + │ │ 131 + **`soul/kimisoul.py`**: │ │ 132 + - Removed the `AskUserQuestion.bind_approval()` call in `_bind_plan_mode_tools()` │ │ 133 + - Updated `is_yolo` property docstring from `"auto-approve / non-interactive"` to `"auto-approve"` │ │ 134 + │ │ 135 + ## Testing Notes │ │ 136 + │ │ 137 + After applying the patch and restarting kimi-cli: │ │ 138 + 1. Enable yolo mode with `/yolo` │ │ 139 + 2. Ask the AI to do something ambiguous │ │ 140 + 3. The AI should now be able to call `AskUserQuestion` and receive your answer │ │ 141 + 4. Previously this would have been auto-dismissed │ │ 142 + │ │ 143 + ## Use Case │ │ 144 + │ │ 145 + A user enables yolo because they don't want to confirm every `Shell` or `WriteFile` operation. Bu… │ │ 146 + │
│ 147 + │
│ 148 + --- │
│ 149 + │
│ 150 + ## 🔧 实际修改的代码 Diff(供 PR 使用) │
│ 151 + │
│ 152 + ### File 1: soul/dynamic_injections/yolo_mode.py │
│ 153 + │
│ 154 + diff │ │ 155 + _YOLO_PROMPT = ( │ │ 156 + - "You are running in non-interactive mode. The user cannot answer questions " │ │ 157 + - "or provide feedback during execution.\n" │ │ 158 + - "- Do NOT call AskUserQuestion. If you need to make a decision, make your " │ │ 159 + - "best judgment and proceed.\n" │ │ 160 + - "- For EnterPlanMode / ExitPlanMode, they will be auto-approved. You can use " │ │ 161 + - "them normally but expect no user feedback." │ │ 162 + + "你现在处于yolo模式,用户给了你自由执行命令的权利,所以在执行一个或许有危险的操作时" │ │ 163 + + "务必与用户沟通确定后才执行,而对于无危险操作便尽量不要打扰用户,你可以自由地调用" │ │ 164 + + "AskUserQuestion工具来确定用户的意图,信息足够才能有好的执行。\n" │ │ 165 + + "- 对于 EnterPlanMode / ExitPlanMode,它们将被自动批准。" │ │ 166 + ) │ │ 167 + │
│ 168 + │
│ 169 + ### File 2: tools/ask_user/__init__.py │
│ 170 + │
│ 171 + diff │ │ 172 + - def __init__(self) -> None: │ │ 173 + - super().__init__() │ │ 174 + - self._is_yolo: Callable[[], bool] | None = None │ │ 175 + - │ │ 176 + - def bind_approval(self, is_yolo: Callable[[], bool]) -> None: │ │ 177 + - """Late-bind yolo checker so we can auto-dismiss in non-interactive mode.""" │ │ 178 + - self._is_yolo = is_yolo │ │ 179 + - │ │ 180 + @override │ │ 181 + async def __call__(self, params: Params) -> ToolReturnValue: │ │ 182 + - if self._is_yolo and self._is_yolo(): │ │ 183 + - return ToolReturnValue( │ │ 184 + - is_error=False, │ │ 185 + - output=( │ │ 186 + - '{"answers": {}, "note": "Running in non-interactive' │ │ 187 + - ' (yolo) mode. Make your own decision."}' │ │ 188 + - ), │ │ 189 + - message="Non-interactive mode, auto-dismissed.", │ │ 190 + - display=[BriefDisplayBlock(text="Auto-dismissed (yolo)")], │ │ 191 + - ) │ │ 192 + - │ │ 193 + wire = get_wire_or_none() │ │ 194 + │
│ 195 + │
│ 196 + ### File 3: soul/kimisoul.py │
│ 197 + │
│ 198 + diff │ │ 199 + @property │ │ 200 + def is_yolo(self) -> bool: │ │ 201 + - """Whether yolo (auto-approve / non-interactive) mode is enabled.""" │ │ 202 + + """Whether yolo (auto-approve) mode is enabled.""" │ │ 203 + return self._approval.is_yolo() │ │ 204 + │
│ 205 + │
│ 206 + diff │ │ 207 + - # AskUserQuestion — bind yolo checker for auto-dismiss │ │ 208 + - from kimi_cli.tools.ask_user import AskUserQuestion │ │ 209 + - │ │ 210 + - ask_tool = self._agent.toolset.find("AskUserQuestion") │ │ 211 + - if isinstance(ask_tool, AskUserQuestion): │ │ 212 + - ask_tool.bind_approval(self._approval.is_yolo) │ │ 213 + - │ │ 214 + def _ensure_plan_session_id(self) -> None: │ │ 215 + │
│ 216 +
Additional information
No response
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 with soul/dynamic_injections/yolo_mode.py, tools/ask_user/init.py, and soul/kimisoul.py, following the yolo prompt and AskUserQuestion approval binding. Verify that yolo communicates auto-approval without describing the session as non-interactive, and that AskUserQuestion proceeds normally; done means the three listed yolo couplings are removed or decoupled as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100