fix(cli): progress agent_message émis en live + anti-doublon running/done par progressId — #187 (QA verte)
- Codex: les items agent_message sont désormais tapés en live comme progress (Message/Delta) dès item.completed, au lieu d'être bufferisés dans pending_final jusqu'à l'événement tool/MCP suivant. - Corrélation stable progressId (codex:item:<id>) ajoutée sur ReplyProgress, propagée jusqu'au DTO (ReplyProgressDto.progressId) et au frontend ; le ProgressSettler et la vue procèdent par upsert running -> done au lieu d'empiler des lignes dupliquées. - Tests: chat_bridge (settler par progressId), dto_chat, session codex, CustomAgentChatView (upsert par progressId).
This commit is contained in:
@ -214,6 +214,7 @@ function normalizeProgress(raw: unknown): ReplyProgress | null {
|
||||
const label = optionalString(record.label);
|
||||
if (!label) return null;
|
||||
return {
|
||||
progressId: optionalString(record.progressId),
|
||||
source: isReplyProgressSource(record.source) ? record.source : "providerNative",
|
||||
kind: isReplyProgressKind(record.kind) ? record.kind : "other",
|
||||
stage: isReplyProgressStage(record.stage) ? record.stage : "info",
|
||||
@ -227,6 +228,7 @@ function normalizeProgress(raw: unknown): ReplyProgress | null {
|
||||
|
||||
function progressKey(progress: ReplyProgress): string {
|
||||
return [
|
||||
progress.progressId ?? "",
|
||||
progress.source,
|
||||
progress.kind,
|
||||
progress.stage,
|
||||
@ -248,6 +250,7 @@ function isDelegationProgress(progress: ReplyProgress): boolean {
|
||||
}
|
||||
|
||||
function progressEntityKey(progress: ReplyProgress): string | null {
|
||||
if (progress.progressId) return `id:${progress.progressId}`;
|
||||
const name = normalizedProgressToolName(progress);
|
||||
if (!name) return null;
|
||||
if (isDelegationProgress(progress)) return `delegation:${name}`;
|
||||
@ -256,7 +259,7 @@ function progressEntityKey(progress: ReplyProgress): string | null {
|
||||
}
|
||||
|
||||
function progressStageBucket(progress: ReplyProgress): string {
|
||||
if (!isCenteredToolProgress(progress)) return progress.stage;
|
||||
if (!progressEntityKey(progress)) return progress.stage;
|
||||
if (progress.stage === "started" || progress.stage === "delta") return "started";
|
||||
if (progress.stage === "completed") return "completed";
|
||||
return "info";
|
||||
|
||||
Reference in New Issue
Block a user