codex-supervisor-mcp 0.14.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +34 -45
- package/README.md +34 -45
- package/package.json +1 -1
- package/skills/codex-supervisor/SKILL.md +86 -90
- package/src/app/acceptance.js +5 -5
- package/src/app/auto-cleanup.js +6 -5
- package/src/app/cleanup-facts.js +7 -4
- package/src/app/cleanup-plan.js +3 -2
- package/src/app/context-compiler.js +2 -1
- package/src/app/dispatch.js +17 -15
- package/src/app/followup.js +5 -4
- package/src/app/land-chain.js +5 -4
- package/src/app/landing.js +8 -8
- package/src/app/ownership.js +1 -1
- package/src/app/rebase.js +1 -1
- package/src/app/restore-worktree.js +2 -1
- package/src/app/resume.js +6 -5
- package/src/app/worktree-setup.js +15 -14
- package/src/domain/acceptance-spec.js +1 -1
- package/src/domain/failure-class.js +2 -2
- package/src/domain/prompt.js +7 -7
- package/src/domain/status.js +9 -0
- package/src/domain/thread-health.js +2 -2
- package/src/domain/worker-branch.js +6 -0
- package/src/domain/worker-changes.js +3 -3
- package/src/infra/cleanup-hint.js +1 -1
- package/src/infra/external-output.js +2 -2
- package/src/infra/sandbox-roots.js +1 -1
- package/src/infra/store/events.js +2 -1
- package/src/infra/store/reconcile.js +4 -3
- package/src/infra/store/tasks.js +1 -1
- package/src/infra/update/auto-update-worker.js +3 -3
- package/src/infra/update/auto-update.js +4 -4
- package/src/infra/update/update-check.js +3 -3
- package/src/infra/workspace-kind.js +8 -8
- package/src/infra/worktree.js +4 -3
- package/src/interface/bin/acceptance-cli.js +4 -4
- package/src/interface/bin/monitor.jsx +6 -6
- package/src/interface/bin/setup.js +3 -3
- package/src/interface/bin/stage.js +2 -2
- package/src/interface/mcp/{tools → handlers}/delivery.js +30 -62
- package/src/interface/mcp/handlers/dispatch.js +233 -0
- package/src/interface/mcp/{tools → handlers}/facts.js +30 -65
- package/src/interface/mcp/handlers/overview.js +103 -0
- package/src/interface/mcp/{tools → handlers}/results.js +31 -60
- package/src/interface/mcp/{tools → handlers}/review.js +16 -36
- package/src/interface/mcp/{tools → handlers}/wait.js +8 -14
- package/src/interface/mcp/server.js +18 -51
- package/src/interface/mcp/tools/deliver.js +48 -0
- package/src/interface/mcp/tools/dispatch.js +78 -257
- package/src/interface/mcp/tools/optional.js +57 -0
- package/src/interface/mcp/tools/read.js +115 -0
- package/src/interface/mcp/tools/run.js +57 -0
- package/src/interface/mcp/tools/shapes.js +66 -0
- package/src/interface/mcp/tools/track.js +84 -0
- package/src/interface/mcp/views/task.js +8 -7
- package/src/interface/web/views.js +2 -1
- package/src/run-host/launch.js +7 -7
- package/src/runners/codex/tool-guard.js +6 -6
- package/src/domain/overview-delta.js +0 -77
- package/src/interface/mcp/tools/overview.js +0 -202
- package/src/interface/mcp/tools/poll.js +0 -58
package/src/app/auto-cleanup.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// It rides on the polling tools, so a batch that is never cleaned up by hand
|
|
3
3
|
// does not grow without bound. A sweep is throttled and bounded: it must never
|
|
4
4
|
// make a poll slow.
|
|
5
|
+
import { branchOf } from "../domain/worker-branch.js";
|
|
5
6
|
import "./compose.js";
|
|
6
7
|
import { holdMsFrom } from "../domain/cleanup-policy.js";
|
|
7
8
|
import { TERMINAL_STATUSES } from "../domain/status.js";
|
|
@@ -19,8 +20,8 @@ const SWEEP_LIMIT = 20;
|
|
|
19
20
|
let lastSweepAt = 0;
|
|
20
21
|
|
|
21
22
|
function intervalMs() {
|
|
22
|
-
const raw = Number(process.env.
|
|
23
|
-
return Number.isFinite(raw) && raw >= 0 && process.env.
|
|
23
|
+
const raw = Number(process.env.AGENT_SUPERVISOR_CLEANUP_INTERVAL_MS);
|
|
24
|
+
return Number.isFinite(raw) && raw >= 0 && process.env.AGENT_SUPERVISOR_CLEANUP_INTERVAL_MS !== undefined ? raw : DEFAULT_INTERVAL_MS;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
const finishedAt = (task) => Date.parse(task.completed_at ?? task.updated_at ?? "") || 0;
|
|
@@ -32,7 +33,7 @@ async function sweepWorktree(task, tasks, now) {
|
|
|
32
33
|
// The worktree is gone whether or not the audit row can be written.
|
|
33
34
|
await recordRemoval(task, { actor: "auto_cleanup", checkpoint, reasons: assessed.reasons })
|
|
34
35
|
.catch((error) => process.stderr.write(`[codex-supervisor] removed ${task.id} but could not record it: ${error.message}\n`));
|
|
35
|
-
return { task_id: task.id, kind: "worktree", branch:
|
|
36
|
+
return { task_id: task.id, kind: "worktree", branch: branchOf(task), checkpoint_commit: checkpoint, reasons: assessed.reasons };
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
// A scratch directory holds a research worker's drafts; its report is in the
|
|
@@ -40,7 +41,7 @@ async function sweepWorktree(task, tasks, now) {
|
|
|
40
41
|
async function sweepScratch(task, now) {
|
|
41
42
|
const path = join(scratchDir, task.id);
|
|
42
43
|
const finished = finishedAt(task);
|
|
43
|
-
if (!finished || now < finished + holdMsFrom(process.env.
|
|
44
|
+
if (!finished || now < finished + holdMsFrom(process.env.AGENT_SUPERVISOR_CLEANUP_HOLD_DAYS) || !existsSync(path)) return null;
|
|
44
45
|
const claim = await claimIdleTask(task.id);
|
|
45
46
|
if (!claim) return null;
|
|
46
47
|
try {
|
|
@@ -55,7 +56,7 @@ async function sweepScratch(task, now) {
|
|
|
55
56
|
|
|
56
57
|
// Returns what was removed. One failure never stops the sweep or the poll.
|
|
57
58
|
export async function sweepCleanup({ now = Date.now(), force = false } = {}) {
|
|
58
|
-
if (process.env.
|
|
59
|
+
if (process.env.AGENT_SUPERVISOR_NO_AUTO_CLEANUP === "1") return [];
|
|
59
60
|
if (!force && now - lastSweepAt < intervalMs()) return [];
|
|
60
61
|
lastSweepAt = now;
|
|
61
62
|
let tasks;
|
package/src/app/cleanup-facts.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Reads what the cleanup policy needs to know about one worker's worktree.
|
|
2
|
+
import { branchOf } from "../domain/worker-branch.js";
|
|
2
3
|
import "./compose.js";
|
|
3
|
-
import { ACTIVE_STATUSES, TERMINAL_STATUSES } from "../domain/status.js";
|
|
4
|
+
import { ACTIVE_STATUSES, TERMINAL_STATUSES, runIsOver } from "../domain/status.js";
|
|
4
5
|
import { gitSucceeds, runGit } from "../infra/git.js";
|
|
5
6
|
import { worktreesDir } from "../infra/paths.js";
|
|
6
7
|
import { isPidAlive } from "../infra/store/tasks.js";
|
|
@@ -14,8 +15,10 @@ const git = (cwd, args) => runGit(cwd, args, { timeout: 15000, noOptionalLocks:
|
|
|
14
15
|
const lines = (text) => text.split("\n").filter(Boolean);
|
|
15
16
|
|
|
16
17
|
function activeReason(task) {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
// Once the run is over its pids may belong to anyone.
|
|
19
|
+
const settled = runIsOver(task);
|
|
20
|
+
if (!settled && task.pid && isPidAlive(task.pid)) return "worker process is still active";
|
|
21
|
+
if (!settled && task.run_host_pid && isPidAlive(task.run_host_pid)) return "run host process is still active";
|
|
19
22
|
const acceptance = task.acceptance_results;
|
|
20
23
|
if (acceptance?.status === "running" || (acceptance?.supervisor_pid && isPidAlive(acceptance.supervisor_pid))) return "acceptance process is still active";
|
|
21
24
|
return null;
|
|
@@ -32,7 +35,7 @@ async function identityProblem(task) {
|
|
|
32
35
|
if (info.isSymbolicLink()) return "worktree is a symlink";
|
|
33
36
|
if (await realpath(path) !== await realpath(managed)) return "worktree realpath is unexpected";
|
|
34
37
|
const branch = git(path, ["symbolic-ref", "--short", "HEAD"]).trim();
|
|
35
|
-
if (branch !==
|
|
38
|
+
if (branch !== branchOf(task)) return "worktree branch ownership is unexpected";
|
|
36
39
|
const registered = git(task.project_root, ["worktree", "list", "--porcelain", "-z"]).split("\0").filter((line) => line.startsWith("worktree "));
|
|
37
40
|
const own = await realpath(path);
|
|
38
41
|
for (const line of registered) {
|
package/src/app/cleanup-plan.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// safe, review or blocked; applying one removes only safe worktrees, after
|
|
3
3
|
// saving any uncommitted edits as a checkpoint commit on the worker's branch.
|
|
4
4
|
// Branches, task rows, events, logs and artifacts are never removed.
|
|
5
|
+
import { branchOf } from "../domain/worker-branch.js";
|
|
5
6
|
import "./compose.js";
|
|
6
7
|
import { cleanupVerdict, holdMsFrom } from "../domain/cleanup-policy.js";
|
|
7
8
|
import { gitSucceeds, runGit } from "../infra/git.js";
|
|
@@ -22,7 +23,7 @@ export const CLEANUP_POLICY = "keep_branch_and_evidence_checkpoint_before_remova
|
|
|
22
23
|
const RETAINED = ["branch", "task", "events", "jsonl", "artifacts"];
|
|
23
24
|
|
|
24
25
|
const git = (cwd, args, options = {}) => runGit(cwd, args, { timeout: 15000, noOptionalLocks: true, ...options });
|
|
25
|
-
const holdMs = () => holdMsFrom(process.env.
|
|
26
|
+
const holdMs = () => holdMsFrom(process.env.AGENT_SUPERVISOR_CLEANUP_HOLD_DAYS);
|
|
26
27
|
|
|
27
28
|
function directoryBytes(path) {
|
|
28
29
|
try {
|
|
@@ -126,7 +127,7 @@ export async function recordRemoval(task, { actor, planId = null, itemId = null,
|
|
|
126
127
|
removed_at: removedAt,
|
|
127
128
|
reasons,
|
|
128
129
|
checkpoint_commit: checkpoint,
|
|
129
|
-
branch:
|
|
130
|
+
branch: branchOf(task),
|
|
130
131
|
retained: RETAINED
|
|
131
132
|
}, { runId: runIdFor(task.id, task.run_count ?? 1), actor });
|
|
132
133
|
return removedAt;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { branchOf } from "../domain/worker-branch.js";
|
|
1
2
|
import { gitSucceeds } from "../infra/git.js";
|
|
2
3
|
import "./compose.js";
|
|
3
4
|
import { buildHandoff } from "../infra/handoff.js";
|
|
@@ -44,7 +45,7 @@ export async function compileWorkerContext(task, { attempt }) {
|
|
|
44
45
|
`- run_id: ${runIdFor(task.id, attempt)}`,
|
|
45
46
|
`- project_root: ${task.project_root}`,
|
|
46
47
|
`- base_sha: ${task.base_commit ?? "unknown"}`,
|
|
47
|
-
`- branch: ${task.worktree_path ?
|
|
48
|
+
`- branch: ${task.worktree_path ? branchOf(task) : "not applicable (in-place workspace)"}`,
|
|
48
49
|
`- worktree: ${task.worktree_path ?? task.cwd}`,
|
|
49
50
|
`- owned_paths: ${JSON.stringify(task.owned_paths ?? [])}`,
|
|
50
51
|
`- acceptance_source: ${Array.isArray(task.acceptance) && task.acceptance.length > 0 ? "dispatch or session policy; commands stay outside this capsule" : "no acceptance configured"}`,
|
package/src/app/dispatch.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { newWorkerBranch } from "../domain/worker-branch.js";
|
|
1
2
|
import { failedStart } from "./run-state.js";
|
|
2
3
|
import "./compose.js";
|
|
3
4
|
import { frameWorkerPrompt } from "../domain/prompt.js";
|
|
@@ -26,7 +27,7 @@ function validateGoal(goal) {
|
|
|
26
27
|
}
|
|
27
28
|
const tokenBudget = goal.tokenBudget ?? goal.token_budget ?? null;
|
|
28
29
|
if (tokenBudget !== null && (!Number.isInteger(tokenBudget) || tokenBudget <= 0)) {
|
|
29
|
-
throw new Error("goal.
|
|
30
|
+
throw new Error("goal.token_budget must be a positive integer when provided");
|
|
30
31
|
}
|
|
31
32
|
return { objective: goal.objective, tokenBudget };
|
|
32
33
|
}
|
|
@@ -77,7 +78,7 @@ async function validateDependencies(dependsOn, projectRoot, baseCommit) {
|
|
|
77
78
|
});
|
|
78
79
|
}
|
|
79
80
|
if (!baseCommit || !containsCommit(projectRoot, dependency.landed_head, baseCommit)) {
|
|
80
|
-
throw dependencyError("dependency_base_mismatch", `worker base does not contain landed dependency ${dependencyId}; use the integrated branch or a newer
|
|
81
|
+
throw dependencyError("dependency_base_mismatch", `worker base does not contain landed dependency ${dependencyId}; use the integrated branch or a newer workspace.base_ref`, {
|
|
81
82
|
dependency_id: dependencyId,
|
|
82
83
|
dependency_head: dependency.landed_head,
|
|
83
84
|
base_commit: baseCommit ?? null
|
|
@@ -115,10 +116,10 @@ async function validateDispatch(input) {
|
|
|
115
116
|
const acceptanceCommands = normalizeAcceptance(acceptance);
|
|
116
117
|
if (!cwd || typeof cwd !== "string") throw new Error("cwd is required");
|
|
117
118
|
if (!allowedReasoningEfforts.has(reasoningEffort)) {
|
|
118
|
-
throw new Error(`unsupported
|
|
119
|
+
throw new Error(`unsupported reasoning_effort: ${reasoningEffort}`);
|
|
119
120
|
}
|
|
120
121
|
if (!Array.isArray(ownedPaths)) {
|
|
121
|
-
throw new Error("
|
|
122
|
+
throw new Error("owned_paths is required; pass an empty list only for a worker that must never land a change (a read-only verifier, or a research worker that reads and reports)");
|
|
122
123
|
}
|
|
123
124
|
if (ownedPaths.length > 0 && acceptanceCommands?.length && acceptanceCommands.every(isArtifactOnlyAcceptance)) {
|
|
124
125
|
throw new Error("a write worker cannot use only file-existence acceptance; add a real test, endpoint probe or structured execution evidence");
|
|
@@ -128,19 +129,19 @@ async function validateDispatch(input) {
|
|
|
128
129
|
await captureExternalOutputs(externalOutputs, { checkBaseline: true });
|
|
129
130
|
if (externalOutputs.length && !acceptanceCommands?.length) throw new Error("shared outputs require explicit acceptance commands");
|
|
130
131
|
if (externalOutputs.length && sandbox === "read-only") throw new Error("a read-only worker cannot declare writable shared outputs");
|
|
131
|
-
if (networkAccess && sandbox === "danger-full-access") throw new Error("
|
|
132
|
-
if (networkAccess && sandbox === "read-only") throw new Error("the read-only sandbox has no network (a fetch there fails on DNS even with network_access); for a worker that must fetch, use sandbox \"workspace-write\" with
|
|
132
|
+
if (networkAccess && sandbox === "danger-full-access") throw new Error("sandbox.network_access is only for the sandboxed workers");
|
|
133
|
+
if (networkAccess && sandbox === "read-only") throw new Error("the read-only sandbox has no network (a fetch there fails on DNS even with network_access); for a worker that must fetch, use sandbox \"workspace-write\" with sandbox.network_access: true and owned_paths: []");
|
|
133
134
|
if (!Array.isArray(writableRoots) || writableRoots.length > 20 || writableRoots.some((root) => typeof root !== "string" || !isAbsolute(root))) {
|
|
134
|
-
throw new Error("
|
|
135
|
+
throw new Error("sandbox.writable_roots must be a list of at most 20 absolute paths");
|
|
135
136
|
}
|
|
136
|
-
if (writableRoots.length && sandbox !== "workspace-write") throw new Error("
|
|
137
|
+
if (writableRoots.length && sandbox !== "workspace-write") throw new Error("sandbox.writable_roots is only configurable for workspace-write workers");
|
|
137
138
|
// Codex refuses a writable root with a symlink component and then fails every
|
|
138
139
|
// command in the worker, so a declared root is stored resolved. Passing the
|
|
139
140
|
// alias would look fine in the receipt and break the run.
|
|
140
141
|
const resolvedWritableRoots = [];
|
|
141
142
|
for (const root of writableRoots) {
|
|
142
143
|
const resolved = resolveWritableRoot(root);
|
|
143
|
-
if (resolved.error) throw new Error(`
|
|
144
|
+
if (resolved.error) throw new Error(`sandbox.writable_roots entry is unusable: ${root} (${resolved.error}); pass an existing directory whose path has no symlink component`);
|
|
144
145
|
resolvedWritableRoots.push(resolved.path);
|
|
145
146
|
}
|
|
146
147
|
for (const value of [maxRunMs, maxTotalMs]) if (value !== null && (!Number.isInteger(value) || value < 1000)) throw new Error("time limits must be integer milliseconds of at least 1000");
|
|
@@ -150,7 +151,7 @@ async function validateDispatch(input) {
|
|
|
150
151
|
if (baseRef && !isGitCheckout(cwd)) throw invalidBaseRefError(cwd, baseRef);
|
|
151
152
|
if (preflight && (!Array.isArray(preflight.probeCommands) || preflight.probeCommands.length === 0
|
|
152
153
|
|| preflight.probeCommands.some((command) => typeof command !== "string" || !command.trim()))) {
|
|
153
|
-
throw new Error("preflight.
|
|
154
|
+
throw new Error("preflight.probe_commands must be a nonempty list of shell commands");
|
|
154
155
|
}
|
|
155
156
|
return { acceptanceCommands, validatedGoal, resolvedWritableRoots };
|
|
156
157
|
}
|
|
@@ -172,7 +173,7 @@ async function claimWorkspace(input, id, acceptanceCommands) {
|
|
|
172
173
|
const projectRoot = workspace.sourceRoot;
|
|
173
174
|
const normalizedOwnedPaths = normalizeOwnedPaths([...ownedPaths, ...externalOutputs.map((entry) => entry.path)], projectRoot);
|
|
174
175
|
const normalizedWorkspaceSetup = normalizeWorkspaceSetup(workspaceSetup, projectRoot);
|
|
175
|
-
if (normalizedWorkspaceSetup && workspace.kind !== "git_worktree") throw new Error("
|
|
176
|
+
if (normalizedWorkspaceSetup && workspace.kind !== "git_worktree") throw new Error("workspace.setup is only supported for git_worktree workers");
|
|
176
177
|
const conflicts = await findOwnershipConflicts(normalizedOwnedPaths);
|
|
177
178
|
if (conflicts.length > 0) throw ownershipConflictError(conflicts);
|
|
178
179
|
return { workspace, projectRoot, normalizedOwnedPaths, normalizedWorkspaceSetup };
|
|
@@ -192,7 +193,7 @@ async function sessionPolicy({ sessionId, sessionTitle, sessionNote }, acceptanc
|
|
|
192
193
|
// model edits. Remove it normally; never force-remove user work.
|
|
193
194
|
async function discardWorktree(projectRoot, worktreePath, id) {
|
|
194
195
|
await runToExit(gitBin(), ["-C", projectRoot, "worktree", "remove", worktreePath]).catch(() => {});
|
|
195
|
-
await runToExit(gitBin(), ["-C", projectRoot, "branch", "-D",
|
|
196
|
+
await runToExit(gitBin(), ["-C", projectRoot, "branch", "-D", newWorkerBranch(id)]).catch(() => {});
|
|
196
197
|
}
|
|
197
198
|
|
|
198
199
|
async function createWorkerWorktree({ workspace, projectRoot, normalizedWorkspaceSetup }, id, baseRef) {
|
|
@@ -200,7 +201,7 @@ async function createWorkerWorktree({ workspace, projectRoot, normalizedWorkspac
|
|
|
200
201
|
? await withWorktreeCreationLock(projectRoot, () => ensureWorktree(projectRoot, id, baseRef))
|
|
201
202
|
: { path: null, baseCommit: null };
|
|
202
203
|
if (workspace.kind === "git_worktree" && !worktree.path) {
|
|
203
|
-
throw coded("git_worktree_unavailable", "
|
|
204
|
+
throw coded("git_worktree_unavailable", "workspace.kind git_worktree could not create an isolated worktree; use read_only_in_place for a non-writing inspection or initialize and commit the repository first");
|
|
204
205
|
}
|
|
205
206
|
if (normalizedWorkspaceSetup) {
|
|
206
207
|
try {
|
|
@@ -276,7 +277,8 @@ function buildRecord(input, parts) {
|
|
|
276
277
|
in_place_authorization: workspace.kind === "in_place_write" ? String(inPlaceAuthorization).trim() : null,
|
|
277
278
|
landable: workspace.landable,
|
|
278
279
|
cleanable: workspace.cleanable,
|
|
279
|
-
setup: normalizedWorkspaceSetup
|
|
280
|
+
setup: normalizedWorkspaceSetup,
|
|
281
|
+
branch: worktreePath ? newWorkerBranch(id) : null
|
|
280
282
|
},
|
|
281
283
|
sandbox,
|
|
282
284
|
model,
|
|
@@ -333,7 +335,7 @@ async function assertPreflightMatches(preflightId, runtimeContract) {
|
|
|
333
335
|
}
|
|
334
336
|
const contractHash = runtimeContractHash(runtimeContract);
|
|
335
337
|
if (preflightResult.contract_hash === contractHash) return;
|
|
336
|
-
throw coded("preflight_mismatch", `preflight ${preflightId} does not match this worker's runtime contract; create a new preflight after changing
|
|
338
|
+
throw coded("preflight_mismatch", `preflight ${preflightId} does not match this worker's runtime contract; create a new preflight after changing workspace.base_ref, sandbox, owned_paths, commands, context, contracts, network or writable roots`, {
|
|
337
339
|
preflight_id: preflightId,
|
|
338
340
|
expected_contract_hash: contractHash,
|
|
339
341
|
actual_contract_hash: preflightResult.contract_hash,
|
package/src/app/followup.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { branchOf } from "../domain/worker-branch.js";
|
|
1
2
|
import "./compose.js";
|
|
2
3
|
import { readTaskEvents } from "../infra/store/events.js";
|
|
3
4
|
import { getTask } from "../infra/store/tasks.js";
|
|
@@ -10,10 +11,10 @@ import { resolveCommit } from "./worktree-setup.js";
|
|
|
10
11
|
function followupBaseRef(parent, baseRef) {
|
|
11
12
|
if (baseRef || parent.landed_at || !parent.project_root || !parent.worktree_path) return baseRef ?? null;
|
|
12
13
|
try {
|
|
13
|
-
resolveCommit(parent.project_root,
|
|
14
|
-
return
|
|
14
|
+
resolveCommit(parent.project_root, branchOf(parent));
|
|
15
|
+
return branchOf(parent);
|
|
15
16
|
} catch {
|
|
16
|
-
const error = new Error(`parent checkpoint
|
|
17
|
+
const error = new Error(`parent checkpoint ${branchOf(parent)} is unavailable; restore it or choose an explicit workspace.base_ref`);
|
|
17
18
|
error.code = "followup_checkpoint_missing";
|
|
18
19
|
throw error;
|
|
19
20
|
}
|
|
@@ -90,7 +91,7 @@ export async function createFollowupWorker(options) {
|
|
|
90
91
|
workspaceSetup: workspaceSetup ?? parent.workspace_metadata?.setup ?? null,
|
|
91
92
|
baseRef: inheritedBaseRef,
|
|
92
93
|
// Inherited unless given; the follow-up runs in a fresh worktree cut
|
|
93
|
-
// from the parent's
|
|
94
|
+
// from the parent's branch, so checks that depend on the
|
|
94
95
|
// parent checkpoint are valid before the parent has landed on the target.
|
|
95
96
|
acceptance: acceptance === undefined ? inheritedAcceptance : acceptance,
|
|
96
97
|
acceptanceTimeoutMs: acceptanceTimeoutMs ?? parent.acceptance_timeout_ms ?? null
|
package/src/app/land-chain.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { branchOf } from "../domain/worker-branch.js";
|
|
1
2
|
import { ensureTaskWorktree } from "./restore-worktree.js";
|
|
2
3
|
import "./compose.js";
|
|
3
4
|
import { runGit } from "../infra/git.js";
|
|
@@ -84,7 +85,7 @@ export async function landOneWorkerTask(taskId, options = {}) {
|
|
|
84
85
|
return { error: "acceptance_not_run", task_id: taskId };
|
|
85
86
|
}
|
|
86
87
|
git(task.project_root, ["merge-base", "--is-ancestor", task.landed_head, "HEAD"]);
|
|
87
|
-
return { task_id: taskId, title: task.title, status: task.status, branch:
|
|
88
|
+
return { task_id: taskId, title: task.title, status: task.status, branch: branchOf(task), skipped: "already_landed", landed_at: task.landed_at, landed_head: task.landed_head };
|
|
88
89
|
} catch {
|
|
89
90
|
return { error: "landed_commit_unreachable", task_id: taskId, reason: "the removed ancestor worktree cannot be skipped without proving its landed commit is on the current target" };
|
|
90
91
|
}
|
|
@@ -106,15 +107,15 @@ export async function landOneWorkerTask(taskId, options = {}) {
|
|
|
106
107
|
task_id: taskId,
|
|
107
108
|
title: task.title,
|
|
108
109
|
status: task.status,
|
|
109
|
-
branch:
|
|
110
|
+
branch: branchOf(task),
|
|
110
111
|
...outcome,
|
|
111
112
|
skipped: "already_in_target",
|
|
112
113
|
lifecycle_recorded: !alreadyRecorded && Boolean(outcome.matched_head)
|
|
113
114
|
};
|
|
114
115
|
}
|
|
115
|
-
if (outcome.error) return { task_id: taskId, title: task.title, status: task.status, branch:
|
|
116
|
+
if (outcome.error) return { task_id: taskId, title: task.title, status: task.status, branch: branchOf(task), ...outcome };
|
|
116
117
|
await recordWorkerLanded(task, { head: outcome.head, branch: outcome.onto, target: outcome.target, alreadyLanded: outcome.already_landed ?? [] });
|
|
117
|
-
return { task_id: taskId, title: task.title, status: task.status, branch:
|
|
118
|
+
return { task_id: taskId, title: task.title, status: task.status, branch: branchOf(task), ...outcome };
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
export async function followupChainIds(taskId) {
|
package/src/app/landing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Landing a worker's commits where they were dispatched from.
|
|
2
2
|
//
|
|
3
|
-
// A worker commits on
|
|
3
|
+
// A worker's commits live on its own branch inside its own worktree. Getting that
|
|
4
4
|
// work onto the branch the main thread integrates on used to be the main
|
|
5
5
|
// thread's job, one cherry-pick per step, dozens of times per batch. This
|
|
6
6
|
// does the same thing with the same guard rails a careful person would use:
|
|
@@ -129,8 +129,8 @@ function hasStagedChanges(cwd) {
|
|
|
129
129
|
// (task.project_root: the row's cwd is the worktree the worker ran in).
|
|
130
130
|
// `onto`, when given, must name that branch: it is a guard, not a switch.
|
|
131
131
|
//
|
|
132
|
-
// `
|
|
133
|
-
// first, as one commit on
|
|
132
|
+
// `commit_message` commits what the worker left uncommitted in its worktree
|
|
133
|
+
// first, as one commit on its branch. A worker in Codex's workspace-write
|
|
134
134
|
// sandbox cannot commit at all (the sandbox keeps .git read-only), so this
|
|
135
135
|
// is how "one step, one commit" is kept without giving workers full access.
|
|
136
136
|
//
|
|
@@ -145,14 +145,14 @@ function acceptanceRefusal(task) {
|
|
|
145
145
|
if (acceptance.passed === false) {
|
|
146
146
|
return {
|
|
147
147
|
error: "acceptance_failed",
|
|
148
|
-
reason: `the worker's acceptance run failed${failing ? ` on "${failing.command.slice(0, 120)}" (exit ${failing.error ?? (failing.baseline?.passed === false ? "baseline/evidence mismatch" : failing.timed_out ? "timeout" : failing.exit_code)})` : acceptance.error ? ` (${acceptance.error})` : ""}; resume the worker with the failing output and land once it passes.
|
|
148
|
+
reason: `the worker's acceptance run failed${failing ? ` on "${failing.command.slice(0, 120)}" (exit ${failing.error ?? (failing.baseline?.passed === false ? "baseline/evidence mismatch" : failing.timed_out ? "timeout" : failing.exit_code)})` : acceptance.error ? ` (${acceptance.error})` : ""}; resume the worker with the failing output and land once it passes. ignore_acceptance: true lands anyway, only when the user said to.`,
|
|
149
149
|
acceptance: { status: acceptance.status, passed: false, checks: acceptance.checks ?? [], error: acceptance.error ?? null }
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
if (acceptance.status === "running" || acceptance.status === "interrupted" || acceptance.status === "cancelled") {
|
|
153
153
|
return {
|
|
154
154
|
error: "acceptance_not_run",
|
|
155
|
-
reason: `the worker's acceptance is ${acceptance.status}; wait for it (or resume the worker to run it again) before landing.
|
|
155
|
+
reason: `the worker's acceptance is ${acceptance.status}; wait for it (or resume the worker to run it again) before landing. ignore_acceptance: true lands anyway, only when the user said to.`,
|
|
156
156
|
acceptance: { status: acceptance.status, passed: null }
|
|
157
157
|
};
|
|
158
158
|
}
|
|
@@ -163,7 +163,7 @@ function acceptanceRefusal(task) {
|
|
|
163
163
|
function targetState(task, onto) {
|
|
164
164
|
const target = task.project_root;
|
|
165
165
|
if (!task.worktree_path || !existsSync(task.worktree_path)) {
|
|
166
|
-
return { error: "no_worktree", reason: "this worker has no worktree (it ran in place), so there is
|
|
166
|
+
return { error: "no_worktree", reason: "this worker has no worktree (it ran in place), so there is no worker branch to land" };
|
|
167
167
|
}
|
|
168
168
|
if (!target || !existsSync(target)) {
|
|
169
169
|
return { error: "no_target", reason: `the directory the worker was dispatched from (${target}) no longer exists` };
|
|
@@ -191,7 +191,7 @@ function ownershipRefusal(task) {
|
|
|
191
191
|
const paths = [...filterWorkspaceSetupChanges(task, readWorktreeChanges(task.worktree_path, worktreeRef(task))),
|
|
192
192
|
...diff.files.flatMap((file) => [file.path, file.from].filter(Boolean).map((path) => join(task.worktree_path, path)))];
|
|
193
193
|
const { outside } = findOutsideOwnedChanges(task, [...new Set(paths)]);
|
|
194
|
-
if (outside.length) return { error: "outside_owned_paths", reason: "worker changes exceed declared
|
|
194
|
+
if (outside.length) return { error: "outside_owned_paths", reason: "worker changes exceed declared owned_paths; review them and obtain explicit authorization before allowing an exception", outside_paths: outside.map((entry) => relative(task.worktree_path, entry)) };
|
|
195
195
|
return null;
|
|
196
196
|
}
|
|
197
197
|
|
|
@@ -267,7 +267,7 @@ function nothingToLand(proof, { branch, target, uncommitted, base }) {
|
|
|
267
267
|
return {
|
|
268
268
|
error: "nothing_to_land",
|
|
269
269
|
reason: uncommitted.length > 0
|
|
270
|
-
? "the worker made no commits on its branch (a workspace-write worker cannot: the sandbox keeps .git read-only); pass
|
|
270
|
+
? "the worker made no commits on its branch (a workspace-write worker cannot: the sandbox keeps .git read-only); pass commit_message to commit its edits as one commit and land that"
|
|
271
271
|
: "the worker made no commits and left no edits on its branch",
|
|
272
272
|
uncommitted,
|
|
273
273
|
base_commit: base
|
package/src/app/ownership.js
CHANGED
|
@@ -50,7 +50,7 @@ export async function findOwnershipConflicts(ownedPaths, { excludeTaskId = null
|
|
|
50
50
|
|
|
51
51
|
export function ownershipConflictError(conflicts) {
|
|
52
52
|
const owners = conflicts.map((conflict) => conflict.task_id).join(", ");
|
|
53
|
-
const error = new Error(`
|
|
53
|
+
const error = new Error(`owned_paths overlap with active worker(s): ${owners}`);
|
|
54
54
|
error.code = "ownership_conflict";
|
|
55
55
|
error.conflicts = conflicts;
|
|
56
56
|
return error;
|
package/src/app/rebase.js
CHANGED
|
@@ -182,7 +182,7 @@ function popOntoNewBase({ cwd, base, head }, ontoCommit) {
|
|
|
182
182
|
const popError = restoreStash(cwd, true);
|
|
183
183
|
return {
|
|
184
184
|
error: "stash_conflict",
|
|
185
|
-
reason: `the worker's uncommitted edits conflict with ${ontoCommit.slice(0, 12)}; the worktree is back as it was${popError ? " (but its stash could not be restored: run git stash pop there)" : ""}. Commit them first (
|
|
185
|
+
reason: `the worker's uncommitted edits conflict with ${ontoCommit.slice(0, 12)}; the worktree is back as it was${popError ? " (but its stash could not be restored: run git stash pop there)" : ""}. Commit them first (land_worker with commit_message) so the conflict is in a commit that can be resolved, or redispatch from the new commit with workspace.base_ref`,
|
|
186
186
|
files,
|
|
187
187
|
git: tail,
|
|
188
188
|
base_commit: base,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// A cleaned-up worker keeps its branch. When the main thread comes back to it
|
|
2
2
|
// (to resume or land), the worktree is cut again from that branch, with the
|
|
3
3
|
// same setup links, so cleanup never closes the door on unfinished work.
|
|
4
|
+
import { branchOf } from "../domain/worker-branch.js";
|
|
4
5
|
import "./compose.js";
|
|
5
6
|
import { gitBin, gitSucceeds } from "../infra/git.js";
|
|
6
7
|
import { runToExit } from "../infra/process.js";
|
|
@@ -20,7 +21,7 @@ function deliveryStepOf(task) {
|
|
|
20
21
|
// gone and cannot be brought back, so no caller carries on somewhere else.
|
|
21
22
|
export async function ensureTaskWorktree(task) {
|
|
22
23
|
if (!task.worktree_path || !task.project_root || existsSync(task.worktree_path)) return false;
|
|
23
|
-
const branch =
|
|
24
|
+
const branch = branchOf(task);
|
|
24
25
|
if (!gitSucceeds(task.project_root, ["rev-parse", "--verify", "--quiet", `refs/heads/${branch}`])) {
|
|
25
26
|
const error = new Error(`the worktree of ${task.id} is gone and its branch ${branch} does not exist, so it cannot be restored`);
|
|
26
27
|
error.code = "worktree_unrecoverable";
|
package/src/app/resume.js
CHANGED
|
@@ -2,7 +2,7 @@ import { mkdir } from "node:fs/promises";
|
|
|
2
2
|
import { ensureTaskWorktree } from "./restore-worktree.js";
|
|
3
3
|
import "./compose.js";
|
|
4
4
|
import { frameWorkerPrompt } from "../domain/prompt.js";
|
|
5
|
-
import { ACTIVE_STATUSES } from "../domain/status.js";
|
|
5
|
+
import { ACTIVE_STATUSES, runIsOver } from "../domain/status.js";
|
|
6
6
|
import { buildHandoff } from "../infra/handoff.js";
|
|
7
7
|
import { appendTaskEvent } from "../infra/store/events.js";
|
|
8
8
|
import { getSession } from "../infra/store/sessions.js";
|
|
@@ -21,7 +21,7 @@ import { appendFile } from "node:fs/promises";
|
|
|
21
21
|
// goal are all inherited from the original task, and the row is reused so one
|
|
22
22
|
// logical piece of work stays one row.
|
|
23
23
|
//
|
|
24
|
-
// `
|
|
24
|
+
// `rebase_onto` names a ref, resolved in the project directory (HEAD, main, a
|
|
25
25
|
// sha): the worktree is moved onto it first so the worker continues on
|
|
26
26
|
// current code, and base_commit is recorded before the worker starts so a
|
|
27
27
|
// spawn failure cannot leave the row describing the old base. A rebase that
|
|
@@ -64,7 +64,7 @@ async function rebaseBeforeResume(task, rebaseOnto) {
|
|
|
64
64
|
try {
|
|
65
65
|
ontoCommit = resolveCommit(task.project_root, rebaseOnto);
|
|
66
66
|
} catch {
|
|
67
|
-
throw coded("invalid_rebase_onto", `
|
|
67
|
+
throw coded("invalid_rebase_onto", `rebase_onto "${rebaseOnto}" does not resolve to a commit in ${task.project_root}`);
|
|
68
68
|
}
|
|
69
69
|
const rebase = rebaseWorktree(task, ontoCommit);
|
|
70
70
|
if (rebase.error) throw coded(rebase.error, rebase.reason, rebase);
|
|
@@ -104,7 +104,7 @@ async function resumeClaimed(claimed, { prompt, rebaseOnto, acceptance }) {
|
|
|
104
104
|
let task = await refreshAcceptance(claimed, session, acceptance);
|
|
105
105
|
if (!task.thread_id) {
|
|
106
106
|
throw new Error(
|
|
107
|
-
`task ${task.id} has no Codex thread_id recorded. Only workers created by this version of codex-supervisor-mcp can be resumed; use
|
|
107
|
+
`task ${task.id} has no Codex thread_id recorded. Only workers created by this version of codex-supervisor-mcp can be resumed; use create_worker with followup_of otherwise.`
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
await ensureTaskWorktree(task);
|
|
@@ -158,7 +158,8 @@ export async function recoverEligibleRuns() {
|
|
|
158
158
|
|| ["blocked", "paused", "budget_limited", "usage_limited"].includes(task.goal_status)
|
|
159
159
|
|| /401|403|unauthori[sz]ed|not logged|permission denied|approval|rate.?limit|429/i.test(task.error ?? "")
|
|
160
160
|
|| /time_limit|quota/.test(`${task.attention_reason ?? ""} ${task.error ?? ""}`)
|
|
161
|
-
|
|
161
|
+
// Once the run is over its pids may belong to anyone.
|
|
162
|
+
|| (!runIsOver(task) && (await isPidAlive(task.pid) || await isPidAlive(task.run_host_pid)))) continue;
|
|
162
163
|
const session = task.session_id ? await getSession(task.session_id) : null;
|
|
163
164
|
if (session?.approval_state === "waiting_user") continue;
|
|
164
165
|
try {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { newWorkerBranch } from "../domain/worker-branch.js";
|
|
1
2
|
import { gitBin, runGit } from "../infra/git.js";
|
|
2
3
|
import { worktreesDir } from "../infra/paths.js";
|
|
3
4
|
import { runToExit } from "../infra/process.js";
|
|
@@ -30,15 +31,15 @@ export function resolveCommit(cwd, ref) {
|
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
export function invalidBaseRefError(cwd, baseRef) {
|
|
33
|
-
const error = new Error(`
|
|
34
|
+
const error = new Error(`workspace.base_ref "${baseRef}" does not resolve to a commit in ${cwd}`);
|
|
34
35
|
error.code = "invalid_base_ref";
|
|
35
36
|
return error;
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
// The worktree is cut from
|
|
39
|
+
// The worktree is cut from workspace.base_ref when given, else from the repository's
|
|
39
40
|
// HEAD. The resolved commit is recorded on the task: it is what
|
|
40
41
|
// readWorktreeChanges diffs against, so committed work stays visible. An
|
|
41
|
-
// explicit
|
|
42
|
+
// explicit workspace.base_ref that does not resolve is an error, not a silent fallback
|
|
42
43
|
// to HEAD - the caller asked for a specific baseline for a reason.
|
|
43
44
|
export async function ensureWorktree(cwd, taskId, baseRef = null) {
|
|
44
45
|
const taskWorktreeDir = join(worktreesDir, taskId);
|
|
@@ -61,7 +62,7 @@ export async function ensureWorktree(cwd, taskId, baseRef = null) {
|
|
|
61
62
|
}
|
|
62
63
|
try {
|
|
63
64
|
await rm(taskWorktreeDir, { recursive: true, force: true });
|
|
64
|
-
const branch =
|
|
65
|
+
const branch = newWorkerBranch(taskId);
|
|
65
66
|
await runToExit(gitBin(), ["-C", cwd, "worktree", "add", "--detach", taskWorktreeDir, baseCommit]);
|
|
66
67
|
await runToExit(gitBin(), ["-C", taskWorktreeDir, "switch", "-c", branch]);
|
|
67
68
|
return { path: taskWorktreeDir, baseCommit };
|
|
@@ -79,16 +80,16 @@ function insidePath(parent, child) {
|
|
|
79
80
|
|
|
80
81
|
export function normalizeWorkspaceSetup(value, projectRoot) {
|
|
81
82
|
if (value == null) return null;
|
|
82
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("
|
|
83
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("workspace.setup must be an object");
|
|
83
84
|
const links = (value.links ?? []).map((entry) => {
|
|
84
85
|
if (!entry || typeof entry.path !== "string" || !entry.path.trim()
|
|
85
|
-
|| typeof entry.source !== "string" || !entry.source.trim()) throw new Error("
|
|
86
|
+
|| typeof entry.source !== "string" || !entry.source.trim()) throw new Error("workspace.setup.links requires path and source");
|
|
86
87
|
const path = entry.path.trim();
|
|
87
|
-
if (isAbsolute(path) || path.split(/[\\/]/).includes("..")) throw new Error(`
|
|
88
|
+
if (isAbsolute(path) || path.split(/[\\/]/).includes("..")) throw new Error(`workspace.setup link path must stay inside the worktree: ${path}`);
|
|
88
89
|
return { path, source: resolve(projectRoot, entry.source.trim()) };
|
|
89
90
|
});
|
|
90
91
|
const commands = (value.commands ?? []).map((command) => String(command).trim()).filter(Boolean);
|
|
91
|
-
if (links.length > 20 || commands.length > 20) throw new Error("
|
|
92
|
+
if (links.length > 20 || commands.length > 20) throw new Error("workspace.setup accepts at most 20 links and 20 commands");
|
|
92
93
|
const submodules = value.submodules === true;
|
|
93
94
|
return links.length || submodules || commands.length ? { links, submodules, commands } : null;
|
|
94
95
|
}
|
|
@@ -99,7 +100,7 @@ export function requireDependencySetup({ kind, projectRoot, setup, commands }) {
|
|
|
99
100
|
if (kind !== "git_worktree" || setup || !existsSync(join(projectRoot, "package.json"))) return;
|
|
100
101
|
const commandText = (commands ?? []).map((check) => typeof check === "string" ? check : check?.command).filter(Boolean).join("\n");
|
|
101
102
|
if (!JS_DEPENDENCY_COMMAND.test(commandText)) return;
|
|
102
|
-
const error = new Error("workspace_setup_required: this JavaScript acceptance uses local project tooling, but the new worktree has no node_modules or generated prepare files; pass
|
|
103
|
+
const error = new Error("workspace_setup_required: this JavaScript acceptance uses local project tooling, but the new worktree has no node_modules or generated prepare files; pass workspace.setup with dependency links and prepare commands (the same setup must be used by preflight)");
|
|
103
104
|
error.code = "workspace_setup_required";
|
|
104
105
|
throw error;
|
|
105
106
|
}
|
|
@@ -107,15 +108,15 @@ export function requireDependencySetup({ kind, projectRoot, setup, commands }) {
|
|
|
107
108
|
export async function prepareWorktreeWorkspace(setup, projectRoot, worktreePath, taskId) {
|
|
108
109
|
if (!setup) return;
|
|
109
110
|
for (const link of setup.links) {
|
|
110
|
-
if (!existsSync(link.source)) throw new Error(`
|
|
111
|
+
if (!existsSync(link.source)) throw new Error(`workspace.setup link source does not exist: ${link.source}`);
|
|
111
112
|
const destination = resolve(worktreePath, link.path);
|
|
112
|
-
if (!insidePath(worktreePath, destination)) throw new Error(`
|
|
113
|
+
if (!insidePath(worktreePath, destination)) throw new Error(`workspace.setup link escapes the worktree: ${link.path}`);
|
|
113
114
|
await mkdir(dirname(destination), { recursive: true });
|
|
114
115
|
if (existsSync(destination)) {
|
|
115
116
|
const existing = await lstat(destination);
|
|
116
|
-
if (!existing.isSymbolicLink()) throw new Error(`
|
|
117
|
+
if (!existing.isSymbolicLink()) throw new Error(`workspace.setup link destination already exists: ${link.path}`);
|
|
117
118
|
const [actual, expected] = await Promise.all([realpath(destination), realpath(link.source)]);
|
|
118
|
-
if (actual !== expected) throw new Error(`
|
|
119
|
+
if (actual !== expected) throw new Error(`workspace.setup link destination points elsewhere: ${link.path}`);
|
|
119
120
|
continue;
|
|
120
121
|
}
|
|
121
122
|
const sourceInfo = await stat(link.source);
|
|
@@ -131,7 +132,7 @@ export async function prepareWorktreeWorkspace(setup, projectRoot, worktreePath,
|
|
|
131
132
|
const result = await runAcceptance(setup.commands, { cwd: worktreePath, taskId, timeoutMs: DEFAULT_ACCEPTANCE_TIMEOUT_MS });
|
|
132
133
|
if (!result.passed) {
|
|
133
134
|
const failing = result.checks.find((check) => !check.passed);
|
|
134
|
-
throw new Error(`
|
|
135
|
+
throw new Error(`workspace.setup command failed: ${failing?.command ?? "unknown"}${failing?.output_tail ? `\n${failing.output_tail}` : ""}`);
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
}
|
|
@@ -9,7 +9,7 @@ export function normalizeAcceptance(value) {
|
|
|
9
9
|
const commands = list.filter((entry) => entry != null && entry !== "").map((entry) => {
|
|
10
10
|
if (typeof entry === "string") return entry.trim();
|
|
11
11
|
if (!entry || typeof entry !== "object" || Array.isArray(entry) || typeof entry.command !== "string" || !entry.command.trim()) throw new Error("acceptance requires a command string or structured check");
|
|
12
|
-
if (typeof entry.reportPath !== "string" || !entry.reportPath || isAbsolute(entry.reportPath) || /^[A-Za-z]:|^\\\\/.test(entry.reportPath) || entry.reportPath.split(/[\\/]/).includes("..")) throw new Error("
|
|
12
|
+
if (typeof entry.reportPath !== "string" || !entry.reportPath || isAbsolute(entry.reportPath) || /^[A-Za-z]:|^\\\\/.test(entry.reportPath) || entry.reportPath.split(/[\\/]/).includes("..")) throw new Error("report_path must stay inside the worktree");
|
|
13
13
|
const validation = compareFailureBaseline(entry.baseline, {
|
|
14
14
|
complete: true, identity: entry.baseline?.identity,
|
|
15
15
|
executed: [...new Set([...(entry.baseline?.required ?? []), ...(entry.baseline?.failures ?? []).map((item) => item?.test_id)])],
|
|
@@ -16,8 +16,8 @@ export function classifyFailure(task) {
|
|
|
16
16
|
if (provider) return provider;
|
|
17
17
|
if (/did not record the process exit/i.test(error)) return { source: "supervisor_process", code: "exit_unrecorded", retryable: true };
|
|
18
18
|
if (attention === "start_failed") return { source: "supervisor_process", code: "start_failed", retryable: true };
|
|
19
|
-
if (/^
|
|
20
|
-
if (/^
|
|
19
|
+
if (/^workspace\.setup command failed:/i.test(error)) return { source: "workspace_setup", code: "setup_command_failed", retryable: true };
|
|
20
|
+
if (/^workspace\.setup link /i.test(error)) return { source: "workspace_setup", code: "setup_link_failed", retryable: true };
|
|
21
21
|
if (attention === "invalid_report" || /Invalid final worker report/i.test(error)) return { source: "model_output", code: "invalid_report", retryable: true };
|
|
22
22
|
if (task.acceptance_results?.passed === false) return { source: "acceptance", code: "acceptance_failed", retryable: true };
|
|
23
23
|
if (attention === "no_work" || attention === "two_stall") return { source: "worker_progress", code: attention, retryable: false };
|