specdojo 0.3.0 → 0.4.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.
Files changed (245) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +77 -18
  3. package/dist/catalog/build-references.js +144 -0
  4. package/dist/catalog/build-render.js +32 -0
  5. package/dist/{catalog-build.js → catalog/build.js} +18 -295
  6. package/dist/{catalog.js → catalog/catalog.js} +11 -11
  7. package/dist/{catalog-generate.js → catalog/generate.js} +13 -16
  8. package/dist/catalog/paths.js +1 -0
  9. package/dist/{catalog-plan-generate.js → catalog/plan-generate.js} +5 -5
  10. package/dist/{catalog-plan.js → catalog/plan.js} +9 -9
  11. package/dist/{catalog-scaffold.js → catalog/scaffold.js} +6 -6
  12. package/dist/{agent.js → commands/agent.js} +11 -11
  13. package/dist/{build-command.js → commands/build.js} +2 -2
  14. package/dist/{init-command.js → commands/init.js} +103 -37
  15. package/dist/{orchestrator.js → commands/orchestrator.js} +2 -2
  16. package/dist/{watch.js → commands/watch.js} +3 -3
  17. package/dist/dashboard/dashboard-timeline.js +175 -0
  18. package/dist/{dashboard.js → dashboard/dashboard.js} +16 -549
  19. package/dist/dashboard/exec-records.js +105 -0
  20. package/dist/dashboard/routines.js +256 -0
  21. package/dist/dashboard/shared.js +14 -0
  22. package/dist/{timeline-build.js → dashboard/timeline-build.js} +2 -1
  23. package/dist/{timeline.js → dashboard/timeline.js} +1 -1
  24. package/dist/{deliverable.js → deliverable/deliverable.js} +5 -5
  25. package/dist/{deliverable-trash.js → deliverable/trash.js} +7 -7
  26. package/dist/{devcontainer-command.js → devcontainer/command.js} +5 -3
  27. package/dist/{devcontainer-scaffold.js → devcontainer/scaffold.js} +94 -2
  28. package/dist/{doc-index.js → docs/doc-index.js} +3 -3
  29. package/dist/{frontmatter-namespace.js → docs/frontmatter-namespace.js} +2 -2
  30. package/dist/{index-command.js → docs/index-command.js} +1 -1
  31. package/dist/docs/template-resolution.js +1 -0
  32. package/dist/{viewpoint-document-kinds-check.js → docs/viewpoint-document-kinds-check.js} +3 -3
  33. package/dist/{yaml-pages-command.js → docs/yaml-pages-command.js} +1 -1
  34. package/dist/{yaml-pages.js → docs/yaml-pages.js} +5 -5
  35. package/dist/{exec-agent-config.js → exec/agent-config.js} +33 -4
  36. package/dist/{exec-agent-git-state.js → exec/agent-git-state.js} +1 -1
  37. package/dist/{exec-agent-protected-config.js → exec/agent-protected-config.js} +1 -1
  38. package/dist/{exec.js → exec/commands.js} +22 -467
  39. package/dist/exec/core.js +457 -0
  40. package/dist/{exec-events.js → exec/events.js} +2 -2
  41. package/dist/{exec-evidence.js → exec/evidence.js} +11 -6
  42. package/dist/exec/exec.js +2 -0
  43. package/dist/exec/format.js +1 -0
  44. package/dist/{exec-handoff.js → exec/handoff.js} +13 -12
  45. package/dist/{exec-limit.js → exec/limit.js} +93 -12
  46. package/dist/{exec-parent-validation.js → exec/parent-validation.js} +4 -4
  47. package/dist/{exec-pipeline-state.js → exec/pipeline-state.js} +16 -2
  48. package/dist/{exec-plans.js → exec/plans-core.js} +97 -468
  49. package/dist/exec/plans-generation.js +249 -0
  50. package/dist/exec/plans-storage.js +131 -0
  51. package/dist/exec/plans.js +3 -0
  52. package/dist/{exec-project.js → exec/project.js} +1 -1
  53. package/dist/{exec-protection-handoff.js → exec/protection-handoff.js} +3 -3
  54. package/dist/{exec-register-resume.js → exec/register-resume.js} +2 -2
  55. package/dist/{exec-register.js → exec/register.js} +92 -9
  56. package/dist/exec/repo-integration-git.js +23 -0
  57. package/dist/exec/repo-integration-sync.js +264 -0
  58. package/dist/{exec-repo-integration.js → exec/repo-integration.js} +13 -287
  59. package/dist/{exec-repo-trace.js → exec/repo-trace.js} +3 -3
  60. package/dist/exec/reporter-output.js +206 -0
  61. package/dist/{exec-reporter.js → exec/reporter.js} +29 -216
  62. package/dist/{exec-results.js → exec/results.js} +277 -36
  63. package/dist/exec/run/agent-pipeline.js +276 -0
  64. package/dist/exec/run/agent.js +583 -0
  65. package/dist/exec/run/in-place.js +570 -0
  66. package/dist/exec/run/job.js +746 -0
  67. package/dist/exec/run/lifecycle-commands.js +530 -0
  68. package/dist/{exec-run-lock.js → exec/run/lock.js} +4 -3
  69. package/dist/exec/run/mode-shared.js +140 -0
  70. package/dist/exec/run/register-command.js +252 -0
  71. package/dist/exec/run/register-core.js +411 -0
  72. package/dist/exec/run/register-mode.js +210 -0
  73. package/dist/exec/run/register-resume.js +398 -0
  74. package/dist/exec/run/register-state.js +325 -0
  75. package/dist/exec/run/register-worktree.js +540 -0
  76. package/dist/exec/run/run.js +11 -0
  77. package/dist/exec/run/schedule-mode.js +294 -0
  78. package/dist/exec/run/schedule-prepare.js +366 -0
  79. package/dist/exec/run/schedule-task.js +599 -0
  80. package/dist/exec/run/shared.js +449 -0
  81. package/dist/{exec-schedule-calendar.js → exec/schedule/calendar.js} +1 -1
  82. package/dist/{exec-schedule-cpm.js → exec/schedule/cpm.js} +2 -2
  83. package/dist/{exec-schedule-gantt-chart-render.js → exec/schedule/gantt-chart-render.js} +2 -2
  84. package/dist/exec/schedule/gantt-chart.js +2 -0
  85. package/dist/{exec-schedule-hash.js → exec/schedule/hash.js} +2 -2
  86. package/dist/exec/schedule/index.js +1 -0
  87. package/dist/{exec-schedule-initial.js → exec/schedule/initial.js} +2 -2
  88. package/dist/{exec-schedule-progress.js → exec/schedule/progress.js} +2 -2
  89. package/dist/{exec-schedule-ready.js → exec/schedule/ready.js} +2 -2
  90. package/dist/{exec-schedule.js → exec/schedule/schedule.js} +11 -11
  91. package/dist/exec/shared.js +63 -0
  92. package/dist/exec/slot-lock.js +1 -0
  93. package/dist/{exec-strategy.js → exec/strategy.js} +2 -2
  94. package/dist/{exec-task-repos.js → exec/task-repos.js} +2 -2
  95. package/dist/{exec-task-view.js → exec/task-view.js} +4 -4
  96. package/dist/{exec-trial.js → exec/trial-commands.js} +23 -388
  97. package/dist/exec/trial-core.js +371 -0
  98. package/dist/exec/trial.js +2 -0
  99. package/dist/{exec-worktree-command.js → exec/worktree-command.js} +25 -23
  100. package/dist/exec/worktree-ops-commit.js +672 -0
  101. package/dist/exec/worktree-ops-lifecycle.js +297 -0
  102. package/dist/exec/worktree-ops-merge.js +344 -0
  103. package/dist/exec/worktree-ops.js +3 -0
  104. package/dist/exec/worktree.js +305 -0
  105. package/dist/grade/apply.js +734 -0
  106. package/dist/grade/command-apply.js +250 -0
  107. package/dist/grade/command-inspect.js +138 -0
  108. package/dist/grade/command-plan.js +101 -0
  109. package/dist/grade/command-shared.js +68 -0
  110. package/dist/grade/core.js +307 -0
  111. package/dist/grade/grade.js +19 -0
  112. package/dist/grade/markdown.js +274 -0
  113. package/dist/grade/pipeline-state.js +184 -0
  114. package/dist/grade/plan.js +507 -0
  115. package/dist/{grade-result.js → grade/result.js} +7 -96
  116. package/dist/grade/target-discovery.js +265 -0
  117. package/dist/grade/targets.js +435 -0
  118. package/dist/{job.js → job/definition.js} +32 -574
  119. package/dist/job/job.js +568 -0
  120. package/dist/{kata-command.js → kata/command.js} +4 -4
  121. package/dist/{kata.js → kata/kata.js} +5 -5
  122. package/dist/register/approach.js +134 -0
  123. package/dist/register/command-types.js +1 -0
  124. package/dist/register/core.js +369 -0
  125. package/dist/register/create-commands.js +352 -0
  126. package/dist/{register-date.js → register/date.js} +1 -1
  127. package/dist/register/derivation.js +163 -0
  128. package/dist/{register-event-merge.js → register/event-merge.js} +32 -3
  129. package/dist/{register-events.js → register/events.js} +12 -6
  130. package/dist/{register-history.js → register/history.js} +7 -6
  131. package/dist/{register-item.js → register/item.js} +28 -10
  132. package/dist/register/lifecycle-lock.js +5 -0
  133. package/dist/register/maintenance-commands.js +193 -0
  134. package/dist/{register-migrate-timestamps.js → register/migrate-timestamps.js} +3 -3
  135. package/dist/register/migration.js +268 -0
  136. package/dist/register/register.js +404 -0
  137. package/dist/register/renumber.js +341 -0
  138. package/dist/register/transition-commands.js +248 -0
  139. package/dist/register/update.js +230 -0
  140. package/dist/register/views.js +296 -0
  141. package/dist/{review-grade.js → review/grade.js} +2 -2
  142. package/dist/{review-plan.js → review/plan.js} +5 -5
  143. package/dist/routine/definition.js +401 -0
  144. package/dist/{routine.js → routine/routine.js} +50 -419
  145. package/dist/{schedule-approach.js → schedule/approach.js} +9 -9
  146. package/dist/{schedule-build.js → schedule/build.js} +7 -4
  147. package/dist/{schedule.js → schedule/schedule.js} +9 -9
  148. package/dist/schedule/strategy-generate-document.js +273 -0
  149. package/dist/schedule/strategy-generate-scope.js +199 -0
  150. package/dist/schedule/strategy-generate.js +348 -0
  151. package/dist/shared/agent-types.js +23 -0
  152. package/dist/shared/artifact-path.js +9 -0
  153. package/dist/{build-if-stale.js → shared/build-if-stale.js} +1 -1
  154. package/dist/shared/catalog-render.js +115 -0
  155. package/dist/{exec-slot-lock.js → shared/cross-process-lock.js} +3 -1
  156. package/dist/shared/fs.js +30 -0
  157. package/dist/shared/git.js +316 -0
  158. package/dist/shared/grade-result.js +94 -0
  159. package/dist/{package-paths.js → shared/package-paths.js} +3 -3
  160. package/dist/shared/plan-templates.js +114 -0
  161. package/dist/{exec-provider-scaffold.js → shared/provider-scaffold.js} +3 -1
  162. package/dist/shared/random.js +4 -0
  163. package/dist/{exec-schedule-index.js → shared/schedule-index.js} +3 -1
  164. package/dist/shared/schedule-paths.js +9 -0
  165. package/dist/{specdojo-config.js → shared/specdojo-config.js} +96 -9
  166. package/dist/{exec-shared.js → shared/text.js} +0 -134
  167. package/dist/shared/time.js +28 -0
  168. package/dist/shared/yaml.js +28 -0
  169. package/dist/specdojo.js +22 -22
  170. package/docs/ja/specdojo/exec-templates/xep-common-conventions-template.md +29 -17
  171. package/docs/ja/specdojo/exec-templates/xep-register-investigate-template.md +1 -2
  172. package/docs/ja/specdojo/exec-templates/xep-register-template.md +1 -2
  173. package/docs/ja/specdojo/exec-templates/xer-template.md +1 -3
  174. package/docs/ja/specdojo/exec-templates/xrp-job-template.md +6 -4
  175. package/docs/ja/specdojo/guides/exec-config-guide.md +97 -22
  176. package/docs/ja/specdojo/guides/exec-operation-guide.md +145 -12
  177. package/docs/ja/specdojo/guides/exec-worktree-guide.md +2 -0
  178. package/docs/ja/specdojo/guides/orchestrator-operation-guide.md +51 -18
  179. package/docs/ja/specdojo/guides/quick-start-guide.md +81 -16
  180. package/docs/ja/specdojo/guides/register-operation-guide.md +2 -1
  181. package/docs/ja/specdojo/guides/remote-host-development-guide.md +10 -1
  182. package/docs/ja/specdojo/guides/review-guide.md +1 -1
  183. package/docs/ja/specdojo/guides/routine-operation-guide.md +6 -6
  184. package/docs/ja/specdojo/guides/use-case-guide.md +1 -1
  185. package/docs/ja/specdojo/references/command-reference.md +52 -28
  186. package/docs/ja/specdojo/rulebooks/pjr-rulebook.md +17 -11
  187. package/docs/ja/specdojo/standards/job-definition-standard.md +20 -18
  188. package/docs/ja/specdojo/standards/rulebook-authoring-standard.md +2 -2
  189. package/docs/ja/specdojo/templates/pjr-derived-items-template.md +22 -0
  190. package/docs/ja/specdojo/templates/pjr-index-template.md +1 -0
  191. package/docs/specdojo/schemas/v1/agent-members.schema.yaml +29 -2
  192. package/docs/specdojo/schemas/v1/exec-defaults.schema.yaml +20 -0
  193. package/docs/specdojo/schemas/v1/exec-evidence.schema.yaml +23 -0
  194. package/docs/specdojo/schemas/v1/job-run.schema.yaml +2 -2
  195. package/docs/specdojo/schemas/v1/job.schema.yaml +7 -0
  196. package/docs/specdojo/schemas/v1/pipeline-state.schema.yaml +26 -0
  197. package/docs/specdojo/schemas/v1/register-events.schema.yaml +3 -0
  198. package/docs/specdojo/schemas/v1/register-item-frontmatter.schema.yaml +70 -7
  199. package/docs/specdojo/schemas/v1/routine-run.schema.yaml +1 -1
  200. package/docs/specdojo/schemas/v1/specdojo-config.schema.yaml +1 -1
  201. package/package.json +4 -5
  202. package/templates/antigravity/README.md +7 -3
  203. package/templates/antigravity/agent-members-snippet.yaml +108 -12
  204. package/templates/antigravity/exec-defaults-snippet.yaml +10 -13
  205. package/templates/claude/README.md +27 -3
  206. package/templates/claude/agents/claude-executor.md +0 -1
  207. package/templates/claude/agents/claude-reporter.md +2 -1
  208. package/templates/claude/agents/claude-review-executor.md +0 -1
  209. package/templates/codex/README.md +23 -4
  210. package/templates/devcontainer/devcontainer.json +2 -2
  211. package/templates/devcontainer/remote-host/specdojo-tmux.sh.sample +69 -0
  212. package/templates/devcontainer/remote-host/ssh-config.sample +16 -0
  213. package/templates/init-agent-members.yaml +75 -25
  214. package/templates/init-exec-defaults.yaml +26 -8
  215. package/templates/opencode/README.md +17 -3
  216. package/templates/opencode/agents/opencode-executor.md +0 -1
  217. package/templates/opencode/agents/opencode-reporter.md +2 -1
  218. package/templates/opencode/agents/opencode-review-executor.md +0 -1
  219. package/dist/exec-run.js +0 -6182
  220. package/dist/exec-schedule-gantt-chart.js +0 -2
  221. package/dist/exec-worktree-ops.js +0 -1292
  222. package/dist/exec-worktree.js +0 -446
  223. package/dist/grade.js +0 -3193
  224. package/dist/register.js +0 -2407
  225. package/dist/schedule-strategy-generate.js +0 -812
  226. package/templates/claude/agents/claude-expert-review-executor.md +0 -14
  227. /package/dist/{catalog-plan-prompt.js → catalog/plan-prompt.js} +0 -0
  228. /package/dist/{catalog-types.js → catalog/types.js} +0 -0
  229. /package/dist/{template-frontmatter.js → docs/template-frontmatter.js} +0 -0
  230. /package/dist/{role-types.js → exec/role-types.js} +0 -0
  231. /package/dist/{exec-schedule-gantt-chart-scope.js → exec/schedule/gantt-chart-scope.js} +0 -0
  232. /package/dist/{exec-types.js → exec/types.js} +0 -0
  233. /package/dist/{review-types.js → review/types.js} +0 -0
  234. /package/dist/{schedule-phase-sets.js → schedule/phase-sets.js} +0 -0
  235. /package/dist/{schedule-strategy-profiles.js → schedule/strategy-profiles.js} +0 -0
  236. /package/dist/{agent-response.js → shared/agent-response.js} +0 -0
  237. /package/dist/{catalog-paths.js → shared/catalog-paths.js} +0 -0
  238. /package/dist/{dist-freshness.js → shared/dist-freshness.js} +0 -0
  239. /package/dist/{git-environment.js → shared/git-environment.js} +0 -0
  240. /package/dist/{exec-format.js → shared/markdown-format.js} +0 -0
  241. /package/dist/{practice-id.js → shared/practice-id.js} +0 -0
  242. /package/dist/{spawn-self.js → shared/spawn-self.js} +0 -0
  243. /package/dist/{specdojo-gitignore.js → shared/specdojo-gitignore.js} +0 -0
  244. /package/dist/{template-resolution.js → shared/template-resolution.js} +0 -0
  245. /package/dist/{yaml-schema-modeline.js → shared/yaml-schema-modeline.js} +0 -0
