Skip to content

Commit e8c1c3b

Browse files
committed
Revert "Fix duplicate reviewer agent card"
This reverts commit 6a18ebf.
1 parent 19d3025 commit e8c1c3b

7 files changed

Lines changed: 4 additions & 115 deletions

File tree

cli/src/utils/__tests__/message-block-helpers.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ describe('getAgentBaseName', () => {
3939
expect(getAgentBaseName('file-picker')).toBe('file-picker')
4040
})
4141

42-
test('normalizes direct tool aliases to canonical agent names', () => {
43-
expect(getAgentBaseName('code_reviewer_lite')).toBe('code-reviewer-lite')
44-
})
45-
4642
test('handles scoped name without version', () => {
4743
expect(getAgentBaseName('codebuff/file-picker')).toBe('file-picker')
4844
})

cli/src/utils/__tests__/sdk-event-handlers.test.ts

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -212,89 +212,6 @@ describe('sdk-event-handlers', () => {
212212
expect(getStreamingAgents().has('tool-1-0')).toBe(false)
213213
})
214214

215-
test('matches underscore direct-tool aliases to hyphenated agent ids', () => {
216-
const { ctx, getMessages, getStreamingAgents } = createTestContext()
217-
const handleEvent = createEventHandler(ctx)
218-
const handleChunk = createStreamChunkHandler(ctx)
219-
220-
handleEvent({
221-
type: 'tool_call',
222-
toolCallId: 'tool-1',
223-
toolName: 'spawn_agents',
224-
input: {
225-
agents: [
226-
{
227-
agent_type: 'code_reviewer_lite',
228-
prompt: 'Review this change',
229-
},
230-
],
231-
},
232-
agentId: 'main-agent',
233-
parentAgentId: undefined,
234-
} as any)
235-
236-
handleEvent({
237-
type: 'subagent_start',
238-
agentId: 'agent-real',
239-
agentType: 'code-reviewer-lite',
240-
displayName: 'Code Reviewer Lite',
241-
onlyChild: true,
242-
parentAgentId: undefined,
243-
params: undefined,
244-
prompt: 'Review this change',
245-
})
246-
247-
handleChunk({
248-
type: 'subagent_chunk',
249-
agentId: 'agent-real',
250-
agentType: 'code-reviewer-lite',
251-
chunk: 'streamed review',
252-
})
253-
254-
handleEvent({
255-
type: 'subagent_finish',
256-
agentId: 'agent-real',
257-
agentType: 'code-reviewer-lite',
258-
displayName: 'Code Reviewer Lite',
259-
onlyChild: true,
260-
parentAgentId: undefined,
261-
params: undefined,
262-
prompt: 'Review this change',
263-
})
264-
265-
handleEvent({
266-
type: 'tool_result',
267-
toolCallId: 'tool-1',
268-
toolName: 'spawn_agents',
269-
output: [
270-
{
271-
type: 'json',
272-
value: [
273-
{
274-
agentName: 'code-reviewer-lite',
275-
agentType: 'code-reviewer-lite',
276-
value: 'streamed review',
277-
},
278-
],
279-
},
280-
],
281-
} as any)
282-
283-
const blocks = getMessages()[0].blocks ?? []
284-
expect(blocks).toHaveLength(1)
285-
const agentBlock = blocks[0] as AgentContentBlock
286-
expect(agentBlock.agentId).toBe('agent-real')
287-
expect(agentBlock.agentName).toBe('code-reviewer-lite')
288-
expect(agentBlock.agentType).toBe('code-reviewer-lite')
289-
expect(agentBlock.status).toBe('complete')
290-
expect(agentBlock.blocks).toHaveLength(1)
291-
expect(agentBlock.blocks?.[0]).toMatchObject({
292-
type: 'text',
293-
content: 'streamed review',
294-
})
295-
expect(getStreamingAgents().size).toBe(0)
296-
})
297-
298215
test('handles spawn_agents tool results and clears streaming agents', () => {
299216
const { ctx, getMessages, getStreamingAgents } = createTestContext()
300217
ctx.message.updater.addBlock(

cli/src/utils/__tests__/send-message-helpers.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,10 +1325,6 @@ describe('getAgentBaseName', () => {
13251325
test('returns simple name unchanged', () => {
13261326
expect(getAgentBaseName('file-picker')).toBe('file-picker')
13271327
})
1328-
1329-
test('normalizes direct tool aliases to canonical agent names', () => {
1330-
expect(getAgentBaseName('code_reviewer_lite')).toBe('code-reviewer-lite')
1331-
})
13321328
})
13331329

13341330
describe('agentTypesMatch', () => {

cli/src/utils/message-block-helpers.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ import type {
1616
* getAgentBaseName('codebuff/file-picker@0.0.2') // 'file-picker'
1717
* getAgentBaseName('file-picker@1.0.0') // 'file-picker'
1818
* getAgentBaseName('file-picker') // 'file-picker'
19-
* getAgentBaseName('file_picker') // 'file-picker'
2019
*/
2120
export const getAgentBaseName = (type: string): string => {
2221
const segment = type.split('/').pop() ?? type
23-
return segment.split('@')[0].replace(/_/g, '-')
22+
return segment.split('@')[0]
2423
}
2524

2625
/**
@@ -467,7 +466,6 @@ export const moveSpawnAgentBlock = (
467466
parentId?: string,
468467
params?: Record<string, unknown>,
469468
prompt?: string,
470-
realAgentType?: string,
471469
): ContentBlock[] => {
472470
const updateAgentBlock = (block: ContentBlock): ContentBlock => {
473471
if (block.type !== 'agent') {
@@ -486,11 +484,6 @@ export const moveSpawnAgentBlock = (
486484
updatedBlock.initialPrompt = prompt
487485
}
488486

489-
if (realAgentType) {
490-
updatedBlock.agentType = realAgentType
491-
updatedBlock.agentName = realAgentType
492-
}
493-
494487
return updatedBlock
495488
}
496489

cli/src/utils/sdk-event-handlers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ const handleSubagentStart = (
183183
blocks,
184184
match: spawnAgentMatch,
185185
realAgentId: event.agentId,
186-
realAgentType: event.agentType,
187186
parentAgentId: event.parentAgentId,
188187
params: event.params,
189188
prompt: event.prompt,

cli/src/utils/spawn-agent-matcher.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export const resolveSpawnAgentToReal = (options: {
2828
blocks: ContentBlock[]
2929
match: SpawnAgentMatch
3030
realAgentId: string
31-
realAgentType?: string
3231
parentAgentId?: string
3332
params?: Record<string, unknown>
3433
prompt?: string
@@ -37,7 +36,6 @@ export const resolveSpawnAgentToReal = (options: {
3736
blocks,
3837
match,
3938
realAgentId,
40-
realAgentType,
4139
parentAgentId,
4240
params: agentParams,
4341
prompt,
@@ -50,6 +48,5 @@ export const resolveSpawnAgentToReal = (options: {
5048
parentAgentId,
5149
agentParams,
5250
prompt,
53-
realAgentType,
5451
)
5552
}

packages/agent-runtime/src/tools/tool-executor.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { endsAgentStepParam, toolNames } from '@codebuff/common/tools/constants'
22
import { toolParams } from '@codebuff/common/tools/list'
3-
import { normalizeAgentIdForLookup } from '@codebuff/common/util/agent-id-parsing'
43
import { generateCompactId } from '@codebuff/common/util/string'
54
import { cloneDeep } from 'lodash'
65

@@ -370,9 +369,7 @@ export async function executeToolCall<T extends ToolName>(
370369
}
371370
}
372371

373-
let agentIdToLoad = isBaseAgent
374-
? normalizeAgentIdForLookup(agentTypeStr)
375-
: agentTypeStr
372+
let agentIdToLoad = agentTypeStr
376373
if (!isBaseAgent) {
377374
const matchingSpawn = getMatchingSpawn(
378375
agentTemplate.spawnableAgents,
@@ -421,13 +418,7 @@ export async function executeToolCall<T extends ToolName>(
421418
}
422419
}
423420

424-
return {
425-
valid: true as const,
426-
agent: {
427-
...(agent as Record<string, unknown>),
428-
agent_type: agentIdToLoad,
429-
},
430-
}
421+
return { valid: true as const, agent }
431422
}),
432423
)
433424

@@ -456,8 +447,8 @@ export async function executeToolCall<T extends ToolName>(
456447
}
457448
const errorMsg = `Some agents could not be spawned: ${errors.join('; ')}. Proceeding with valid agents only.`
458449
onResponseChunk({ type: 'error', message: errorMsg })
450+
effectiveInput = { ...effectiveInput, agents: validAgents }
459451
}
460-
effectiveInput = { ...effectiveInput, agents: validAgents }
461452
}
462453
}
463454

0 commit comments

Comments
 (0)