@codyswann/lisa 4.87.13 → 4.88.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/check-third-party-review-evidence.mjs +40 -12
- 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/nightly-e2e-guard-behavior-certificate.js.map +1 -1
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +33 -14
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/dist/sync/lifecycle-defaults.d.ts +1 -0
- package/dist/sync/lifecycle-defaults.d.ts.map +1 -1
- package/dist/sync/lifecycle-defaults.js +3 -0
- package/dist/sync/lifecycle-defaults.js.map +1 -1
- package/dist/sync/registry.d.ts.map +1 -1
- package/dist/sync/registry.js +6 -1
- package/dist/sync/registry.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/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-persist-learning/SKILL.md +3 -2
- package/plugins/lisa/.codex-plugin/skills/lisa-pull-request-review/SKILL.md +18 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +50 -5
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-human.mjs +51 -14
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-overruled.mjs +70 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +23 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/escalation-overruled.mjs +327 -0
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/human-needed.mjs +39 -11
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/queue-github.mjs +14 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/session-manager.mjs +11 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-task-decomposition/SKILL.md +2 -1
- package/plugins/lisa/agents/learning-judge.md +20 -5
- package/plugins/lisa/rules/reference/config-resolution.md +2 -1
- package/plugins/lisa/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa/skills/lisa-persist-learning/SKILL.md +3 -2
- package/plugins/lisa/skills/lisa-pull-request-review/SKILL.md +18 -3
- package/plugins/lisa/skills/lisa-session-manager/SKILL.md +50 -5
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-human.mjs +51 -14
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-overruled.mjs +70 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +23 -3
- package/plugins/lisa/skills/lisa-session-manager/scripts/escalation-overruled.mjs +327 -0
- package/plugins/lisa/skills/lisa-session-manager/scripts/human-needed.mjs +39 -11
- package/plugins/lisa/skills/lisa-session-manager/scripts/queue-github.mjs +14 -1
- package/plugins/lisa/skills/lisa-session-manager/scripts/session-manager.mjs +11 -1
- package/plugins/lisa/skills/lisa-task-decomposition/SKILL.md +2 -1
- package/plugins/lisa-agy/agents/learning-judge.md +20 -5
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-agy/skills/lisa-persist-learning/SKILL.md +3 -2
- package/plugins/lisa-agy/skills/lisa-pull-request-review/SKILL.md +18 -3
- package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +50 -5
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-human.mjs +51 -14
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-overruled.mjs +70 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +23 -3
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/escalation-overruled.mjs +327 -0
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/human-needed.mjs +39 -11
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/queue-github.mjs +14 -1
- package/plugins/lisa-agy/skills/lisa-session-manager/scripts/session-manager.mjs +11 -1
- package/plugins/lisa-agy/skills/lisa-task-decomposition/SKILL.md +2 -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/agents/learning-judge.agent.md +20 -5
- package/plugins/lisa-copilot/rules/reference/config-resolution.md +2 -1
- package/plugins/lisa-copilot/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-copilot/skills/lisa-persist-learning/SKILL.md +3 -2
- package/plugins/lisa-copilot/skills/lisa-pull-request-review/SKILL.md +18 -3
- package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +50 -5
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-human.mjs +51 -14
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-overruled.mjs +70 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +23 -3
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/escalation-overruled.mjs +327 -0
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/human-needed.mjs +39 -11
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/queue-github.mjs +14 -1
- package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/session-manager.mjs +11 -1
- package/plugins/lisa-copilot/skills/lisa-task-decomposition/SKILL.md +2 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/agents/learning-judge.md +20 -5
- package/plugins/lisa-cursor/rules/config-resolution-reference.mdc +2 -1
- package/plugins/lisa-cursor/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-cursor/skills/lisa-persist-learning/SKILL.md +3 -2
- package/plugins/lisa-cursor/skills/lisa-pull-request-review/SKILL.md +18 -3
- package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +50 -5
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-human.mjs +51 -14
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-overruled.mjs +70 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +23 -3
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/escalation-overruled.mjs +327 -0
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/human-needed.mjs +39 -11
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/queue-github.mjs +14 -1
- package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/session-manager.mjs +11 -1
- package/plugins/lisa-cursor/skills/lisa-task-decomposition/SKILL.md +2 -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/agents/learning-judge.md +20 -5
- package/plugins/lisa-devin/rules/reference/config-resolution.md +2 -1
- package/plugins/lisa-devin/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/lisa-devin/skills/lisa-persist-learning/SKILL.md +3 -2
- package/plugins/lisa-devin/skills/lisa-pull-request-review/SKILL.md +18 -3
- package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +50 -5
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-human.mjs +51 -14
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-overruled.mjs +70 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +23 -3
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/escalation-overruled.mjs +327 -0
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/human-needed.mjs +39 -11
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/queue-github.mjs +14 -1
- package/plugins/lisa-devin/skills/lisa-session-manager/scripts/session-manager.mjs +11 -1
- package/plugins/lisa-devin/skills/lisa-task-decomposition/SKILL.md +2 -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/agents/learning-judge.md +20 -5
- package/plugins/src/base/rules/reference/config-resolution.md +2 -1
- package/plugins/src/base/skills/lisa-drive-pr-to-merge/SKILL.md +16 -3
- package/plugins/src/base/skills/lisa-persist-learning/SKILL.md +3 -2
- package/plugins/src/base/skills/lisa-pull-request-review/SKILL.md +18 -3
- package/plugins/src/base/skills/lisa-session-manager/SKILL.md +50 -5
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-human.mjs +51 -14
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-overruled.mjs +70 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +23 -3
- package/plugins/src/base/skills/lisa-session-manager/scripts/escalation-overruled.mjs +327 -0
- package/plugins/src/base/skills/lisa-session-manager/scripts/human-needed.mjs +39 -11
- package/plugins/src/base/skills/lisa-session-manager/scripts/queue-github.mjs +14 -1
- package/plugins/src/base/skills/lisa-session-manager/scripts/session-manager.mjs +11 -1
- package/plugins/src/base/skills/lisa-task-decomposition/SKILL.md +2 -1
- package/typescript/create-only/.github/workflows/third-party-review-evidence.yml +2 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture an operator's "wrongly escalated" verdict as a learning
|
|
3
|
+
* (CodySwannGT/lisa#4657). Pure: no I/O, no clock, no config reads.
|
|
4
|
+
*
|
|
5
|
+
* An agent can put an item behind a human gate (`[lisa-human-gate]` plus the
|
|
6
|
+
* human-needed label) for a decision it could have made itself. The
|
|
7
|
+
* planning-miss loop (#4569) trusts that claim: a self-flagged gate counts as
|
|
8
|
+
* the plan working. When a human disagrees, releases the hold and labels the
|
|
9
|
+
* item with the configured wrongly-escalated label, that label is an explicit
|
|
10
|
+
* ruling with the evidence attached: the strongest learning signal the
|
|
11
|
+
* factory gets. This module turns each such item into exactly one
|
|
12
|
+
* `lisa-persist-learning` candidate, and names the visible marker comment
|
|
13
|
+
* that records the capture, so later cycles never capture it twice.
|
|
14
|
+
*
|
|
15
|
+
* The label is a classification, not a release: it moves no lane, so no
|
|
16
|
+
* release authorization applies, and who applied it does not matter. An
|
|
17
|
+
* automation identity applying it at an operator's direction counts.
|
|
18
|
+
* @module session-manager/escalation-overruled
|
|
19
|
+
*/
|
|
20
|
+
import { createHash } from "node:crypto";
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
HUMAN_GATE_MARKER,
|
|
24
|
+
HUMAN_GATE_RELEASE_MARKER,
|
|
25
|
+
humanGateHolds,
|
|
26
|
+
normalizeProviderMarkdown,
|
|
27
|
+
} from "../../../scripts/intake-blocker-reprobe.mjs";
|
|
28
|
+
import { QUESTION_MARKER } from "./human-needed.mjs";
|
|
29
|
+
|
|
30
|
+
/** The built-in label name, used when the tracker's config names none. */
|
|
31
|
+
export const DEFAULT_WRONGLY_ESCALATED_LABEL = "wrongly-escalated-to-human";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Where each tracker keeps the label: next to `human_needed`, the way that
|
|
35
|
+
* label is keyed (Jira's marker labels sit outside a workflow map; GitHub's
|
|
36
|
+
* and Linear's sit under `labels.build`).
|
|
37
|
+
*/
|
|
38
|
+
export const WRONGLY_ESCALATED_CONFIG_PATHS = Object.freeze({
|
|
39
|
+
jira: "jira.labels.wrongly_escalated",
|
|
40
|
+
linear: "linear.labels.build.wrongly_escalated",
|
|
41
|
+
github: "github.labels.build.wrongly_escalated",
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The visible capture marker. Visible text, not an HTML comment, because
|
|
46
|
+
* Linear strips HTML comments and a stripped marker would defeat dedupe.
|
|
47
|
+
*/
|
|
48
|
+
export const OVERRULED_MARKER = "[lisa-escalation-overruled]";
|
|
49
|
+
|
|
50
|
+
/** The persist-learning `signal` a capture carries. */
|
|
51
|
+
export const WRONGLY_ESCALATED_SIGNAL = "wrongly-escalated";
|
|
52
|
+
|
|
53
|
+
/** The planning stage an overruled self-flagged gate points at. */
|
|
54
|
+
export const FILING_STAGE = "filing";
|
|
55
|
+
|
|
56
|
+
/** At most this many captures per cycle unless the caller says otherwise. */
|
|
57
|
+
export const DEFAULT_MAX_CAPTURES = 3;
|
|
58
|
+
|
|
59
|
+
/** Evidence excerpts are bounded so one long comment cannot flood a prompt. */
|
|
60
|
+
const EXCERPT_LIMIT = 600;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Compare label names the way trackers behave: case and padding drift.
|
|
64
|
+
* @param {unknown} value - A label name
|
|
65
|
+
* @returns {string} Comparable form, empty when there is none
|
|
66
|
+
*/
|
|
67
|
+
const normalize = value =>
|
|
68
|
+
typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Label names off a tracker payload: strings or `{ name }` objects.
|
|
72
|
+
* @param {unknown} labels - The item's labels
|
|
73
|
+
* @returns {string[]} Their names
|
|
74
|
+
*/
|
|
75
|
+
function labelNames(labels) {
|
|
76
|
+
return (Array.isArray(labels) ? labels : [])
|
|
77
|
+
.map(entry => (typeof entry === "string" ? entry : entry?.name))
|
|
78
|
+
.filter(name => typeof name === "string");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Whether an item carries the label.
|
|
83
|
+
* @param {unknown} labels - The item's labels
|
|
84
|
+
* @param {string} label - The resolved wrongly-escalated label
|
|
85
|
+
* @returns {boolean} True when present (case-insensitive)
|
|
86
|
+
*/
|
|
87
|
+
export function carriesWronglyEscalated(labels, label) {
|
|
88
|
+
const wanted = normalize(label);
|
|
89
|
+
if (wanted === "") return false;
|
|
90
|
+
return labelNames(labels).some(name => normalize(name) === wanted);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The stable dedupe key for one item: an item is captured once, however many
|
|
95
|
+
* times it is labeled, released or re-read.
|
|
96
|
+
* @param {string} ref - Canonical item ref
|
|
97
|
+
* @returns {string} `eo-` plus 12 hex characters
|
|
98
|
+
*/
|
|
99
|
+
export function overruledFingerprint(ref) {
|
|
100
|
+
const digest = createHash("sha256").update(String(ref)).digest("hex");
|
|
101
|
+
return `eo-${digest.slice(0, 12)}`;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Comment bodies off a tracker payload, keeping the id and url when present.
|
|
106
|
+
* @param {unknown} comments - The item's comments
|
|
107
|
+
* @returns {{body: string, id?: string, url?: string}[]} Normalized comments
|
|
108
|
+
*/
|
|
109
|
+
function commentsOf(comments) {
|
|
110
|
+
return (Array.isArray(comments) ? comments : [])
|
|
111
|
+
.map(entry =>
|
|
112
|
+
typeof entry === "string"
|
|
113
|
+
? { body: entry }
|
|
114
|
+
: {
|
|
115
|
+
body: typeof entry?.body === "string" ? entry.body : "",
|
|
116
|
+
...(entry?.id != null ? { id: String(entry.id) } : {}),
|
|
117
|
+
...(typeof entry?.url === "string" ? { url: entry.url } : {}),
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
.filter(comment => comment.body !== "");
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Whether a body has a line starting with `marker` (after leading space and
|
|
125
|
+
* an optional HTML comment opener), so a comment that only discusses the
|
|
126
|
+
* marker mid-sentence does not count. Provider escaping is undone first:
|
|
127
|
+
* Linear stores `[` as `\[`, and a raw comparison would miss every marker
|
|
128
|
+
* there, recapturing the item each cycle.
|
|
129
|
+
* @param {string} body - Comment body
|
|
130
|
+
* @param {string} marker - Marker text
|
|
131
|
+
* @returns {boolean} True when some line declares it
|
|
132
|
+
*/
|
|
133
|
+
function declares(body, marker) {
|
|
134
|
+
return normalizeProviderMarkdown(body)
|
|
135
|
+
.split("\n")
|
|
136
|
+
.some(line => line.replace(/^\s*(?:<!--\s*)?/u, "").startsWith(marker));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Whether the item already carries this capture's marker comment.
|
|
141
|
+
* @param {{body: string}[]} comments - Normalized comments
|
|
142
|
+
* @param {string} fingerprint - The item's capture key
|
|
143
|
+
* @returns {boolean} True when captured before
|
|
144
|
+
*/
|
|
145
|
+
function alreadyCaptured(comments, fingerprint) {
|
|
146
|
+
const stamp = `${OVERRULED_MARKER} key=${fingerprint}`;
|
|
147
|
+
return comments.some(comment => declares(comment.body, stamp));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* A bounded excerpt of evidence text.
|
|
152
|
+
* @param {string} text - Source text
|
|
153
|
+
* @returns {string} At most {@link EXCERPT_LIMIT} characters
|
|
154
|
+
*/
|
|
155
|
+
function excerpt(text) {
|
|
156
|
+
const trimmed = text.trim();
|
|
157
|
+
return trimmed.length > EXCERPT_LIMIT
|
|
158
|
+
? `${trimmed.slice(0, EXCERPT_LIMIT)}…`
|
|
159
|
+
: trimmed;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* One evidence record: where it is, and a bounded excerpt of what it says.
|
|
164
|
+
* @param {{body: string, id?: string, url?: string}} comment - Source comment
|
|
165
|
+
* @param {string} source - `comment`
|
|
166
|
+
* @returns {object} Evidence record
|
|
167
|
+
*/
|
|
168
|
+
function evidenceOf(comment, source) {
|
|
169
|
+
return {
|
|
170
|
+
source,
|
|
171
|
+
...(comment.id ? { id: comment.id } : {}),
|
|
172
|
+
...(comment.url ? { url: comment.url } : {}),
|
|
173
|
+
excerpt: excerpt(comment.body),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* The hold the human overruled: the `[lisa-human-gate]` body marker, a
|
|
179
|
+
* hold comment, or the session manager's question comment; and the human's
|
|
180
|
+
* release. Each is optional: the label alone is the ruling.
|
|
181
|
+
* @param {{body?: unknown, comments: {body: string}[]}} item - The item
|
|
182
|
+
* @returns {{holdReasons: string[], hold: object[], release: object[]}}
|
|
183
|
+
* Evidence, oldest first
|
|
184
|
+
*/
|
|
185
|
+
function collectEvidence({ body, comments }) {
|
|
186
|
+
const text = typeof body === "string" ? body : "";
|
|
187
|
+
const declared = humanGateHolds(text);
|
|
188
|
+
const holdReasons = declared.filter(reason => reason !== "");
|
|
189
|
+
const hold = [
|
|
190
|
+
...(declared.length > 0
|
|
191
|
+
? [{ source: "body", excerpt: excerpt(text) }]
|
|
192
|
+
: []),
|
|
193
|
+
...comments
|
|
194
|
+
.filter(
|
|
195
|
+
comment =>
|
|
196
|
+
declares(comment.body, HUMAN_GATE_MARKER) ||
|
|
197
|
+
declares(comment.body, QUESTION_MARKER)
|
|
198
|
+
)
|
|
199
|
+
.map(comment => evidenceOf(comment, "comment")),
|
|
200
|
+
];
|
|
201
|
+
const release = comments
|
|
202
|
+
.filter(comment => declares(comment.body, HUMAN_GATE_RELEASE_MARKER))
|
|
203
|
+
.map(comment => evidenceOf(comment, "comment"));
|
|
204
|
+
return { holdReasons, hold, release };
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* The draft rule: the filing check that would have kept the gate off. The
|
|
209
|
+
* manager may sharpen it with the hold reason; the judge rewrites it.
|
|
210
|
+
* @param {string[]} holdReasons - The overruled hold reasons
|
|
211
|
+
* @returns {string} A `Planning (filing): …` rule within the contract caps
|
|
212
|
+
*/
|
|
213
|
+
function draftRule(holdReasons) {
|
|
214
|
+
const named = holdReasons.length > 0 ? ` (seen: ${holdReasons[0]})` : "";
|
|
215
|
+
const rule = `Planning (filing): file human_gate only for an act no agent can perform, such as a credential, spend, an external account or a legal sign-off; make an open decision yourself${named}.`;
|
|
216
|
+
return rule.length > 240 ? `${rule.slice(0, 238)}.` : rule;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* The visible marker comment the manager posts after routing the candidate.
|
|
221
|
+
* @param {string} fingerprint - Capture key
|
|
222
|
+
* @param {string} label - The label the human applied
|
|
223
|
+
* @returns {string} Comment body
|
|
224
|
+
*/
|
|
225
|
+
export function overruledMarkerComment(fingerprint, label) {
|
|
226
|
+
return `${OVERRULED_MARKER} key=${fingerprint} This item carries the \`${label}\` label, so its escalation to a human was ruled wrong. The session manager sent that ruling to the learning loop once, as evidence for a filing check; it changes nothing about this item.`;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* One evidence record the candidate carries.
|
|
231
|
+
* @typedef {object} OverruledEvidence
|
|
232
|
+
* @property {string} source - `body` or `comment`
|
|
233
|
+
* @property {string} [id] - Comment id, when the tracker gave one
|
|
234
|
+
* @property {string} [url] - Comment url, when the tracker gave one
|
|
235
|
+
* @property {string} excerpt - Bounded excerpt of the text
|
|
236
|
+
*/
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* One capture: the persist-learning candidate and the marker comment.
|
|
240
|
+
* @typedef {object} OverruledCapture
|
|
241
|
+
* @property {string} ref - The item
|
|
242
|
+
* @property {string} fingerprint - Its capture key
|
|
243
|
+
* @property {string} comment - The marker comment to post afterwards
|
|
244
|
+
* @property {{signal: string, triggering_issue: string,
|
|
245
|
+
* provenance: string[], scope_hint: string, stage_hint: string,
|
|
246
|
+
* label: string, rule: string, why: string, evidence_links: string[],
|
|
247
|
+
* hold_reasons: string[], evidence: {hold: OverruledEvidence[],
|
|
248
|
+
* release: OverruledEvidence[]}}} candidate - The candidate
|
|
249
|
+
*/
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* The capture for one labeled, uncaptured item.
|
|
253
|
+
* @param {{ref: string, body?: unknown, comments: object[]}} item - The item
|
|
254
|
+
* @param {string} label - Resolved label
|
|
255
|
+
* @returns {OverruledCapture} The capture
|
|
256
|
+
*/
|
|
257
|
+
function captureFor(item, label) {
|
|
258
|
+
const fingerprint = overruledFingerprint(item.ref);
|
|
259
|
+
const evidence = collectEvidence(item);
|
|
260
|
+
const links = [...evidence.hold, ...evidence.release]
|
|
261
|
+
.map(entry => entry.url)
|
|
262
|
+
.filter(Boolean);
|
|
263
|
+
return {
|
|
264
|
+
ref: item.ref,
|
|
265
|
+
fingerprint,
|
|
266
|
+
comment: overruledMarkerComment(fingerprint, label),
|
|
267
|
+
candidate: {
|
|
268
|
+
signal: WRONGLY_ESCALATED_SIGNAL,
|
|
269
|
+
triggering_issue: item.ref,
|
|
270
|
+
provenance: [item.ref],
|
|
271
|
+
scope_hint: "project",
|
|
272
|
+
stage_hint: FILING_STAGE,
|
|
273
|
+
label,
|
|
274
|
+
rule: draftRule(evidence.holdReasons),
|
|
275
|
+
why: `A human ruled this escalation wrong by applying the \`${label}\` label: the hold asked a person for something an agent could have decided, so the filing check let it through.`,
|
|
276
|
+
evidence_links: [item.ref, ...links],
|
|
277
|
+
hold_reasons: evidence.holdReasons,
|
|
278
|
+
evidence: { hold: evidence.hold, release: evidence.release },
|
|
279
|
+
},
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Plan this cycle's captures. Items without the label are skipped; items
|
|
285
|
+
* already carrying their capture marker are skipped; at most `max` captures
|
|
286
|
+
* are returned and the rest are `deferred` to a later cycle.
|
|
287
|
+
* @param {{items?: unknown, label?: string, max?: number}} input - The
|
|
288
|
+
* listed items (`{ref, labels, body, comments}`), the resolved label and
|
|
289
|
+
* the per-cycle cap
|
|
290
|
+
* @returns {{label: string, captures: OverruledCapture[],
|
|
291
|
+
* skipped: {ref: string | null, reason: string}[],
|
|
292
|
+
* deferred: string[]}} Plan
|
|
293
|
+
*/
|
|
294
|
+
export function planOverruledCaptures({
|
|
295
|
+
items,
|
|
296
|
+
label = DEFAULT_WRONGLY_ESCALATED_LABEL,
|
|
297
|
+
max = DEFAULT_MAX_CAPTURES,
|
|
298
|
+
}) {
|
|
299
|
+
if (!Number.isInteger(max) || max < 0) {
|
|
300
|
+
throw new Error("max must be a non-negative integer");
|
|
301
|
+
}
|
|
302
|
+
const captures = [];
|
|
303
|
+
const skipped = [];
|
|
304
|
+
const deferred = [];
|
|
305
|
+
for (const raw of Array.isArray(items) ? items : []) {
|
|
306
|
+
const ref = typeof raw?.ref === "string" ? raw.ref.trim() : "";
|
|
307
|
+
if (ref === "") {
|
|
308
|
+
skipped.push({ ref: null, reason: "no ref" });
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
if (!carriesWronglyEscalated(raw.labels, label)) {
|
|
312
|
+
skipped.push({ ref, reason: "no wrongly-escalated label" });
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
const comments = commentsOf(raw.comments);
|
|
316
|
+
if (alreadyCaptured(comments, overruledFingerprint(ref))) {
|
|
317
|
+
skipped.push({ ref, reason: "already captured" });
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
if (captures.length >= max) {
|
|
321
|
+
deferred.push(ref);
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
captures.push(captureFor({ ref, body: raw.body, comments }, label));
|
|
325
|
+
}
|
|
326
|
+
return { label, captures, skipped, deferred };
|
|
327
|
+
}
|
|
@@ -33,7 +33,8 @@ export const HUMAN_NEEDED_KINDS = Object.freeze([
|
|
|
33
33
|
* ready gate and still needed a person. `environment` is an outage, an
|
|
34
34
|
* expired credential or a flaky tool; `human-gate` is a decision planning
|
|
35
35
|
* flagged as a human gate on the item. Neither of those two is a planning
|
|
36
|
-
* miss
|
|
36
|
+
* miss, except a `human-gate` a human has since labeled wrongly escalated
|
|
37
|
+
* (`overruled`, CodySwannGT/lisa#4657).
|
|
37
38
|
*/
|
|
38
39
|
export const PLANNING_MISS_CAUSES = Object.freeze([
|
|
39
40
|
"planning",
|
|
@@ -72,15 +73,34 @@ const NOT_A_PLANNING_MISS = Object.freeze({
|
|
|
72
73
|
* Whether a human-needed stop is a planning miss: the PRD, decomposition or
|
|
73
74
|
* ready gate let through an item a dispatched worker could not finish without
|
|
74
75
|
* a person. Throws on an unknown cause.
|
|
75
|
-
*
|
|
76
|
+
*
|
|
77
|
+
* `overruled` is true when the item carries the configured wrongly-escalated
|
|
78
|
+
* label (CodySwannGT/lisa#4657). A human has then ruled that the gate was
|
|
79
|
+
* not the plan working, so the label overrides `cause=human-gate`: the stop
|
|
80
|
+
* counts, pointing at the `filing` stage that let the gate on. It never
|
|
81
|
+
* overrides `environment`: the ruling is about the gate, not an outage.
|
|
82
|
+
* @param {{kind: string, cause?: string, overruled?: boolean}} input - The
|
|
83
|
+
* `--kind` and `--cause`, and whether the escalation was ruled wrong
|
|
76
84
|
* @returns {{counts: boolean, reason: string, stageHint?: string}} Verdict
|
|
77
85
|
*/
|
|
78
|
-
export function planningMissFor({
|
|
86
|
+
export function planningMissFor({
|
|
87
|
+
kind,
|
|
88
|
+
cause = "planning",
|
|
89
|
+
overruled = false,
|
|
90
|
+
}) {
|
|
79
91
|
if (!PLANNING_MISS_CAUSES.includes(cause)) {
|
|
80
92
|
throw new Error(
|
|
81
93
|
`--cause must be one of: ${PLANNING_MISS_CAUSES.join(", ")}.`
|
|
82
94
|
);
|
|
83
95
|
}
|
|
96
|
+
if (cause === "human-gate" && overruled === true) {
|
|
97
|
+
return {
|
|
98
|
+
counts: true,
|
|
99
|
+
stageHint: "filing",
|
|
100
|
+
reason:
|
|
101
|
+
"a human labeled this escalation wrong, so the human gate was not the plan working: the filing check let it through",
|
|
102
|
+
};
|
|
103
|
+
}
|
|
84
104
|
if (cause !== "planning") {
|
|
85
105
|
return { counts: false, reason: NOT_A_PLANNING_MISS[cause] };
|
|
86
106
|
}
|
|
@@ -104,17 +124,22 @@ export function planningMissFor({ kind, cause = "planning" }) {
|
|
|
104
124
|
* `lisa-persist-learning` candidate the manager can fill in without judgment.
|
|
105
125
|
* The rule and its why are the manager's to draft: they name the check
|
|
106
126
|
* planning should have run, which no script can know.
|
|
107
|
-
* @param {{ref: string, kind: string, cause?: string, question: string
|
|
108
|
-
* input - The item, why, the cause
|
|
127
|
+
* @param {{ref: string, kind: string, cause?: string, question: string,
|
|
128
|
+
* overruled?: boolean}} input - The item, why, the cause, the question
|
|
129
|
+
* text and whether the escalation was ruled wrong
|
|
109
130
|
* @returns {object} `{counts, reason, stageHint?, candidate?}`
|
|
110
131
|
*/
|
|
111
|
-
function planningMissPlan({ ref, kind, cause, question }) {
|
|
112
|
-
const verdict = planningMissFor({ kind, cause });
|
|
132
|
+
function planningMissPlan({ ref, kind, cause, question, overruled }) {
|
|
133
|
+
const verdict = planningMissFor({ kind, cause, overruled });
|
|
113
134
|
if (!verdict.counts) return verdict;
|
|
135
|
+
const signal =
|
|
136
|
+
cause === "human-gate" && overruled === true
|
|
137
|
+
? "wrongly-escalated"
|
|
138
|
+
: "planning-miss";
|
|
114
139
|
return {
|
|
115
140
|
...verdict,
|
|
116
141
|
candidate: {
|
|
117
|
-
signal
|
|
142
|
+
signal,
|
|
118
143
|
triggering_issue: ref,
|
|
119
144
|
provenance: [ref],
|
|
120
145
|
scope_hint: "project",
|
|
@@ -231,11 +256,13 @@ function chooseMarker(label, blocked) {
|
|
|
231
256
|
* unknown kind, empty or credential-shaped text, no marker, or an `exhausted`
|
|
232
257
|
* item with no `blocked` role to move it to.
|
|
233
258
|
* @param {{ref: string, kind: string, text: string, label?: string,
|
|
234
|
-
* blocked?: string, channel?: boolean, answerers?: boolean, cause?: string
|
|
259
|
+
* blocked?: string, channel?: boolean, answerers?: boolean, cause?: string,
|
|
260
|
+
* overruled?: boolean}}
|
|
235
261
|
* input - The item, why, the question, the configured human-needed label
|
|
236
262
|
* and `blocked` role value, whether a notification channel exists, whether
|
|
237
263
|
* anyone (operatorIds / trustedAuthorIds) may answer on the item, and the
|
|
238
|
-
* cause the planning-miss signal needs (default `planning`)
|
|
264
|
+
* cause the planning-miss signal needs (default `planning`), and whether
|
|
265
|
+
* the item carries the wrongly-escalated label (`overruled`)
|
|
239
266
|
* @returns {{ref: string, kind: string, marker: {type: string, value: string},
|
|
240
267
|
* move?: {role: "blocked", value: string}, comment: string,
|
|
241
268
|
* answerWith: {item: string|null, cli: string, channel: string|null},
|
|
@@ -251,6 +278,7 @@ export function planMark({
|
|
|
251
278
|
channel = false,
|
|
252
279
|
answerers = true,
|
|
253
280
|
cause = "planning",
|
|
281
|
+
overruled = false,
|
|
254
282
|
}) {
|
|
255
283
|
if (!HUMAN_NEEDED_KINDS.includes(kind)) {
|
|
256
284
|
throw new Error(`--kind must be one of: ${HUMAN_NEEDED_KINDS.join(", ")}.`);
|
|
@@ -300,6 +328,6 @@ export function planMark({
|
|
|
300
328
|
cli: `the answerCommand that session-manager.mjs status lists for ${ref} (answer on stdin)`,
|
|
301
329
|
channel: channel ? `Answer with: ${short} <your answer>` : null,
|
|
302
330
|
},
|
|
303
|
-
planningMiss: planningMissPlan({ ref, kind, cause, question }),
|
|
331
|
+
planningMiss: planningMissPlan({ ref, kind, cause, question, overruled }),
|
|
304
332
|
};
|
|
305
333
|
}
|
|
@@ -45,6 +45,19 @@ function stringLeaves(value) {
|
|
|
45
45
|
return Object.values(value).flatMap(stringLeaves);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* The build label map without `wrongly_escalated`: that label is a ruling
|
|
50
|
+
* left on an item for good (CodySwannGT/lisa#4657), not a lane or a hold,
|
|
51
|
+
* so it must not hide a released item from the backlog tier.
|
|
52
|
+
* @param {unknown} build - `github.labels.build`
|
|
53
|
+
* @returns {unknown} The map minus the ruling label
|
|
54
|
+
*/
|
|
55
|
+
export function withoutRuling(build) {
|
|
56
|
+
if (!build || typeof build !== "object") return build;
|
|
57
|
+
const { wrongly_escalated: _ruling, ...rest } = build;
|
|
58
|
+
return rest;
|
|
59
|
+
}
|
|
60
|
+
|
|
48
61
|
/**
|
|
49
62
|
* Fetch every open GitHub issue carrying no lifecycle label (build or PRD),
|
|
50
63
|
* all pages: the GitHub backlog tier.
|
|
@@ -57,7 +70,7 @@ export function fetchGithubBacklog(ctx, project) {
|
|
|
57
70
|
const lifecycle = new Set(
|
|
58
71
|
[project.global?.github?.labels, project.local?.github?.labels]
|
|
59
72
|
.flatMap(labels => [
|
|
60
|
-
...stringLeaves(labels?.build),
|
|
73
|
+
...stringLeaves(withoutRuling(labels?.build)),
|
|
61
74
|
...stringLeaves(labels?.prd),
|
|
62
75
|
])
|
|
63
76
|
.map(label => label.toLowerCase())
|
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
route,
|
|
47
47
|
} from "./cli-cycle.mjs";
|
|
48
48
|
import { answer, itemAnswer, markPlan } from "./cli-human.mjs";
|
|
49
|
+
import { overruledPlan } from "./cli-overruled.mjs";
|
|
49
50
|
import { repoDir, start, status, stop, validate } from "./cli-manager.mjs";
|
|
50
51
|
import { queue } from "./cli-queue.mjs";
|
|
51
52
|
import { CliError, EXIT } from "./cli-runtime.mjs";
|
|
@@ -113,9 +114,18 @@ const COMMANDS = {
|
|
|
113
114
|
},
|
|
114
115
|
"mark-plan": {
|
|
115
116
|
run: markPlan,
|
|
116
|
-
options: {
|
|
117
|
+
options: {
|
|
118
|
+
kind: text,
|
|
119
|
+
cause: text,
|
|
120
|
+
"item-label": { ...text, multiple: true },
|
|
121
|
+
},
|
|
117
122
|
positionals: 1,
|
|
118
123
|
},
|
|
124
|
+
"overruled-plan": {
|
|
125
|
+
run: overruledPlan,
|
|
126
|
+
options: { input: text, max: text },
|
|
127
|
+
positionals: 0,
|
|
128
|
+
},
|
|
119
129
|
answer: { run: answer, options: {}, positionals: 1 },
|
|
120
130
|
"item-answer": { run: itemAnswer, options: {}, positionals: 1 },
|
|
121
131
|
"record-cycle": {
|
|
@@ -14,7 +14,7 @@ Break work into ordered, well-scoped tasks that can be independently implemented
|
|
|
14
14
|
Every time a dispatched worker had to stop for a human, or file a new ticket mid-build, because planning let a gap through, `learning-judge` may have persisted the check planning should have run as a `planning-miss` learning (CodySwannGT/lisa#4569). Those checks only help if planning reads them back. Before decomposing, load them through the learnings contract's **bounded projection** — never by reading the ledger file wholesale:
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
node -e 'import("@codyswann/lisa/learnings").then(async m => { const { readFile } = await import("node:fs/promises"); const file = m.resolveProjectLearningsFile(await m.readProjectConfig(process.cwd())); const raw = await readFile(file, "utf8").catch(() => null); if (raw === null) return; const { entries, omittedCount } = m.projectLearnings(m.parseLearningsFile(raw)); const checks = entries.filter(e => /^Planning \((prd|decomposition|ready-gate)\):/.test(e.rule)).map(e => ({ id: e.id, rule: e.rule, confidence: e.confidence })); console.log(JSON.stringify({ checks, omittedCount })); }).catch(error => console.error(`learned planning checks unavailable: ${error.message}`))' || true
|
|
17
|
+
node -e 'import("@codyswann/lisa/learnings").then(async m => { const { readFile } = await import("node:fs/promises"); const file = m.resolveProjectLearningsFile(await m.readProjectConfig(process.cwd())); const raw = await readFile(file, "utf8").catch(() => null); if (raw === null) return; const { entries, omittedCount } = m.projectLearnings(m.parseLearningsFile(raw)); const checks = entries.filter(e => /^Planning \((prd|decomposition|ready-gate|filing)\):/.test(e.rule)).map(e => ({ id: e.id, rule: e.rule, confidence: e.confidence })); console.log(JSON.stringify({ checks, omittedCount })); }).catch(error => console.error(`learned planning checks unavailable: ${error.message}`))' || true
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
Run it from the project root. No output means there is no ledger yet: carry on. A malformed ledger prints one warning and yields nothing: carry on without it. Never let this step block planning.
|
|
@@ -24,6 +24,7 @@ Each check names the stage that owns it, and binds there:
|
|
|
24
24
|
- **`Planning (prd): …`** — a requirement the PRD must settle. In PRD intake (`*-to-tracker` Phase 1.45) a register entry that fails one is a `product-clarity` item, like any other requirement-quality failure.
|
|
25
25
|
- **`Planning (decomposition): …`** — binds in this skill: apply each as an extra obligation on every work unit it concerns, alongside steps 1–6 below. A unit that cannot meet it is split, re-scoped or given its missing dependency now, not left for the worker to discover.
|
|
26
26
|
- **`Planning (ready-gate): …`** — binds in the validator's S18 stateless-pickup dry-run (`lisa-jira-validate-ticket`, `lisa-github-validate-issue`, `lisa-linear-validate-issue`): each becomes a question the dry-run must be able to answer from the item and the links it can resolve.
|
|
27
|
+
- **`Planning (filing): …`** — binds on any agent about to file a work unit with `human_gate:` (the `ready-role-filing` rule), here included. Each is a check a hold reason must pass; a hold it rules out is a decision to make now, and the unit is filed build-ready. These come from escalations a human labeled wrong (`learning-judge` Step 2.6).
|
|
27
28
|
|
|
28
29
|
A check is a learned heuristic, not a new gate number: cite its `id` where it changed a decision, so `last_confirmed` can be advanced at claim time (`project-learnings`). When a check plainly does not apply to this work, skip it silently.
|
|
29
30
|
|
|
@@ -30,7 +30,7 @@ Each candidate you evaluate is a single object:
|
|
|
30
30
|
| `evidence_links[]` | string[] | Concrete evidence URLs/refs available for citation (failure logs, rejection comments, prior incidents). |
|
|
31
31
|
| `scope_hint` | `project` \| `upstream` | The submitter's guess at where the learning belongs. A hint only — attribution below decides. |
|
|
32
32
|
| `triggering_issue` | string | The issue/work item whose failure produced this candidate. |
|
|
33
|
-
| `signal` | `planning-miss` \| absent |
|
|
33
|
+
| `signal` | `planning-miss` \| `wrongly-escalated` \| absent | `planning-miss`: set by a caller that saw a dispatched item stop for a human or file a new ticket mid-build (`lisa-session-manager`, `lisa-implement`); Step 2.5 decides. `wrongly-escalated`: set by `lisa-session-manager` when a human labeled an item's escalation wrong (the configured wrongly-escalated label); Step 2.6 decides. A hint only. |
|
|
34
34
|
| `fingerprint` | string | Stable dedupe key for this candidate (computed by the caller, e.g. `lisa-persist-learning`). Echo it back unchanged. |
|
|
35
35
|
|
|
36
36
|
A candidate missing `triggering_issue` or with an empty evidence set can still be evaluated — but it can never reach `durable-learning`, because the mandatory citations below would be impossible.
|
|
@@ -62,19 +62,33 @@ A missing, ambiguous, contradictory or undecided requirement is not always a one
|
|
|
62
62
|
|
|
63
63
|
1. **It was dispatched.** The item had passed the ready gate — it was in the ready role and was picked up for dispatch — claimed by a worker, or held by the dispatcher while routing it to a repository (a `repo-route` hold: the item is past the ready gate and mid-dispatch, and `repo-scope-split` at decomposition should have made the route unambiguous) — before the gap surfaced. Cite the claim, the dispatch, or the ready-role history. A gap found at PRD intake, during validation, or before the ready flip is the gate **working**: that is `misunderstanding/spec-gap`.
|
|
64
64
|
2. **The information really was missing.** Quote what the worker could not find, and confirm it is absent from the item and the links it resolves. If the answer was on the item and the worker misread it, it is `misunderstanding/spec-gap` (the worker's defect, not planning's).
|
|
65
|
-
3. **It is not environmental or planned.** An outage, an expired credential, a flaky tool, missing tool access (`tool-access-gate`), or a decision planning **flagged as a human gate** on the item (`human_gate`, `[lisa-human-gate]`) is not a planning miss: asking there was the plan working. Neither is an item that exhausted its attempts.
|
|
65
|
+
3. **It is not environmental or planned.** An outage, an expired credential, a flaky tool, missing tool access (`tool-access-gate`), or a decision planning **flagged as a human gate** on the item (`human_gate`, `[lisa-human-gate]`) is not a planning miss: asking there was the plan working. Neither is an item that exhausted its attempts. The one exception is a flagged gate a human has since **labeled wrongly escalated**: that is Step 2.6, and this exclusion does not apply to it.
|
|
66
66
|
4. **A planning check would have caught it.** This is Step 2's prevention question, asked of planning instead of the build. Name the stage that should have caught it — `prd` (the requirement was never decided), `decomposition` (the work was mis-scoped, mis-split, or depended on something nobody filed, including a leaf the router could not place in one repo per `repo-scope-split`), or `ready-gate` (the item looked ready but S18 should have asked the question) — and re-walk it: with the check in force, the item would not have reached Ready with this gap.
|
|
67
67
|
|
|
68
68
|
**The rule is the check planning should have run, never the answer.** Rewrite the candidate's `rule` as `Planning (<stage>): <check>` — e.g. `Planning (decomposition): an export ticket must name its report format before it is Ready.` — never `Exports use CSV.`, which only answers the one ticket and belongs on the item. A rule that only makes sense for this one item is not a check: drop it as `misunderstanding/spec-gap`. The `why` names the stage that let it through and quotes what the worker could not find. The prefix is load-bearing: planning skills select these entries from the bounded projection by it (`lisa-task-decomposition` step 0).
|
|
69
69
|
|
|
70
70
|
**Recurrence never blocks a first occurrence.** A first-occurrence planning miss persists at `low` confidence, so its persistence PR waits for a human to merge it. That is a deliberate, bounded exception to Step 2's recurrence requirement. The hostile default exists because a plausible-but-wrong rule would reach every future session unattended; a `low` rule never does, because a human reads it at the gate first. Meanwhile the signal is unusually strong and unusually rare: each occurrence already cost the human interruption the gate exists to prevent, so waiting for a second occurrence costs a second interruption and teaches nothing new. And the rule only adds a check to planning — a wrong one costs a planning question, not changed build behaviour. With recurrence evidence (another dispatched item that stopped on the same class of gap), Step 4 may grant `high`.
|
|
71
71
|
|
|
72
|
+
### Step 2.6: Overruled escalation (`signal: wrongly-escalated`)
|
|
73
|
+
|
|
74
|
+
A self-flagged human gate is the agent's own claim that a human is needed. When a human disagrees — releases the hold and applies the project's configured wrongly-escalated label (`*.labels.build.wrongly_escalated` / `jira.labels.wrongly_escalated`, default `wrongly-escalated-to-human`) — the claim has been ruled on, and the ruling is the evidence. Trusting the claim over the ruling is exactly how agents keep escalating the same way. So a candidate is a `planning-miss` at stage `filing` when **all** of these hold:
|
|
75
|
+
|
|
76
|
+
1. **The ruling is on the item.** Cite the label on the item (the candidate's `triggering_issue`, or the `[lisa-escalation-overruled]` capture comment). Who applied it does not matter: the label is a classification, not a release, so it needs no release authorization, and an automation identity applying it at an operator's direction counts the same as a person.
|
|
77
|
+
2. **The item was held for a human.** Cite the hold: the `[lisa-human-gate]` marker, a hold comment, or the session manager's question comment. A label on an item that was never held is not an overruled escalation: drop it as `one-off`.
|
|
78
|
+
3. **A filing check would have kept the gate off.** Name the class of hold the human overruled (the hold reason, or what the hold asked for) and re-walk the filing with the check in force: the item would have been filed build-ready and decided by an agent. The release comment, when present, usually says this outright ("this was just a decision, make it").
|
|
79
|
+
|
|
80
|
+
Step 2.5's dispatch condition does not apply (the item was held at filing, never dispatched), and neither does its flagged-human-gate exclusion. Step 1 does not short-circuit to `lisa-upstream` merely because the `human_gate` contract is Lisa-shipped: the ruling is about this project's escalations, and the rule is this project's filing check. Hand off upstream only when the evidence shows a shipped Lisa skill **instructed** the gate for this case.
|
|
81
|
+
|
|
82
|
+
**The rule is the filing check, never the answer.** Rewrite it as `Planning (filing): <check>` — e.g. `Planning (filing): file human_gate only for an act no agent can perform (credential, spend, external account, legal sign-off); decide dispatch-order questions yourself.` — never the decision the human then made.
|
|
83
|
+
|
|
84
|
+
**Confidence.** Several labeled items whose holds share the same gap pattern are recurrence: grant `high`. A single labeled item is `low`. Either way, the persistence PR never waits for a human: the human has already ruled, at the label, and the operator's position is that humans are involved only when an agent is actually stuck. `lisa-persist-learning` merges a `wrongly-escalated` learning through the project's normal gates at either confidence; if the call was wrong, the gardener retires the rule later.
|
|
85
|
+
|
|
72
86
|
### Step 3: Classify (5-way taxonomy)
|
|
73
87
|
|
|
74
88
|
Exactly one of:
|
|
75
89
|
|
|
76
90
|
- **`durable-learning`** — both falsification questions pass with cited evidence. Disposition `persist`.
|
|
77
|
-
- **`planning-miss`** — every Step 2.5 condition holds: the item was dispatched past the ready gate, the information really was missing, the cause is not an outage, an expired credential, a flaky tool or a decision flagged as a human gate, and a named planning check would have caught it. Disposition `persist`, with `planning_stage` set and `rule` rewritten as the check.
|
|
91
|
+
- **`planning-miss`** — every Step 2.5 condition holds: the item was dispatched past the ready gate, the information really was missing, the cause is not an outage, an expired credential, a flaky tool or a decision flagged as a human gate, and a named planning check would have caught it. Or every Step 2.6 condition holds: a human labeled a held item's escalation wrong and a named filing check would have kept the gate off (`planning_stage: filing`). Disposition `persist`, with `planning_stage` set and `rule` rewritten as the check.
|
|
78
92
|
- **`one-off`** — a genuine typo, transient fluke, or single-occurrence mistake with no recurrence evidence. Disposition `drop`.
|
|
79
93
|
- **`misunderstanding/spec-gap`** — the failure traces to an ambiguous or missing requirement caught **before** the item was dispatched (the gate worked), or to information the item did hold that was misread. The fix is a better spec (raise it on the work item), not a rule. Disposition `drop`.
|
|
80
94
|
- **`lisa-upstream`** — set in Step 1. Disposition `handoff-upstream`; never persisted locally.
|
|
@@ -98,7 +112,7 @@ Return exactly one verdict object per candidate:
|
|
|
98
112
|
| `cited_evidence[]` | string[] | The concrete refs you actually relied on for this call — prevention and recurrence citations for durable; attribution citations for upstream; the decisive absence/counter-evidence for drops. Never empty. This is what makes a wrong call auditable. |
|
|
99
113
|
| `rationale` | string | 1–3 sentences readable by product, engineering, and QA alike (a non-technical operator stands at the gate). |
|
|
100
114
|
| `confidence` | `high` \| `low` | Present **only** when `classification` is `durable-learning` or `planning-miss`. |
|
|
101
|
-
| `planning_stage` | `prd` \| `decomposition` \| `ready-gate` | Present **only** when `classification` is `planning-miss`: the stage that let the gap through. |
|
|
115
|
+
| `planning_stage` | `prd` \| `decomposition` \| `ready-gate` \| `filing` | Present **only** when `classification` is `planning-miss`: the stage that let the gap through. `filing` only under Step 2.6. |
|
|
102
116
|
| `rule` | string | Present **only** when `classification` is `planning-miss`: the candidate's rule rewritten as the `Planning (<stage>): <check>` check, within the contract's caps. The caller persists this text, not the submitted one. |
|
|
103
117
|
| `disposition` | `persist` \| `drop` \| `handoff-upstream` | `persist` iff durable-learning or planning-miss; `handoff-upstream` iff lisa-upstream; otherwise `drop`. |
|
|
104
118
|
|
|
@@ -120,9 +134,10 @@ Also echo back the candidate's `fingerprint` and `triggering_issue` so the calle
|
|
|
120
134
|
| Prevention (would the rule have prevented it?) | yes/no | [refs] |
|
|
121
135
|
| Recurrence (does the class recur?) | yes/no | [refs] |
|
|
122
136
|
| Planning miss (dispatched, really missing, not environmental or a flagged gate, planning check named) | yes/no/n-a | [refs] |
|
|
137
|
+
| Overruled escalation (wrongly-escalated label on a held item, filing check named) | yes/no/n-a | [refs] |
|
|
123
138
|
|
|
124
139
|
**Classification**: durable-learning | planning-miss | one-off | misunderstanding/spec-gap | lisa-upstream
|
|
125
|
-
**Planning stage**: prd | decomposition | ready-gate (planning-miss only)
|
|
140
|
+
**Planning stage**: prd | decomposition | ready-gate | filing (planning-miss only)
|
|
126
141
|
**Rule**: Planning (<stage>): <check> (planning-miss only — the rewritten rule the caller persists)
|
|
127
142
|
**Confidence**: high | low (durable-learning and planning-miss only)
|
|
128
143
|
**Disposition**: persist | drop | handoff-upstream
|
|
@@ -1004,10 +1004,22 @@ verdict. Take the verdict from it, not from your own reading of the payloads
|
|
|
1004
1004
|
above:
|
|
1005
1005
|
|
|
1006
1006
|
```bash
|
|
1007
|
-
node scripts/check-third-party-review-evidence.mjs --sha <head-sha> --json
|
|
1007
|
+
node scripts/check-third-party-review-evidence.mjs --sha <head-sha> --repo <owner>/<repo> --json
|
|
1008
1008
|
```
|
|
1009
1009
|
|
|
1010
|
-
|
|
1010
|
+
Pass the owning PR's repository explicitly in local checkouts. Without
|
|
1011
|
+
`--repo` or a valid `GITHUB_REPOSITORY`, the prover exits with a usage error
|
|
1012
|
+
before reading GitHub; this is not a review verdict.
|
|
1013
|
+
|
|
1014
|
+
**First, stop on `pull-requests-unreadable`.** The PR discovery read failed,
|
|
1015
|
+
so the head's review status is **unknown**. `readings: []` in this outcome is
|
|
1016
|
+
not a reviewer saying it did no work. Report the failed pull-request read and
|
|
1017
|
+
stop under `tool-access-gate`, keeping the PR open and every check enabled.
|
|
1018
|
+
Do not post a reviewer-specific substitute or make a merge decision from this
|
|
1019
|
+
outcome. Restore the configured GitHub read access before rerunning the prover;
|
|
1020
|
+
this instruction adds no automatic retry loop.
|
|
1021
|
+
|
|
1022
|
+
For the remaining outcomes, three cases are handled differently:
|
|
1011
1023
|
|
|
1012
1024
|
1. **`satisfied`** — every configured reviewer showed its reviewed-when
|
|
1013
1025
|
evidence: a status whose description is the phrase, or a check run that
|
|
@@ -1017,7 +1029,8 @@ Three cases, and each is handled differently:
|
|
|
1017
1029
|
state, **not** a pass: say so explicitly in the report ("no third-party
|
|
1018
1030
|
reviewer configured; nothing read this diff on that path"), and do not
|
|
1019
1031
|
invent a substitute for a reviewer the project never asked for.
|
|
1020
|
-
3. **anything else** — throttled, skipped, absent, empty, unreadable
|
|
1032
|
+
3. **anything else** — throttled, skipped, absent, empty, unreadable reviewer
|
|
1033
|
+
evidence after successful PR discovery, a check
|
|
1021
1034
|
run that did not succeed, or words in no configured list. **Treat every one
|
|
1022
1035
|
of these as NOT REVIEWED.** The allowlist is the only thing that grants
|
|
1023
1036
|
credit; a denylist of known-bad phrases fails open, and the vocabulary is
|
|
@@ -21,7 +21,7 @@ Accept the candidate as JSON or `key=value` fields:
|
|
|
21
21
|
- `evidence_links` — concrete evidence refs available for citation
|
|
22
22
|
- `scope_hint` — `project` | `upstream` (a hint; the judge decides)
|
|
23
23
|
- `triggering_issue` — the issue/work item whose failure produced this candidate (required)
|
|
24
|
-
- `signal` — optional; `planning-miss` when a dispatched item stopped for a human or filed a new ticket mid-build (from `lisa-session-manager` or `lisa-implement`)
|
|
24
|
+
- `signal` — optional; `planning-miss` when a dispatched item stopped for a human or filed a new ticket mid-build (from `lisa-session-manager` or `lisa-implement`); `wrongly-escalated` when a human labeled an item's escalation wrong with the configured wrongly-escalated label (from `lisa-session-manager`'s overruled-escalation sweep, CodySwannGT/lisa#4657), carrying the hold and release as `evidence`. A hint for the judge, never a verdict
|
|
25
25
|
- `fingerprint` — optional; computed below when absent
|
|
26
26
|
|
|
27
27
|
## Phase 0 — Fingerprint (stable dedupe key)
|
|
@@ -235,7 +235,7 @@ No learning content is ever committed without a PR — there is no other write p
|
|
|
235
235
|
Stage: <planning_stage>. The worker could not find: "<quoted>". Planning skills read this rule back through the bounded projection (`lisa-task-decomposition` step 0).
|
|
236
236
|
```
|
|
237
237
|
|
|
238
|
-
For a **low-confidence** PR, the body must additionally end with this fixed decision-framing line so the human at the gate knows exactly what merging means:
|
|
238
|
+
For a **low-confidence** PR (other than a `wrongly-escalated` one, which no human merges — step 6), the body must additionally end with this fixed decision-framing line so the human at the gate knows exactly what merging means:
|
|
239
239
|
|
|
240
240
|
```markdown
|
|
241
241
|
**Merge** to adopt this rule into every future session for all six coding agents; **close** to discard it.
|
|
@@ -255,6 +255,7 @@ No learning content is ever committed without a PR — there is no other write p
|
|
|
255
255
|
```
|
|
256
256
|
|
|
257
257
|
A low-confidence PR sitting OPEN with green checks and `autoMergeRequest: null` is this mode's **success** state — a human merges or closes it. All pending low-confidence learning PRs are findable by filtering on the `learning:needs-triage` label (`gh pr list --label "learning:needs-triage"`).
|
|
258
|
+
- **`signal: wrongly-escalated`, at either confidence** → submit through `lisa-git-submit-pr` with its defaults, exactly like `high`, and apply no triage label. The candidate exists because a human already ruled — the wrongly-escalated label on the item is the review a low-confidence PR would otherwise wait for — and waiting for a second human to merge the learning is the very interruption the ruling objected to. Who applied the label does not change this: an automation identity applying it at an operator's direction counts. A `low` entry stays `confidence: low` in the ledger, so the gardener (`lisa-learnings-audit`) can find it and retire the rule if the call was wrong.
|
|
258
259
|
|
|
259
260
|
## Rules
|
|
260
261
|
|