fix: update additional missed <task> and <feedback> usages

- src/services/command/built-in-commands.ts: Change <task> to <user_message> in init command
- src/core/tools/ExecuteCommandTool.ts: Change <feedback> to <user_message> for running command feedback
- src/core/mentions/processUserContentMentions.ts: Update comment to reflect new tag
- src/core/tools/__tests__/readFileTool.spec.ts: Update mock implementations

Note: <task> tags in fetch_instructions tool remain unchanged as they are
XML tool parameters (parameter name = 'task'), not user content wrappers.
This commit is contained in:
Hannes Rudolph 2025-12-03 21:50:34 -07:00
parent 0d013e35c4
commit a23f1ea98a
4 changed files with 8 additions and 18 deletions

View file

@ -30,13 +30,10 @@ export async function processUserContentMentions({
// Process userContent array, which contains various block types:
// TextBlockParam, ImageBlockParam, ToolUseBlockParam, and ToolResultBlockParam.
// We need to apply parseMentions() to:
// 1. All TextBlockParam's text (first user message with task)
// 1. All TextBlockParam's text (first user message)
// 2. ToolResultBlockParam's content/context text arrays if it contains
// "<feedback>" (see formatToolDeniedFeedback, attemptCompletion,
// executeCommand, and consecutiveMistakeCount >= 3) or "<answer>"
// (see askFollowupQuestion), we place all user generated content in
// these tags so they can effectively be used as markers for when we
// should parse mentions).
// "<user_message>" - we place all user generated content in this tag
// so it can effectively be used as a marker for when we should parse mentions.
return Promise.all(
userContent.map(async (block) => {
const shouldProcessMentions = (text: string) => text.includes("<user_message>")

View file

@ -337,8 +337,7 @@ export async function executeCommandInTerminal(
[
`Command is still running in terminal from '${terminal.getCurrentWorkingDirectory().toPosix()}'.`,
result.length > 0 ? `Here's the output so far:\n${result}\n` : "\n",
`The user provided the following feedback:`,
`<feedback>\n${text}\n</feedback>`,
`<user_message>\n${text}\n</user_message>`,
].join("\n"),
images,
),

View file

@ -86,14 +86,8 @@ const { toolResultMock, imageBlocksMock } = vi.hoisted(() => {
vi.mock("../../prompts/responses", () => ({
formatResponse: {
toolDenied: vi.fn(() => "The user denied this operation."),
toolDeniedWithFeedback: vi.fn(
(feedback?: string) =>
`The user denied this operation and provided the following feedback:\n<feedback>\n${feedback}\n</feedback>`,
),
toolApprovedWithFeedback: vi.fn(
(feedback?: string) =>
`The user approved this operation and provided the following context:\n<feedback>\n${feedback}\n</feedback>`,
),
toolDeniedWithFeedback: vi.fn((feedback?: string) => `<user_message>\n${feedback}\n</user_message>`),
toolApprovedWithFeedback: vi.fn((feedback?: string) => `<user_message>\n${feedback}\n</user_message>`),
rooIgnoreError: vi.fn(
(path: string) =>
`Access to ${path} is blocked by the .rooignore file settings. You must try to continue in the task without using this file, or ask the user to update the .rooignore file.`,

View file

@ -11,11 +11,11 @@ const BUILT_IN_COMMANDS: Record<string, BuiltInCommandDefinition> = {
init: {
name: "init",
description: "Analyze codebase and create concise AGENTS.md files for AI assistants",
content: `<task>
content: `<user_message>
Please analyze this codebase and create an AGENTS.md file containing:
1. Build/lint/test commands - especially for running a single test
2. Code style guidelines including imports, formatting, types, naming conventions, error handling, etc.
</task>
</user_message>
<initialization>
<purpose>