mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix(cli): stop prepending skill_lookup $name instruction onto user turns (#1096)
Cursor ACP (and other remotes) flagged the glued-on SKILL_LOOKUP_INSTRUCTION as prompt injection. Keep discovery on the skill_lookup MCP tool description and on system prompts (OpenCode/Grok); do not taint user messages. Fixes #1095 Co-authored-by: Debian <heavygee@oos-linux.in.lockhouse> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Debian
Cursor
parent
b74a11ecc3
commit
af962fc61f
@@ -10,8 +10,6 @@ import type { PermissionMode } from './types';
|
||||
import { createKimiBackend } from './utils/kimiBackend';
|
||||
import { KimiPermissionHandler } from './utils/permissionHandler';
|
||||
import { resolveKimiRuntimeConfig } from './utils/config';
|
||||
import { SKILL_LOOKUP_INSTRUCTION } from '@/modules/common/skillLookupInstruction';
|
||||
|
||||
class KimiRemoteLauncher extends RemoteLauncherBase {
|
||||
private readonly session: KimiSession;
|
||||
private readonly model?: string;
|
||||
@@ -24,8 +22,6 @@ class KimiRemoteLauncher extends RemoteLauncherBase {
|
||||
private currentBackendModel: string | null = null;
|
||||
private setModelSupported: boolean | undefined = undefined;
|
||||
private lastDisplayedToolCall = new Map<string, string>();
|
||||
private skillLookupInstructionSent = false;
|
||||
|
||||
constructor(session: KimiSession, opts: { model?: string }) {
|
||||
super(process.env.DEBUG ? session.logPath : undefined);
|
||||
this.session = session;
|
||||
@@ -171,15 +167,11 @@ class KimiRemoteLauncher extends RemoteLauncherBase {
|
||||
this.applyDisplayMode(batch.mode.permissionMode, batch.mode.model);
|
||||
messageBuffer.addMessage(batch.message, 'user');
|
||||
|
||||
let messageText = batch.message;
|
||||
if (!this.skillLookupInstructionSent && !messageText.trimStart().startsWith('/')) {
|
||||
messageText = `${SKILL_LOOKUP_INSTRUCTION}\n\n${messageText}`;
|
||||
this.skillLookupInstructionSent = true;
|
||||
}
|
||||
|
||||
// skill_lookup discovery lives on the MCP tool description — do not
|
||||
// prepend instructions onto user turns (prompt-injection false positive).
|
||||
const promptContent: PromptContent[] = [{
|
||||
type: 'text',
|
||||
text: messageText
|
||||
text: batch.message
|
||||
}];
|
||||
|
||||
session.onThinkingChange(true);
|
||||
|
||||
Reference in New Issue
Block a user