fix(openai): Cline fallback에 workspace root 실행을 명시

This commit is contained in:
toki 2026-06-27 23:03:22 +09:00
parent 87d2929a56
commit a342d584c5
4 changed files with 8 additions and 0 deletions

View file

@ -528,6 +528,7 @@ func textToolFallbackInstruction(tools any) (string, bool) {
}
return "Tool calls must be emitted as plain text because this backend does not support native OpenAI tool calling. When a tool is needed, respond with exactly one tool call and no markdown:\n" +
"<tool_call>\n<function=TOOL_NAME>\n<parameter=PARAMETER_NAME>JSON_VALUE</parameter>\n</function>\n</tool_call>\n" +
"run_commands executes from the client workspace root. Do not prepend cd to an absolute workspace path unless the user explicitly asks to operate in a different directory; prefer current-workspace commands such as git status.\n" +
"Use valid JSON for each parameter value and follow the supplied parameter schema. Available tools JSON: " + string(encoded), true
}

View file

@ -434,6 +434,9 @@ func TestOpenAICompatExecuteFallsBackToTextToolsWhenNativeToolsUnsupported(t *te
if first["role"] != "system" || !strings.Contains(first["content"].(string), "<tool_call>") || !strings.Contains(first["content"].(string), "run_commands") {
t.Fatalf("fallback system instruction missing tool format/name: %+v", first)
}
if !strings.Contains(first["content"].(string), "client workspace root") || !strings.Contains(first["content"].(string), "Do not prepend cd") {
t.Fatalf("fallback system instruction missing workspace-root guidance: %+v", first)
}
if !strings.Contains(first["content"].(string), "Existing Cline system prompt.") {
t.Fatalf("fallback system instruction did not preserve existing system content: %+v", first)
}

View file

@ -463,6 +463,7 @@ func textToolFallbackInstruction(tools any) (string, bool) {
}
return "Tool calls must be emitted as plain text because this backend does not support native OpenAI tool calling. When a tool is needed, respond with exactly one tool call and no markdown:\n" +
"<tool_call>\n<function=TOOL_NAME>\n<parameter=PARAMETER_NAME>JSON_VALUE</parameter>\n</function>\n</tool_call>\n" +
"run_commands executes from the client workspace root. Do not prepend cd to an absolute workspace path unless the user explicitly asks to operate in a different directory; prefer current-workspace commands such as git status.\n" +
"Use valid JSON for each parameter value and follow the supplied parameter schema. Available tools JSON: " + string(encoded), true
}

View file

@ -306,6 +306,9 @@ func TestVllmExecuteFallsBackToTextToolsWhenNativeToolsUnsupported(t *testing.T)
if first["role"] != "system" || !strings.Contains(first["content"].(string), "<tool_call>") || !strings.Contains(first["content"].(string), "run_commands") {
t.Fatalf("fallback system instruction missing tool format/name: %+v", first)
}
if !strings.Contains(first["content"].(string), "client workspace root") || !strings.Contains(first["content"].(string), "Do not prepend cd") {
t.Fatalf("fallback system instruction missing workspace-root guidance: %+v", first)
}
if !strings.Contains(first["content"].(string), "Existing Cline system prompt.") {
t.Fatalf("fallback system instruction did not preserve existing system content: %+v", first)
}