merge: maestro/tsk_N5wO3Armums2 [重试与超时策略细化(可配 + 退避)]
# Conflicts: # src/api/server.ts # test/store.test.ts
This commit is contained in:
@@ -20,7 +20,8 @@ export interface RunnerResult {
|
||||
export type RunnerFn = (task: Task, project: Project, worktree: WorktreeInfo, runId: string) => Promise<RunnerResult>;
|
||||
|
||||
const DEFAULT_MAX_TURNS = 100;
|
||||
const DEFAULT_TIMEOUT_MS = 30 * 60_000; // 整体兜底超时 30min
|
||||
/** 若项目未配置 timeoutMs 时的全局兜底超时(30min) */
|
||||
const DEFAULT_TIMEOUT_MS = 30 * 60_000;
|
||||
|
||||
/** 组装任务提示词:标题 + operations/spec 全文 + 执行约束 */
|
||||
export function buildPrompt(task: Task): string {
|
||||
@@ -58,13 +59,14 @@ async function ensureCommitted(dir: string, task: Task): Promise<void> {
|
||||
*/
|
||||
export async function runTask(task: Task, project: Project, worktree: WorktreeInfo, runId: string): Promise<RunnerResult> {
|
||||
const model = pickModel(task, project, 'executor');
|
||||
const timeoutMs = project.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
||||
const cc = await runClaude({
|
||||
prompt: buildPrompt(task),
|
||||
cwd: worktree.dir,
|
||||
model,
|
||||
runId,
|
||||
maxTurns: DEFAULT_MAX_TURNS,
|
||||
timeoutMs: DEFAULT_TIMEOUT_MS,
|
||||
timeoutMs,
|
||||
permissionMode: 'acceptEdits', // worktree 内自动接受编辑
|
||||
allowedTools: [
|
||||
'Read', 'Edit', 'Write', 'Glob', 'Grep',
|
||||
|
||||
Reference in New Issue
Block a user