slug エージェントが暴走するのを対処
This commit is contained in:
parent
d185039c73
commit
eb32cf0138
@ -130,6 +130,7 @@ describe('template file existence', () => {
|
|||||||
'score_interactive_policy',
|
'score_interactive_policy',
|
||||||
'score_summary_system_prompt',
|
'score_summary_system_prompt',
|
||||||
'score_slug_system_prompt',
|
'score_slug_system_prompt',
|
||||||
|
'score_slug_user_prompt',
|
||||||
'perform_phase1_message',
|
'perform_phase1_message',
|
||||||
'perform_phase2_message',
|
'perform_phase2_message',
|
||||||
'perform_phase3_message',
|
'perform_phase3_message',
|
||||||
|
|||||||
@ -57,20 +57,25 @@ describe('summarizeTaskName', () => {
|
|||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
});
|
});
|
||||||
|
|
||||||
// When
|
// When
|
||||||
const result = await summarizeTaskName('long task name for testing', { cwd: '/project' });
|
const result = await summarizeTaskName('long task name for testing', { cwd: '/project' });
|
||||||
|
|
||||||
// Then
|
// Then
|
||||||
expect(result).toBe('add-auth');
|
expect(result).toBe('add-auth');
|
||||||
expect(mockGetProvider).toHaveBeenCalledWith('claude');
|
expect(mockGetProvider).toHaveBeenCalledWith('claude');
|
||||||
expect(mockProviderCall).toHaveBeenCalledWith(
|
const callPrompt = mockProviderCall.mock.calls[0]?.[0];
|
||||||
'long task name for testing',
|
expect(callPrompt).toContain('Generate a slug from the task description below.');
|
||||||
expect.objectContaining({
|
expect(callPrompt).toContain('<task_description>');
|
||||||
cwd: '/project',
|
expect(callPrompt).toContain('long task name for testing');
|
||||||
allowedTools: [],
|
expect(callPrompt).toContain('</task_description>');
|
||||||
})
|
expect(mockProviderCall).toHaveBeenCalledWith(
|
||||||
);
|
expect.any(String),
|
||||||
});
|
expect.objectContaining({
|
||||||
|
cwd: '/project',
|
||||||
|
permissionMode: 'readonly',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('should return AI-generated slug for English task name', async () => {
|
it('should return AI-generated slug for English task name', async () => {
|
||||||
// Given
|
// Given
|
||||||
|
|||||||
@ -70,10 +70,11 @@ export class TaskSummarizer {
|
|||||||
name: 'summarizer',
|
name: 'summarizer',
|
||||||
systemPrompt: loadTemplate('score_slug_system_prompt', 'en'),
|
systemPrompt: loadTemplate('score_slug_system_prompt', 'en'),
|
||||||
});
|
});
|
||||||
const response = await agent.call(taskName, {
|
const prompt = loadTemplate('score_slug_user_prompt', 'en', { taskDescription: taskName });
|
||||||
|
const response = await agent.call(prompt, {
|
||||||
cwd: options.cwd,
|
cwd: options.cwd,
|
||||||
model,
|
model,
|
||||||
allowedTools: [],
|
permissionMode: 'readonly',
|
||||||
});
|
});
|
||||||
|
|
||||||
const slug = sanitizeSlug(response.content);
|
const slug = sanitizeSlug(response.content);
|
||||||
|
|||||||
12
src/shared/prompts/en/score_slug_user_prompt.md
Normal file
12
src/shared/prompts/en/score_slug_user_prompt.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!--
|
||||||
|
template: score_slug_user_prompt
|
||||||
|
role: user prompt for task-name-to-slug generation
|
||||||
|
vars: taskDescription
|
||||||
|
caller: infra/task/summarize
|
||||||
|
-->
|
||||||
|
Generate a slug from the task description below.
|
||||||
|
Output ONLY the slug text.
|
||||||
|
|
||||||
|
<task_description>
|
||||||
|
{{taskDescription}}
|
||||||
|
</task_description>
|
||||||
12
src/shared/prompts/ja/score_slug_user_prompt.md
Normal file
12
src/shared/prompts/ja/score_slug_user_prompt.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<!--
|
||||||
|
template: score_slug_user_prompt
|
||||||
|
role: user prompt for task-name-to-slug generation
|
||||||
|
vars: taskDescription
|
||||||
|
caller: infra/task/summarize
|
||||||
|
-->
|
||||||
|
Generate a slug from the task description below.
|
||||||
|
Output ONLY the slug text.
|
||||||
|
|
||||||
|
<task_description>
|
||||||
|
{{taskDescription}}
|
||||||
|
</task_description>
|
||||||
Loading…
x
Reference in New Issue
Block a user