fix: イテレーション入力待ち中のpoll_tickログ連続出力を抑制
入力待ちフラグ(enterInputWait/leaveInputWait)を導入し、 selectOption待ち中はワーカープールのポーリングログをスキップする。 入力完了で自動復活。
This commit is contained in:
parent
4823a9cb83
commit
75ce583d0b
24
src/features/tasks/execute/inputWait.ts
Normal file
24
src/features/tasks/execute/inputWait.ts
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Shared input-wait state for worker pool log suppression.
|
||||
*
|
||||
* When a task is waiting for user input (e.g. iteration limit prompt),
|
||||
* the worker pool should suppress poll_tick debug logs to avoid
|
||||
* flooding the log file with identical entries.
|
||||
*/
|
||||
|
||||
let waitCount = 0;
|
||||
|
||||
/** Call when entering an input-wait state (e.g. selectOption). */
|
||||
export function enterInputWait(): void {
|
||||
waitCount++;
|
||||
}
|
||||
|
||||
/** Call when leaving an input-wait state. */
|
||||
export function leaveInputWait(): void {
|
||||
if (waitCount > 0) waitCount--;
|
||||
}
|
||||
|
||||
/** Returns true if any task is currently waiting for user input. */
|
||||
export function isInputWaiting(): boolean {
|
||||
return waitCount > 0;
|
||||
}
|
||||
@ -18,6 +18,7 @@ import { EXIT_SIGINT } from '../../../shared/exitCodes.js';
|
||||
import { createLogger } from '../../../shared/utils/index.js';
|
||||
import { executeAndCompleteTask } from './taskExecution.js';
|
||||
import { ShutdownManager } from './shutdownManager.js';
|
||||
import { isInputWaiting } from './inputWait.js';
|
||||
import type { TaskExecutionOptions } from './types.js';
|
||||
|
||||
const log = createLogger('worker-pool');
|
||||
@ -169,7 +170,7 @@ export async function runWithWorkerPool(
|
||||
}
|
||||
}
|
||||
|
||||
if (!abortController.signal.aborted) {
|
||||
if (!abortController.signal.aborted && !isInputWaiting()) {
|
||||
const freeSlots = concurrency - active.size;
|
||||
if (freeSlots > 0) {
|
||||
const newTasks = taskRunner.claimNextTasks(freeSlots);
|
||||
|
||||
@ -10,6 +10,7 @@ import type { PieceExecutionResult, PieceExecutionOptions } from './types.js';
|
||||
import { detectRuleIndex } from '../../../shared/utils/ruleIndex.js';
|
||||
import { interruptAllQueries } from '../../../infra/claude/query-manager.js';
|
||||
import { callAiJudge } from '../../../agents/ai-judge.js';
|
||||
import { enterInputWait, leaveInputWait } from './inputWait.js';
|
||||
|
||||
export type { PieceExecutionResult, PieceExecutionOptions };
|
||||
|
||||
@ -398,6 +399,8 @@ export async function executePiece(
|
||||
playWarningSound();
|
||||
}
|
||||
|
||||
enterInputWait();
|
||||
try {
|
||||
const action = await selectOption(getLabel('piece.iterationLimit.continueQuestion'), [
|
||||
{
|
||||
label: getLabel('piece.iterationLimit.continueLabel'),
|
||||
@ -425,6 +428,9 @@ export async function executePiece(
|
||||
|
||||
out.warn(getLabel('piece.iterationLimit.invalidInput'));
|
||||
}
|
||||
} finally {
|
||||
leaveInputWait();
|
||||
}
|
||||
};
|
||||
|
||||
const onUserInput = interactiveUserInput
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user