@codyswann/lisa 4.107.4 → 4.107.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all/copy-overwrite/scripts/lisa-hooks/block-managed-file-edits.sh +84 -0
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +4 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +26 -13
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/opencode/plugin-templates/block-managed-file-edits.sh +84 -0
- package/npm-package/create-only/.github/workflows/publish-to-npm.yml +2 -2
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +17 -7
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -8
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-workers.mjs +155 -17
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/ledger-setup-gaps.mjs +164 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/ledger.mjs +11 -4
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/session-manager.mjs +1 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/worker-launch.mjs +6 -2
- package/plugins/lisa/hooks/block-managed-file-edits.sh +84 -0
- package/plugins/lisa/skills/lisa-session-manager/SKILL.md +17 -7
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -8
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -3
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-workers.mjs +155 -17
- package/plugins/lisa/skills/lisa-session-manager/scripts/ledger-setup-gaps.mjs +164 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/ledger.mjs +11 -4
- package/plugins/lisa/skills/lisa-session-manager/scripts/session-manager.mjs +1 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/worker-launch.mjs +6 -2
- package/plugins/lisa-agy/hooks/block-managed-file-edits.sh +84 -0
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +17 -7
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -8
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -3
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-workers.mjs +155 -17
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/ledger-setup-gaps.mjs +164 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/ledger.mjs +11 -4
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/session-manager.mjs +1 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/worker-launch.mjs +6 -2
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/hooks/block-managed-file-edits.sh +84 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +17 -7
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -8
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -3
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-workers.mjs +155 -17
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/ledger-setup-gaps.mjs +164 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/ledger.mjs +11 -4
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/session-manager.mjs +1 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/worker-launch.mjs +6 -2
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/block-managed-file-edits.sh +84 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +17 -7
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -8
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -3
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-workers.mjs +155 -17
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/ledger-setup-gaps.mjs +164 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/ledger.mjs +11 -4
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/session-manager.mjs +1 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/worker-launch.mjs +6 -2
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/hooks/block-managed-file-edits.sh +84 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +17 -7
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -8
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -3
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-workers.mjs +155 -17
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/ledger-setup-gaps.mjs +164 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/ledger.mjs +11 -4
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/session-manager.mjs +1 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/worker-launch.mjs +6 -2
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/hooks/block-managed-file-edits.sh +84 -0
- package/plugins/src/base/skills/lisa-session-manager/SKILL.md +17 -7
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-cycle.mjs +3 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -8
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +21 -3
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-workers.mjs +155 -17
- package/plugins/src/base/skills/lisa-session-manager/scripts/ledger-setup-gaps.mjs +164 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/ledger.mjs +11 -4
- package/plugins/src/base/skills/lisa-session-manager/scripts/session-manager.mjs +1 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/worker-launch.mjs +6 -2
- package/scripts/update-node-version.ts +16 -2
- package/typescript/copy-overwrite/.github/GITHUB_ACTIONS.md +2 -2
|
@@ -280,6 +280,86 @@ relative_path() {
|
|
|
280
280
|
printf '%s' "${rel#./}"
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
+
# The host's dependency and devDependency names, one per line, read at most
|
|
284
|
+
# once per classification. `managed_source` runs inside `$(...)`, so the cache
|
|
285
|
+
# lives only as long as that subshell — one classification, not one hook run.
|
|
286
|
+
# Unreadable or malformed `package.json` yields nothing, which makes every
|
|
287
|
+
# dependency-keyed stack below read as absent — an allow, the safe direction.
|
|
288
|
+
#
|
|
289
|
+
# Loaded into a global rather than echoed, so callers match with a here-string
|
|
290
|
+
# and no pipeline: under `pipefail` a `grep -q` that stops reading early can
|
|
291
|
+
# fail the writer with SIGPIPE and turn a match into a miss.
|
|
292
|
+
host_dependency_names=""
|
|
293
|
+
host_dependency_names_pending=1
|
|
294
|
+
load_host_dependency_names() {
|
|
295
|
+
[ "$host_dependency_names_pending" -eq 1 ] || return 0
|
|
296
|
+
host_dependency_names="$(jq -r \
|
|
297
|
+
'[(.dependencies // {}), (.devDependencies // {})] | add | keys[]' \
|
|
298
|
+
"$project_root/package.json" 2>/dev/null || true)"
|
|
299
|
+
host_dependency_names_pending=0
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
# Exact dependency name, or with `prefix` as the second argument, any name
|
|
303
|
+
# starting with it (the NestJS detector's `@nestjs` test).
|
|
304
|
+
host_has_dependency() {
|
|
305
|
+
load_host_dependency_names
|
|
306
|
+
local name
|
|
307
|
+
while IFS= read -r name; do
|
|
308
|
+
case "$name" in
|
|
309
|
+
"$1") return 0 ;;
|
|
310
|
+
"$1"*) [ "${2:-}" = prefix ] && return 0 ;;
|
|
311
|
+
esac
|
|
312
|
+
done <<<"$host_dependency_names"
|
|
313
|
+
return 1
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
# Whether the host is the given stack, so that stack's templates reach it.
|
|
317
|
+
#
|
|
318
|
+
# THE SAME PATH CAN BELONG TO DIFFERENT OWNERS IN DIFFERENT STACKS.
|
|
319
|
+
# `.github/workflows/ci.yml` is create-only in typescript, nestjs, cdk, expo and
|
|
320
|
+
# rails — the host owns it after the first apply — but copy-overwrite in
|
|
321
|
+
# harper-fabric and phaser. Probing every stack's tree without asking which
|
|
322
|
+
# stacks this host is made a NestJS host's own ci.yml read as managed via the
|
|
323
|
+
# harper-fabric copy, and a project-owned one-line Node bump needed a human to
|
|
324
|
+
# run the override (CodySwannGT/lisa#4511).
|
|
325
|
+
#
|
|
326
|
+
# `lisa apply` copies a stack's templates only into a host that stack's
|
|
327
|
+
# detector recognises, so each arm mirrors `src/detection/detectors/<stack>.ts`.
|
|
328
|
+
# `all`, `typescript`, and any stack without an arm here keep the pre-existing
|
|
329
|
+
# answer — always managed — so this narrows only where a detector proves the
|
|
330
|
+
# stack absent. Where a shell mirror cannot be exact it errs toward allowing,
|
|
331
|
+
# the same direction `.lisaignore` handling above takes.
|
|
332
|
+
stack_reaches_host() {
|
|
333
|
+
local stack="$1"
|
|
334
|
+
case "$stack" in
|
|
335
|
+
harper-fabric)
|
|
336
|
+
local config="$project_root/harper-app/config.yaml"
|
|
337
|
+
[ -f "$config" ] && [ -e "$project_root/harper-app/schema.graphql" ] ||
|
|
338
|
+
return 1
|
|
339
|
+
{
|
|
340
|
+
grep -qF 'graphqlSchema:' "$config" &&
|
|
341
|
+
grep -qF 'jsResource:' "$config" &&
|
|
342
|
+
grep -qF 'static:' "$config"
|
|
343
|
+
} || host_has_dependency harperdb
|
|
344
|
+
;;
|
|
345
|
+
phaser) host_has_dependency phaser ;;
|
|
346
|
+
nestjs)
|
|
347
|
+
[ -e "$project_root/nest-cli.json" ] ||
|
|
348
|
+
host_has_dependency @nestjs prefix
|
|
349
|
+
;;
|
|
350
|
+
expo)
|
|
351
|
+
[ -e "$project_root/app.json" ] || [ -e "$project_root/eas.json" ] ||
|
|
352
|
+
host_has_dependency expo
|
|
353
|
+
;;
|
|
354
|
+
cdk) [ -e "$project_root/cdk.json" ] ;;
|
|
355
|
+
rails)
|
|
356
|
+
[ -e "$project_root/bin/rails" ] ||
|
|
357
|
+
[ -e "$project_root/config/application.rb" ]
|
|
358
|
+
;;
|
|
359
|
+
*) return 0 ;;
|
|
360
|
+
esac
|
|
361
|
+
}
|
|
362
|
+
|
|
283
363
|
# Whether a host-relative path is shipped as a copy-overwrite template.
|
|
284
364
|
#
|
|
285
365
|
# A few stat calls rather than an enumeration: the same relative path is probed
|
|
@@ -299,6 +379,10 @@ managed_source() {
|
|
|
299
379
|
for stack in "$package_root"/*/copy-overwrite; do
|
|
300
380
|
[ -d "$stack" ] || continue
|
|
301
381
|
if [ -e "$stack/$rel" ]; then
|
|
382
|
+
# Another stack's copy-overwrite twin is not this host's file. Keep
|
|
383
|
+
# looking: a stack this host IS may still manage the same path.
|
|
384
|
+
local stack_name="${stack%/copy-overwrite}"
|
|
385
|
+
stack_reaches_host "${stack_name##*/}" || continue
|
|
302
386
|
printf '%s' "${stack#"$package_root"/}/$rel"
|
|
303
387
|
return 0
|
|
304
388
|
fi
|
|
@@ -451,7 +451,7 @@ shows them.
|
|
|
451
451
|
| `working`, `waiting`, `finished` | Nothing. |
|
|
452
452
|
| `requestion` | With Telegram: re-send the pending question once, then re-record it with `ledger set-question` (same text, new message id); that restarts the re-ping clock. With no channel: nothing to re-send; leave it pending. |
|
|
453
453
|
| `stalled`, `dead` | Read the item. If it left the `claimed` role, a human moved it: do not retry or move it; `ledger finish <ref> --status FAILED` with reason "left the claimed role outside the manager". Otherwise check for a merged PR first (`gh pr list --state merged --search <ref>` in the item's repo dir). If merged, leave the state change to Lisa's lifecycle and `ledger finish <ref> --status DONE` with reason "PR merged". Otherwise `claude stop <worker>` if it is still listed, then `spawn` a **fresh** attempt when capacity allows (the CLI counts attempts). |
|
|
454
|
-
| `setup-gap` | The worker's first prompt never ran: `setupGap.kind` is `unknown-command` (Lisa's plugin is not visible in that repo, so `/lisa:implement` is unknown there) or `prompt-blocked` (a `UserPromptSubmit` hook rejected the prompt; `setupGap.detail` is what the hook said). Retrying cannot fix it. `claude stop <worker>` if it is still listed, `ledger finish <ref> --status FAILED --setup-gap` with reason "setup gap: <kind>: <detail>" (the spawn is not counted as an attempt). Then read the item: If it left the `claimed` role, a human moved it: respect that and do not move it back to the `ready` role. Otherwise move the item back to the `ready` role. Either way post one plain-language line naming the repo and the fix to Telegram, do not respawn it, do not dispatch to that repo again until the operator fixes it, and end the cycle `recovery-required` with that line as the summary. |
|
|
454
|
+
| `setup-gap` | The worker's first prompt never ran: `setupGap.kind` is `unknown-command` (Lisa's plugin is not visible in that repo, so `/lisa:implement` is unknown there) or `prompt-blocked` (a `UserPromptSubmit` hook rejected the prompt; `setupGap.detail` is what the hook said). Retrying cannot fix it. `claude stop <worker>` if it is still listed, `ledger finish <ref> --status FAILED --setup-gap` with reason "setup gap: <kind>: <detail>" (the spawn is not counted as an attempt). Then read the item: If it left the `claimed` role, a human moved it: respect that and do not move it back to the `ready` role. Otherwise move the item back to the `ready` role. Either way post one plain-language line naming the repo and the fix to Telegram, do not respawn it, do not dispatch to that repo again until the operator fixes it, and end the cycle `recovery-required` with that line as the summary. `classify` has already recorded the repo's setup gap, so later cycles' `queue` leaves that repo out and `spawn` refuses it until the operator fixes the repo and runs `ledger clear-setup-gap <repo>` (`.` on a single-repo project); include that command in the line. |
|
|
455
455
|
| `exhausted` | Attempts reached `stall.maxAttempts`. Stop the worker if listed, `ledger finish <ref> --status FAILED`, then follow "Mark and move on" with `--kind exhausted` and, as the reason, how many attempts failed and how each ended: it moves the item to the `blocked` role and marks it for a human. |
|
|
456
456
|
|
|
457
457
|
**Blocked.** List the items in the `blocked` role (paged to completion, same access paths as the
|
|
@@ -520,7 +520,10 @@ Skip while `capacity` reports `paused`. Otherwise:
|
|
|
520
520
|
description, reporter, issuetype, subtasks); raw Linear nodes carry identifier, title, priority,
|
|
521
521
|
createdAt, assignee, labels, description, creator and children with their state type.
|
|
522
522
|
- `ordered` is the dispatch order: assigned to an operator, then to "me", then unassigned; each
|
|
523
|
-
group by priority, then age. `excluded` needs no action.
|
|
523
|
+
group by priority, then age. `excluded` needs no action. `setupGaps` lists each repo the
|
|
524
|
+
manager will not dispatch to until the operator fixes it (`kind`, `detail`, and `clear`, the
|
|
525
|
+
command that lifts it); its items are excluded as `setup-gap:<repo>`. Report a gap to the
|
|
526
|
+
operator only in the cycle that recorded it, never again each cycle.
|
|
524
527
|
- **Backlog tier** (only when `sessionManager.backlogPickup` is `true`). GitHub: `queue` fetches
|
|
525
528
|
it itself (open issues with no build or PRD lifecycle label). Jira / Linear: also fetch the
|
|
526
529
|
open leaf items in **no** lifecycle role — Linear workflow state type `backlog` or `unstarted`
|
|
@@ -564,13 +567,20 @@ Skip while `capacity` reports `paused`. Otherwise:
|
|
|
564
567
|
`ledger record-spawn <ref> --worker <worker> --session-id <id> --repo <key>`; continue.
|
|
565
568
|
- exit 2 (setup gap, e.g. workspace trust not accepted in the repo dir), including a worker
|
|
566
569
|
whose first prompt never ran (`/lisa:implement` unknown in that repo, or a
|
|
567
|
-
`UserPromptSubmit` hook rejected it; the CLI already stopped that worker
|
|
568
|
-
|
|
570
|
+
`UserPromptSubmit` hook rejected it; the CLI already stopped that worker, recorded no
|
|
571
|
+
item and recorded the repo's setup gap). If the ledger already has an item for the ref and it is still
|
|
569
572
|
running, run `ledger finish <ref> --status FAILED --setup-gap` with the CLI's message as
|
|
570
573
|
the reason, so that stale row from an earlier worker is never later read as a human
|
|
571
|
-
moving the item. Then move the item back to the `ready` role
|
|
572
|
-
|
|
573
|
-
|
|
574
|
+
moving the item. Then move the item back to the `ready` role. It is not a failed attempt.
|
|
575
|
+
The CLI remembers the gap: later cycles' `queue` leaves that repo's items out and `spawn`
|
|
576
|
+
refuses the repo (exit 2, nothing launched) until the operator fixes it and runs
|
|
577
|
+
`ledger clear-setup-gap <repo>` (`.` on a single-repo project). The exit-2 stdout's
|
|
578
|
+
`setupGapStatus` says what to tell the operator:
|
|
579
|
+
- `recorded` (this spawn found the gap) or `not-recorded` (the ledger write failed): post
|
|
580
|
+
the CLI's one-line message to Telegram and end the cycle `recovery-required` with that
|
|
581
|
+
message as the summary.
|
|
582
|
+
- `already-recorded` (the operator was told when it was recorded): post nothing and
|
|
583
|
+
continue with the next item.
|
|
574
584
|
- any other exit: move the item back to the `ready` role, notify Telegram, continue.
|
|
575
585
|
3. **Backlog tier, lowest priority.** Only when `backlogPickup` is on, every `ordered` item has been
|
|
576
586
|
taken or skipped, and `capacity` still says `can_spawn`. Ready work always wins: never promote a
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
setPendingQuestion,
|
|
35
35
|
} from "./ledger.mjs";
|
|
36
36
|
import { recordMarked } from "./ledger-questions.mjs";
|
|
37
|
+
import { clearSetupGap } from "./ledger-setup-gaps.mjs";
|
|
37
38
|
import { planBlockedRelease } from "./reconcile.mjs";
|
|
38
39
|
import { formatAnswer, routeInbound } from "./telegram-route.mjs";
|
|
39
40
|
|
|
@@ -159,6 +160,8 @@ const LEDGER_ACTIONS = {
|
|
|
159
160
|
}),
|
|
160
161
|
"validation-cleared": ctx =>
|
|
161
162
|
clearValidationFailure(ctx.root, { ref: requirePositional(ctx, "ref") }),
|
|
163
|
+
"clear-setup-gap": ctx =>
|
|
164
|
+
clearSetupGap(ctx.root, { repo: requirePositional(ctx, "repo") }),
|
|
162
165
|
control: ctx =>
|
|
163
166
|
setControl(
|
|
164
167
|
ctx.root,
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
* (open leaves in no lifecycle role) as `backlogOrdered`, under the same
|
|
15
15
|
* paging rule. The manager walks it only after the whole Ready queue.
|
|
16
16
|
*
|
|
17
|
+
* Both tiers leave out items routed to a repo with a recorded setup gap
|
|
18
|
+
* (#4820) and list every gap once as `setupGaps`, with the command that
|
|
19
|
+
* clears it, so the manager reports it in plain language instead of
|
|
20
|
+
* re-dispatching there every cycle.
|
|
21
|
+
*
|
|
17
22
|
* The GitHub fetches live in queue-github.mjs and JSON input in
|
|
18
23
|
* json-input.mjs (re-exported here), to keep each module under the line
|
|
19
24
|
* budget.
|
|
@@ -35,6 +40,7 @@ import {
|
|
|
35
40
|
} from "./cli-runtime.mjs";
|
|
36
41
|
import { readJsonFile } from "./json-input.mjs";
|
|
37
42
|
import { readLedger } from "./ledger.mjs";
|
|
43
|
+
import { blockingGapRepo, listSetupGaps } from "./ledger-setup-gaps.mjs";
|
|
38
44
|
import { fetchGithubBacklog, fetchGithubQueue } from "./queue-github.mjs";
|
|
39
45
|
|
|
40
46
|
export { parseJson, readJsonFile } from "./json-input.mjs";
|
|
@@ -124,6 +130,32 @@ function withoutPending(order, waiting) {
|
|
|
124
130
|
};
|
|
125
131
|
}
|
|
126
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Move items routed to a repo with a recorded setup gap out of `ordered` into
|
|
135
|
+
* `excluded` with reason `setup-gap:<repo>` (#4820). Retrying cannot fix a
|
|
136
|
+
* setup gap, so dispatching there would only fail the same way every cycle.
|
|
137
|
+
* @param {{ordered: {ref: string, repoLabels?: string[]}[], excluded: {ref: string, reason: string}[]}} order - Ordered tier
|
|
138
|
+
* @param {Record<string, object>} gaps - `control.setupGaps`
|
|
139
|
+
* @param {boolean} multiRepo - Whether `sessionManager.repos` is set
|
|
140
|
+
* @returns {{ordered: {ref: string}[], excluded: {ref: string, reason: string}[]}} Filtered tier
|
|
141
|
+
*/
|
|
142
|
+
function withoutSetupGaps(order, gaps, multiRepo) {
|
|
143
|
+
const blocked = order.ordered.map(item => ({
|
|
144
|
+
item,
|
|
145
|
+
repo: blockingGapRepo(item, gaps, multiRepo),
|
|
146
|
+
}));
|
|
147
|
+
return {
|
|
148
|
+
...order,
|
|
149
|
+
ordered: blocked.filter(row => row.repo === null).map(row => row.item),
|
|
150
|
+
excluded: [
|
|
151
|
+
...order.excluded,
|
|
152
|
+
...blocked
|
|
153
|
+
.filter(row => row.repo !== null)
|
|
154
|
+
.map(row => ({ ref: row.item.ref, reason: `setup-gap:${row.repo}` })),
|
|
155
|
+
],
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
127
159
|
/**
|
|
128
160
|
* `queue --tracker <github|jira|linear>`: the Ready queue, the operator's
|
|
129
161
|
* items first (`sessionManager.operatorIds`), then mine, then unassigned.
|
|
@@ -132,7 +164,7 @@ function withoutPending(order, waiting) {
|
|
|
132
164
|
* ordered the same way and always dispatched after every Ready item.
|
|
133
165
|
* @param {object} ctx - CLI context
|
|
134
166
|
* @returns {Promise<{ json: object }>}
|
|
135
|
-
* `{tracker,me,operators,total,pages,ordered,excluded,backlogPickup[,
|
|
167
|
+
* `{tracker,me,operators,total,pages,ordered,excluded,setupGaps,backlogPickup[,
|
|
136
168
|
* backlogTotal,backlogPages,backlogOrdered,backlogExcluded]}`
|
|
137
169
|
*/
|
|
138
170
|
export async function queue(ctx) {
|
|
@@ -160,7 +192,13 @@ export async function queue(ctx) {
|
|
|
160
192
|
humanNeededLabel: humanNeededLabel(project, tracker),
|
|
161
193
|
};
|
|
162
194
|
const waiting = pendingRefs(ledger);
|
|
163
|
-
const
|
|
195
|
+
const gaps = ledger.control.setupGaps;
|
|
196
|
+
const multiRepo = Boolean(config?.repos);
|
|
197
|
+
const order = withoutSetupGaps(
|
|
198
|
+
withoutPending(orderReadyQueue(items, policy), waiting),
|
|
199
|
+
gaps,
|
|
200
|
+
multiRepo
|
|
201
|
+
);
|
|
164
202
|
const json = {
|
|
165
203
|
tracker,
|
|
166
204
|
me,
|
|
@@ -168,18 +206,23 @@ export async function queue(ctx) {
|
|
|
168
206
|
total: items.length,
|
|
169
207
|
pages,
|
|
170
208
|
...order,
|
|
209
|
+
setupGaps: listSetupGaps(ledger),
|
|
171
210
|
backlogPickup,
|
|
172
211
|
};
|
|
173
212
|
if (!backlog) return { json };
|
|
174
213
|
// An item both Ready and in the backlog fetch is Ready work; never twice.
|
|
175
214
|
const readyRefs = new Set(items.map(item => item.ref));
|
|
176
215
|
const backlogItems = backlog.items.filter(item => !readyRefs.has(item.ref));
|
|
177
|
-
const tier =
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
216
|
+
const tier = withoutSetupGaps(
|
|
217
|
+
withoutPending(
|
|
218
|
+
orderBacklogQueue(backlogItems, {
|
|
219
|
+
...policy,
|
|
220
|
+
validationFailures: ledger.validationFailures,
|
|
221
|
+
}),
|
|
222
|
+
waiting
|
|
223
|
+
),
|
|
224
|
+
gaps,
|
|
225
|
+
multiRepo
|
|
183
226
|
);
|
|
184
227
|
return {
|
|
185
228
|
json: {
|
|
@@ -27,7 +27,9 @@ Workers and capacity
|
|
|
27
27
|
spawn <ref> [--repo <key>] [--max-workers <n>]
|
|
28
28
|
Checks, in order: repo dir resolves and has .lisa.config.json (exit 2);
|
|
29
29
|
capacity (exit 3, stdout = capacity report); no live wk- worker for the
|
|
30
|
-
ref (exit 4, stdout = {ref,worker,sessionId}); no
|
|
30
|
+
ref (exit 4, stdout = {ref,worker,sessionId}); no recorded setup gap
|
|
31
|
+
for the repo (exit 2, nothing launched or recorded: fix the repo, then
|
|
32
|
+
ledger clear-setup-gap <repo>); no pending question in
|
|
31
33
|
the ledger for the ref (exit 2: clear it first). Then runs, with cwd = repo
|
|
32
34
|
dir and every TELEGRAM_* variable removed:
|
|
33
35
|
claude --bg -n wk-<token>-<MMDD-HHMM> --dangerously-skip-permissions
|
|
@@ -36,8 +38,14 @@ Workers and capacity
|
|
|
36
38
|
Then reads the worker's transcript for up to 30s
|
|
37
39
|
(LISA_SESSION_MANAGER_FIRST_PROMPT_MS overrides it): when the first
|
|
38
40
|
prompt never ran (the command is unknown in that repo, or a
|
|
39
|
-
UserPromptSubmit hook rejected it), stops the worker, records
|
|
40
|
-
and exits 2 (setup gap; no attempt counted).
|
|
41
|
+
UserPromptSubmit hook rejected it), stops the worker, records no item
|
|
42
|
+
and exits 2 (setup gap; no attempt counted). That gap, and an
|
|
43
|
+
untrusted workspace, are recorded per repo in the ledger's
|
|
44
|
+
control.setupGaps (repo "." on a single-repo project) until cleared.
|
|
45
|
+
Every setup-gap exit 2 prints {repo,setupGap,setupGapStatus}:
|
|
46
|
+
"recorded" (new: tell the operator), "already-recorded" (refused; the
|
|
47
|
+
operator was already told) or "not-recorded" (the ledger write failed,
|
|
48
|
+
warned on stderr: tell the operator).
|
|
41
49
|
Records the ledger and sessions.jsonl. stdout {ref,name,sessionId,repo,
|
|
42
50
|
cwd,firstPrompt}, firstPrompt "alive" or "unconfirmed" (the transcript
|
|
43
51
|
did not resolve in time).
|
|
@@ -198,6 +206,10 @@ Per cycle
|
|
|
198
206
|
ledger's validationFailures entry matches the item's updatedAt).
|
|
199
207
|
GitHub fetches them itself; jira|linear need <file>.backlog =
|
|
200
208
|
{complete:true,pages,items}, else exit 2.
|
|
209
|
+
Items in a repo with a recorded setup gap are excluded from both tiers
|
|
210
|
+
(setup-gap:<repo>): every item on a single-repo project, or items
|
|
211
|
+
labelled repo:<key> on a multi-repo one. setupGaps lists each gap once
|
|
212
|
+
as {repo,kind,detail,at,clear} (clear = the command that lifts it).
|
|
201
213
|
ledger get [<ref>]
|
|
202
214
|
ledger record-spawn <ref> --worker <name> [--session-id <id>] [--repo <key>]
|
|
203
215
|
ledger set-question <ref> [--kind <kind>] [--telegram-message-id <n>]
|
|
@@ -232,6 +244,12 @@ Per cycle
|
|
|
232
244
|
ledger validation-cleared <ref>
|
|
233
245
|
Forgets that failure: after a promotion, or by hand to have the next
|
|
234
246
|
cycle re-validate an item without editing it. stdout {cleared}.
|
|
247
|
+
ledger clear-setup-gap <repo>
|
|
248
|
+
Forgets a repo's recorded setup gap ("." on a single-repo project),
|
|
249
|
+
after the operator fixed the repo; queue offers its items and spawn
|
|
250
|
+
launches there again. Never automatic. Also stamps
|
|
251
|
+
control.setupGapsClearedAt, so classify never re-records the gap from
|
|
252
|
+
a worker that started before the clear. stdout {repo,cleared}.
|
|
235
253
|
ledger control [--paused true|false] [--max-workers <n>|none] [--me <id>|none]
|
|
236
254
|
route [--reply-to <telegram message id>] [--owner <name>] STDIN: message
|
|
237
255
|
stdout {kind:"answer",ref,body[,message]} | {kind:"command",name,...}
|
|
@@ -11,9 +11,14 @@
|
|
|
11
11
|
* trust was never accepted is exit 2 too (see worker-launch.mjs). So is a
|
|
12
12
|
* worker whose first prompt never ran — `/lisa:implement` unknown in that
|
|
13
13
|
* repo, or refused by a `UserPromptSubmit` hook: `spawn` reads the new
|
|
14
|
-
* session's transcript briefly, stops that worker and records
|
|
14
|
+
* session's transcript briefly, stops that worker and records no item
|
|
15
15
|
* (lisa#4503). `classify` reads the same transcript every cycle and reports
|
|
16
16
|
* such a worker as `setup-gap` instead of `working` until the stall timer.
|
|
17
|
+
*
|
|
18
|
+
* Either setup gap — and one `classify` finds later — is recorded per repo in
|
|
19
|
+
* the ledger (lisa#4820), and
|
|
20
|
+
* `spawn` refuses a repo with a recorded gap (exit 2) before launching
|
|
21
|
+
* anything, until the operator runs `ledger clear-setup-gap <repo>`.
|
|
17
22
|
* @module session-manager/cli-workers
|
|
18
23
|
*/
|
|
19
24
|
import { createHash } from "node:crypto";
|
|
@@ -53,6 +58,11 @@ import {
|
|
|
53
58
|
parseSessionId,
|
|
54
59
|
} from "./workers.mjs";
|
|
55
60
|
import { claudeConfigDir, readFirstPrompt } from "./first-prompt.mjs";
|
|
61
|
+
import {
|
|
62
|
+
clearCommand,
|
|
63
|
+
recordSetupGap,
|
|
64
|
+
setupGapOf,
|
|
65
|
+
} from "./ledger-setup-gaps.mjs";
|
|
56
66
|
import {
|
|
57
67
|
confirmFirstPrompt,
|
|
58
68
|
resolveFullSessionId,
|
|
@@ -114,6 +124,109 @@ function knownNames(agents, ledger) {
|
|
|
114
124
|
);
|
|
115
125
|
}
|
|
116
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Refuse a repo whose setup gap is recorded (exit 2), before any worker is
|
|
129
|
+
* launched or any attempt recorded. Retrying cannot fix a setup gap, so the
|
|
130
|
+
* repo stays refused until the operator clears it (lisa#4820).
|
|
131
|
+
* @param {Awaited<ReturnType<typeof readLedger>>} ledger - Ledger
|
|
132
|
+
* @param {string} repo - Repo key (`.` for a single-repo project)
|
|
133
|
+
*/
|
|
134
|
+
function refuseSetupGap(ledger, repo) {
|
|
135
|
+
const gap = setupGapOf(ledger, repo);
|
|
136
|
+
if (gap === null) return;
|
|
137
|
+
throw new CliError(
|
|
138
|
+
`Repo ${repo} has a recorded setup gap (${gap.kind}: ${gap.detail}, ` +
|
|
139
|
+
`recorded ${gap.at}), so no worker was started and nothing was ` +
|
|
140
|
+
`recorded. Fix the repo, then run "${clearCommand(repo)}" to resume ` +
|
|
141
|
+
`dispatching there.`,
|
|
142
|
+
EXIT.SETUP,
|
|
143
|
+
{ repo, setupGap: gap, setupGapStatus: "already-recorded" }
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Record a spawn's setup gap, reporting what happened. A failed ledger write
|
|
149
|
+
* is warned about and reported as `not-recorded`, never allowed to replace
|
|
150
|
+
* the setup message the operator needs.
|
|
151
|
+
*
|
|
152
|
+
* probe-direction: fail-open — an unwritten gap only means the next cycle
|
|
153
|
+
* may dispatch to the repo once more and hit the same exit 2.
|
|
154
|
+
* @param {object} ctx - CLI context
|
|
155
|
+
* @param {string} repo - Repo key
|
|
156
|
+
* @param {{kind: string, detail: string}} gap - What failed
|
|
157
|
+
* @returns {Promise<"recorded" | "already-recorded" | "not-recorded">} Status
|
|
158
|
+
*/
|
|
159
|
+
async function persistSpawnGap(ctx, repo, gap) {
|
|
160
|
+
try {
|
|
161
|
+
const { status } = await recordSetupGap(ctx.root, { repo, ...gap });
|
|
162
|
+
return status === "already-recorded" ? status : "recorded";
|
|
163
|
+
} catch (error) {
|
|
164
|
+
ctx.warn(
|
|
165
|
+
`Could not record the setup gap for repo ${repo} in the ledger ` +
|
|
166
|
+
`(${error.message}); the next cycle may dispatch there again.`
|
|
167
|
+
);
|
|
168
|
+
return "not-recorded";
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Run `launch`; when it fails with a setup gap (exit 2 carrying
|
|
174
|
+
* `json.setupGap`), record the gap under `repo` and rethrow it naming the
|
|
175
|
+
* command that clears it. `json.setupGapStatus` says whether this spawn
|
|
176
|
+
* recorded the gap (`recorded`: tell the operator), found it already
|
|
177
|
+
* recorded, or could not record it (`not-recorded`: tell the operator).
|
|
178
|
+
* @template T
|
|
179
|
+
* @param {object} ctx - CLI context
|
|
180
|
+
* @param {string} repo - Repo key
|
|
181
|
+
* @param {() => Promise<T>} launch - The launch to guard
|
|
182
|
+
* @returns {Promise<T>} What `launch` returned
|
|
183
|
+
*/
|
|
184
|
+
async function rememberingSetupGap(ctx, repo, launch) {
|
|
185
|
+
try {
|
|
186
|
+
return await launch();
|
|
187
|
+
} catch (error) {
|
|
188
|
+
const gap = error instanceof CliError ? error.json?.setupGap : null;
|
|
189
|
+
if (error.exitCode !== EXIT.SETUP || !gap) throw error;
|
|
190
|
+
const setupGapStatus = await persistSpawnGap(ctx, repo, gap);
|
|
191
|
+
const paused =
|
|
192
|
+
setupGapStatus === "not-recorded"
|
|
193
|
+
? ""
|
|
194
|
+
: ` Dispatch to repo ${repo} is now paused: once it is fixed, run ` +
|
|
195
|
+
`"${clearCommand(repo)}".`;
|
|
196
|
+
throw new CliError(`${error.message}${paused}`, EXIT.SETUP, {
|
|
197
|
+
...error.json,
|
|
198
|
+
repo,
|
|
199
|
+
setupGapStatus,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Start the worker and confirm its first prompt ran.
|
|
206
|
+
* @param {object} ctx - CLI context
|
|
207
|
+
* @param {ReturnType<typeof buildWorkerSpawn>} spec - Spawn spec
|
|
208
|
+
* @param {string} repoDir - Where the worker starts
|
|
209
|
+
* @returns {Promise<{name: string, sessionId: string | null,
|
|
210
|
+
* firstPrompt: "alive" | "unconfirmed"}>} The launched worker
|
|
211
|
+
*/
|
|
212
|
+
async function launchWorker(ctx, spec, repoDir) {
|
|
213
|
+
const name = spec.args[2];
|
|
214
|
+
const sessionId = parseSessionId(runWorkerSession(spec));
|
|
215
|
+
if (sessionId === null) {
|
|
216
|
+
ctx.warn(
|
|
217
|
+
`claude --bg printed no session id; find ${name} in claude agents --json.`
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
// Before anything is recorded: a first prompt that never ran is a setup
|
|
221
|
+
// gap (exit 2), not an attempt. With no session id there is no transcript
|
|
222
|
+
// to find, so waiting would only delay the spawn.
|
|
223
|
+
const firstPrompt =
|
|
224
|
+
sessionId === null
|
|
225
|
+
? "unconfirmed"
|
|
226
|
+
: await confirmFirstPrompt(ctx, { name, sessionId, repoDir });
|
|
227
|
+
return { name, sessionId, firstPrompt };
|
|
228
|
+
}
|
|
229
|
+
|
|
117
230
|
/**
|
|
118
231
|
* `spawn <ref> [--repo <key>]`: start one worker for one claimed item.
|
|
119
232
|
* @param {object} ctx - CLI context
|
|
@@ -147,6 +260,8 @@ export async function spawn(ctx) {
|
|
|
147
260
|
}
|
|
148
261
|
|
|
149
262
|
const ledger = await readLedger(ctx.root);
|
|
263
|
+
const repo = key ?? ".";
|
|
264
|
+
refuseSetupGap(ledger, repo);
|
|
150
265
|
// A spawn no longer clears a pending question (lisa#4571), and a worker
|
|
151
266
|
// under one classifies as waiting, never stalled or dead. So refuse here:
|
|
152
267
|
// the question must be answered and cleared first ("Clearing").
|
|
@@ -167,22 +282,11 @@ export async function spawn(ctx) {
|
|
|
167
282
|
env: ctx.env,
|
|
168
283
|
});
|
|
169
284
|
});
|
|
170
|
-
const name =
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
`claude --bg printed no session id; find ${name} in claude agents --json.`
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
// Before anything is recorded: a first prompt that never ran is a setup
|
|
179
|
-
// gap (exit 2), not an attempt. With no session id there is no transcript
|
|
180
|
-
// to find, so waiting would only delay the spawn.
|
|
181
|
-
const firstPrompt =
|
|
182
|
-
sessionId === null
|
|
183
|
-
? "unconfirmed"
|
|
184
|
-
: await confirmFirstPrompt(ctx, { name, sessionId, repoDir });
|
|
185
|
-
const repo = key ?? ".";
|
|
285
|
+
const { name, sessionId, firstPrompt } = await rememberingSetupGap(
|
|
286
|
+
ctx,
|
|
287
|
+
repo,
|
|
288
|
+
() => launchWorker(ctx, spec, repoDir)
|
|
289
|
+
);
|
|
186
290
|
await recordSpawn(ctx.root, { ref, worker: name, sessionId, repo });
|
|
187
291
|
await appendSessionEvent(ctx.root, {
|
|
188
292
|
event: "spawn",
|
|
@@ -331,6 +435,37 @@ function transcriptFailure(ctx, config, entry) {
|
|
|
331
435
|
);
|
|
332
436
|
}
|
|
333
437
|
|
|
438
|
+
/**
|
|
439
|
+
* Record a gap `classify` found in a running worker's transcript, unless the
|
|
440
|
+
* repo already has one (so its `at` stays when the gap was first seen) or
|
|
441
|
+
* the worker started before the operator last cleared the repo (its old
|
|
442
|
+
* transcript would otherwise undo the clear every cycle). A worker whose
|
|
443
|
+
* first prompt failed after spawn's window never went through spawn's exit 2,
|
|
444
|
+
* so without this its repo would still be dispatched to (lisa#4820).
|
|
445
|
+
*
|
|
446
|
+
* probe-direction: fail-open — a failed write is warned about and must not
|
|
447
|
+
* abort classifying the remaining items; the next cycle retries it.
|
|
448
|
+
* @param {object} ctx - CLI context
|
|
449
|
+
* @param {{repo?: string|null, startedAt?: string|null}} entry - Ledger item
|
|
450
|
+
* @param {{kind: string, detail: string}} failure - From the transcript
|
|
451
|
+
* @returns {Promise<void>}
|
|
452
|
+
*/
|
|
453
|
+
async function rememberClassifiedGap(ctx, entry, failure) {
|
|
454
|
+
const repo = entry.repo ?? ".";
|
|
455
|
+
try {
|
|
456
|
+
await recordSetupGap(ctx.root, {
|
|
457
|
+
repo,
|
|
458
|
+
...failure,
|
|
459
|
+
startedAt: entry.startedAt ?? null,
|
|
460
|
+
});
|
|
461
|
+
} catch (error) {
|
|
462
|
+
ctx.warn(
|
|
463
|
+
`Could not record the setup gap for repo ${repo} in the ledger ` +
|
|
464
|
+
`(${error.message}); the next cycle will try again.`
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
334
469
|
/**
|
|
335
470
|
* `classify [<ref>]`: classify one ledger item, or every one, for this cycle,
|
|
336
471
|
* and record each logs hash as progress.
|
|
@@ -364,6 +499,9 @@ export async function classify(ctx) {
|
|
|
364
499
|
firstPromptFailure: setupGap,
|
|
365
500
|
});
|
|
366
501
|
if (hash !== null) await recordProgress(ctx.root, { ref, logsHash: hash });
|
|
502
|
+
if (classification === "setup-gap") {
|
|
503
|
+
await rememberClassifiedGap(ctx, entry, setupGap);
|
|
504
|
+
}
|
|
367
505
|
rows.push({
|
|
368
506
|
ref,
|
|
369
507
|
worker: entry.worker ?? null,
|