@miroshnik/elves 2026.1027.0 → 2026.1027.1

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
2
  import {
3
3
  locale_default
4
- } from "../../spec/scripts/harness-t9bqz3st.js";
4
+ } from "../../spec/scripts/harness-91h1qpb5.js";
5
5
 
6
6
  // skills/github/scripts/github.ts
7
7
  import { spawnSync } from "node:child_process";
@@ -2263,7 +2263,7 @@ function cmdTaskQueue(io, slug, o) {
2263
2263
  const ready = [];
2264
2264
  const running = [];
2265
2265
  const waiting = [];
2266
- let settled = 0;
2266
+ const settled = [];
2267
2267
  let holding = 0;
2268
2268
  const past = [];
2269
2269
  for (const n of numbers.sort((a, b) => a - b)) {
@@ -2300,7 +2300,7 @@ function cmdTaskQueue(io, slug, o) {
2300
2300
  if (work.length) {
2301
2301
  running.push(`= ${label} — ${work.join(", ")}`);
2302
2302
  if (merged !== undefined && pr === undefined)
2303
- settled++;
2303
+ settled.push(i.number);
2304
2304
  else if (batch === null)
2305
2305
  holding++;
2306
2306
  else if (pr !== undefined ? prBase(i, pr) === batch : merged === undefined && hand !== undefined && hand.executor !== "cloud" && !hand.main && !pastBatch(i))
@@ -2342,6 +2342,9 @@ ${batches.map((b) => `batch ${b.repo} ${b.branch}
2342
2342
  io.out("○ session not recognized (no CLAUDE_CODE_SESSION_ID) — not marked as a dispatcher: task status in the executors would pin their tasks");
2343
2343
  appWorktreeWarning(io);
2344
2344
  pruneExecutors(io, slug, handed, isOpen);
2345
+ if (settled.length && checkoutOfRepo(io, originUrl(io), slug))
2346
+ for (const n of settled)
2347
+ takeDownStacks(io, n, true);
2345
2348
  const group = o.tasks !== undefined ? `tasks ${numbers.map((n) => `#${n}`).join(", ")}` : null;
2346
2349
  const scope = [o.epic !== undefined ? `epic #${o.epic}` : group ?? "open tasks", want && `type ${q(want)}`, o.priority?.length && `Priority ${o.priority.join("|")}`].filter(Boolean).join(", ");
2347
2350
  io.out(`Queue ${slug} (${scope}): ready ${ready.length}, ${q(N.status.inProgress)} ${running.length}, not ready ${waiting.length}`);
@@ -2354,7 +2357,7 @@ ${batches.map((b) => `batch ${b.repo} ${b.branch}
2354
2357
  for (const line of waiting)
2355
2358
  io.out(line);
2356
2359
  const releaseCommand = `bun --no-env-file ${import.meta.path} batch release --repo ${slug}`;
2357
- const now = settled ? `; the owner's word to release now — ${releaseCommand}: what is merged into ${batch} goes, the live executors go on, no new ones till its merge` : "";
2360
+ const now = settled.length ? `; the owner's word to release now — ${releaseCommand}: what is merged into ${batch} goes, the live executors go on, no new ones till its merge` : "";
2358
2361
  const ask = locale_default.autoProject(io.cwd ?? process.cwd()) ? "" : `; ${MERGE_ASK}`;
2359
2362
  const checks = release && releasing !== null ? releaseChecks(io, slug, release) : null;
2360
2363
  if (release && batch && checks?.state === "red") {
@@ -2364,9 +2367,9 @@ ${batches.map((b) => `batch ${b.repo} ${b.branch}
2364
2367
  io.out(`Next: the release of ${batch} is open — PR #${releasing} https://github.com/${slug}/pull/${releasing}: no new executors till its merge, ` + `the live executors' PRs into ${batch} wait for it (pr premerge refuses the merge); its steps — ${releaseCommand} prints them; ` + `after each executor's answer — task queue again; ${SESSION_ARCHIVE}.`);
2365
2368
  } else if (ready.length) {
2366
2369
  io.out(`Next: each ready task above — a background subagent in its own worktree while fewer than ${QUEUE_EXECUTORS} run (a number from the request replaces it); ` + `the indented line is its whole prompt. After each executor's answer — task queue again: new tasks get in${ask}; ${SESSION_ARCHIVE}${now}.`);
2367
- } else if (holding || !settled && running.length)
2370
+ } else if (holding || !settled.length && running.length)
2368
2371
  io.out(`Next: no ready tasks — wait for the executors' answers; after each — task queue again${ask}; ${SESSION_ARCHIVE}${now}.`);
2369
- else if (settled) {
2372
+ else if (settled.length) {
2370
2373
  io.out(`Next: the batch ${batch} is complete — nothing ready, every task of the batch is merged into it: its release — ${releaseCommand}, ` + `once no executor of the batch is still at work${past.length ? `; past the batch — ${past.join(", ")}: they don't hold the release` : ""}; ${SESSION_ARCHIVE}.`);
2371
2374
  } else {
2372
2375
  const done = group ? ` The group (${group}) has nothing left — no new batch: a task outside it joins only by the owner's word, task queue --tasks with it.` : "";
@@ -3018,6 +3021,7 @@ function cmdTaskAssignment(io, slug, number, o = {}) {
3018
3021
  repo: slug,
3019
3022
  epic: issue.parent ? locale_default.fill(N.queue.epic, { epicWord: N.subagentPrompt.epic, epic: issue.parent.number }) : "",
3020
3023
  script: `bun --no-env-file ${import.meta.path}`,
3024
+ taskEnv: `bun --no-env-file ${taskEnvScript(io)}`,
3021
3025
  waitCi: `bash ${waitCi()}`,
3022
3026
  inProgress: N.status.inProgress,
3023
3027
  done: N.lastLine.done,
@@ -3673,6 +3677,8 @@ function tailOver(io, slug, number) {
3673
3677
  function finishMerged(io, slug, number, epicNumber, merged, f) {
3674
3678
  if (isBatchBranch(merged.base)) {
3675
3679
  io.out(`✅ PR #${merged.number} is merged into ${merged.base} — #${number} stays ${q(N.status.inProgress)} till the batch's release`);
3680
+ if (checkoutOfRepo(io, originUrl(io), slug))
3681
+ takeDownStacks(io, number);
3676
3682
  io.out(`Next: nothing more for the task — no CI or deploy wait, no epic refresh and no task close: the dispatcher's batch release does them`);
3677
3683
  return 0;
3678
3684
  }
@@ -3807,13 +3813,13 @@ function originUrl(io) {
3807
3813
  return remote.status === 0 ? remote.stdout : "";
3808
3814
  }
3809
3815
  var taskEnvScript = (io) => io.env["ELVES_TASK_ENV"] ?? path.resolve(import.meta.dir, "../../task-env/scripts/task-env.ts");
3810
- function takeDownStacks(io, number) {
3816
+ function takeDownStacks(io, number, quiet = false) {
3811
3817
  const script = taskEnvScript(io);
3812
3818
  if (!existsSync(script))
3813
- return io.out(`○ task stacks: task-env is not installed (${script})`);
3819
+ return quiet ? undefined : io.out(`○ task stacks: task-env is not installed (${script})`);
3814
3820
  const r = (io.run ?? realRun)("bun", ["--no-env-file", script, "down", String(number)], io.cwd);
3815
3821
  const lines = r.stdout.split(`
3816
- `).filter((l) => l.trim());
3822
+ `).filter((l) => l.trim() && !(quiet && l.startsWith("○")));
3817
3823
  for (const line of lines)
3818
3824
  io.out(line);
3819
3825
  if (r.status !== 0 && !lines.length)
@@ -2,10 +2,10 @@ import {
2
2
  invariant2,
3
3
  codeOnly2,
4
4
  envNamesInCode2
5
- } from "./harness-nn3hnqwn.js";
5
+ } from "./harness-whad9qej.js";
6
6
  import {
7
7
  locale_default
8
- } from "./harness-t9bqz3st.js";
8
+ } from "./harness-91h1qpb5.js";
9
9
 
10
10
  // skills/spec/scripts/architecture.ts
11
11
  import { readdirSync, readFileSync } from "node:fs";
@@ -108,7 +108,7 @@ var en_default = {
108
108
  live: "- while any of your subagents works, don't answer: wait for their answers — a background subagent wakes you with its answer; an answer with live subagents looks like a failure, and the dispatcher would give the task to a second executor next to you. Can't wait — answer `waits for subagents: <which and what they do>`: it isn't `failed`, there will be no second executor;",
109
109
  refresh: '- the epic refresh — the subagent `task actualize` prints, without a worktree of its own (in yours) and not in the background (`run_in_background: false`): its answer — in the same turn, then `{script} task close {number}`, and only then the answer to the dispatcher: once you answer, a worktree without changes is removed, and a background subagent is left without a directory; a task without a PR (a data edit, a reconciliation, research) — first close the issue as completed with a result comment: `gh issue close {number} --repo {repo} --reason completed --comment "<result>"`;',
110
110
  batchLead: "{task} #{number} «{title}» in {repo}{epic}: you are an executor of the dispatcher session, the task goes into the batch `{batch}` — do the task whole by the canon, {mode}: `{script} task start {number} --branch <type>/{number}-<slug>` (the task's questions and its parallel work — inside it), the branch from a fresh origin/{batch}, not from main (`git fetch origin {batch}`, then the task branch on `origin/{batch}`), code and tests, the checks before a commit, PR into the batch (`gh pr create --base {batch}`), `pr premerge`, merge. No CI wait, no deploy, no epic refresh and no `task close`: the task stays «{inProgress}» till the batch's release — the dispatcher's, with one full CI run and one refresh per epic.",
111
- batchWait: "- don't wait for CI: a PR into the batch runs none — its gate is the checks before a commit by the canon (`elves precommit --base origin/<batch branch>`: `lint`, `typecheck`, `test:spec`, the affected tests — `docs/testing.md`) and `pr premerge` (the fast checks on the merge, if the batch moved on); after its code 0 — `gh pr merge <PR> --rebase` without a CI wait; the full run and the deploy are the release's, nothing to wait for after the merge;",
111
+ batchWait: "- don't wait for CI: a PR into the batch runs none — its gate is the checks before a commit by the canon (`elves precommit --base origin/<batch branch>`: `lint`, `typecheck`, `test:spec`, the affected tests — `docs/testing.md`) and `pr premerge` (the fast checks on the merge, if the batch moved on); after its code 0 — `gh pr merge <PR> --rebase` without a CI wait; the full run and the deploy are the release's, nothing to wait for after the merge, but before the answer take the task's stacks down (`{taskEnv} down {number}`, unsandboxed: Docker): the task waits for the release, its stack would load the machine till then;",
112
112
  batchRefresh: "- the epic refresh and `task close` aren't yours: both are the batch's release — one refresh per epic of its tasks, then `task close` of each, the dispatcher's; a task without a PR (a data edit, a reconciliation, research) isn't in the batch — close the issue as completed with a result comment: `gh issue close {number} --repo {repo} --reason completed --comment \"<result>\"`, then the epic refresh — the subagent `task actualize {number}` prints, without a worktree of its own (in yours) and not in the background (`run_in_background: false`): its answer — in the same turn, then `{script} task close {number}`, and only then the answer to the dispatcher: once you answer, a worktree without changes is removed, and a background subagent is left without a directory;",
113
113
  bypass: "- the task goes past the dispatcher's batch `{batch}` — the owner's word: the task branch from a fresh origin/main, not from the batch, the PR into the default branch (not `--base {batch}`) with the full CI, the deploy, the epic refresh and `task close` — yours, as in a project without batches; the batch's release doesn't wait for you;",
114
114
  fixLead: '{task} #{number} «{title}» in {repo}{epic}: you are an executor of the dispatcher session — a fix in the batch `{batch}`: its release PR #{release} is red ({checks}), and the task, merged into the batch already, is named guilty — fix it in the batch by the canon, {mode}: `{script} task status {number} "{inProgress}" --branch fix/{number}-<slug>`, a new branch from a fresh origin/{batch} (`git fetch origin {batch}`, then the branch on `origin/{batch}`){previous}, the cause by the failed checks (`gh pr checks {release}`, their logs), the fix and its test, commits with `Refs #{number}`, the checks before a commit, PR into the batch (`gh pr create --base {batch}`, `Refs #{number}` in the body), `pr premerge` (it lets the guilty task\'s PR through the open release), merge. No CI wait, no deploy, no epic refresh and no `task close`: after the merge the dispatcher runs the release again — the full run on the same PR #{release}.',
@@ -588,7 +588,7 @@ var ru_default = {
588
588
  live: "- пока работает хоть один твой субагент, ответ не отдавай: жди их ответов — фоновый субагент будит тебя своим ответом; ответ при живых субагентах выглядит провалом, и диспетчер отдал бы задачу второму исполнителю рядом с тобой. Ждать нельзя — ответь `ждёт субагентов: <какие и что делают>`: это не «сломалось», второго исполнителя не будет;",
589
589
  refresh: '- актуализация эпика — субагент, которого печатает `task actualize`, без своего worktree (в твоём) и не в фоне (`run_in_background: false`): его ответ — в том же ходе, затем `{script} task close {number}`, и только потом ответ диспетчеру: стоит тебе ответить, worktree без изменений убирают, и фоновый субагент остаётся без каталога; у задачи без PR (правка данных, сверка, исследование) — сначала закрой issue как выполненную с итоговым комментарием: `gh issue close {number} --repo {repo} --reason completed --comment "<итог>"`;',
590
590
  batchLead: "{task} #{number} «{title}» в {repo}{epic}: ты исполнитель сессии-диспетчера, задача идёт в пачку `{batch}` — сделай задачу целиком по канону, {mode}: `{script} task start {number} --branch <тип>/{number}-<slug>` (вопросы задачи и её параллельная работа — в нём), ветка от свежего origin/{batch}, а не от main (`git fetch origin {batch}`, затем ветка задачи на `origin/{batch}`), код и тесты, проверки перед коммитом, PR в пачку (`gh pr create --base {batch}`), `pr premerge`, мерж. Ожидания CI, деплоя, актуализации эпика и `task close` нет: задача — «{inProgress}» до выпуска пачки, его делает диспетчер — с одним полным прогоном CI и одной актуализацией на эпик.",
591
- batchWait: "- CI не жди: PR в пачку его не запускает — его ворота — проверки перед коммитом по канону (`elves precommit --base origin/<ветка пачки>`: `lint`, `typecheck`, `test:spec`, затронутые тесты — `docs/testing.md`) и `pr premerge` (быстрые проверки на слиянии, если пачка ушла вперёд); после его кода 0 — `gh pr merge <PR> --rebase` без ожидания CI; полный прогон и деплой — у выпуска, после мержа ждать нечего;",
591
+ batchWait: "- CI не жди: PR в пачку его не запускает — его ворота — проверки перед коммитом по канону (`elves precommit --base origin/<ветка пачки>`: `lint`, `typecheck`, `test:spec`, затронутые тесты — `docs/testing.md`) и `pr premerge` (быстрые проверки на слиянии, если пачка ушла вперёд); после его кода 0 — `gh pr merge <PR> --rebase` без ожидания CI; полный прогон и деплой — у выпуска, после мержа ждать нечего, но до ответа сними стеки задачи (`{taskEnv} down {number}`, вне песочницы: Docker): задача ждёт выпуска, а её стек до него грузил бы машину;",
592
592
  batchRefresh: '- актуализация эпика и `task close` — не твои: обе — у выпуска пачки, одна актуализация на каждый эпик её задач, затем `task close` каждой, их делает диспетчер; задача без PR (правка данных, сверка, исследование) в пачку не идёт — закрой issue как выполненную с итоговым комментарием: `gh issue close {number} --repo {repo} --reason completed --comment "<итог>"`, затем актуализация эпика — субагент, которого печатает `task actualize {number}`, без своего worktree (в твоём) и не в фоне (`run_in_background: false`): его ответ — в том же ходе, затем `{script} task close {number}`, и только потом ответ диспетчеру: стоит тебе ответить, worktree без изменений убирают, и фоновый субагент остаётся без каталога;',
593
593
  bypass: "- задача идёт мимо пачки диспетчера `{batch}` — слово владельца: ветка задачи от свежего origin/main, а не от пачки, PR в ветку по умолчанию (не `--base {batch}`) с полным CI, деплой, актуализация эпика и `task close` — твои, как в проекте без пачек; выпуск пачки тебя не ждёт;",
594
594
  fixLead: '{task} #{number} «{title}» в {repo}{epic}: ты исполнитель сессии-диспетчера — починка в пачке `{batch}`: её PR выпуска #{release} красный ({checks}), а задача, уже влитая в пачку, названа виновной — почини её в пачке по канону, {mode}: `{script} task status {number} "{inProgress}" --branch fix/{number}-<slug>`, новая ветка от свежего origin/{batch} (`git fetch origin {batch}`, затем ветка на `origin/{batch}`){previous}, причина — по упавшим проверкам (`gh pr checks {release}`, их логи), починка и её тест, коммиты с `Refs #{number}`, проверки перед коммитом, PR в пачку (`gh pr create --base {batch}`, в теле `Refs #{number}`), `pr premerge` (PR виновной задачи он пропускает при открытом выпуске), мерж. Ожидания CI, деплоя, актуализации эпика и `task close` нет: после мержа диспетчер гонит выпуск заново — полный прогон на том же PR #{release}.',
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  locale_default
3
- } from "./harness-t9bqz3st.js";
3
+ } from "./harness-91h1qpb5.js";
4
4
  var __create = Object.create;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __defProp = Object.defineProperty;
@@ -23,7 +23,7 @@ import {
23
23
  envNamesInCode2,
24
24
  dotenvNames2,
25
25
  envVars2
26
- } from "./harness-nn3hnqwn.js";
26
+ } from "./harness-whad9qej.js";
27
27
  export {
28
28
  ENV_SERVICE2 as ENV_SERVICE,
29
29
  codeFiles2 as codeFiles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miroshnik/elves",
3
- "version": "2026.1027.0",
3
+ "version": "2026.1027.1",
4
4
  "type": "module",
5
5
  "description": "Elves — a development flow with AI agents: shared rules and skills for any agent; install — bunx @miroshnik/elves install -g; the installer and skill scripts — TypeScript under Bun, tests — bun test in tests/",
6
6
  "repository": {
@@ -72,5 +72,5 @@
72
72
  "eslint-plugin-boundaries": "^7.2.0",
73
73
  "knip": "^6.41.0"
74
74
  },
75
- "gitHead": "c8aefea287e10052ba441d63042d2981c1e025f5"
75
+ "gitHead": "af1dc04656248295ddbc09910f726dafcb145cec"
76
76
  }
@@ -104,7 +104,7 @@
104
104
  "live": "- while any of your subagents works, don't answer: wait for their answers — a background subagent wakes you with its answer; an answer with live subagents looks like a failure, and the dispatcher would give the task to a second executor next to you. Can't wait — answer `waits for subagents: <which and what they do>`: it isn't `failed`, there will be no second executor;",
105
105
  "refresh": "- the epic refresh — the subagent `task actualize` prints, without a worktree of its own (in yours) and not in the background (`run_in_background: false`): its answer — in the same turn, then `{script} task close {number}`, and only then the answer to the dispatcher: once you answer, a worktree without changes is removed, and a background subagent is left without a directory; a task without a PR (a data edit, a reconciliation, research) — first close the issue as completed with a result comment: `gh issue close {number} --repo {repo} --reason completed --comment \"<result>\"`;",
106
106
  "batchLead": "{task} #{number} «{title}» in {repo}{epic}: you are an executor of the dispatcher session, the task goes into the batch `{batch}` — do the task whole by the canon, {mode}: `{script} task start {number} --branch <type>/{number}-<slug>` (the task's questions and its parallel work — inside it), the branch from a fresh origin/{batch}, not from main (`git fetch origin {batch}`, then the task branch on `origin/{batch}`), code and tests, the checks before a commit, PR into the batch (`gh pr create --base {batch}`), `pr premerge`, merge. No CI wait, no deploy, no epic refresh and no `task close`: the task stays «{inProgress}» till the batch's release — the dispatcher's, with one full CI run and one refresh per epic.",
107
- "batchWait": "- don't wait for CI: a PR into the batch runs none — its gate is the checks before a commit by the canon (`elves precommit --base origin/<batch branch>`: `lint`, `typecheck`, `test:spec`, the affected tests — `docs/testing.md`) and `pr premerge` (the fast checks on the merge, if the batch moved on); after its code 0 — `gh pr merge <PR> --rebase` without a CI wait; the full run and the deploy are the release's, nothing to wait for after the merge;",
107
+ "batchWait": "- don't wait for CI: a PR into the batch runs none — its gate is the checks before a commit by the canon (`elves precommit --base origin/<batch branch>`: `lint`, `typecheck`, `test:spec`, the affected tests — `docs/testing.md`) and `pr premerge` (the fast checks on the merge, if the batch moved on); after its code 0 — `gh pr merge <PR> --rebase` without a CI wait; the full run and the deploy are the release's, nothing to wait for after the merge, but before the answer take the task's stacks down (`{taskEnv} down {number}`, unsandboxed: Docker): the task waits for the release, its stack would load the machine till then;",
108
108
  "batchRefresh": "- the epic refresh and `task close` aren't yours: both are the batch's release — one refresh per epic of its tasks, then `task close` of each, the dispatcher's; a task without a PR (a data edit, a reconciliation, research) isn't in the batch — close the issue as completed with a result comment: `gh issue close {number} --repo {repo} --reason completed --comment \"<result>\"`, then the epic refresh — the subagent `task actualize {number}` prints, without a worktree of its own (in yours) and not in the background (`run_in_background: false`): its answer — in the same turn, then `{script} task close {number}`, and only then the answer to the dispatcher: once you answer, a worktree without changes is removed, and a background subagent is left without a directory;",
109
109
  "bypass": "- the task goes past the dispatcher's batch `{batch}` — the owner's word: the task branch from a fresh origin/main, not from the batch, the PR into the default branch (not `--base {batch}`) with the full CI, the deploy, the epic refresh and `task close` — yours, as in a project without batches; the batch's release doesn't wait for you;",
110
110
  "fixLead": "{task} #{number} «{title}» in {repo}{epic}: you are an executor of the dispatcher session — a fix in the batch `{batch}`: its release PR #{release} is red ({checks}), and the task, merged into the batch already, is named guilty — fix it in the batch by the canon, {mode}: `{script} task status {number} \"{inProgress}\" --branch fix/{number}-<slug>`, a new branch from a fresh origin/{batch} (`git fetch origin {batch}`, then the branch on `origin/{batch}`){previous}, the cause by the failed checks (`gh pr checks {release}`, their logs), the fix and its test, commits with `Refs #{number}`, the checks before a commit, PR into the batch (`gh pr create --base {batch}`, `Refs #{number}` in the body), `pr premerge` (it lets the guilty task's PR through the open release), merge. No CI wait, no deploy, no epic refresh and no `task close`: after the merge the dispatcher runs the release again — the full run on the same PR #{release}.",
@@ -104,7 +104,7 @@
104
104
  "live": "- пока работает хоть один твой субагент, ответ не отдавай: жди их ответов — фоновый субагент будит тебя своим ответом; ответ при живых субагентах выглядит провалом, и диспетчер отдал бы задачу второму исполнителю рядом с тобой. Ждать нельзя — ответь `ждёт субагентов: <какие и что делают>`: это не «сломалось», второго исполнителя не будет;",
105
105
  "refresh": "- актуализация эпика — субагент, которого печатает `task actualize`, без своего worktree (в твоём) и не в фоне (`run_in_background: false`): его ответ — в том же ходе, затем `{script} task close {number}`, и только потом ответ диспетчеру: стоит тебе ответить, worktree без изменений убирают, и фоновый субагент остаётся без каталога; у задачи без PR (правка данных, сверка, исследование) — сначала закрой issue как выполненную с итоговым комментарием: `gh issue close {number} --repo {repo} --reason completed --comment \"<итог>\"`;",
106
106
  "batchLead": "{task} #{number} «{title}» в {repo}{epic}: ты исполнитель сессии-диспетчера, задача идёт в пачку `{batch}` — сделай задачу целиком по канону, {mode}: `{script} task start {number} --branch <тип>/{number}-<slug>` (вопросы задачи и её параллельная работа — в нём), ветка от свежего origin/{batch}, а не от main (`git fetch origin {batch}`, затем ветка задачи на `origin/{batch}`), код и тесты, проверки перед коммитом, PR в пачку (`gh pr create --base {batch}`), `pr premerge`, мерж. Ожидания CI, деплоя, актуализации эпика и `task close` нет: задача — «{inProgress}» до выпуска пачки, его делает диспетчер — с одним полным прогоном CI и одной актуализацией на эпик.",
107
- "batchWait": "- CI не жди: PR в пачку его не запускает — его ворота — проверки перед коммитом по канону (`elves precommit --base origin/<ветка пачки>`: `lint`, `typecheck`, `test:spec`, затронутые тесты — `docs/testing.md`) и `pr premerge` (быстрые проверки на слиянии, если пачка ушла вперёд); после его кода 0 — `gh pr merge <PR> --rebase` без ожидания CI; полный прогон и деплой — у выпуска, после мержа ждать нечего;",
107
+ "batchWait": "- CI не жди: PR в пачку его не запускает — его ворота — проверки перед коммитом по канону (`elves precommit --base origin/<ветка пачки>`: `lint`, `typecheck`, `test:spec`, затронутые тесты — `docs/testing.md`) и `pr premerge` (быстрые проверки на слиянии, если пачка ушла вперёд); после его кода 0 — `gh pr merge <PR> --rebase` без ожидания CI; полный прогон и деплой — у выпуска, после мержа ждать нечего, но до ответа сними стеки задачи (`{taskEnv} down {number}`, вне песочницы: Docker): задача ждёт выпуска, а её стек до него грузил бы машину;",
108
108
  "batchRefresh": "- актуализация эпика и `task close` — не твои: обе — у выпуска пачки, одна актуализация на каждый эпик её задач, затем `task close` каждой, их делает диспетчер; задача без PR (правка данных, сверка, исследование) в пачку не идёт — закрой issue как выполненную с итоговым комментарием: `gh issue close {number} --repo {repo} --reason completed --comment \"<итог>\"`, затем актуализация эпика — субагент, которого печатает `task actualize {number}`, без своего worktree (в твоём) и не в фоне (`run_in_background: false`): его ответ — в том же ходе, затем `{script} task close {number}`, и только потом ответ диспетчеру: стоит тебе ответить, worktree без изменений убирают, и фоновый субагент остаётся без каталога;",
109
109
  "bypass": "- задача идёт мимо пачки диспетчера `{batch}` — слово владельца: ветка задачи от свежего origin/main, а не от пачки, PR в ветку по умолчанию (не `--base {batch}`) с полным CI, деплой, актуализация эпика и `task close` — твои, как в проекте без пачек; выпуск пачки тебя не ждёт;",
110
110
  "fixLead": "{task} #{number} «{title}» в {repo}{epic}: ты исполнитель сессии-диспетчера — починка в пачке `{batch}`: её PR выпуска #{release} красный ({checks}), а задача, уже влитая в пачку, названа виновной — почини её в пачке по канону, {mode}: `{script} task status {number} \"{inProgress}\" --branch fix/{number}-<slug>`, новая ветка от свежего origin/{batch} (`git fetch origin {batch}`, затем ветка на `origin/{batch}`){previous}, причина — по упавшим проверкам (`gh pr checks {release}`, их логи), починка и её тест, коммиты с `Refs #{number}`, проверки перед коммитом, PR в пачку (`gh pr create --base {batch}`, в теле `Refs #{number}`), `pr premerge` (PR виновной задачи он пропускает при открытом выпуске), мерж. Ожидания CI, деплоя, актуализации эпика и `task close` нет: после мержа диспетчер гонит выпуск заново — полный прогон на том же PR #{release}.",
@@ -1106,7 +1106,12 @@ the merge at once — no CI wait (the PR runs none: the slot is free at the
1106
1106
  merge, #676), no deploy wait, no epic refresh (the release's, one per epic)
1107
1107
  and no `task close` — it refuses a task merged only into a batch branch,
1108
1108
  before any change; a task without a PR isn't in the batch — its refresh and
1109
- close are the executor's. `task actualize` names the batch PR as what
1109
+ close are the executor's. The task's stacks don't wait for the release (#765):
1110
+ the assignment names `task-env down <N>` after the merge, before the answer,
1111
+ `task finish` of a PR merged into the batch takes them down too, and the
1112
+ dispatcher's `task queue` — of each task merged into the batch with no open PR
1113
+ (its executor is done), only `+` and `!` lines: a stack already down is said
1114
+ nothing of; `task close` at the release finds them gone — an `○` line. `task actualize` names the batch PR as what
1110
1115
  shipped and leaves the blocked-by links on the task till the release. A cloud
1111
1116
  executor (`--cloud`) isn't in the batch: its PR goes into the default branch
1112
1117
  with the full CI — the dispatcher learns of its end only by the task's
@@ -3141,7 +3141,7 @@ export function cmdTaskQueue(io: Io, slug: string, o: QueueFilter): number {
3141
3141
  const running: string[] = [];
3142
3142
  const waiting: string[] = [];
3143
3143
  /** Of the tasks in work: merged into the batch and nothing else going — they wait only for the release (#649). */
3144
- let settled = 0;
3144
+ const settled: number[] = [];
3145
3145
  /**
3146
3146
  * Of the tasks in work: the batch's live executors — the release waits for them (#696). Without a batch — all of them;
3147
3147
  * with one — a task with an open PR into the batch, or handed out to an executor of the batch (a subagent, an app
@@ -3184,7 +3184,7 @@ export function cmdTaskQueue(io: Io, slug: string, o: QueueFilter): number {
3184
3184
  if (work.length) {
3185
3185
  running.push(`= ${label} — ${work.join(", ")}`);
3186
3186
  // merged into the batch, no open PR of it: its executor is done, the task waits for the release
3187
- if (merged !== undefined && pr === undefined) settled++;
3187
+ if (merged !== undefined && pr === undefined) settled.push(i.number);
3188
3188
  else if (batch === null) holding++;
3189
3189
  else if (pr !== undefined ? prBase(i, pr) === batch : merged === undefined && hand !== undefined && hand.executor !== "cloud" && !hand.main && !pastBatch(i)) holding++;
3190
3190
  else past.push(`#${i.number}`);
@@ -3217,6 +3217,8 @@ export function cmdTaskQueue(io: Io, slug: string, o: QueueFilter): number {
3217
3217
  appWorktreeWarning(io);
3218
3218
  // the executor the dispatcher continues with SendMessage — an answered question, a restart — has no lock (#533)
3219
3219
  pruneExecutors(io, slug, handed, isOpen);
3220
+ // a task merged into the batch waits for the release, its stack doesn't (#765): the executor didn't take it down — the queue does
3221
+ if (settled.length && checkoutOfRepo(io, originUrl(io), slug)) for (const n of settled) takeDownStacks(io, n, true);
3220
3222
  const group = o.tasks !== undefined ? `tasks ${numbers.map((n) => `#${n}`).join(", ")}` : null;
3221
3223
  const scope = [o.epic !== undefined ? `epic #${o.epic}` : group ?? "open tasks", want && `type ${q(want)}`, o.priority?.length && `Priority ${o.priority.join("|")}`].filter(Boolean).join(", ");
3222
3224
  io.out(`Queue ${slug} (${scope}): ready ${ready.length}, ${q(N.status.inProgress)} ${running.length}, not ready ${waiting.length}`);
@@ -3229,7 +3231,7 @@ export function cmdTaskQueue(io: Io, slug: string, o: QueueFilter): number {
3229
3231
  const releaseCommand = `bun --no-env-file ${import.meta.path} batch release --repo ${slug}`;
3230
3232
  // the owner's word «release» — the same command with live executors: they go on, their PRs wait for the release
3231
3233
  // (question 2 of epic #645)
3232
- const now = settled ? `; the owner's word to release now — ${releaseCommand}: what is merged into ${batch} goes, the live executors go on, no new ones till its merge` : "";
3234
+ const now = settled.length ? `; the owner's word to release now — ${releaseCommand}: what is merged into ${batch} goes, the live executors go on, no new ones till its merge` : "";
3233
3235
  // outside auto an executor's merge is the owner's «yes» (#667)
3234
3236
  const ask = locale.autoProject(io.cwd ?? process.cwd()) ? "" : `; ${MERGE_ASK}`;
3235
3237
  // a red release (#650): its guilty task by the labels — the fix; the bisect is batch release's, the queue names it
@@ -3247,8 +3249,8 @@ export function cmdTaskQueue(io: Io, slug: string, o: QueueFilter): number {
3247
3249
  `Next: each ready task above — a background subagent in its own worktree while fewer than ${QUEUE_EXECUTORS} run (a number from the request replaces it); ` +
3248
3250
  `the indented line is its whole prompt. After each executor's answer — task queue again: new tasks get in${ask}; ${SESSION_ARCHIVE}${now}.`,
3249
3251
  );
3250
- } else if (holding || (!settled && running.length)) io.out(`Next: no ready tasks — wait for the executors' answers; after each — task queue again${ask}; ${SESSION_ARCHIVE}${now}.`);
3251
- else if (settled) {
3252
+ } else if (holding || (!settled.length && running.length)) io.out(`Next: no ready tasks — wait for the executors' answers; after each — task queue again${ask}; ${SESSION_ARCHIVE}${now}.`);
3253
+ else if (settled.length) {
3252
3254
  io.out(
3253
3255
  `Next: the batch ${batch} is complete — nothing ready, every task of the batch is merged into it: its release — ${releaseCommand}, ` +
3254
3256
  `once no executor of the batch is still at work${past.length ? `; past the batch — ${past.join(", ")}: they don't hold the release` : ""}; ${SESSION_ARCHIVE}.`,
@@ -4158,6 +4160,7 @@ export function cmdTaskAssignment(io: Io, slug: string, number: number, o: { clo
4158
4160
  repo: slug,
4159
4161
  epic: issue.parent ? locale.fill(N.queue.epic, { epicWord: N.subagentPrompt.epic, epic: issue.parent.number }) : "",
4160
4162
  script: `bun --no-env-file ${import.meta.path}`,
4163
+ taskEnv: `bun --no-env-file ${taskEnvScript(io)}`,
4161
4164
  waitCi: `bash ${waitCi()}`,
4162
4165
  inProgress: N.status.inProgress,
4163
4166
  done: N.lastLine.done,
@@ -5012,6 +5015,8 @@ function finishMerged(
5012
5015
  ): number {
5013
5016
  if (isBatchBranch(merged.base)) {
5014
5017
  io.out(`✅ PR #${merged.number} is merged into ${merged.base} — #${number} stays ${q(N.status.inProgress)} till the batch's release`);
5018
+ // the task's stacks don't wait for the release (#765): the executor is done, its stack only loads the machine
5019
+ if (checkoutOfRepo(io, originUrl(io), slug)) takeDownStacks(io, number);
5015
5020
  io.out(`Next: nothing more for the task — no CI or deploy wait, no epic refresh and no task close: the dispatcher's batch release does them`);
5016
5021
  return 0;
5017
5022
  }
@@ -5206,13 +5211,15 @@ const taskEnvScript = (io: Io) => io.env["ELVES_TASK_ENV"] ?? path.resolve(impor
5206
5211
  * in the checkout takes the dev and e2e stacks down with their volumes and prints a line per stack (`+`, `○`, `!`) —
5207
5212
  * printed as is; it failed without a line — its error as a `!` line. A failure doesn't stop the close: a stack left
5208
5213
  * behind is found by `task-env prune`. Docker doesn't work in the Claude Code sandbox — task close is an unsandboxed
5209
- * call (SKILL.md).
5214
+ * call (SKILL.md). A batch's task (#765) closes only with the release — its stack goes at the merge into the batch:
5215
+ * `task finish` of the executor, and the dispatcher's `task queue` as insurance (`quiet`: only `+` and `!` lines).
5210
5216
  */
5211
- function takeDownStacks(io: Io, number: number): void {
5217
+ function takeDownStacks(io: Io, number: number, quiet = false): void {
5212
5218
  const script = taskEnvScript(io);
5213
- if (!existsSync(script)) return io.out(`○ task stacks: task-env is not installed (${script})`);
5219
+ if (!existsSync(script)) return quiet ? undefined : io.out(`○ task stacks: task-env is not installed (${script})`);
5214
5220
  const r = (io.run ?? realRun)("bun", ["--no-env-file", script, "down", String(number)], io.cwd);
5215
- const lines = r.stdout.split("\n").filter((l) => l.trim());
5221
+ // quiet — the queue's insurance (#765): a stack already down (`○`) is said nothing of, each queue would repeat it
5222
+ const lines = r.stdout.split("\n").filter((l) => l.trim() && !(quiet && l.startsWith("○")));
5216
5223
  for (const line of lines) io.out(line);
5217
5224
  if (r.status !== 0 && !lines.length) io.out(`! task-env down: ${why(r)}`);
5218
5225
  }