agent-dealer 1.4.4 → 1.4.5

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.
Files changed (62) hide show
  1. package/bundle/server/dist/adapters/muse-capability.js +81 -8
  2. package/bundle/server/dist/adapters/muse-capability.test.js +89 -1
  3. package/bundle/server/dist/coordinator/commands.js +2 -1
  4. package/bundle/server/package.json +2 -2
  5. package/bundle/server/static-ui/assets/index-2IuALSbV.js +64 -0
  6. package/bundle/server/static-ui/assets/index-MgimDoh2.css +1 -0
  7. package/bundle/server/static-ui/index.html +2 -2
  8. package/bundle/shared/package.json +1 -1
  9. package/dist/bin.js +0 -0
  10. package/package.json +2 -3
  11. package/bundle/server/dist/adapters/authority-lifecycle.js +0 -289
  12. package/bundle/server/dist/adapters/execution-authority.js +0 -103
  13. package/bundle/server/dist/adapters/execution-authority.test.js +0 -166
  14. package/bundle/server/dist/adapters/external.js +0 -20
  15. package/bundle/server/dist/coordinator/authority-recovery.integration.test.js +0 -661
  16. package/bundle/server/dist/coordinator/dispatcher.js +0 -58
  17. package/bundle/server/dist/coordinator/dispatcher.test.js +0 -81
  18. package/bundle/server/dist/coordinator/intent-forecast.js +0 -13
  19. package/bundle/server/dist/coordinator/intent-forecast.test.js +0 -34
  20. package/bundle/server/dist/coordinator/session-lifecycle.integration.test.js +0 -127
  21. package/bundle/server/dist/coordinator/session-lifecycle.js +0 -280
  22. package/bundle/server/dist/coordinator/session-lifecycle.test.js +0 -121
  23. package/bundle/server/dist/db/authority-attempts-stale-at-migration.test.js +0 -65
  24. package/bundle/server/dist/intake/agent-routing.js +0 -32
  25. package/bundle/server/dist/queue/answers.test.js +0 -117
  26. package/bundle/server/dist/queue/dispatcher-recovery.test.js +0 -37
  27. package/bundle/server/dist/queue/dispatcher.js +0 -597
  28. package/bundle/server/dist/queue/plan-delegation.js +0 -27
  29. package/bundle/server/dist/queue/plan-delegation.test.js +0 -61
  30. package/bundle/server/dist/queue/plan-gate.test.js +0 -55
  31. package/bundle/server/dist/queue/result-qa.js +0 -66
  32. package/bundle/server/dist/queue/result-qa.test.js +0 -146
  33. package/bundle/server/dist/repository/authority-attempts.js +0 -189
  34. package/bundle/server/dist/repository/result-qa.js +0 -37
  35. package/bundle/server/dist/runners/codex-args.js +0 -59
  36. package/bundle/server/dist/runners/codex-args.test.js +0 -72
  37. package/bundle/server/dist/runners/codex-resume.test.js +0 -19
  38. package/bundle/server/dist/runners/codex.js +0 -46
  39. package/bundle/server/dist/runners/muse-code-settings.js +0 -23
  40. package/bundle/server/dist/runners/muse-code-settings.test.js +0 -18
  41. package/bundle/server/dist/runners/persist.js +0 -142
  42. package/bundle/server/dist/runners/qa.js +0 -54
  43. package/bundle/server/dist/runners/run-context.js +0 -183
  44. package/bundle/server/dist/runners/stream-json.test.js +0 -95
  45. package/bundle/server/dist/trace-summary.js +0 -93
  46. package/bundle/server/dist/usage-summary.js +0 -61
  47. package/bundle/server/dist/usage-summary.test.js +0 -33
  48. package/bundle/server/static-ui/assets/index-CHCiztRI.css +0 -1
  49. package/bundle/server/static-ui/assets/index-CrLQFFpw.js +0 -64
  50. package/bundle/server/static-ui/fonts/Monaco.ttf +0 -0
  51. package/bundle/shared/dist/cursor-auth-health.d.ts +0 -12
  52. package/bundle/shared/dist/cursor-auth-health.js +0 -36
  53. package/bundle/shared/dist/cursor-auth-health.test.d.ts +0 -1
  54. package/bundle/shared/dist/cursor-auth-health.test.js +0 -40
  55. package/bundle/shared/dist/plan-triage.d.ts +0 -317
  56. package/bundle/shared/dist/plan-triage.js +0 -65
  57. package/bundle/shared/dist/plan-triage.test.d.ts +0 -1
  58. package/bundle/shared/dist/plan-triage.test.js +0 -66
  59. package/bundle/shared/dist/result-qa.d.ts +0 -45
  60. package/bundle/shared/dist/result-qa.js +0 -25
  61. package/bundle/shared/dist/result-qa.test.d.ts +0 -1
  62. package/bundle/shared/dist/result-qa.test.js +0 -60
