fix(scheduler): forward only final agent output to chat

Scheduled tasks only suppressed phase 'progress', so intermediate
preambles (e.g. "I'll run the watchdog checks.") leaked to the chat
each run while the actual <internal>-wrapped result was correctly
stripped. The interactive path treats intermediate/tool-activity as
silent (toVisiblePhase); align the scheduler to forward only the final
message, with error outputs still falling through to rotation/error
handling.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-06-13 14:37:42 +09:00
parent ee4c5559b1
commit 80ddb1aa0d
2 changed files with 89 additions and 2 deletions

View File

@@ -45,7 +45,7 @@ import {
suspendTask,
} from './task-suspension.js';
import { getTaskQueueJid, isGitHubCiTask } from './task-watch-status.js';
import { ScheduledTask } from './types.js';
import { normalizeAgentOutputPhase, ScheduledTask } from './types.js';
import { resolveGroupIpcPath } from './group-folder.js';
import { schedulePairedFollowUpOnce } from './paired-follow-up-scheduler.js';
import {
@@ -216,7 +216,16 @@ async function runTask(
outputText,
evaluation,
}) => {
if (streamedOutput.phase === 'progress') {
// Only the agent's final message should reach the chat. Progress,
// intermediate (e.g. a preamble like "I'll run the watchdog
// checks."), and tool-activity outputs are silent in the
// interactive path (see toVisiblePhase); the scheduler must honor
// the same contract. Errors still fall through so rotation/error
// handling below can run.
if (
streamedOutput.status !== 'error' &&
normalizeAgentOutputPhase(streamedOutput.phase) !== 'final'
) {
return;
}
if (