@codyswann/lisa 4.110.1 → 4.111.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all/copy-overwrite/scripts/lib/completion-proof-conformance.mjs +24 -1
- package/all/copy-overwrite/scripts/lib/completion-proof-markdown.mjs +91 -3
- package/all/copy-overwrite/scripts/lib/completion-proof-shape.mjs +189 -19
- package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +4 -3
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +38 -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 +82 -13
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- 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/scripts/human-gate-lift.mjs +148 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-linear-validate-issue/SKILL.md +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +69 -4
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/references/runbook-template.md +3 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-cycle.mjs +16 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-orphans.mjs +162 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +40 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/ledger.mjs +15 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/orphan-buckets.mjs +233 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/orphan-holds.mjs +252 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/orphan-sweep.mjs +335 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/session-manager.mjs +12 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-tracker-evidence/SKILL.md +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-tracker-evidence/references/completion-authorization.md +10 -1
- package/plugins/lisa/skills/lisa-linear-validate-issue/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-session-manager/SKILL.md +69 -4
- package/plugins/lisa/skills/lisa-session-manager/references/runbook-template.md +3 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-cycle.mjs +16 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-orphans.mjs +162 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +40 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/ledger.mjs +15 -3
- package/plugins/lisa/skills/lisa-session-manager/scripts/orphan-buckets.mjs +233 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/orphan-holds.mjs +252 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/orphan-sweep.mjs +335 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/session-manager.mjs +12 -1
- package/plugins/lisa/skills/lisa-tracker-evidence/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-tracker-evidence/references/completion-authorization.md +10 -1
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-linear-validate-issue/SKILL.md +1 -1
- package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +69 -4
- package/plugins/lisa-agy/skills/lisa-session-manager/references/runbook-template.md +3 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-cycle.mjs +16 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-orphans.mjs +162 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +40 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/ledger.mjs +15 -3
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/orphan-buckets.mjs +233 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/orphan-holds.mjs +252 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/orphan-sweep.mjs +335 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/session-manager.mjs +12 -1
- package/plugins/lisa-agy/skills/lisa-tracker-evidence/SKILL.md +1 -1
- package/plugins/lisa-agy/skills/lisa-tracker-evidence/references/completion-authorization.md +10 -1
- 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/skills/lisa-linear-validate-issue/SKILL.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +69 -4
- package/plugins/lisa-copilot/skills/lisa-session-manager/references/runbook-template.md +3 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-cycle.mjs +16 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-orphans.mjs +162 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +40 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/ledger.mjs +15 -3
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/orphan-buckets.mjs +233 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/orphan-holds.mjs +252 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/orphan-sweep.mjs +335 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/session-manager.mjs +12 -1
- package/plugins/lisa-copilot/skills/lisa-tracker-evidence/SKILL.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-tracker-evidence/references/completion-authorization.md +10 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/skills/lisa-linear-validate-issue/SKILL.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +69 -4
- package/plugins/lisa-cursor/skills/lisa-session-manager/references/runbook-template.md +3 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-cycle.mjs +16 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-orphans.mjs +162 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +40 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/ledger.mjs +15 -3
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/orphan-buckets.mjs +233 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/orphan-holds.mjs +252 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/orphan-sweep.mjs +335 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/session-manager.mjs +12 -1
- package/plugins/lisa-cursor/skills/lisa-tracker-evidence/SKILL.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-tracker-evidence/references/completion-authorization.md +10 -1
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/skills/lisa-linear-validate-issue/SKILL.md +1 -1
- package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +69 -4
- package/plugins/lisa-devin/skills/lisa-session-manager/references/runbook-template.md +3 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-cycle.mjs +16 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-orphans.mjs +162 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +40 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/ledger.mjs +15 -3
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/orphan-buckets.mjs +233 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/orphan-holds.mjs +252 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/orphan-sweep.mjs +335 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/session-manager.mjs +12 -1
- package/plugins/lisa-devin/skills/lisa-tracker-evidence/SKILL.md +1 -1
- package/plugins/lisa-devin/skills/lisa-tracker-evidence/references/completion-authorization.md +10 -1
- 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/skills/lisa-linear-validate-issue/SKILL.md +1 -1
- package/plugins/src/base/skills/lisa-session-manager/SKILL.md +69 -4
- package/plugins/src/base/skills/lisa-session-manager/references/runbook-template.md +3 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-cycle.mjs +16 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-orphans.mjs +162 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +40 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/ledger.mjs +15 -3
- package/plugins/src/base/skills/lisa-session-manager/scripts/orphan-buckets.mjs +233 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/orphan-holds.mjs +252 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/orphan-sweep.mjs +335 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/session-manager.mjs +12 -1
- package/plugins/src/base/skills/lisa-tracker-evidence/SKILL.md +1 -1
- package/plugins/src/base/skills/lisa-tracker-evidence/references/completion-authorization.md +10 -1
package/package.json
CHANGED
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
"qs": "^6.16.0"
|
|
189
189
|
},
|
|
190
190
|
"name": "@codyswann/lisa",
|
|
191
|
-
"version": "4.
|
|
191
|
+
"version": "4.111.0",
|
|
192
192
|
"description": "Governance-as-code for AI coding agents: turns a repository into agent-operated software factories with guardrails, guidance and automated enforcement for Claude Code, Codex, Cursor, OpenCode, Antigravity, Copilot and Devin",
|
|
193
193
|
"main": "dist/index.js",
|
|
194
194
|
"exports": {
|
|
@@ -351,7 +351,7 @@
|
|
|
351
351
|
"test": "tests"
|
|
352
352
|
},
|
|
353
353
|
"types": "./dist/index.d.ts",
|
|
354
|
-
"lisaReleaseCommit": "
|
|
355
|
-
"gitHead": "
|
|
356
|
-
"lisaReleaseTag": "v4.
|
|
354
|
+
"lisaReleaseCommit": "52910f16a196135cadb6b95ed662b5d6546e8a0b",
|
|
355
|
+
"gitHead": "52910f16a196135cadb6b95ed662b5d6546e8a0b",
|
|
356
|
+
"lisaReleaseTag": "v4.111.0"
|
|
357
357
|
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lift holds that were never valid, with no person involved.
|
|
3
|
+
*
|
|
4
|
+
* Holds filed under the old "a human product call is pending" wording keep
|
|
5
|
+
* stalling items, and the operator should never have to comment to release
|
|
6
|
+
* one (CodySwannGT/lisa#4658, item 5). The intake and repair sweeps call
|
|
7
|
+
* {@link planHumanGateLift} on every open item carrying a `[lisa-human-gate]`
|
|
8
|
+
* hold. A hold that is not valid under the project's `humanGate.mode` and
|
|
9
|
+
* `humanGate.humanOnly` (see `human-gate-act.mjs`) is lifted: the sweep posts a visible
|
|
10
|
+
* `[lisa-human-gate-lifted] reason=<slug>` comment saying why, removes the
|
|
11
|
+
* human-needed marker, and moves the item to the build-ready role.
|
|
12
|
+
*
|
|
13
|
+
* This is not a forged human release. A release records a person's answer; a
|
|
14
|
+
* lift records that there was no question a person had to answer. A valid
|
|
15
|
+
* hold — a credential, spend, a legal signature — is never lifted and still
|
|
16
|
+
* waits for its act. Pass `humanGateMode` (`humanGate.mode`) alongside
|
|
17
|
+
* `humanOnly`: under `"strict"` a pre-#4687 gate such as naming an accountable
|
|
18
|
+
* person is valid and kept; omitted, the default `access-only` mode lifts it
|
|
19
|
+
* (CodySwannGT/lisa#4687). A label-only hold (access blocked, a blocked verdict) has no
|
|
20
|
+
* declared reason to judge and is never lifted either.
|
|
21
|
+
* @module human-gate-lift
|
|
22
|
+
*/
|
|
23
|
+
import {
|
|
24
|
+
HUMAN_GATE_LIFTED_MARKER,
|
|
25
|
+
humanGateVerdict,
|
|
26
|
+
invalidHumanGateHolds,
|
|
27
|
+
planHumanGateRelease,
|
|
28
|
+
} from "./intake-blocker-reprobe.mjs";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Render the lift comment for one invalid hold.
|
|
32
|
+
*
|
|
33
|
+
* The first line is the declaration the verdict reads; the rest is for a
|
|
34
|
+
* non-technical operator, who is who reads this.
|
|
35
|
+
* @param {{ reason?: unknown }} lift - The hold's reason key
|
|
36
|
+
* @returns {string} Comment body
|
|
37
|
+
*/
|
|
38
|
+
export function formatHumanGateLift(lift = {}) {
|
|
39
|
+
const reason = String(lift.reason ?? "").trim();
|
|
40
|
+
const declaration =
|
|
41
|
+
reason.length > 0
|
|
42
|
+
? `${HUMAN_GATE_LIFTED_MARKER} reason=${reason}`
|
|
43
|
+
: HUMAN_GATE_LIFTED_MARKER;
|
|
44
|
+
const named = reason.length > 0 ? `"${reason}"` : "this hold";
|
|
45
|
+
return [
|
|
46
|
+
declaration,
|
|
47
|
+
`Hold lifted: ${named} is a decision an agent can make, not an act only a ` +
|
|
48
|
+
"person can perform (a login or credential, spend, an external account, " +
|
|
49
|
+
"a legal signature, an account only a person holds, or a system the " +
|
|
50
|
+
"agent cannot reach), so this item is back in " +
|
|
51
|
+
"the build queue and whoever builds it decides and records the call; " +
|
|
52
|
+
"the description is unchanged.",
|
|
53
|
+
].join("\n");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Plan the lift for one item.
|
|
58
|
+
*
|
|
59
|
+
* Idempotent by state: a reason already lifted gets no second comment, and an
|
|
60
|
+
* item already moved needs no label writes. Label actions are computed as if
|
|
61
|
+
* the planned comments were already posted, by the same release planner the
|
|
62
|
+
* human-release path uses, so the lane rules (never drag an item that has moved
|
|
63
|
+
* on back to the queue) are shared rather than restated.
|
|
64
|
+
* @param {{
|
|
65
|
+
* labels?: unknown
|
|
66
|
+
* body?: unknown
|
|
67
|
+
* comments?: unknown
|
|
68
|
+
* trustedHumanActorIds?: unknown
|
|
69
|
+
* humanNeededLabel?: unknown
|
|
70
|
+
* humanOnly?: unknown
|
|
71
|
+
* humanGateMode?: unknown
|
|
72
|
+
* readyLabel?: unknown
|
|
73
|
+
* lifecycleLabels?: unknown
|
|
74
|
+
* }} input - Candidate surfaces plus lane vocabulary and project policy
|
|
75
|
+
* @returns {{ lift: boolean, reason: string, lifted: string[], kept: string[], comments: string[], actions: { removeHumanNeededLabel: boolean, addReadyLabel: string | null } }} Lift plan
|
|
76
|
+
*/
|
|
77
|
+
export function planHumanGateLift(input = {}) {
|
|
78
|
+
const idle = Object.freeze({
|
|
79
|
+
removeHumanNeededLabel: false,
|
|
80
|
+
addReadyLabel: null,
|
|
81
|
+
});
|
|
82
|
+
const verdict = humanGateVerdict(input);
|
|
83
|
+
const liftable = new Set(
|
|
84
|
+
invalidHumanGateHolds(input.body, input.humanOnly, input.humanGateMode)
|
|
85
|
+
);
|
|
86
|
+
const toLift = verdict.outstanding.filter(reason => liftable.has(reason));
|
|
87
|
+
const kept = verdict.outstanding.filter(reason => !toLift.includes(reason));
|
|
88
|
+
const comments = toLift.map(reason => formatHumanGateLift({ reason }));
|
|
89
|
+
|
|
90
|
+
// Nothing new to lift and something still held: an earlier partial lift is
|
|
91
|
+
// history, not news, so a later cycle must not report the item again.
|
|
92
|
+
if (toLift.length === 0 && (verdict.lifted.length === 0 || kept.length > 0)) {
|
|
93
|
+
return {
|
|
94
|
+
lift: false,
|
|
95
|
+
reason: kept.length > 0 ? "hold-valid" : "nothing-to-lift",
|
|
96
|
+
lifted: [],
|
|
97
|
+
kept,
|
|
98
|
+
comments: [],
|
|
99
|
+
actions: idle,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (kept.length > 0) {
|
|
103
|
+
return {
|
|
104
|
+
lift: true,
|
|
105
|
+
reason: "partial-lift",
|
|
106
|
+
lifted: toLift,
|
|
107
|
+
kept,
|
|
108
|
+
comments,
|
|
109
|
+
actions: idle,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const prior = Array.isArray(input.comments) ? input.comments : [];
|
|
114
|
+
const release = planHumanGateRelease({
|
|
115
|
+
...input,
|
|
116
|
+
comments: [...prior, ...comments.map(body => ({ body }))],
|
|
117
|
+
alreadyNotified: true,
|
|
118
|
+
});
|
|
119
|
+
const actions = {
|
|
120
|
+
removeHumanNeededLabel: release.actions.removeHumanNeededLabel,
|
|
121
|
+
addReadyLabel: release.actions.addReadyLabel,
|
|
122
|
+
};
|
|
123
|
+
const changed =
|
|
124
|
+
comments.length > 0 ||
|
|
125
|
+
actions.removeHumanNeededLabel ||
|
|
126
|
+
actions.addReadyLabel !== null;
|
|
127
|
+
return {
|
|
128
|
+
lift: true,
|
|
129
|
+
reason: changed ? "lift" : "already-lifted",
|
|
130
|
+
lifted: toLift,
|
|
131
|
+
kept: [],
|
|
132
|
+
comments,
|
|
133
|
+
actions,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Render the cycle-summary line naming what was lifted, printed even at zero.
|
|
139
|
+
* @param {readonly unknown[]} lifted - Item references lifted this cycle
|
|
140
|
+
* @returns {string} One summary line
|
|
141
|
+
*/
|
|
142
|
+
export function summarizeHumanGateLifts(lifted = []) {
|
|
143
|
+
const names = (Array.isArray(lifted) ? lifted : [])
|
|
144
|
+
.map(item => (typeof item === "string" ? item.trim() : ""))
|
|
145
|
+
.filter(name => name.length > 0);
|
|
146
|
+
if (names.length === 0) return "Invalid holds lifted: none.";
|
|
147
|
+
return `Invalid holds lifted (${String(names.length)}): ${names.join(", ")}.`;
|
|
148
|
+
}
|
|
@@ -262,7 +262,7 @@ Each marker must satisfy ALL of:
|
|
|
262
262
|
|
|
263
263
|
FAIL when the Validation Journey is present but declares zero binding `[EVIDENCE: ...]` markers, when any binding marker is untyped or uses a type outside the taxonomy, or when any binding name is empty, duplicated, or not kebab-case. A behavior-changing work unit SHOULD declare both a success marker and an error/edge marker; a journey with only one binding marker passes but the remediation should recommend adding the error/edge case.
|
|
264
264
|
|
|
265
|
-
Parse claiming markers by the exact `[EVIDENCE:` prefix. A cross-work-item pointer in the canonical form `[EVIDENCE-REF: <work-item-ref> | <artifact-type>: <kebab-case-name>]` is non-claiming. The Lisa 2.223.0 form `[EVIDENCE-REF: <tracker-ref>: <artifact-type>: <kebab-case-name>]` is also accepted as a legacy non-claiming alias; parse it from the right so the final two fields are type/name and a tracker URL may contain `:`. Exclude both forms from the manifest, S14's minimum-marker count, local marker type/name validation, and duplicate-name checks. Independently validate every `EVIDENCE-REF`: the native work-item reference must be non-empty and unambiguous, the artifact type must use the fixed taxonomy, and the name must be non-empty kebab-case. A malformed reference FAILs S14 as an invalid pointer but never becomes a local evidence obligation. A valid canonical or legacy reference may point to a sibling's artifact, but it never satisfies S14 for this item. Therefore a runtime-changing leaf whose journey contains only `EVIDENCE-REF` entries FAILs S14 for zero local claiming markers, not because a valid legacy reference is malformed. Quoting or code-formatting another item's `[EVIDENCE: ...]` marker does not make it a reference; writers must convert it to the canonical pipe form. Linear returns stored Markdown with brackets escaped (`\[EVIDENCE: cli-output: name\]`, `\[EVIDENCE-REF: ...\]`): decode one Markdown escape layer outside code fences, indented code and inline code spans before matching, as `localMarkers` in `completion-proof-shape.mjs` does, so an escaped and an unescaped marker are the same declaration and a malformed one still FAILs. A marker inside an inline code span on a single line (any backtick-run length) is an example, like one in a fence: it never counts toward S14 and is never refused as malformed.
|
|
265
|
+
Parse claiming markers by the exact `[EVIDENCE:` prefix. A cross-work-item pointer in the canonical form `[EVIDENCE-REF: <work-item-ref> | <artifact-type>: <kebab-case-name>]` is non-claiming. The Lisa 2.223.0 form `[EVIDENCE-REF: <tracker-ref>: <artifact-type>: <kebab-case-name>]` is also accepted as a legacy non-claiming alias; parse it from the right so the final two fields are type/name and a tracker URL may contain `:`. Exclude both forms from the manifest, S14's minimum-marker count, local marker type/name validation, and duplicate-name checks. Independently validate every `EVIDENCE-REF`: the native work-item reference must be non-empty and unambiguous, the artifact type must use the fixed taxonomy, and the name must be non-empty kebab-case. A malformed reference FAILs S14 as an invalid pointer but never becomes a local evidence obligation. A valid canonical or legacy reference may point to a sibling's artifact, but it never satisfies S14 for this item. Therefore a runtime-changing leaf whose journey contains only `EVIDENCE-REF` entries FAILs S14 for zero local claiming markers, not because a valid legacy reference is malformed. Quoting or code-formatting another item's `[EVIDENCE: ...]` marker does not make it a reference; writers must convert it to the canonical pipe form. Linear returns stored Markdown with brackets escaped (`\[EVIDENCE: cli-output: name\]`, `\[EVIDENCE-REF: ...\]`): decode one Markdown escape layer outside code fences, indented code and inline code spans before matching, as `localMarkers` in `completion-proof-shape.mjs` does, so an escaped and an unescaped marker are the same declaration and a malformed one still FAILs. A marker inside an inline code span on a single line (any backtick-run length) is an example, like one in a fence: it never counts toward S14 and is never refused as malformed. Indented code means four or more columns past the content column of the list item that holds the line (or past the margin outside a list), after a blank line or heading: a marker on a list item's continuation line, at any indentation that still continues the item's paragraph, is claiming.
|
|
266
266
|
|
|
267
267
|
This gate depends on S11. It is `N/A` for containers — a **Project** (the Epic equivalent), or any item with open child work (coordination containers, not work units) — and for leaf units with `runtime_behavior_change = false` (doc-only / config-only / type-only / test-only). If S11 fails because the Validation Journey is absent, S14 also FAILs (there is no manifest to bind) with remediation pointing back to `lisa-linear-add-journey`. It is likewise `N/A` with a repair note when `runtime_behavior_change` is **underivable** under S8 — reading an absent declaration as `false` is exactly the silent assumption that made this gate unauditable on a live Issue.
|
|
268
268
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: lisa-session-manager
|
|
3
3
|
description: "Runs the local session manager…"
|
|
4
4
|
---
|
|
5
|
-
Runs the local session manager for a project: a long-lived Claude Code session in tmux that dispatches Ready work items to fresh background worker sessions (`/lisa:implement <REF> managedBy=<manager>`), relays worker questions and operator answers over the project's own Telegram bot when one is configured (Telegram is optional; without it questions stay pending in the ledger), reconciles stalled and
|
|
5
|
+
Runs the local session manager for a project: a long-lived Claude Code session in tmux that dispatches Ready work items to fresh background worker sessions (`/lisa:implement <REF> managedBy=<manager>`), relays worker questions and operator answers over the project's own Telegram bot when one is configured (Telegram is optional; without it questions stay pending in the ledger), reconciles stalled, blocked and orphaned items, re-judges human holds, and records one automation run outcome per cycle. Tracker-neutral (GitHub, Jira, Linear); lifecycle states always come from config. Requires Claude Code (background sessions, channels, cross-session messaging). Set it up with lisa-setup-session-manager.
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
# Session manager
|
|
@@ -458,7 +458,7 @@ shows them.
|
|
|
458
458
|
not valid JSON): report its message
|
|
459
459
|
to the operator and leave the item; it never means the reply was a credential.
|
|
460
460
|
|
|
461
|
-
**In Progress (ledger-driven).** Run `classify`. Items not in the ledger are
|
|
461
|
+
**In Progress (ledger-driven).** Run `classify`. Items not in the ledger are handled by "Orphans and holds" below, never here.
|
|
462
462
|
|
|
463
463
|
| Classification | Action |
|
|
464
464
|
|---|---|
|
|
@@ -475,6 +475,69 @@ covers a plain Bash call (lisa#4522). So `blocked-on-prompt` detection is the gu
|
|
|
475
475
|
`resume` passes the same permission flags as `spawn`, so a relayed answer or nudge never drops
|
|
476
476
|
the bypass.
|
|
477
477
|
|
|
478
|
+
**Orphans and holds** (CodySwannGT/lisa#4722). Items get left in the `claimed` role (or the
|
|
479
|
+
`review` role) by an earlier manager session, a worker that died or was stopped, or a completion
|
|
480
|
+
step that never ran, and nothing else revisits them. Holds an agent may decide sit in the queue
|
|
481
|
+
just as long. Sweep both every cycle, after `classify` and before Dispatch:
|
|
482
|
+
|
|
483
|
+
1. **List** the items in the `claimed` role and, only when `resolve-lifecycle-role.mjs` resolves
|
|
484
|
+
the optional `review` role, the `review` role; plus the open items carrying the human-needed
|
|
485
|
+
label or a `[lisa-human-gate]` body marker, in any role. Page every list to completion (GitHub:
|
|
486
|
+
`gh`, with `--limit 10000`; Jira / Linear: `lisa-atlassian-access` or `lisa-linear-access`).
|
|
487
|
+
Write `{"complete":true,"items":[{ref,role,labels,body,comments,assignees,updatedAt}],"holds":[{ref,role,labels,body,comments,assignees,updatedAt}]}`
|
|
488
|
+
to `.lisa/session-manager/orphan-input.json`: refs canonical as dispatch uses them, comments
|
|
489
|
+
as `{id,author,body,createdAt}` with the author's stable id and the comment's own posting
|
|
490
|
+
time (a refusal comment with no `createdAt` never ages out of its 24-hour park), assignees as `{login,id}` objects on GitHub (the REST
|
|
491
|
+
`.assignees[].id`) and as the account or user id on Jira and Linear, and each hold's `role` as
|
|
492
|
+
the lifecycle role it is in (`ready`, `claimed`, `review`, `blocked`, `done`), so a lift never
|
|
493
|
+
moves an item that is in a lane back to the `ready` role. On Jira and Linear a hold with no
|
|
494
|
+
known role is lifted but never moved. Set `complete` to `true`
|
|
495
|
+
only when every list reached its last page; the CLI refuses anything else. Run
|
|
496
|
+
`node "$SM/session-manager.mjs" orphan-plan --input .lisa/session-manager/orphan-input.json --project-root "$ROOT"`.
|
|
497
|
+
For each ref in `lookup`, find its pull request in the item's repo dir
|
|
498
|
+
(`gh pr list --state all --search <ref>`); when several match, prefer the merged one, then an
|
|
499
|
+
open one, then a closed one. Set that item's `pr` to `null` or
|
|
500
|
+
`{"url":…,"state":"open"|"merged"|"closed"}`, and run it again. The live refs, "me", the
|
|
501
|
+
operators and the trusted authors come from the ledger and config, never from the input. It
|
|
502
|
+
skips refs the ledger shows running or asking (their holds too, so an item waiting on a
|
|
503
|
+
person's answer is never on the operator's list twice), items assigned to anyone but "me" or an
|
|
504
|
+
operator, and items updated within `--stale-hours` (default 6) or with no `updatedAt`, which
|
|
505
|
+
protects a person running `/lisa:implement` by hand. A live or foreign hold is skipped the
|
|
506
|
+
same way; a fresh or undated one is not lifted this cycle, but its human reasons still reach
|
|
507
|
+
the operator's list, so a new comment never makes the list change.
|
|
508
|
+
2. **Act** per bucket. **Before every write** in this sweep (a finish, a return, a re-dispatch
|
|
509
|
+
claim, a parked comment, a hold lift), re-read the item with `lisa-tracker-read`. Skip it for
|
|
510
|
+
this cycle, with one transcript line and no write, when its role is no longer the one the plan
|
|
511
|
+
saw, it gained an assignee who is neither "me" nor an operator, or its `updatedAt` is newer than
|
|
512
|
+
the snapshot the plan used, apart from this sweep's own earlier write on that item. The plan is
|
|
513
|
+
a snapshot; someone may have moved the item since. Every write goes through `lisa-tracker-write`
|
|
514
|
+
and is read back with `lisa-tracker-read`; every comment is the planner's, which starts with
|
|
515
|
+
`[lisa-session-manager]`.
|
|
516
|
+
- `doneReady`: the pull request merged. In the item's repo dir run
|
|
517
|
+
`node scripts/lisa-work-item.mjs finish --ref <ref> --pr-url <prUrl>`. If it refuses, post
|
|
518
|
+
one comment that starts `[lisa-session-manager] Cannot complete:` and says, in plain words,
|
|
519
|
+
why the item cannot complete yet. Later cycles see that comment and park the item, then retry
|
|
520
|
+
finishing once it is more than 24 hours old.
|
|
521
|
+
- `return`: move it to the `ready` role with the entry's `comment`.
|
|
522
|
+
- `redispatch`: an open pull request and no worker. Claim it (`reused`) and `spawn` it exactly
|
|
523
|
+
as Dispatch steps 2.3 and 2.4, ahead of new items, while `capacity` says `can_spawn`. A
|
|
524
|
+
spawn that reaches `stall.maxAttempts` follows the `exhausted` row above.
|
|
525
|
+
- `parked`: post the entry's `comment` only when `reasonOnItem` is false. An item in the
|
|
526
|
+
`review` role with an open pull request is parked, never re-dispatched: it is waiting on
|
|
527
|
+
review or merge.
|
|
528
|
+
- `holds.lift`: post each of its `comments` (each ends with its `Decision:` line; `decision` is null for a lift an earlier cycle
|
|
529
|
+
already posted, which only re-lanes the item); a partial
|
|
530
|
+
lift is also in `holds.keep` with the reasons still left for a person. Then remove
|
|
531
|
+
the human-needed label and move it to the `ready` role as its `actions` say.
|
|
532
|
+
- `holds.keep`: when `holds.digest.changed` is true, send `holds.digest.text` to the operator
|
|
533
|
+
once (Telegram when configured, else the cycle summary; nothing when the text is empty), then
|
|
534
|
+
record it with `ledger control --hold-digest <fingerprint>` (`none` when `fingerprint` is
|
|
535
|
+
null). An unchanged list is never re-sent.
|
|
536
|
+
- `deferred`: the next cycle takes them.
|
|
537
|
+
|
|
538
|
+
A failure anywhere in this sweep is one transcript line: it never holds dispatch and never makes
|
|
539
|
+
the cycle `recovery-required`.
|
|
540
|
+
|
|
478
541
|
**Blocked.** List the items in the `blocked` role (paged to completion, same access paths as the
|
|
479
542
|
queue below). For each:
|
|
480
543
|
|
|
@@ -652,7 +715,7 @@ session `start` creates), every cycle ends in **exactly one** of the six outcome
|
|
|
652
715
|
| This cycle | Run outcome |
|
|
653
716
|
|---|---|
|
|
654
717
|
| No dispatch, no state change, no question relayed or newly pending. The summary still states the denominator: "swept N ready, 0 dispatchable; R running/C cap". | `nothing-needed` |
|
|
655
|
-
| At least one of: a worker spawned and seen live in `status`; a Blocked→Ready release written and read back; an answer delivered and its marker removed (`SendMessage` acknowledged, or `resume` returned a session id), or recorded on the item and read back before its marker was removed; a stalled or `blocked-on-prompt` item retried. | `change-proved` |
|
|
718
|
+
| At least one of: a worker spawned and seen live in `status`; a Blocked→Ready release written and read back; an orphan finished, returned or re-dispatched, or a hold lifted, written and read back; an answer delivered and its marker removed (`SendMessage` acknowledged, or `resume` returned a session id), or recorded on the item and read back before its marker was removed; a stalled or `blocked-on-prompt` item retried. | `change-proved` |
|
|
656
719
|
| An item was marked human-needed ("Mark and move on": marker and question comment written and read back), in any of the four cases, including an `exhausted` item moved to the `blocked` role, or a marked item whose question comment was re-posted after `item-answer` reported `no-question-comment`; or a worker `FAILED` moved the item to the `blocked` role with its reason comment, both read back. The summary names each ref and where to answer it. | `candidate-proposed` |
|
|
657
720
|
| No item was newly marked, but a pending question was re-sent on Telegram (`requestion`) and awaits the operator, and nothing else changed. | `approval-requested` |
|
|
658
721
|
| The tracker, a configured Telegram or `claude` was unreachable; Telegram is configured but was unavailable or unpaired (a question stayed pending with no Telegram message id); a human-needed mark could not be written or read back, or no marker is configured; an answer for a finished worker, an `exhausted` item or a `decision` no worker has picked up could not be posted on the item or read back (its question stays pending); a worker `FAILED`'s move to the `blocked` role could not be written or read back; a spawn failed after the claim (the item went back to Ready); a worker classified `setup-gap` (the item went back to Ready); the capacity probe failed. | `recovery-required` |
|
|
@@ -670,7 +733,9 @@ other candidates. The planning-miss candidate a mark routes (step 6 of "Mark and
|
|
|
670
733
|
one: it runs in the background, and whatever it does — a learning PR, a drop note, a failure —
|
|
671
734
|
never moves the cycle's outcome. The same holds for the overruled-escalation sweep in Reconcile,
|
|
672
735
|
including its `[lisa-escalation-overruled]` marker comment: it is never a state change for the run
|
|
673
|
-
outcome.
|
|
736
|
+
outcome. In the "Orphans and holds" sweep, a completion, return, re-dispatch or hold lift
|
|
737
|
+
written and read back counts as `change-proved`; a failure in that sweep is one transcript line and
|
|
738
|
+
never `recovery-required`, and a parked comment or the operator's hold list is never a state change. When several rows apply, the most urgent wins: `recovery-required`, then
|
|
674
739
|
`candidate-proposed`, then `approval-requested`, then `change-proved`.
|
|
675
740
|
A missing channel is never a reason for `recovery-required`: with `notify` `none`, a cycle ends
|
|
676
741
|
`nothing-needed`, `change-proved` or `candidate-proposed` on its work alone.
|
package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/references/runbook-template.md
CHANGED
|
@@ -9,6 +9,9 @@ the project: edit the prose to match how you run it. The loop follows the
|
|
|
9
9
|
|
|
10
10
|
Keeps Ready work moving on this machine: each Ready item gets its own fresh coding session, and the
|
|
11
11
|
operator answers that session's questions, from their phone when the project has a Telegram bot.
|
|
12
|
+
Each cycle it also sweeps items left claimed with no live worker (finishing, returning or
|
|
13
|
+
re-dispatching them) and re-judges human holds: it lifts the ones an agent may decide and sends the
|
|
14
|
+
operator one list of the rest, only when that list changes.
|
|
12
15
|
|
|
13
16
|
## Sources of truth
|
|
14
17
|
|
|
@@ -57,6 +57,21 @@ function pausedFlag(value) {
|
|
|
57
57
|
return value === "true";
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Parse `--hold-digest <fingerprint>`: the sha256 `orphan-plan` reported.
|
|
62
|
+
* @param {string} value - Flag value
|
|
63
|
+
* @returns {string} Fingerprint
|
|
64
|
+
*/
|
|
65
|
+
function holdDigestFlag(value) {
|
|
66
|
+
if (!/^[0-9a-f]{64}$/u.test(value)) {
|
|
67
|
+
throw new CliError(
|
|
68
|
+
"--hold-digest must be a sha256 fingerprint or none.",
|
|
69
|
+
2
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return value;
|
|
73
|
+
}
|
|
74
|
+
|
|
60
75
|
/**
|
|
61
76
|
* Parse a flag where `none` clears the value.
|
|
62
77
|
* @param {string | undefined} value - Flag value
|
|
@@ -173,6 +188,7 @@ const LEDGER_ACTIONS = {
|
|
|
173
188
|
intFlag(value, "--max-workers")
|
|
174
189
|
),
|
|
175
190
|
me: clearable(ctx.values.me, value => value),
|
|
191
|
+
holdDigest: clearable(ctx.values["hold-digest"], holdDigestFlag),
|
|
176
192
|
}).filter(([, value]) => value !== undefined)
|
|
177
193
|
)
|
|
178
194
|
),
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `orphan-plan`: the session manager's per-cycle "Orphans and holds" sweep
|
|
3
|
+
* (CodySwannGT/lisa#4722). The plan writes nothing: the manager finishes,
|
|
4
|
+
* returns, re-dispatches or parks each orphan and lifts or keeps each hold
|
|
5
|
+
* through `lisa-tracker-write`, as the skill says.
|
|
6
|
+
*
|
|
7
|
+
* Who the manager is and who may release a hold come from the ledger and
|
|
8
|
+
* config only, never from the input: the input is assembled from items'
|
|
9
|
+
* own (untrusted) bodies and comments, so ids carried beside them would let
|
|
10
|
+
* an item vouch for itself, and a live ref an input could drop would let the
|
|
11
|
+
* sweep return an item a worker is still on.
|
|
12
|
+
*
|
|
13
|
+
* Item bodies and comments arrive on stdin or in a file, never in argv.
|
|
14
|
+
* @module session-manager/cli-orphans
|
|
15
|
+
*/
|
|
16
|
+
import {
|
|
17
|
+
readPath,
|
|
18
|
+
resolveRole,
|
|
19
|
+
} from "../../../scripts/resolve-lifecycle-role.mjs";
|
|
20
|
+
import {
|
|
21
|
+
CliError,
|
|
22
|
+
asSetupError,
|
|
23
|
+
humanNeededLabel,
|
|
24
|
+
intFlag,
|
|
25
|
+
loadProject,
|
|
26
|
+
stdinText,
|
|
27
|
+
validOrAbsent,
|
|
28
|
+
} from "./cli-runtime.mjs";
|
|
29
|
+
import { parseJson, readJsonFile } from "./json-input.mjs";
|
|
30
|
+
import { readLedger } from "./ledger.mjs";
|
|
31
|
+
import { planOrphanSweep } from "./orphan-sweep.mjs";
|
|
32
|
+
|
|
33
|
+
/** The roles whose labels count as "in a lane" for a hold release. */
|
|
34
|
+
const LANE_ROLES = ["ready", "claimed", "blocked", "review", "human_needed"];
|
|
35
|
+
|
|
36
|
+
/** Ledger statuses that mean a worker is on the item, or a person is asked. */
|
|
37
|
+
const LIVE_STATUSES = new Set(["running", "question"]);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The tracker this project uses.
|
|
41
|
+
* @param {ReturnType<typeof loadProject>} project - Loaded project
|
|
42
|
+
* @returns {string | undefined} `github`, `jira` or `linear`
|
|
43
|
+
*/
|
|
44
|
+
const trackerOf = project => project.local?.tracker ?? project.global?.tracker;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* One lifecycle role's configured value, empty when unset.
|
|
48
|
+
* @param {ReturnType<typeof loadProject>} project - Loaded project
|
|
49
|
+
* @param {string} name - Role name
|
|
50
|
+
* @returns {string} Label or state
|
|
51
|
+
*/
|
|
52
|
+
function roleValue(project, name) {
|
|
53
|
+
return resolveRole({
|
|
54
|
+
role: name,
|
|
55
|
+
vendor: trackerOf(project),
|
|
56
|
+
local: project.local,
|
|
57
|
+
global: project.global,
|
|
58
|
+
}).value;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Every configured `done` value: the env-keyed map's values, or one string.
|
|
63
|
+
* @param {ReturnType<typeof loadProject>} project - Loaded project
|
|
64
|
+
* @returns {string[]} Done labels or states
|
|
65
|
+
*/
|
|
66
|
+
function doneValues(project) {
|
|
67
|
+
const roots = { jira: "jira.workflow", linear: "linear.workflow" };
|
|
68
|
+
const root = roots[trackerOf(project)] ?? "github.labels.build";
|
|
69
|
+
for (const config of [project.local, project.global]) {
|
|
70
|
+
const done = readPath(config, `${root}.done`);
|
|
71
|
+
if (typeof done === "string" && done !== "") return [done];
|
|
72
|
+
if (done && typeof done === "object") {
|
|
73
|
+
return Object.values(done).filter(value => typeof value === "string");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The hold policy from config: labels, lanes and human-only classes.
|
|
81
|
+
* @param {ReturnType<typeof loadProject>} project - Loaded project
|
|
82
|
+
* @returns {object} Policy fields for planOrphanSweep
|
|
83
|
+
*/
|
|
84
|
+
function holdPolicy(project) {
|
|
85
|
+
const humanOnly =
|
|
86
|
+
readPath(project.local, "humanGate.humanOnly") ??
|
|
87
|
+
readPath(project.global, "humanGate.humanOnly");
|
|
88
|
+
return {
|
|
89
|
+
humanNeededLabel: humanNeededLabel(project, undefined),
|
|
90
|
+
humanOnly,
|
|
91
|
+
readyLabel: roleValue(project, "ready"),
|
|
92
|
+
// A hold's role is its lane: on Jira and Linear the lane is a state, so
|
|
93
|
+
// the lift's lane check reads it as one more label.
|
|
94
|
+
roleLabels: {
|
|
95
|
+
...Object.fromEntries(
|
|
96
|
+
LANE_ROLES.map(name => [name, roleValue(project, name)]).filter(
|
|
97
|
+
([, value]) => value !== ""
|
|
98
|
+
)
|
|
99
|
+
),
|
|
100
|
+
done: doneValues(project),
|
|
101
|
+
},
|
|
102
|
+
// Where roles are states, a hold with no known lane is lifted but never
|
|
103
|
+
// re-laned (fail closed).
|
|
104
|
+
rolesAreStates: trackerOf(project) !== "github",
|
|
105
|
+
lifecycleLabels: [
|
|
106
|
+
...LANE_ROLES.map(name => roleValue(project, name)),
|
|
107
|
+
...doneValues(project),
|
|
108
|
+
].filter(value => value !== ""),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Read the envelope and refuse one not paged to completion.
|
|
114
|
+
* @param {object} ctx - CLI context
|
|
115
|
+
* @returns {{items: unknown, holds: unknown}} The listed items and holds
|
|
116
|
+
*/
|
|
117
|
+
function readEnvelope(ctx) {
|
|
118
|
+
const envelope = ctx.values.input
|
|
119
|
+
? readJsonFile(ctx.values.input)
|
|
120
|
+
: parseJson(stdinText(ctx, "orphan JSON"), "stdin");
|
|
121
|
+
if (envelope?.complete !== true) {
|
|
122
|
+
throw new CliError(
|
|
123
|
+
"The orphan listing was not paged to completion (complete !== true); " +
|
|
124
|
+
"refusing to plan from a partial list.",
|
|
125
|
+
2
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
return { items: envelope.items, holds: envelope.holds };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* `orphan-plan [--input <file>] [--max <n>] [--stale-hours <n>]` (stdin
|
|
133
|
+
* without --input: `{"complete":true,"items":[...],"holds":[...]}`).
|
|
134
|
+
* @param {object} ctx - CLI context
|
|
135
|
+
* @returns {Promise<{ json: object }>} The plan from planOrphanSweep
|
|
136
|
+
*/
|
|
137
|
+
export async function orphanPlan(ctx) {
|
|
138
|
+
const input = readEnvelope(ctx);
|
|
139
|
+
const max = intFlag(ctx.values.max, "--max");
|
|
140
|
+
const staleHours = intFlag(ctx.values["stale-hours"], "--stale-hours");
|
|
141
|
+
const project = loadProject(ctx.root);
|
|
142
|
+
const config = validOrAbsent(project);
|
|
143
|
+
const ledger = await readLedger(ctx.root);
|
|
144
|
+
const liveRefs = Object.entries(ledger.items)
|
|
145
|
+
.filter(([, item]) => LIVE_STATUSES.has(item.status))
|
|
146
|
+
.map(([ref]) => ref);
|
|
147
|
+
return {
|
|
148
|
+
json: asSetupError(() =>
|
|
149
|
+
planOrphanSweep(input, {
|
|
150
|
+
liveRefs,
|
|
151
|
+
me: ledger.control.me ?? null,
|
|
152
|
+
operatorIds: config?.operatorIds ?? [],
|
|
153
|
+
trustedAuthorIds: config?.trustedAuthorIds ?? [],
|
|
154
|
+
now: new Date(),
|
|
155
|
+
...(max === undefined ? {} : { max }),
|
|
156
|
+
...(staleHours === undefined ? {} : { staleHours }),
|
|
157
|
+
previousDigest: ledger.control.holdDigest ?? null,
|
|
158
|
+
...holdPolicy(project),
|
|
159
|
+
})
|
|
160
|
+
),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
@@ -257,6 +257,10 @@ Per cycle
|
|
|
257
257
|
control.setupGapsClearedAt, so classify never re-records the gap from
|
|
258
258
|
a worker that started before the clear. stdout {repo,cleared}.
|
|
259
259
|
ledger control [--paused true|false] [--max-workers <n>|none] [--me <id>|none]
|
|
260
|
+
[--hold-digest <fingerprint>|none]
|
|
261
|
+
--hold-digest records the orphan-plan holds.digest.fingerprint the
|
|
262
|
+
operator was last sent (a sha256, else exit 2), so the same hold list
|
|
263
|
+
is sent once; orphan-plan reports holds.digest.changed against it.
|
|
260
264
|
route [--reply-to <telegram message id>] [--owner <name>] STDIN: message
|
|
261
265
|
stdout {kind:"answer",ref,body[,message]} | {kind:"command",name,...}
|
|
262
266
|
| {kind:"invalid-command",reason} | {kind:"ambiguous",candidates}.
|
|
@@ -307,6 +311,42 @@ Per cycle
|
|
|
307
311
|
wrongly-escalated, hold and release evidence, a draft
|
|
308
312
|
Planning (filing) rule); comment is the marker to post afterwards.
|
|
309
313
|
--max caps captures per cycle (default 3); the rest are deferred.
|
|
314
|
+
orphan-plan [--input <file>] [--max <n>] [--stale-hours <n>]
|
|
315
|
+
STDIN (without --input): JSON
|
|
316
|
+
{complete:true,items:[{ref,role,labels,body,comments,assignees,
|
|
317
|
+
updatedAt,pr}],holds:[{ref,role,labels,body,comments,assignees,
|
|
318
|
+
updatedAt}]}. Plans the
|
|
319
|
+
"Orphans and holds" sweep; writes nothing. items are the claimed (and
|
|
320
|
+
review) role; pr is omitted when not looked up, null when none was
|
|
321
|
+
found, else {url,state:open|merged|closed}. holds carry the
|
|
322
|
+
human-needed label or a [lisa-human-gate] marker; a hold's role
|
|
323
|
+
(ready, claimed, review, blocked, done) counts as its lane, so a lift
|
|
324
|
+
never moves an item that is in a lane back to ready, and on jira and
|
|
325
|
+
linear a hold with no known role is lifted but never re-laned. Live refs (ledger
|
|
326
|
+
status running or question), me (ledger control.me), operatorIds,
|
|
327
|
+
trustedAuthorIds and the hold labels come from the ledger and config;
|
|
328
|
+
the same keys in the input are ignored. Skips live, foreign (assigned
|
|
329
|
+
to neither me nor an operator), fresh (updated within --stale-hours,
|
|
330
|
+
default 6) and undated items. Live and foreign holds are skipped; a
|
|
331
|
+
fresh or undated hold is not lifted (skipped fresh or undated) but its
|
|
332
|
+
kept reasons still reach holds.keep and the digest. A lift left with
|
|
333
|
+
nothing to write is skipped as nothing-to-write; decision is null for
|
|
334
|
+
a lift with no newly lifted reason. A review-role
|
|
335
|
+
item with an open pull request, and a merged item whose comments hold
|
|
336
|
+
a line starting "[lisa-session-manager] Cannot complete:" posted
|
|
337
|
+
within 24 hours (or undated: send each comment's createdAt), are parked with reasonOnItem true; only the claimed role is re-dispatched. A
|
|
338
|
+
partial lift also appears in holds.keep with the reasons still left
|
|
339
|
+
for a person. stdout {doneReady:[{ref,prUrl,reason}],
|
|
340
|
+
return:[{ref,reason,comment}],redispatch:[{ref,prUrl,reason}],
|
|
341
|
+
parked:[{ref,reason,reasonOnItem[,comment]}],lookup:[{ref,reason}],
|
|
342
|
+
skipped:[{ref,reason}],holds:{lift:[{ref,reason,comments,actions,
|
|
343
|
+
decision}],keep:[{ref,reason}],digest:{fingerprint,text,changed}},
|
|
344
|
+
deferred:[{ref,bucket}]}. --max (default 10) caps the writes, spent in
|
|
345
|
+
order doneReady, return, redispatch, parked, holds.lift (a parked item
|
|
346
|
+
that already says why costs none; every kept hold is listed), and caps
|
|
347
|
+
lookup separately; the rest are deferred. Every comment starts with
|
|
348
|
+
[lisa-session-manager]. Exit 2 when complete is not true, the input
|
|
349
|
+
is not JSON, or a flag is bad.
|
|
310
350
|
answer <ref> STDIN: the answer
|
|
311
351
|
Queues an operator's answer (source "cli") for the next cycle to
|
|
312
352
|
deliver to the worker, or record on the item when the worker has
|
|
@@ -110,6 +110,7 @@ const FINISH_STATUSES = new Set(["DONE", "FAILED"]);
|
|
|
110
110
|
* @property {number} version - Shape version
|
|
111
111
|
* @property {Record<string, LedgerItem>} items - Items keyed by ref
|
|
112
112
|
* @property {{paused: boolean, maxWorkers: number|null, me: string|null,
|
|
113
|
+
* holdDigest?: string|null,
|
|
113
114
|
* setupGaps: Record<string, import("./ledger-setup-gaps.mjs").SetupGap>,
|
|
114
115
|
* setupGapsClearedAt?: Record<string, string>}}
|
|
115
116
|
* control - Operator controls; `setupGaps` holds the repos `spawn` refuses
|
|
@@ -475,7 +476,8 @@ export function clearValidationFailure(projectRoot, { ref }, seams) {
|
|
|
475
476
|
|
|
476
477
|
/**
|
|
477
478
|
* Check a control patch before it is written.
|
|
478
|
-
* @param {{paused?: unknown, maxWorkers?: unknown, me?: unknown
|
|
479
|
+
* @param {{paused?: unknown, maxWorkers?: unknown, me?: unknown,
|
|
480
|
+
* holdDigest?: unknown}} patch - Patch
|
|
479
481
|
*/
|
|
480
482
|
function assertControlPatch(patch) {
|
|
481
483
|
if ("paused" in patch && typeof patch.paused !== "boolean") {
|
|
@@ -497,15 +499,25 @@ function assertControlPatch(patch) {
|
|
|
497
499
|
if ("me" in patch && patch.me !== null && typeof patch.me !== "string") {
|
|
498
500
|
throw new Error("control.me must be a string or null");
|
|
499
501
|
}
|
|
502
|
+
if (
|
|
503
|
+
"holdDigest" in patch &&
|
|
504
|
+
patch.holdDigest !== null &&
|
|
505
|
+
typeof patch.holdDigest !== "string"
|
|
506
|
+
) {
|
|
507
|
+
throw new Error("control.holdDigest must be a string or null");
|
|
508
|
+
}
|
|
500
509
|
}
|
|
501
510
|
|
|
502
511
|
/**
|
|
503
512
|
* Merge operator controls into the ledger: `paused`, the `maxWorkers`
|
|
504
|
-
* override (null clears it)
|
|
513
|
+
* override (null clears it), `me`, the resolved tracker identity, and
|
|
514
|
+
* `holdDigest`, the fingerprint of the hold list last sent to the operator
|
|
515
|
+
* (#4722; `orphan-plan` reports `changed` against it). The
|
|
505
516
|
* block also carries `setupGaps` (and `setupGapsClearedAt` once a gap was
|
|
506
517
|
* cleared); this never changes them — only ledger-setup-gaps.mjs writes them.
|
|
507
518
|
* @param {string} projectRoot - Absolute project root
|
|
508
|
-
* @param {{paused?: boolean, maxWorkers?: number|null, me?: string|null
|
|
519
|
+
* @param {{paused?: boolean, maxWorkers?: number|null, me?: string|null,
|
|
520
|
+
* holdDigest?: string|null}} patch - Fields to set
|
|
509
521
|
* @param {LedgerSeams} [seams] - Injected seams
|
|
510
522
|
* @returns {Promise<Ledger["control"]>} New control block, setup gaps included
|
|
511
523
|
*/
|