mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-08-23 23:56:41 +00:00
fix(transcript): keep other tasks' notifications in task-origin turns
This commit is contained in:
parent
bbb2559160
commit
7c36d456ea
2 changed files with 23 additions and 1 deletions
|
|
@ -896,7 +896,7 @@ export class AgentTranscriptProjector {
|
|||
};
|
||||
return [{ op: 'frame.upsert', turnId: turn.turnId, stepId: step.stepId, frame }];
|
||||
}
|
||||
if (turn.origin?.kind === 'task') return [];
|
||||
if (turn.origin?.kind === 'task' && (turn.origin.taskId === undefined || turn.origin.taskId === event.sourceId)) return [];
|
||||
this.pendingTaskNotifications.push({ text, taskId: event.sourceId });
|
||||
return [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1514,6 +1514,28 @@ describe('AgentTranscriptProjector', () => {
|
|||
expect(turnOps('t1', tx.getItems()).steps[0]!.frames).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('keeps a different task’s notification in a task-origin turn', () => {
|
||||
const projector = new AgentTranscriptProjector('main');
|
||||
const tx = new AgentTranscript('main');
|
||||
const feed = (event: ProjectorBusEvent): void => void tx.apply(projector.map(event));
|
||||
|
||||
feed(ev({ type: 'turn.started', turnId: 1, origin: { kind: 'task', taskId: 'task_1' } }));
|
||||
feed(
|
||||
ev({
|
||||
type: 'task.notified',
|
||||
notificationType: 'task.completed',
|
||||
title: 'Background agent completed',
|
||||
body: 'second task done.',
|
||||
severity: 'info',
|
||||
sourceKind: 'background_task',
|
||||
sourceId: 'task_2',
|
||||
}),
|
||||
);
|
||||
feed(ev({ type: 'turn.step.started', turnId: 1, step: 1 }));
|
||||
const frames = turnOps('t1', tx.getItems()).steps[0]!.frames;
|
||||
expect(frames.map((f) => f.kind === 'text' && f.taskId)).toEqual(['task_2']);
|
||||
});
|
||||
|
||||
it('drops a buffered task notification when the turn ends before the next step', () => {
|
||||
const projector = new AgentTranscriptProjector('main');
|
||||
const tx = new AgentTranscript('main');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue