fix(runtime): apply open policy when continuing legacy tasks

This commit is contained in:
Agent Workbench Dev
2026-11-06 05:08:02 +08:00
parent 2fa220735d
commit c93c434808
6 changed files with 36 additions and 1 deletions
+3
View File
@@ -509,6 +509,9 @@ export class Store extends EventEmitter {
task.workspaceIdentity ??= structuredClone(workspaceIdentity);
if (JSON.stringify(task.workspaceIdentity) !== JSON.stringify(workspaceIdentity)) throw Object.assign(new Error('任务的工作区身份已变化,不能将原任务移动到另一个工作区。'), { status: 409 });
const run = createRun(session, task, config, resume || continuing ? previousRunId : null);
// A new open Run adopts the user's current policy even when it continues
// an exhausted legacy Task. Historical Run budgets and usage stay intact.
if (unrestricted(config)) task.budget.maxTokens = 0;
run.purpose = purpose;
if (purpose === 'diagnostic') {
run.question = String(content); run.taskStatusBefore = task.status;