@@ -0,0 +1,530 @@
1
+ import { existsSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { loadExecDefaultsConfig, providerSlotPoolPath, resolveMaxConcurrency, resolveMaxConcurrentRuns, } from "../agent-config.js";
4
+ import { activateResolvedProjectPaths, resolveProjectPaths } from "../project.js";
5
+ import { acquireSchedulerLock, buildEvent, readAllEventFiles, foldEventsToState, releaseSchedulerLock, writeEventFile, } from "../events.js";
6
+ import { selectDueDeferredLimitTasks } from "../limit.js";
7
+ import { buildScheduleIndex } from "../schedule/schedule.js";
8
+ import { buildInitialStateFromStrategy } from "../schedule/initial.js";
9
+ import { qualifyTaskId } from "../shared.js";
10
+ import { specdojoRootDir } from "../../shared/specdojo-config.js";
11
+ import { collectExecLockUsage, execLocksDir, formatExecLockUsage } from "./lock.js";
12
+ import { buildTaskView } from "../task-view.js";
13
+ import { readResultFrontmatterSnapshot, updateResultStatus } from "../results.js";
14
+ import { findExecWorktree, resolveWorktreeBase } from "../worktree.js";
15
+ import { configuredProductRepos, withProductWorktrees } from "../task-repos.js";
16
+ import { parentValidationPoolPath, resolveParentValidationConcurrency, } from "../parent-validation.js";
17
+ import { loadPipelineResumeCheckpoint } from "../pipeline-state.js";
18
+ import { buildTaskPhaseMap, configuredWorktreeBase, parseParallel, resolveExecDefaultsPath, withProjectExecRunLock, } from "./shared.js";
19
+ import { loadRosterForExecutionPath, pathInsideWorktree } from "./agent.js";
20
+ import { findClaimEventPath, prepareSingleTask, } from "./schedule-prepare.js";
21
+ import { runPreparedTask } from "./schedule-task.js";
22
+ import { rebuildStaleGeneratedTracksForCycle, resolveClaimingActor, runBatchMode, } from "./schedule-mode.js";
23
+ import { spawnBlock, spawnIndexBuild, spawnRefresh, spawnValidate } from "./mode-shared.js";
24
+ // 同じ project の exec run が共有する枠(主 run・--join run・register lifecycle・provider の
25
+ // max_concurrency・親検証)の上限と現在の使用数を表示する。ロックは取得しない。
26
+ export function formatExecSlotsReport(executionPath, execDefaults) {
27
+ const lockRoot = execLocksDir(executionPath);
28
+ const providers = Object.keys(execDefaults.providers ?? {}).sort();
29
+ const providerPools = providers.flatMap((provider) => {
30
+ const cap = resolveMaxConcurrency(execDefaults, provider);
31
+ return cap === undefined
32
+ ? []
33
+ : [
34
+ {
35
+ name: `provider ${provider}`,
36
+ path: providerSlotPoolPath(lockRoot, provider),
37
+ limit: cap,
38
+ },
39
+ ];
40
+ });
41
+ const parentValidationPools = execDefaults.pipeline?.parent_validations?.length
42
+ ? [
43
+ {
44
+ name: "parent validations",
45
+ path: parentValidationPoolPath(lockRoot),
46
+ limit: resolveParentValidationConcurrency(execDefaults.pipeline.parent_validation_concurrency),
47
+ },
48
+ ]
49
+ : [];
50
+ const entries = collectExecLockUsage(executionPath, {
51
+ joinLimit: resolveMaxConcurrentRuns(execDefaults) - 1,
52
+ pools: [...providerPools, ...parentValidationPools],
53
+ });
54
+ return (`max concurrent runs: ${resolveMaxConcurrentRuns(execDefaults)}\n` +
55
+ formatExecLockUsage(entries));
56
+ }
57
+ export function registerSlotsCommand(exec) {
58
+ const cmd = exec
59
+ .command("slots")
60
+ .description("Show the limits and current usage of the slots shared by concurrent exec runs of a project");
61
+ cmd.option("--project <projectId>", "Project id in .specdojo/specdojo.config.json");
62
+ cmd.option("--exec-defaults <path>", "Path to exec-defaults.yaml global config (default: .specdojo/exec-defaults.yaml)");
63
+ cmd.action((opts) => {
64
+ try {
65
+ const { schedulePath, executionPath } = resolveProjectPaths({ project: opts.project });
66
+ const execDefaults = loadExecDefaultsConfig(resolveExecDefaultsPath(opts, schedulePath), executionPath);
67
+ process.stdout.write(formatExecSlotsReport(executionPath, execDefaults));
68
+ }
69
+ catch (error) {
70
+ const message = error instanceof Error ? error.message : String(error);
71
+ process.stdout.write(message + "\n");
72
+ process.exitCode = 1;
73
+ }
74
+ });
75
+ }
76
+ // exec cycle: run limit-resume, doc-index rebuild, stale schedule rebuild, schedule refresh, and
77
+ // the auto loop as one
78
+ // ordered sequence while holding a single project exec-run lock for the whole run. Ordering does
79
+ // not depend on routine file order or cron time offsets, and no manual run / other routine / CI
80
+ // can interleave between the steps. The individual steps (runResumeMode, index build,
81
+ // schedule build, validate/refresh, runBatchMode) do not acquire the exec-run lock themselves, so
82
+ // the later steps never busy-skip against this run's own lock.
83
+ //
84
+ // Step failure policy (fixed and documented so results are predictable):
85
+ // - resume: a re-deferred or failed limit task must not block Ready tasks, so a resume failure
86
+ // is recorded but the cycle still proceeds to index/refresh + auto.
87
+ // - index: doc-index feeds wikilink/ID resolution for Ready task plans; if it fails, tasks may
88
+ // reference deliverables the previous cycle just created but cannot resolve them
89
+ // reliably, so the cycle aborts the remaining steps.
90
+ // - schedule: stale generated tracks must be rebuilt before validation/refresh; if any build
91
+ // fails, the cycle stops instead of selecting tasks from an old track.
92
+ // - refresh: validate/refresh feeds ready.json; if it fails the auto step cannot select tasks
93
+ // safely, so the cycle aborts the remaining step.
94
+ // - auto: failures are recorded; nothing runs after it.
95
+ // The cycle exits non-zero when any executed step failed. Busy at start is handled by the shared
96
+ // exec-run lock (--if-busy skip records a routine "skipped"; wait/fail behave as for run/resume).
97
+ export async function runCycleMode(opts) {
98
+ const resolvedPaths = resolveProjectPaths({ project: opts.project });
99
+ const projectId = resolvedPaths.projectId ?? opts.project;
100
+ const dryRun = !!opts.dryRun;
101
+ const stepOutcomes = [];
102
+ let anyFailure = false;
103
+ // runResumeMode / runBatchMode report failure via process.exitCode. Read and reset it around
104
+ // each step so one step's exit code cannot leak into the next step's outcome.
105
+ const takeStepFailure = () => {
106
+ const failed = process.exitCode !== undefined && process.exitCode !== 0;
107
+ process.exitCode = 0;
108
+ return failed;
109
+ };
110
+ // Step 1/5: resume due deferred-limit tasks.
111
+ process.stdout.write("[cycle] step 1/5: resume due deferred-limit tasks\n");
112
+ process.exitCode = 0;
113
+ await runResumeMode({ ...opts, due: true });
114
+ if (takeStepFailure()) {
115
+ anyFailure = true;
116
+ stepOutcomes.push("resume=failure");
117
+ process.stdout.write("[cycle] resume reported failures — continuing to run Ready tasks\n");
118
+ }
119
+ else {
120
+ stepOutcomes.push("resume=success");
121
+ }
122
+ // Step 2/5: rebuild doc-index before recalculating schedule state, so deliverables created by
123
+ // the resume step, or left unindexed by a prior cycle run, are resolvable before Ready
124
+ // selection instead of only becoming resolvable on a later, out-of-band index build.
125
+ process.stdout.write("[cycle] step 2/5: rebuild doc index\n");
126
+ if (dryRun) {
127
+ process.stdout.write(" [dry-run] specdojo index build\n");
128
+ stepOutcomes.push("index=success");
129
+ }
130
+ else if (!spawnIndexBuild()) {
131
+ stepOutcomes.push("index=failure");
132
+ process.stdout.write("[cycle] index build failed — aborting auto step\n");
133
+ process.stdout.write(`[cycle] summary: ${stepOutcomes.join(", ")}\n`);
134
+ process.exitCode = 1;
135
+ return;
136
+ }
137
+ else {
138
+ stepOutcomes.push("index=success");
139
+ }
140
+ // Step 3/5 is conditional: regenerate only stale/missing generated tracks. It intentionally
141
+ // emits nothing and adds nothing to the summary when no rebuild is needed.
142
+ const rebuild = await rebuildStaleGeneratedTracksForCycle(resolvedPaths.schedulePath, projectId, dryRun);
143
+ if (rebuild.status === "failure") {
144
+ stepOutcomes.push("schedule=failure");
145
+ process.stdout.write(`[cycle] summary: ${stepOutcomes.join(", ")}\n`);
146
+ process.exitCode = 1;
147
+ return;
148
+ }
149
+ if (rebuild.status === "success")
150
+ stepOutcomes.push("schedule=success");
151
+ // Step 4/5: validate + refresh schedule state before selecting Ready tasks.
152
+ process.stdout.write("[cycle] step 4/5: validate + refresh schedule state\n");
153
+ if (dryRun) {
154
+ process.stdout.write(" [dry-run] specdojo exec validate\n");
155
+ process.stdout.write(" [dry-run] specdojo exec refresh\n");
156
+ stepOutcomes.push("refresh=success");
157
+ }
158
+ else if (!spawnValidate(projectId)) {
159
+ stepOutcomes.push("refresh=failure(validate)");
160
+ process.stdout.write("[cycle] validate failed — aborting auto step\n");
161
+ process.stdout.write(`[cycle] summary: ${stepOutcomes.join(", ")}\n`);
162
+ process.exitCode = 1;
163
+ return;
164
+ }
165
+ else if (!spawnRefresh(projectId)) {
166
+ stepOutcomes.push("refresh=failure(refresh)");
167
+ process.stdout.write("[cycle] refresh failed — aborting auto step\n");
168
+ process.stdout.write(`[cycle] summary: ${stepOutcomes.join(", ")}\n`);
169
+ process.exitCode = 1;
170
+ return;
171
+ }
172
+ else {
173
+ stepOutcomes.push("refresh=success");
174
+ }
175
+ // Step 5/5: run Ready tasks (auto loop). In dry-run the refresh above is skipped, so ready.json
176
+ // may be stale/absent; preview the planned auto invocation instead of reading the cache.
177
+ process.stdout.write("[cycle] step 5/5: run Ready tasks (--auto)\n");
178
+ if (dryRun) {
179
+ const autoArgs = ["exec", "run", "--auto"];
180
+ if (projectId)
181
+ autoArgs.push("--project", projectId);
182
+ if (opts.strategy)
183
+ autoArgs.push("--strategy", opts.strategy);
184
+ if (opts.parallel)
185
+ autoArgs.push("--parallel", opts.parallel);
186
+ if (opts.executorBy)
187
+ autoArgs.push("--executor-by", opts.executorBy);
188
+ if (opts.reporterBy)
189
+ autoArgs.push("--reporter-by", opts.reporterBy);
190
+ if (opts.loop) {
191
+ autoArgs.push("--loop");
192
+ if (opts.maxRounds)
193
+ autoArgs.push("--max-rounds", opts.maxRounds);
194
+ }
195
+ process.stdout.write(` [dry-run] specdojo ${autoArgs.join(" ")}\n`);
196
+ stepOutcomes.push("auto=success");
197
+ }
198
+ else {
199
+ process.exitCode = 0;
200
+ await runBatchMode({ ...opts, auto: true, cycleRebuildStaleTracks: true });
201
+ if (takeStepFailure()) {
202
+ anyFailure = true;
203
+ stepOutcomes.push("auto=failure");
204
+ }
205
+ else {
206
+ stepOutcomes.push("auto=success");
207
+ }
208
+ }
209
+ process.stdout.write(`[cycle] summary: ${stepOutcomes.join(", ")}\n`);
210
+ if (anyFailure)
211
+ process.exitCode = 1;
212
+ }
213
+ export function registerCycleCommand(exec) {
214
+ const cmd = exec
215
+ .command("cycle")
216
+ .description("Run limit-resume, doc-index rebuild, stale track rebuild, schedule refresh, and the --auto loop as one ordered sequence under a single project lock");
217
+ cmd.option("--project <projectId>", "Project id in .specdojo/specdojo.config.json");
218
+ cmd.option("--strategy <s>", "Task selection strategy for the auto step: critical-first|fifo (default: critical-first)");
219
+ cmd.option("--parallel <n>", "Number of tasks to resume / run in parallel", "1");
220
+ cmd.option("--loop", "Repeat the auto step until no Ready tasks remain", false);
221
+ cmd.option("--max-rounds <n>", "Maximum number of auto rounds when using --loop");
222
+ cmd.option("--edit-by <nickname>", "agent-members.yaml nickname for edit-mode tasks (resume + auto)");
223
+ cmd.option("--review-by <nickname>", "agent-members.yaml nickname for review-mode tasks (resume + auto)");
224
+ cmd.option("--executor-by <nickname>", "agent-members.yaml executor nickname for pipeline tasks (resume + auto)");
225
+ cmd.option("--reporter-by <nickname>", "agent-members.yaml reporter nickname for pipeline tasks (resume + auto)");
226
+ cmd.option("--worktree-base <path>", "Override worktree base directory");
227
+ cmd.option("--exec-defaults <path>", "Path to exec-defaults.yaml global config (default: .specdojo/exec-defaults.yaml)");
228
+ cmd.option("--if-busy <policy>", "When another exec is running for the project: skip|wait|fail (default: fail)", "fail");
229
+ cmd.option("--dry-run", "Print resolved steps without executing", false);
230
+ cmd.action(async (opts) => {
231
+ try {
232
+ await withProjectExecRunLock(opts, "cycle", () => runCycleMode(opts));
233
+ }
234
+ catch (error) {
235
+ const message = error instanceof Error ? error.message : String(error);
236
+ process.stdout.write(message + "\n");
237
+ process.exitCode = 1;
238
+ }
239
+ });
240
+ }
241
+ // Restore a Schedule pipeline at its runner-owned integration stage without resolving or starting
242
+ // an agent. The block event supplies the run-scoped state reference; both agent stages must still
243
+ // be succeeded and the original worktree/result must exist before any lifecycle state is changed.
244
+ export function prepareScheduleIntegrationResume(params) {
245
+ const { task, taskState, actor, projectId, repoRoot, executionPath, schedulePath } = params;
246
+ const stateRef = typeof taskState?.meta?.pipeline_state_ref === "string"
247
+ ? taskState.meta.pipeline_state_ref
248
+ : undefined;
249
+ if (!stateRef) {
250
+ throw new Error(`integration resume has no pipeline_state_ref for ${task.id}`);
251
+ }
252
+ const worktreeTaskId = qualifyTaskId(projectId, task.id);
253
+ const foundWorktree = findExecWorktree(repoRoot, worktreeTaskId);
254
+ if (!foundWorktree)
255
+ throw new Error(`no exec worktree to resume integration for ${task.id}`);
256
+ const worktree = withProductWorktrees(foundWorktree, configuredProductRepos(schedulePath), worktreeTaskId);
257
+ const checkpoint = loadPipelineResumeCheckpoint({
258
+ worktreePath: worktree.path,
259
+ stateRef,
260
+ taskId: task.id,
261
+ });
262
+ if (!checkpoint)
263
+ throw new Error(`pipeline state is missing or invalid for ${task.id}`);
264
+ if (checkpoint.state.stages.executor.status !== "succeeded" ||
265
+ checkpoint.state.stages.reporter.status !== "succeeded") {
266
+ throw new Error(`integration resume requires succeeded executor and reporter stages for ${task.id}`);
267
+ }
268
+ const resultPath = join(executionPath, "exec", "results", `${task.id}-result.md`);
269
+ const worktreeResultPath = pathInsideWorktree(repoRoot, worktree.path, resultPath);
270
+ if (!existsSync(resultPath) || !existsSync(worktreeResultPath)) {
271
+ throw new Error(`result is missing for integration resume: ${task.id}-result.md`);
272
+ }
273
+ // 統合再開でも、root に未 commit のまま残る claim / plan / result の作業コピーを merge 前に
274
+ // 解放できるよう、通常実行と同じ checkpoint パスを持たせる。
275
+ const claimEventPath = findClaimEventPath(schedulePath, task.id);
276
+ const checkpointPaths = [
277
+ join(executionPath, "exec", "plans", `${task.id}-plan.md`),
278
+ resultPath,
279
+ ...(claimEventPath ? [claimEventPath] : []),
280
+ ];
281
+ return {
282
+ task,
283
+ actor,
284
+ agentCandidates: [],
285
+ plan: "",
286
+ prompt: "",
287
+ worktree,
288
+ resultPath,
289
+ resultScaffold: readResultFrontmatterSnapshot(resultPath),
290
+ checkpointPaths,
291
+ pipelineRunId: checkpoint.state.run_id,
292
+ pipelineResumeStage: "integrate",
293
+ pipelineStateRef: stateRef,
294
+ };
295
+ }
296
+ // Resume tasks left in "doing" state by an interrupted run. Unlike --auto (which selects from
297
+ // ready.json and provably excludes "doing"/"blocked" tasks), resume folds the event log to find
298
+ // in-flight tasks and re-runs each on its existing worktree, reusing the claiming actor and the
299
+ // partially-filled result (scaffoldResult is idempotent; the worktree is reused). No validate/build
300
+ // pass — selection comes from events, not the generated cache.
301
+ export async function runResumeMode(opts) {
302
+ const resolvedPaths = resolveProjectPaths({ project: opts.project });
303
+ activateResolvedProjectPaths(resolvedPaths);
304
+ const { schedulePath, executionPath, catalogPath, rolesPath, viewpointsPath, projectContext } = resolvedPaths;
305
+ const projectId = resolvedPaths.projectId ?? opts.project;
306
+ const planGenPaths = { catalogPath, rolesPath, viewpointsPath, projectContext };
307
+ const repoRoot = specdojoRootDir();
308
+ const worktreeBase = resolveWorktreeBase(repoRoot, opts.worktreeBase, configuredWorktreeBase(schedulePath));
309
+ const parallel = parseParallel(opts.parallel);
310
+ const dryRun = !!opts.dryRun;
311
+ const execDefaults = loadExecDefaultsConfig(resolveExecDefaultsPath(opts, schedulePath), executionPath);
312
+ const roster = loadRosterForExecutionPath(executionPath);
313
+ const { localIdToPhaseSets, phaseSetSuffixToId } = buildTaskPhaseMap(schedulePath);
314
+ // Resolve current state from the event log (not the state.json cache) so freshly claimed/blocked
315
+ // tasks within a just-interrupted run are reflected.
316
+ const schedule = buildScheduleIndex(schedulePath);
317
+ const events = readAllEventFiles(schedulePath);
318
+ const initTasks = buildInitialStateFromStrategy(schedulePath, schedule);
319
+ let snapshot = foldEventsToState(events, schedule, schedulePath, initTasks);
320
+ let doingIds;
321
+ if (opts.due) {
322
+ let lockDir = "";
323
+ try {
324
+ lockDir = acquireSchedulerLock(schedulePath, {
325
+ actor: opts.by ?? "exec-limit-resume",
326
+ lockTimeoutMs: 10_000,
327
+ lockStaleMs: 300_000,
328
+ });
329
+ // Re-fold after acquiring the scheduler lock. A concurrent routine may have already
330
+ // unblocked the task; only tasks that are still blocked and due are claimed below.
331
+ const lockedEvents = readAllEventFiles(schedulePath);
332
+ snapshot = foldEventsToState(lockedEvents, schedule, schedulePath, initTasks);
333
+ let dueTasks = selectDueDeferredLimitTasks(snapshot);
334
+ if (opts.task)
335
+ dueTasks = dueTasks.filter((task) => task.taskId === opts.task);
336
+ doingIds = dueTasks.map((task) => task.taskId);
337
+ if (!dryRun) {
338
+ for (const task of dueTasks) {
339
+ const existingMeta = snapshot.tasks[task.taskId]?.meta ?? {};
340
+ const meta = Object.entries(existingMeta).map(([key, value]) => `${key}=${String(value)}`);
341
+ meta.push("limit_resume_claimed=true");
342
+ const event = buildEvent("unblock", {
343
+ task: task.taskId,
344
+ by: task.actor || "exec-limit-resume",
345
+ msg: `automatic limit resume due at ${task.resumeAt}`,
346
+ meta,
347
+ });
348
+ writeEventFile(schedulePath, event);
349
+ }
350
+ }
351
+ // Use the post-unblock state for actor/command resolution below. In dry-run mode this is
352
+ // only an in-memory projection; otherwise it mirrors the events just written.
353
+ for (const task of dueTasks) {
354
+ snapshot.tasks[task.taskId] = {
355
+ ...snapshot.tasks[task.taskId],
356
+ state: "doing",
357
+ last_by: task.actor || "exec-limit-resume",
358
+ last_type: "unblock",
359
+ };
360
+ }
361
+ }
362
+ finally {
363
+ if (lockDir)
364
+ releaseSchedulerLock(lockDir);
365
+ }
366
+ }
367
+ else {
368
+ doingIds = Object.entries(snapshot.tasks)
369
+ .filter(([, st]) => st.state === "doing")
370
+ .map(([id]) => id)
371
+ .sort();
372
+ if (opts.task) {
373
+ const taskState = snapshot.tasks[opts.task];
374
+ const blockedPipelineStage = taskState?.meta?.pipeline_stage;
375
+ const canResumeBlockedPipeline = taskState?.state === "blocked" &&
376
+ (blockedPipelineStage === "executor" ||
377
+ blockedPipelineStage === "reporter" ||
378
+ blockedPipelineStage === "integrate") &&
379
+ typeof taskState.meta?.pipeline_state_ref === "string";
380
+ if (canResumeBlockedPipeline) {
381
+ const actor = taskState.last_by ?? opts.by ?? "exec-pipeline-resume";
382
+ if (!dryRun) {
383
+ const meta = Object.entries(taskState.meta ?? {}).map(([key, value]) => `${key}=${String(value)}`);
384
+ meta.push("pipeline_resume_claimed=true");
385
+ writeEventFile(schedulePath, buildEvent("unblock", {
386
+ task: opts.task,
387
+ by: actor,
388
+ msg: blockedPipelineStage === "integrate"
389
+ ? "resume integration from persisted pipeline state"
390
+ : blockedPipelineStage === "reporter"
391
+ ? "resume reporter from persisted pipeline state"
392
+ : "resume executor from persisted pipeline state",
393
+ meta,
394
+ }));
395
+ }
396
+ snapshot.tasks[opts.task] = {
397
+ ...taskState,
398
+ state: "doing",
399
+ last_by: actor,
400
+ last_type: "unblock",
401
+ };
402
+ }
403
+ else if (taskState?.state !== "doing") {
404
+ process.stdout.write(`[resume] ${opts.task} is not resumable (state: ${taskState?.state ?? "unknown"}) — nothing to resume.\n`);
405
+ process.exitCode = 1;
406
+ return;
407
+ }
408
+ doingIds = [opts.task];
409
+ }
410
+ }
411
+ if (doingIds.length === 0) {
412
+ process.stdout.write(opts.due
413
+ ? "[resume] no due deferred-limit tasks — exit\n"
414
+ : '[resume] no "doing" tasks to resume — exit\n');
415
+ return;
416
+ }
417
+ process.stdout.write(opts.due
418
+ ? `[resume] ${doingIds.length} due deferred-limit task(s): ${doingIds.join(", ")}\n`
419
+ : `[resume] ${doingIds.length} doing task(s): ${doingIds.join(", ")}\n`);
420
+ for (let offset = 0; offset < doingIds.length; offset += parallel) {
421
+ const batch = doingIds.slice(offset, offset + parallel);
422
+ const preparedTasks = [];
423
+ for (const taskId of batch) {
424
+ try {
425
+ const task = buildTaskView(schedulePath, executionPath, taskId);
426
+ const resolved = resolveClaimingActor(snapshot.tasks[taskId], opts.by);
427
+ const prepared = snapshot.tasks[taskId]?.meta?.pipeline_stage === "integrate"
428
+ ? prepareScheduleIntegrationResume({
429
+ task,
430
+ taskState: snapshot.tasks[taskId],
431
+ actor: resolved.actor ?? snapshot.tasks[taskId]?.last_by ?? "exec-pipeline-resume",
432
+ projectId,
433
+ repoRoot,
434
+ executionPath,
435
+ schedulePath,
436
+ })
437
+ : await prepareSingleTask(task, projectId, repoRoot, schedulePath, executionPath, roster, localIdToPhaseSets, phaseSetSuffixToId, resolved.actor, { edit: opts.editBy, review: opts.reviewBy }, { executor: opts.executorBy, reporter: opts.reporterBy }, resolved.actor, dryRun, true, // skipClaim: the task is already "doing" and remains claimed
438
+ worktreeBase, planGenPaths, execDefaults, undefined, {
439
+ stage: snapshot.tasks[taskId]?.meta?.pipeline_stage === "reporter"
440
+ ? "reporter"
441
+ : snapshot.tasks[taskId]?.meta?.pipeline_stage === "executor"
442
+ ? "executor"
443
+ : undefined,
444
+ stateRef: typeof snapshot.tasks[taskId]?.meta?.pipeline_state_ref === "string"
445
+ ? snapshot.tasks[taskId]?.meta?.pipeline_state_ref
446
+ : undefined,
447
+ }, opts);
448
+ if (typeof prepared !== "string") {
449
+ const attempts = snapshot.tasks[taskId]?.meta?.limit_attempts;
450
+ prepared.priorLimitAttempts =
451
+ typeof attempts === "string" && /^\d+$/.test(attempts)
452
+ ? Number.parseInt(attempts, 10)
453
+ : 0;
454
+ preparedTasks.push(prepared);
455
+ }
456
+ else if (prepared === "failure")
457
+ process.exitCode = 1;
458
+ }
459
+ catch (error) {
460
+ const message = error instanceof Error ? error.message : String(error);
461
+ process.stderr.write(`[resume] setup error for ${taskId}: ${message}\n`);
462
+ if (opts.due && !dryRun) {
463
+ spawnBlock(projectId, taskId, snapshot.tasks[taskId]?.last_by ?? "exec-limit-resume", `resume setup error: ${message}`);
464
+ }
465
+ process.exitCode = 1;
466
+ }
467
+ }
468
+ if (preparedTasks.length === 0)
469
+ continue;
470
+ const settled = await Promise.allSettled(preparedTasks.map((prepared) => runPreparedTask(prepared, projectId, repoRoot, schedulePath, executionPath, catalogPath, execDefaults, dryRun)));
471
+ for (const [index, result] of settled.entries()) {
472
+ if (result.status === "rejected") {
473
+ const prepared = preparedTasks[index];
474
+ const message = result.reason instanceof Error ? result.reason.message : String(result.reason);
475
+ process.stderr.write(`[resume] error: ${prepared.worktree.name}: ${message}\n`);
476
+ if (!dryRun) {
477
+ const completedAt = new Date().toISOString();
478
+ if (prepared.resultPath)
479
+ await updateResultStatus(prepared.resultPath, "blocked", completedAt);
480
+ spawnBlock(projectId, prepared.task.id, prepared.actor, `runner error: ${message}`);
481
+ }
482
+ process.exitCode = 1;
483
+ }
484
+ else if (result.value === "failure") {
485
+ process.exitCode = 1;
486
+ }
487
+ }
488
+ }
489
+ }
490
+ export function registerResumeCommand(exec) {
491
+ const cmd = exec
492
+ .command("resume")
493
+ .description("Resume in-flight tasks, blocked reporter/integration stages, or due deferred-limit tasks on existing worktrees");
494
+ cmd.option("--project <projectId>", "Project id in .specdojo/specdojo.config.json");
495
+ cmd.option("--task <taskId>", 'Resume only this task ("doing", blocked pipeline stage, or due with --due)');
496
+ cmd.option("--due", "Atomically claim and resume only retryable limit blocks whose resume time has arrived", false);
497
+ cmd.option("--by <nickname>", "Select an agent-members.yaml agent (default: the agent that claimed the task)");
498
+ cmd.option("--edit-by <nickname>", "agent-members.yaml nickname for edit-mode tasks (overrides the claiming actor)");
499
+ cmd.option("--review-by <nickname>", "agent-members.yaml nickname for review-mode tasks (overrides the claiming actor)");
500
+ cmd.option("--executor-by <nickname>", "agent-members.yaml executor nickname for pipeline tasks");
501
+ cmd.option("--reporter-by <nickname>", "agent-members.yaml reporter nickname for pipeline tasks");
502
+ cmd.option("--on-rate-limit <action>", "Pinned-agent rate-limit action: stop|wait|fallback (overrides rate_limit_policy.pinned)");
503
+ cmd.option("--fallback-executor-by <nickname>", "Fallback executor after a rate limit");
504
+ cmd.option("--fallback-reporter-by <nickname>", "Fallback reporter after a rate limit");
505
+ cmd.option("--parallel <n>", "Number of tasks to resume in parallel", "1");
506
+ cmd.option("--worktree-base <path>", "Override worktree base directory");
507
+ cmd.option("--exec-defaults <path>", "Path to exec-defaults.yaml global config (default: .specdojo/exec-defaults.yaml)");
508
+ cmd.option("--if-busy <policy>", "When another exec is running for the project: skip|wait|fail (default: fail)", "fail");
509
+ cmd.option("--dry-run", "Print resolved commands without executing", false);
510
+ cmd.action(async (opts) => {
511
+ try {
512
+ if (opts.by && opts.executorBy) {
513
+ process.stdout.write("Specify either --by or --executor-by, not both.\n");
514
+ process.exitCode = 1;
515
+ return;
516
+ }
517
+ if (opts.onRateLimit && !["stop", "wait", "fallback"].includes(opts.onRateLimit)) {
518
+ process.stdout.write('--on-rate-limit must be "stop", "wait", or "fallback".\n');
519
+ process.exitCode = 1;
520
+ return;
521
+ }
522
+ await withProjectExecRunLock(opts, "resume", () => runResumeMode(opts));
523
+ }
524
+ catch (error) {
525
+ const message = error instanceof Error ? error.message : String(error);
526
+ process.stdout.write(message + "\n");
527
+ process.exitCode = 1;
528
+ }
529
+ });
530
+ }
@@ -1,6 +1,7 @@
1
1
  import { join } from "node:path";
2
- import { ensureDir } from "./exec-shared.js";
3
- import { delay, formatLockOwner, isLiveLock, LOCK_HEARTBEAT_MS, LOCK_POLL_MS, LOCK_STALE_MS, livePoolHolders, readLockOwner, releaseLock, tryAcquireLock, tryAcquirePoolSlot, } from "./exec-slot-lock.js";
2
+ import { ensureDir } from "../shared.js";
3
+ import { registerLifecyclePoolPath } from "../../register/lifecycle-lock.js";
4
+ import { delay, formatLockOwner, isLiveLock, LOCK_HEARTBEAT_MS, LOCK_POLL_MS, LOCK_STALE_MS, livePoolHolders, readLockOwner, releaseLock, tryAcquireLock, tryAcquirePoolSlot, } from "../slot-lock.js";
4
5
  export const EXEC_RUN_LOCK_HEARTBEAT_MS = LOCK_HEARTBEAT_MS;
5
6
  export const EXEC_RUN_LOCK_STALE_MS = LOCK_STALE_MS;
6
7
  export const EXEC_RUN_LOCK_TOKEN_ENV = "SPECDOJO_EXEC_RUN_LOCK_TOKEN";
@@ -104,7 +105,7 @@ export function releaseExecRunLock(handle) {
104
105
  // Serializes the register lifecycle steps that write the root worktree (start transition,
105
106
  // checkpoint, merge, wait commit, view rebuild) across every exec run of the project.
106
107
  export function execLifecyclePoolPath(executionPath) {
107
- return join(execLocksDir(executionPath), "exec-lifecycle");
108
+ return registerLifecyclePoolPath(executionPath);
108
109
  }
109
110
  function describeSlotOwner(slot) {
110
111
  if (!slot.owner)