@@ -1,121 +0,0 @@
1
- // packages/server/src/coordinator/session-lifecycle.test.ts
2
- import { test, before } from "node:test";
3
- import assert from "node:assert/strict";
4
- import fs from "node:fs";
5
- import os from "node:os";
6
- import path from "node:path";
7
- process.env.AGENT_DEALER_HOME = fs.mkdtempSync(path.join(os.tmpdir(), "dealer-lifecycle-"));
8
- const { migrate } = await import("../db/index.js");
9
- const { BUILTIN_AGENT_CLAUDE_ID, BUILTIN_AGENT_CURSOR_ID } = await import("@agent-dealer/shared");
10
- const { createIssue, getIssue } = await import("../repository/issues.js");
11
- const { listWorkerSessionsForIssue } = await import("../repository/worker-sessions.js");
12
- const { listOpenHumanActions } = await import("../repository/human-actions.js");
13
- const { listWorkflowEventsForIssue } = await import("../repository/workflow-events.js");
14
- const { startIssueWorkflow, advanceIssue } = await import("./session-lifecycle.js");
15
- const { ReviewerResult } = await import("./reviewer-result.js");
16
- before(() => {
17
- migrate();
18
- });
19
- function seedIssue(title) {
20
- return createIssue({
21
- title,
22
- description: "test issue",
23
- acceptanceCriteria: "works",
24
- repo: "/tmp/fake-repo",
25
- baseBranch: "main",
26
- developerAgentId: BUILTIN_AGENT_CLAUDE_ID,
27
- reviewerAgentId: BUILTIN_AGENT_CURSOR_ID,
28
- maxReviewRounds: 3,
29
- source: "manual",
30
- });
31
- }
32
- /** Fake deps: no real git/gh/spawn — deterministic canned responses per test. */
33
- function fakeDeps(overrides = {}) {
34
- return {
35
- worktree: {
36
- addWorktree: overrides.addWorktree ?? (async () => { }),
37
- removeWorktree: async () => { },
38
- isWorktreeClean: overrides.isWorktreeClean ?? (async () => true),
39
- mergeBase: overrides.mergeBase ?? (async () => "base-sha-1"),
40
- },
41
- github: {
42
- viewPr: overrides.viewPr ??
43
- (async () => ({ number: 1, url: "https://github.com/x/y/pull/1", headRefOid: "head-sha-1", baseRefName: "main", headRefName: "issue-branch", reviews: [] })),
44
- publishReview: overrides.publishReview ?? (async () => ({ ok: true, event: "APPROVE" })),
45
- },
46
- spawnDeveloper: overrides.spawnDeveloper ?? (async () => ({ exitCode: 0, transcript: "done", logPath: "/tmp/log" })),
47
- spawnReviewer: overrides.spawnReviewer ?? (async () => ({ exitCode: 0, transcript: "reviewed", logPath: "/tmp/log" })),
48
- };
49
- }
50
- test("starting a workflow creates one instance and one queued developer session for round 1", async () => {
51
- const issue = seedIssue("Start workflow");
52
- await startIssueWorkflow(issue.id, fakeDeps());
53
- const sessions = listWorkerSessionsForIssue(issue.id);
54
- assert.equal(sessions.length, 1);
55
- assert.equal(sessions[0].role, "developer");
56
- assert.equal(sessions[0].round, 1);
57
- assert.equal(getIssue(issue.id)?.status, "developing");
58
- });
59
- test("clean developer handoff advances to a queued reviewer session", async () => {
60
- const issue = seedIssue("Clean handoff");
61
- await startIssueWorkflow(issue.id, fakeDeps());
62
- await advanceIssue(issue.id, fakeDeps());
63
- const sessions = listWorkerSessionsForIssue(issue.id);
64
- assert.equal(sessions.length, 2);
65
- assert.equal(sessions[1].role, "reviewer");
66
- assert.equal(sessions[1].inputSha, "head-sha-1");
67
- assert.equal(getIssue(issue.id)?.status, "reviewing");
68
- assert.equal(getIssue(issue.id)?.headSha, "head-sha-1");
69
- });
70
- test("approved review creates a final_review human action", async () => {
71
- const issue = seedIssue("Approved review");
72
- const approvedResult = { verdict: "approved", baseSha: "base-sha-1", headSha: "head-sha-1", acceptanceCriteriaAssessment: "met", evidenceAssessment: "ok", findings: [], risks: [] };
73
- await startIssueWorkflow(issue.id, fakeDeps());
74
- await advanceIssue(issue.id, fakeDeps()); // developer -> reviewer queued
75
- await advanceIssue(issue.id, fakeDeps({
76
- spawnReviewer: async () => ({ exitCode: 0, transcript: "```json\n" + JSON.stringify(approvedResult) + "\n```", logPath: "/tmp/log" }),
77
- })); // reviewer runs -> approved
78
- assert.equal(getIssue(issue.id)?.status, "final_review");
79
- const actions = listOpenHumanActions();
80
- assert.ok(actions.some((a) => a.issueId === issue.id && a.actionType === "final_review"));
81
- });
82
- test("changes_requested with rounds remaining queues a round-2 developer session with findings context", async () => {
83
- const issue = seedIssue("Changes requested");
84
- const crResult = {
85
- verdict: "changes_requested",
86
- baseSha: "base-sha-1",
87
- headSha: "head-sha-1",
88
- acceptanceCriteriaAssessment: "partial",
89
- evidenceAssessment: "ok",
90
- findings: [{ fingerprint: "fp1", severity: "blocking", title: "Missing check", rationale: "r" }],
91
- risks: [],
92
- };
93
- await startIssueWorkflow(issue.id, fakeDeps());
94
- await advanceIssue(issue.id, fakeDeps());
95
- await advanceIssue(issue.id, fakeDeps({ spawnReviewer: async () => ({ exitCode: 0, transcript: "```json\n" + JSON.stringify(crResult) + "\n```", logPath: "/tmp/log" }) }));
96
- const sessions = listWorkerSessionsForIssue(issue.id);
97
- assert.equal(sessions.length, 3);
98
- assert.equal(sessions[2].role, "developer");
99
- assert.equal(sessions[2].round, 2);
100
- assert.equal(getIssue(issue.id)?.status, "repairing");
101
- assert.equal(getIssue(issue.id)?.currentRound, 2);
102
- });
103
- test("dirty worktree after developer session creates policy_escalation without consuming a round", async () => {
104
- const issue = seedIssue("Dirty worktree");
105
- await startIssueWorkflow(issue.id, fakeDeps());
106
- await advanceIssue(issue.id, fakeDeps({ isWorktreeClean: async () => false }));
107
- assert.equal(getIssue(issue.id)?.status, "needs_human");
108
- assert.equal(getIssue(issue.id)?.currentRound, 1);
109
- const actions = listOpenHumanActions();
110
- assert.ok(actions.some((a) => a.issueId === issue.id && a.actionType === "policy_escalation"));
111
- });
112
- test("every completed round emits workflow_events with the issue and round attached", async () => {
113
- const issue = seedIssue("Events issue");
114
- await startIssueWorkflow(issue.id, fakeDeps());
115
- await advanceIssue(issue.id, fakeDeps());
116
- const events = listWorkflowEventsForIssue(issue.id);
117
- assert.ok(events.some((e) => e.type === "workflow.started"));
118
- assert.ok(events.some((e) => e.type === "worker.started"));
119
- assert.ok(events.some((e) => e.type === "worker.completed"));
120
- assert.ok(events.some((e) => e.type === "pull_request.opened"));
121
- });
@@ -1,65 +0,0 @@
1
- // Regression test for the bug `npm run dev` hit against any database that ran migrate()
2
- // between NOT-93 (introduced `authority_attempts`) and NOT-91 (added its `stale_at`
3
- // column + an index on it): schema.sql's own `CREATE INDEX idx_authority_attempts_stale
4
- // ON authority_attempts(status, stale_at)` threw "no such column: stale_at" against the
5
- // pre-existing table, aborting migrate() before it ever reached the incremental-ALTER
6
- // section below it — see db/index.ts's pre-schema.sql guard.
7
- import { test } from "node:test";
8
- import assert from "node:assert/strict";
9
- import fs from "node:fs";
10
- import os from "node:os";
11
- import path from "node:path";
12
- process.env.AGENT_DEALER_HOME = fs.mkdtempSync(path.join(os.tmpdir(), "dealer-authattempt-migrate-"));
13
- const { migrate, getDb } = await import("./index.js");
14
- test("migrate() upgrades a pre-NOT-91 authority_attempts table that has no stale_at column", () => {
15
- migrate();
16
- const db = getDb();
17
- // Recreate the pre-NOT-91 world: the table and its two original indexes, but without
18
- // stale_at or the index on it — exactly what a database that last ran migrate() between
19
- // NOT-93 and NOT-91 landing would have.
20
- db.exec(`
21
- DROP INDEX IF EXISTS idx_authority_attempts_owner;
22
- DROP INDEX IF EXISTS idx_authority_attempts_stale;
23
- DROP INDEX IF EXISTS idx_authority_attempts_status;
24
- DROP TABLE authority_attempts;
25
- CREATE TABLE authority_attempts (
26
- id TEXT PRIMARY KEY,
27
- owner_kind TEXT NOT NULL,
28
- owner_id TEXT NOT NULL,
29
- idempotency_key TEXT NOT NULL,
30
- authority_id TEXT,
31
- deck_id TEXT NOT NULL,
32
- run_id TEXT NOT NULL,
33
- attempt_id TEXT NOT NULL,
34
- ttl_ms INTEGER NOT NULL,
35
- tool_scope_hint_json TEXT,
36
- status TEXT NOT NULL,
37
- expires_at TEXT,
38
- created_at TEXT NOT NULL,
39
- updated_at TEXT NOT NULL
40
- );
41
- CREATE INDEX idx_authority_attempts_owner ON authority_attempts(owner_kind, owner_id);
42
- CREATE INDEX idx_authority_attempts_status ON authority_attempts(status);
43
- `);
44
- const preFixCols = db.prepare("PRAGMA table_info(authority_attempts)").all();
45
- assert.ok(!preFixCols.some((c) => c.name === "stale_at"), "test setup must reproduce the pre-fix table exactly");
46
- const now = new Date().toISOString();
47
- db.prepare(`INSERT INTO authority_attempts (id, owner_kind, owner_id, idempotency_key, deck_id, run_id, attempt_id, ttl_ms, status, created_at, updated_at)
48
- VALUES ('a1', 'developer', 'issue-1:developer', 'a1:1', 'deck-1', 'run-1', 'a1', 60000, 'acquiring', ?, ?)`).run(now, now);
49
- // This is the actual regression: pre-fix, this throws "no such column: stale_at" from
50
- // schema.sql's own CREATE INDEX, before ever reaching an incremental ALTER.
51
- assert.doesNotThrow(() => migrate());
52
- const cols = db.prepare("PRAGMA table_info(authority_attempts)").all();
53
- assert.ok(cols.some((c) => c.name === "stale_at"), "stale_at must exist after migrate()");
54
- // The pre-existing row survived the migration untouched.
55
- const row = db.prepare("SELECT stale_at FROM authority_attempts WHERE id = 'a1'").get();
56
- assert.equal(row.stale_at, null);
57
- // The stale-tracking index now exists and is actually usable.
58
- db.exec("UPDATE authority_attempts SET stale_at = '2026-01-01T00:00:00.000Z' WHERE id = 'a1'");
59
- const staleRows = db
60
- .prepare("SELECT id FROM authority_attempts WHERE status = 'acquiring' AND stale_at IS NOT NULL")
61
- .all();
62
- assert.deepEqual(staleRows.map((r) => r.id), ["a1"]);
63
- // A second migrate() is a no-op (column already present) and still starts cleanly.
64
- assert.doesNotThrow(() => migrate());
65
- });
@@ -1,32 +0,0 @@
1
- import { listAgentsWithHealth } from "../adapters/agent-health.js";
2
- import { listAgents } from "../repository/agents.js";
3
- export async function resolveAgentForIssue(issue, settings, explicitAgentId) {
4
- if (explicitAgentId) {
5
- return { agentId: explicitAgentId, reason: "explicit agentId on promote" };
6
- }
7
- const issueLabels = new Set((issue.labels ?? []).map((l) => l.toLowerCase()));
8
- for (const rule of settings.routingRules) {
9
- if (issueLabels.has(rule.label.toLowerCase())) {
10
- return {
11
- agentId: rule.agentId,
12
- reason: `label:${rule.label} → configured agent`,
13
- };
14
- }
15
- }
16
- if (settings.defaultAgentId) {
17
- return {
18
- agentId: settings.defaultAgentId,
19
- reason: "linear.defaultAgentId",
20
- };
21
- }
22
- const agents = await listAgentsWithHealth(listAgents());
23
- const healthyWithWorkspace = agents.filter((a) => a.healthy && a.workspaceRoot);
24
- if (healthyWithWorkspace.length > 0) {
25
- const pick = healthyWithWorkspace[0];
26
- return {
27
- agentId: pick.id,
28
- reason: `first healthy agent with workspace (${pick.name})`,
29
- };
30
- }
31
- throw new Error("No agent available — set defaultAgentId, routing rules, or configure a healthy agent with workspace");
32
- }
@@ -1,117 +0,0 @@
1
- import { test, before } from "node:test";
2
- import assert from "node:assert/strict";
3
- import fs from "node:fs";
4
- import os from "node:os";
5
- import path from "node:path";
6
- process.env.AGENT_DEALER_HOME = fs.mkdtempSync(path.join(os.tmpdir(), "dealer-answers-"));
7
- process.env.MAX_CONCURRENT_RUNS = "0";
8
- const { migrate } = await import("../db/index.js");
9
- const { BUILTIN_AGENT_CLAUDE_ID } = await import("@agent-dealer/shared");
10
- const { updateAgent } = await import("../repository/agents.js");
11
- const { addArtifact, createRun, getLatestArtifact, getRun, markPlanTriageConsumed, updateRunFields } = await import("../repository/runs.js");
12
- const { submitPlanAnswers } = await import("./dispatcher.js");
13
- const QUESTIONS = [
14
- { id: "q1", question: "Which approach?", options: [{ label: "A" }, { label: "B" }] },
15
- { id: "q2", question: "Ship docs too?", options: [{ label: "Yes" }, { label: "No" }] },
16
- ];
17
- before(() => {
18
- migrate();
19
- updateAgent(BUILTIN_AGENT_CLAUDE_ID, { workspaceRoot: process.env.AGENT_DEALER_HOME });
20
- });
21
- function seedQuestionRun() {
22
- const run = createRun({
23
- title: "Answers test",
24
- taskCategory: "other",
25
- status: "plan_pending",
26
- agentId: BUILTIN_AGENT_CLAUDE_ID,
27
- });
28
- addArtifact(run.id, "draft_plan", { markdown: "# Plan", sessionId: "sess-1" }, "agent");
29
- addArtifact(run.id, "plan_triage", { verdict: "needs_review", rationale: "r", questions: QUESTIONS, sessionId: "sess-1", parseFallback: false, consumed: false }, "agent");
30
- return getRun(run.id);
31
- }
32
- test("all-structured answers approve and mark plan_answers approved", () => {
33
- const run = seedQuestionRun();
34
- const res = submitPlanAnswers(run.id, {
35
- answers: [
36
- { questionId: "q1", selectedLabel: "A" },
37
- { questionId: "q2", selectedLabel: "No" },
38
- ],
39
- });
40
- assert.equal(res.ok, true);
41
- assert.equal(res.ok && res.outcome, "approved");
42
- assert.equal(getRun(run.id).status, "plan_approved");
43
- const ans = getLatestArtifact(run.id, "plan_answers");
44
- assert.match(ans.contentJson, /"outcome":"approved"/);
45
- assert.equal(getLatestArtifact(run.id, "approved_plan").author, "human");
46
- const triage = getLatestArtifact(run.id, "plan_triage");
47
- assert.match(triage.contentJson, /"consumed":true/);
48
- });
49
- test("executeModel null does not wipe seeded execute_model", () => {
50
- const run = seedQuestionRun();
51
- updateRunFields(run.id, { execute_model: "claude-sonnet-4" });
52
- const res = submitPlanAnswers(run.id, {
53
- answers: [
54
- { questionId: "q1", selectedLabel: "A" },
55
- { questionId: "q2", selectedLabel: "No" },
56
- ],
57
- executeModel: null,
58
- });
59
- assert.equal(res.ok, true);
60
- assert.equal(getRun(run.id).executeModel, "claude-sonnet-4");
61
- });
62
- test("free-form answer schedules a redraft instead of approving", () => {
63
- const run = seedQuestionRun();
64
- let redrafted = false;
65
- const res = submitPlanAnswers(run.id, {
66
- answers: [
67
- { questionId: "q1", freeText: "Do it a third way" },
68
- { questionId: "q2", selectedLabel: "Yes" },
69
- ],
70
- }, { onRedraft: () => { redrafted = true; } });
71
- assert.equal(res.ok && res.outcome, "redraft");
72
- assert.equal(redrafted, true);
73
- assert.equal(getRun(run.id).status, "plan_pending");
74
- });
75
- test("answers must cover every open question exactly once", () => {
76
- const run = seedQuestionRun();
77
- const res = submitPlanAnswers(run.id, { answers: [{ questionId: "q1", selectedLabel: "A" }] });
78
- assert.equal(res.ok, false);
79
- assert.equal(!res.ok && res.code, 400);
80
- });
81
- test("double submit returns 409", () => {
82
- const run = seedQuestionRun();
83
- submitPlanAnswers(run.id, {
84
- answers: [
85
- { questionId: "q1", selectedLabel: "A" },
86
- { questionId: "q2", selectedLabel: "Yes" },
87
- ],
88
- });
89
- const again = submitPlanAnswers(run.id, {
90
- answers: [
91
- { questionId: "q1", selectedLabel: "B" },
92
- { questionId: "q2", selectedLabel: "No" },
93
- ],
94
- });
95
- assert.equal(!again.ok && again.code, 409);
96
- });
97
- test("run without open questions returns 409", () => {
98
- const run = createRun({
99
- title: "No questions",
100
- taskCategory: "other",
101
- status: "plan_pending",
102
- agentId: BUILTIN_AGENT_CLAUDE_ID,
103
- });
104
- const res = submitPlanAnswers(run.id, { answers: [{ questionId: "q1", selectedLabel: "A" }] });
105
- assert.equal(!res.ok && res.code, 409);
106
- });
107
- test("consumed triage rejects answers", () => {
108
- const run = seedQuestionRun();
109
- markPlanTriageConsumed(run.id);
110
- const res = submitPlanAnswers(run.id, {
111
- answers: [
112
- { questionId: "q1", selectedLabel: "A" },
113
- { questionId: "q2", selectedLabel: "Yes" },
114
- ],
115
- });
116
- assert.equal(!res.ok && res.code, 409);
117
- });
@@ -1,37 +0,0 @@
1
- import { test, before } from "node:test";
2
- import assert from "node:assert/strict";
3
- import fs from "node:fs";
4
- import os from "node:os";
5
- import path from "node:path";
6
- process.env.AGENT_DEALER_HOME = fs.mkdtempSync(path.join(os.tmpdir(), "dealer-recovery-"));
7
- process.env.MAX_CONCURRENT_RUNS = "2";
8
- process.env.MAX_PLAN_ATTEMPTS = "3";
9
- const { migrate } = await import("../db/index.js");
10
- const { BUILTIN_AGENT_CLAUDE_ID } = await import("@agent-dealer/shared");
11
- const { updateAgent } = await import("../repository/agents.js");
12
- const { addArtifact, createRun, getRun, transitionRun, } = await import("../repository/runs.js");
13
- const { recoverOrphanedRuns, cancelActiveRun, } = await import("./dispatcher.js");
14
- before(() => {
15
- migrate();
16
- updateAgent(BUILTIN_AGENT_CLAUDE_ID, { workspaceRoot: process.env.AGENT_DEALER_HOME });
17
- });
18
- test("recoverOrphanedRuns fails stuck running rows", () => {
19
- const run = createRun({
20
- title: "Orphan",
21
- taskCategory: "other",
22
- status: "plan_pending",
23
- agentId: BUILTIN_AGENT_CLAUDE_ID,
24
- });
25
- transitionRun(run.id, "plan_approved");
26
- transitionRun(run.id, "running");
27
- assert.equal(getRun(run.id).status, "running");
28
- const n = recoverOrphanedRuns();
29
- assert.equal(n, 1);
30
- assert.equal(getRun(run.id).status, "failed");
31
- });
32
- test("recoverOrphanedRuns is a no-op when queue is clean", () => {
33
- assert.equal(recoverOrphanedRuns(), 0);
34
- });
35
- test("cancelActiveRun delegates to process registry without throwing", () => {
36
- assert.doesNotThrow(() => cancelActiveRun("missing-run-id"));
37
- });