fix: use task_started description as immediate heading, dedupe final

- Show subagent description from task_started immediately (no 30s wait)
- Remove AI summary (agentProgressSummaries) — task_started is sufficient
- Revert progress heading to previous when final text matches current
- Track previousProgressText in direct-update path
This commit is contained in:
Eyejoker
2026-03-23 19:20:23 +09:00
parent a8a1c9b45a
commit 83df0e7dc1
2 changed files with 29 additions and 11 deletions

View File

@@ -555,14 +555,6 @@ async function runQuery(
const tp = message as Record<string, unknown>; const tp = message as Record<string, unknown>;
const summary = typeof tp.summary === 'string' ? tp.summary : ''; const summary = typeof tp.summary === 'string' ? tp.summary : '';
const description = typeof tp.description === 'string' ? tp.description : ''; const description = typeof tp.description === 'string' ? tp.description : '';
if (summary) {
writeOutput({
status: 'success',
phase: 'progress',
result: `📋 ${summary}`,
newSessionId,
});
}
if (description) { if (description) {
writeOutput({ writeOutput({
status: 'success', status: 'success',
@@ -574,8 +566,17 @@ async function runQuery(
} }
if (message.type === 'system' && (message as { subtype?: string }).subtype === 'task_started') { if (message.type === 'system' && (message as { subtype?: string }).subtype === 'task_started') {
const ts = message as { task_id: string; teammate_name?: string }; const ts = message as { task_id: string; description?: string };
log(`Subagent started: task=${ts.task_id} name=${ts.teammate_name || 'unknown'}`); const desc = ts.description || '';
log(`Subagent started: task=${ts.task_id} desc=${desc.slice(0, 200)}`);
if (desc) {
writeOutput({
status: 'success',
phase: 'progress',
result: `🔄 ${desc}`,
newSessionId,
});
}
} }
if (message.type === 'tool_progress') { if (message.type === 'tool_progress') {

View File

@@ -133,6 +133,7 @@ export class MessageTurnController {
if (text) { if (text) {
if (this.progressMessageId) { if (this.progressMessageId) {
// Progress message already visible — update heading directly // Progress message already visible — update heading directly
this.previousProgressText = this.latestProgressText;
this.latestProgressText = text; this.latestProgressText = text;
this.toolActivities = []; this.toolActivities = [];
void this.syncTrackedProgressMessage(); void this.syncTrackedProgressMessage();
@@ -153,6 +154,18 @@ export class MessageTurnController {
// then discard the pending buffer so it never shows up. // then discard the pending buffer so it never shows up.
if (text) { if (text) {
await this.flushPendingProgress(text); await this.flushPendingProgress(text);
// If the displayed progress heading matches the final text,
// revert to the previous heading so it doesn't show twice.
if (
this.latestProgressText === text &&
this.previousProgressText &&
this.progressMessageId &&
this.options.channel.editMessage
) {
this.latestProgressText = this.previousProgressText;
this.toolActivities = [];
await this.syncTrackedProgressMessage();
}
await this.finalizeProgressMessage(); await this.finalizeProgressMessage();
await this.deliverFinalText(text); await this.deliverFinalText(text);
} else if (raw) { } else if (raw) {
@@ -377,7 +390,11 @@ export class MessageTurnController {
} }
this.progressTicker = setInterval(() => { this.progressTicker = setInterval(() => {
if (this.progressMessageId && this.latestProgressText && !this.progressCreating) { if (
this.progressMessageId &&
this.latestProgressText &&
!this.progressCreating
) {
void this.syncTrackedProgressMessage(); void this.syncTrackedProgressMessage();
} }
}, 5_000); }, 5_000);