You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: prevent Kimi K2 model from completing tasks without performing actions
- Add validation in attempt_completion to check if actual work was done
- Add model-specific instructions in system prompt for Kimi K2
- Track premature completion attempts via telemetry
- Add comprehensive tests for the new validation logic
Fixes#5999
Copy file name to clipboardExpand all lines: src/core/prompts/sections/rules.ts
+12-1Lines changed: 12 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,7 @@ export function getRulesSection(
50
50
supportsComputerUse: boolean,
51
51
diffStrategy?: DiffStrategy,
52
52
codeIndexManager?: CodeIndexManager,
53
+
modelId?: string,
53
54
): string{
54
55
constisCodebaseSearchAvailable=
55
56
codeIndexManager&&
@@ -61,11 +62,21 @@ export function getRulesSection(
61
62
? "- **CRITICAL: For ANY exploration of code you haven't examined yet in this conversation, you MUST use the `codebase_search` tool FIRST before using search_files or other file exploration tools.** This requirement applies throughout the entire conversation, not just when starting a task. The codebase_search tool uses semantic search to find relevant code based on meaning, not just keywords, making it much more effective for understanding how features are implemented. Even if you've already explored some parts of the codebase, any new area or functionality you need to understand requires using codebase_search first.\n"
? `- **CRITICAL FOR KIMI K2 MODEL**: You MUST complete the actual implementation before using attempt_completion. Simply identifying issues without fixing them is NOT acceptable. You must:
69
+
1. Use appropriate tools to make the necessary changes (write_to_file, apply_diff, etc.)
70
+
2. Verify that your changes have been applied
71
+
3. Only then use attempt_completion to present your completed work
72
+
Attempting completion without performing actual work will result in an error.\n`
73
+
: ""
74
+
64
75
return`====
65
76
66
77
RULES
67
78
68
-
- The project base directory is: ${cwd.toPosix()}
79
+
${kimiK2Rules}- The project base directory is: ${cwd.toPosix()}
69
80
- All file paths must be relative to this directory. However, commands may change directories in terminals, so respect working directory specified by the response to <execute_command>.
70
81
- You cannot \`cd\` into a different directory to complete a task. You are stuck operating from '${cwd.toPosix()}', so be sure to pass in the correct 'path' parameter when using tools that require a path.
71
82
- Do not use the ~ character or $HOME to refer to the home directory.
"Cannot complete task without performing any actions. You identified the issue but haven't implemented the fix yet. Please use the appropriate tools to make the necessary changes before attempting completion.",
0 commit comments