@codyswann/lisa 4.59.0 → 4.59.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  2. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  3. package/dist/core/upstream-evidence-manifest.js +5 -4
  4. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  5. package/package.json +4 -4
  6. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  7. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  8. package/plugins/lisa/.codex-plugin/skills/lisa-github-build-intake/SKILL.md +9 -5
  9. package/plugins/lisa/.codex-plugin/skills/lisa-repair-intake/SKILL.md +26 -24
  10. package/plugins/lisa/rules/reference/leaf-only-lifecycle.md +1 -1
  11. package/plugins/lisa/scripts/lifecycle-label-trust.mjs +23 -20
  12. package/plugins/lisa/skills/lisa-github-build-intake/SKILL.md +9 -5
  13. package/plugins/lisa/skills/lisa-repair-intake/SKILL.md +26 -24
  14. package/plugins/lisa-agy/plugin.json +1 -1
  15. package/plugins/lisa-agy/scripts/lifecycle-label-trust.mjs +23 -20
  16. package/plugins/lisa-agy/skills/lisa-github-build-intake/SKILL.md +9 -5
  17. package/plugins/lisa-agy/skills/lisa-repair-intake/SKILL.md +26 -24
  18. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  19. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  20. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  21. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  22. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  23. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  24. package/plugins/lisa-copilot/rules/reference/leaf-only-lifecycle.md +1 -1
  25. package/plugins/lisa-copilot/scripts/lifecycle-label-trust.mjs +23 -20
  26. package/plugins/lisa-copilot/skills/lisa-github-build-intake/SKILL.md +9 -5
  27. package/plugins/lisa-copilot/skills/lisa-repair-intake/SKILL.md +26 -24
  28. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  29. package/plugins/lisa-cursor/rules/leaf-only-lifecycle-reference.mdc +1 -1
  30. package/plugins/lisa-cursor/scripts/lifecycle-label-trust.mjs +23 -20
  31. package/plugins/lisa-cursor/skills/lisa-github-build-intake/SKILL.md +9 -5
  32. package/plugins/lisa-cursor/skills/lisa-repair-intake/SKILL.md +26 -24
  33. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  34. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  35. package/plugins/lisa-expo-agy/plugin.json +1 -1
  36. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  37. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  38. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  39. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  40. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  41. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  43. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  44. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  45. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  46. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  47. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  48. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  49. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  50. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  51. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  52. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  53. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  55. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  56. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  57. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  60. package/plugins/lisa-rails-agy/plugin.json +1 -1
  61. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  64. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  65. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  66. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  67. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  70. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  71. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  72. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  73. package/plugins/src/base/rules/reference/leaf-only-lifecycle.md +1 -1
  74. package/plugins/src/base/scripts/lifecycle-label-trust.mjs +23 -20
  75. package/plugins/src/base/skills/lisa-github-build-intake/SKILL.md +9 -5
  76. package/plugins/src/base/skills/lisa-repair-intake/SKILL.md +26 -24
@@ -683,7 +683,8 @@ LISA_BLOCKER_NODE
683
683
  invoke `resolveBlockerEdges` as shown above; never create a second resolver in the host.
684
684
  It returns `dissolve` / `keep` / `escalate` per edge.
685
685
  **Dissolve the edge in the SAME write that records the ruling, then read the relation back and
686
- confirm it is gone.** Only when every edge dissolves → move `blocked → claimed`, then run the
686
+ confirm it is gone.** Only when the parsed edge set is non-empty and the resolver returns
687
+ `proceed: true` with every edge dissolved → move `blocked → claimed`, then run the
687
688
  same agent-dispatch + post-agent `claimed → done` sequence as the stalled-`claimed` path above
688
689
  (one-cycle recovery). If the agent re-blocks, move back to `blocked` — a valid outcome.
689
690
 
@@ -773,22 +774,16 @@ native-open / active / unresolved:
773
774
  4. Post a compact `[lisa-repair-intake]` note only when the native close-out changed state or when
774
775
  an actionable setup error must be surfaced. Do not spam already-closed terminal items.
775
776
 
776
- ### Lifecycle label contradicts native state — walk BOTH directions
777
+ ### Lifecycle label contradicts native state — walk every direction
777
778
 
778
- A lifecycle label can lie in two ways, and historically only one of them had an owner:
779
+ Use the existing detector to check native state and closure reason together.
780
+ `directionsWalked` reports all three repair directions:
779
781
 
780
- | label | native state | owned by |
782
+ | Label | Native state | Repair |
781
783
  |---|---|---|
782
- | terminal `done` role | still open / active | the `Build terminal-open` section above |
783
- | non-terminal role (`ready`, `claimed`, `blocked`, or any other `status:` member) | closed / completed | **nothing, until now** |
784
-
785
- A pass that walks one direction leaves the other accumulating silently. Measured on the Linear TUN
786
- board: **TUN-556 and TUN-503 both carry a terminal `status:done` while still natively open in
787
- `On Dev`** — invisible to intake and indistinguishable from handled, exactly like a bot-applied
788
- `status:in-progress` on GitHub.
789
-
790
- Resolve both directions in one pass with the shipped detector, which always reports
791
- `directionsWalked` covering both, so a "clean" verdict is an assertion that both were examined.
784
+ | Terminal `done` role | Open / active | Follow `Build terminal-open` above |
785
+ | Non-terminal lifecycle role | Closed as `COMPLETED` or reason absent | Advance to the configured terminal role |
786
+ | Non-terminal lifecycle role | Closed as `NOT_PLANNED` | Remove the stale role and add nothing |
792
787
 
793
788
  **Build the classifier input inside this cycle. Never consume a temp file another skill wrote.**
794
789
  repair-intake runs as its own cycle, so borrowing `lisa-github-build-intake`'s scratch file fails
@@ -801,6 +796,9 @@ silent-clean verdict this section promises cannot happen.
801
796
  TRUST_DIR=$(mktemp -d)
802
797
  trap 'rm -rf "$TRUST_DIR"' EXIT
803
798
 
799
+ # REST, not `gh issue view`: this payload carries `state_reason`, and the reason is
800
+ # what separates the two closed directions. A read that drops it makes a NOT_PLANNED
801
+ # closure indistinguishable from a completion at the exact moment one of them WRITES.
804
802
  gh api "repos/<org>/<repo>/issues/<n>" > "$TRUST_DIR/issue.json"
805
803
 
806
804
  # --paginate emits ONE ARRAY PER PAGE; --slurp + `add` flattens all of them so a
@@ -835,14 +833,18 @@ The `excluded` array reports what was held back; surface it, do not repair it.
835
833
  1. **`terminal-label-open-state`** → hand to the `Build terminal-open → native close` section above.
836
834
  Do not restate its rules; the terminality test lives there (intermediate env rungs like
837
835
  `status:on-dev` / `status:on-stg` are **not** terminal).
838
- 2. **`open-label-closed-state`** → the previously unowned direction. The item is natively closed or
839
- completed while still wearing a non-terminal lifecycle role. Advance the label to the env-resolved
840
- terminal `done` role and post one idempotent `[lisa-repair-intake]` note. This is a write on
841
- **Lisa's own** lifecycle surface, not a contest with another writer.
836
+ 2. **`open-label-closed-state`** → the previously unowned direction. The item is natively closed as
837
+ **completed** while still wearing a non-terminal lifecycle role. Advance the label to the
838
+ env-resolved terminal `done` role and post one idempotent `[lisa-repair-intake]` note. This is a
839
+ write on **Lisa's own** lifecycle surface, not a contest with another writer.
842
840
  Apply the leaf/container check from the **Lifecycle ownership guard** section *before* this
843
841
  branch: repair-intake owns container repair, so a natively-closed `ready` **leaf** is skipped
844
842
  here and left to the build lane rather than claimed by this pass.
845
- 3. **Vendor caveat — Linear.** On Linear the lifecycle surface is the native workflow **state**, not a
843
+ 3. **`open-label-abandoned-state`** → closed as **`NOT_PLANNED`**. Remove the stale
844
+ non-terminal role and add nothing: declined work has not shipped. Post one idempotent
845
+ `[lisa-repair-intake]` note naming the closure reason. This removal also applies to closed
846
+ ready leaves, before the ordinary ready-leaf skip; it never claims or dispatches them.
847
+ 4. **Vendor caveat — Linear.** On Linear the lifecycle surface is the native workflow **state**, not a
846
848
  `status:*` label (see `config-resolution`). A `status:*` label there is leftover cruft that no
847
849
  repair direction reads, which is precisely why TUN-556 and TUN-503 rotted. Treat Linear's native
848
850
  state as authoritative and remove the contradicting stale label; never move the state to match a
@@ -1417,8 +1419,9 @@ It MAY:
1417
1419
  terminal `done`.
1418
1420
  - Reconcile a **container** wrongly carrying the build-ready `ready` role (a leaf-only-invariant
1419
1421
  violation) by rolling it up from its children and removing the `ready`, with a
1420
- `[lisa-repair-intake]` audit note. This is the one `ready`-touching exception (see MUST NOT) and
1421
- applies only to containers, never to leaves.
1422
+ `[lisa-repair-intake]` audit note.
1423
+ - Remove stale lifecycle labels from a natively closed `NOT_PLANNED` item, including a ready
1424
+ leaf. Add no done label and do not claim or dispatch it.
1422
1425
  - Move a PRD with fully terminal generated work to `shipped` and close/archive the source artifact
1423
1426
  where the source vendor supports native close-out, per `prd-lifecycle-rollup`.
1424
1427
  - Repair missing native GitHub child links by replaying the same-repo, idempotent `addSubIssue`
@@ -1439,9 +1442,8 @@ It MUST NOT:
1439
1442
  (empty parent token / `Top-level work:` entries) may become PRD children.
1440
1443
  - Apply a build `done` value other than via the env-resolution rules, or close a native item at
1441
1444
  any value other than the true terminal `done` (see `leaf-only-lifecycle`).
1442
- - Touch `ready` **leaves** (that is `lisa-intake`'s lane). A container carrying `ready` is the
1443
- documented exception above — repair-intake reconciles it because `ready` on a parent is an
1444
- invariant violation, not the human "claim this leaf" signal intake owns.
1445
+ - Touch `ready` **leaves** except to remove stale labels from a natively closed `NOT_PLANNED`
1446
+ item as above. Open ready leaves remain `lisa-intake`'s lane.
1445
1447
  - Move a GitHub issue that already carries a configured lifecycle label back to `ready` merely
1446
1448
  because some other label looks stale. Official lifecycle labels remain authoritative.
1447
1449
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "4.59.0",
3
+ "version": "4.59.1",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "4.59.0",
3
+ "version": "4.59.1",
4
4
  "description": "AWS CDK-specific Lisa plugin.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "4.59.0",
3
+ "version": "4.59.1",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "4.59.0",
3
+ "version": "4.59.1",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "4.59.0",
3
+ "version": "4.59.1",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "4.59.0",
3
+ "version": "4.59.1",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -67,7 +67,7 @@ Three constraints on how it is done:
67
67
 
68
68
  - **Remove only roles the item actually carries.** Naming an absent label is a 404, which fails a clean closure and makes a repeat run fail where the first one succeeded.
69
69
  - **Verify by re-reading.** Confirm the final closed state and the unique terminal role from a **fresh read of the item**, never from the write's own response. A write that reports success is not evidence of the state it intended to produce — asserting otherwise is the same defect as the drift being repaired, one layer up.
70
- - **Never re-complete an abandoned item.** Applying a terminal `done` role to an item someone already closed as not-planned rewrites their decision that the work would not be done, and afterwards the two are indistinguishable. Refuse and say so. This does not restrict the duplicate closeout below, which is a flow deliberately closing an open item as not-planned rather than overwriting a closure that already exists.
70
+ - **Never re-complete an abandoned item.** Refuse to apply a terminal `done` role to work closed as not-planned. Duplicate closeout below remains allowed, but removes lifecycle labels without adding a done label; verify that no lifecycle role remains.
71
71
 
72
72
  Trackers with a native lifecycle field (JIRA, Linear) get exclusivity for free: the field that closes the item is the field a queue scan filters on, so the two cannot disagree. GitHub Issues has no lifecycle beyond open/closed, so Lisa synthesizes one in labels and inherits a reconciliation duty the others do not have. That asymmetry is tracked separately in `CodySwannGT/lisa#3479`; this section is the obligation, not the redesign.
73
73
 
@@ -66,18 +66,16 @@ export const DEFAULT_TERMINAL_LIFECYCLE_LABEL = "status:done";
66
66
  */
67
67
  export const IMPLAUSIBLE_CLAIM_WINDOW_SECONDS = 300;
68
68
 
69
- /**
70
- * Both directions a lifecycle label can contradict native state.
71
- *
72
- * Emitted on every drift result so a repair pass cannot walk one direction and
73
- * silently leave the other accumulating — the asymmetry that let TUN-556 and
74
- * TUN-503 sit on a terminal `status:done` while still natively open.
75
- */
69
+ /** Report each contradiction; abandoned closures must not earn a done label. */
76
70
  export const LIFECYCLE_DRIFT_DIRECTIONS = [
77
71
  "terminal-label-open-state",
78
72
  "open-label-closed-state",
73
+ "open-label-abandoned-state",
79
74
  ];
80
75
 
76
+ /** The closure reason that means the work will deliberately NOT be done. */
77
+ const NOT_PLANNED = "not_planned";
78
+
81
79
  /**
82
80
  * @typedef {{ readonly login?: string, readonly type?: string }} Actor
83
81
  *
@@ -277,22 +275,13 @@ export function resolveClaimability({ trusted, config }) {
277
275
  }
278
276
 
279
277
  /**
280
- * Detect lifecycle labels that contradict native state, in BOTH directions.
281
- *
282
- * `directionsWalked` is always the full direction list, so a caller reporting
283
- * "clean" is asserting it looked at both — the failure mode refinement #1 of
284
- * issue #2539 describes, where only the auto-complete direction was ever
285
- * repaired and the reverse rotted unobserved.
286
- *
287
- * `excludeLabels` removes labels from consideration entirely. Callers MUST pass
288
- * the untrusted set here: `open-label-closed-state` is a repair direction that
289
- * WRITES (it advances the label to the terminal `done` role), so without this a
290
- * bot-applied label the classifier just refused to believe would still drive a
291
- * real label write — the guard would launder the very input it rejected.
278
+ * Detect every native-state contradiction, excluding untrusted labels.
279
+ * Only an explicit not-planned reason selects the retire-only repair.
292
280
  *
293
281
  * @param {{
294
282
  * readonly labels?: readonly (string | { readonly name?: string })[]
295
283
  * readonly state?: string
284
+ * readonly stateReason?: string
296
285
  * readonly terminalLabels?: readonly string[]
297
286
  * readonly excludeLabels?: readonly string[]
298
287
  * }} input
@@ -317,6 +306,11 @@ export function detectLifecycleDrift(input = {}) {
317
306
  String(input.state ?? "")
318
307
  .trim()
319
308
  .toLowerCase() === "closed";
309
+ const abandoned =
310
+ closed &&
311
+ String(input.stateReason ?? "")
312
+ .trim()
313
+ .toLowerCase() === NOT_PLANNED;
320
314
  const allLifecycleLabels = normalizeLabelNames(input.labels).filter(
321
315
  isLifecycleLabel
322
316
  );
@@ -333,7 +327,14 @@ export function detectLifecycleDrift(input = {}) {
333
327
  return [{ direction: "terminal-label-open-state", label }];
334
328
  }
335
329
  if (!isTerminal && closed) {
336
- return [{ direction: "open-label-closed-state", label }];
330
+ return [
331
+ {
332
+ direction: abandoned
333
+ ? "open-label-abandoned-state"
334
+ : "open-label-closed-state",
335
+ label,
336
+ },
337
+ ];
337
338
  }
338
339
  return [];
339
340
  });
@@ -538,6 +539,8 @@ async function main() {
538
539
  const drift = detectLifecycleDrift({
539
540
  labels: issue.labels,
540
541
  state: issue.state,
542
+ // REST and GitHub CLI use different field names for the same reason.
543
+ stateReason: issue.state_reason ?? issue.stateReason,
541
544
  terminalLabels: terminalLifecycleLabels(payload.config),
542
545
  excludeLabels: trust.untrusted.map(entry => entry.label),
543
546
  });
@@ -491,7 +491,11 @@ Before the claim mutation, apply `claim-time-guards` — **Value before claim**,
491
491
  1. **`two-failed-attempts` valve.** Count `[lisa-build-attempt]` markers on the issue from the read bundle's comments (match on the marker, never the title), applying both filters from `claim-time-guards`: count a marker only when it carries `measures=work` (a marker with no `measures=` counts as `work`), and only when its `createdAt` is **after the issue most recently gained the ready label**. The ready-lane entry comes from the read bundle's `LabeledEvent` stream, which is already fetched — no extra call. If that history is `unknown`, count every `measures=work` marker regardless of age and say so in the comment. With two or more surviving markers, do **not** claim: relabel to the configured blocked role (`gh issue edit <number> --repo <org>/<repo> --remove-label "$READY" --add-label "$BLOCKED"`, resolved from `github.labels.build.blocked` per `config-resolution`), post the operator-readable comment naming both attempts, and **stop the cycle** at Phase 3e. Every non-success terminal outcome recorded in 3c/3d also appends a fresh `<!-- [lisa-build-attempt] n=<N> outcome=<outcome> measures=<work|machine> -->` marker so the next cycle can count it — `measures=machine` when the run was terminated by a signal or its outcome was `recovery-required`, `measures=work` when the build ran and did not satisfy the issue.
492
492
  2. **`already-implemented` check.** Probe for this issue's own key — `git log --all --grep "<org>/<repo>#<number>"` and `gh pr list --repo <org>/<repo> --state all --search "<org>/<repo>#<number>" --json number,state,mergedAt,url`. On a hit, claim as normal but route 3c to **verify-and-close** instead of `lisa-implement`: verify what shipped against the issue's acceptance criteria, post evidence via `lisa-github-evidence` naming the shipping PR/commit, then run the ordinary 3d transition and 3d.1 rollup. A partial hit implements only the remaining gap. An unreadable history degrades to "no hit" and the ordinary path proceeds — the guard never blocks the claim. This is not `DUPLICATE_ALREADY_FIXED` (a *different* canonical issue) and not `claim-archaeology` (a *different* ancestor issue); it is this issue's own work already having shipped without a transition.
493
493
 
494
+ Immediately before claiming, re-read native state. If it is closed, skip it without
495
+ relabeling or dispatching; an unreadable state holds the candidate.
496
+
494
497
  ```bash
498
+ gh issue view <number> --repo <org>/<repo> --json state -q '.state' # must be OPEN
495
499
  gh issue edit <number> --repo <org>/<repo> --remove-label "$READY" --add-label "$CLAIMED"
496
500
  # Assign to the authenticated user ONLY when the issue is currently unassigned (attributable claim;
497
501
  # do not pile a second assignee onto an issue that already has an owner):
@@ -536,7 +540,7 @@ The lifecycle run returns one of the following outcomes; resume this scanner wit
536
540
 
537
541
  - **Success** — the build flow completed and a PR exists; evidence posted. The PR may already be **merged** or still **open** (auto-merge enabled, awaiting checks/merge). "Success" means the build work is sound — it does **not** assert the change reached an environment. The env transition in 3d gates on the PR actually being merged; an open PR does not advance the issue to a `done` env status.
538
542
  - **Blocked by github-verify pre-flight gate** — the pre-flight gate (github-agent workflow step 2) relabels the issue to `status:blocked` (or removes `$CLAIMED` and reassigns to the original author). This is correct and expected — let it stand. Record and move on.
539
- - **Duplicate already fixed** — `lisa-ticket-triage` returned `DUPLICATE_ALREADY_FIXED` with a canonical issue reference and empirical base-branch evidence. Post the triage finding, ensure the native `duplicates <canonical>` relationship exists when GitHub exposes it (otherwise leave an explicit cross-reference comment/body link), remove `$CLAIMED`, add the terminal `$DONE` label, close the issue with `gh issue close --reason "not planned"`, and do not open a PR. If the canonical fix is merged but not yet on the production branch, the close comment must say the production error can recur until the canonical issue promotes and that recurrence is tracked by the canonical issue; do not reopen this duplicate for that recurrence.
543
+ - **Duplicate already fixed** — `lisa-ticket-triage` returned `DUPLICATE_ALREADY_FIXED` with a canonical issue reference and empirical base-branch evidence. Follow 3c.1 to link the duplicate, remove lifecycle roles, and close it as not planned without adding a done label or opening a PR. If the canonical fix is merged but not yet on the production branch, the close comment must say the production error can recur until the canonical issue promotes and that recurrence is tracked by the canonical issue; do not reopen this duplicate for that recurrence.
540
544
  - **Blocked by ticket-triage ambiguities** — triage posts findings and the lifecycle stops. The issue stays in `$CLAIMED`. Surface to human; do not auto-relabel. Record under "Errors".
541
545
  - **Errored** — exception, missing config, etc. Leave the issue in `$CLAIMED` for human investigation. Record under "Errors".
542
546
 
@@ -547,12 +551,12 @@ Run this only when the returned triage verdict is exactly `DUPLICATE_ALREADY_FIX
547
551
  1. Verify the structured result includes a canonical issue reference, the canonical PR/commit, and empirical evidence that the canonical fix is present on the base branch. If any piece is missing, treat the outcome as Held instead of closing.
548
552
  2. Post or preserve the triage-finding comment that explains why this issue is a duplicate and names the canonical issue.
549
553
  3. Ensure a native `duplicates <canonical>` link exists when GitHub exposes issue relationships; if this installation cannot create that relationship, leave an explicit issue cross-reference comment/body link and record the limitation in the summary.
550
- 4. Resolve terminal `$DONE` exactly as in Phase 3d. For a single-env repo, `$DONE` is terminal; for env-keyed config, only the production/final value is terminal.
551
- 5. Apply `$DONE` and retire every competing lifecycle role the issue currently carries — not just `$CLAIMED` — per the `leaf-only-lifecycle` rule's "Exactly one lifecycle role survives closure". Then close the issue as duplicate/not-planned:
554
+ 4. Resolve the configured lifecycle role set, including every environment's done value.
555
+ 5. Remove every lifecycle role the issue currently carries. Add no done label: this duplicate is being declined, and the canonical issue records delivery. Close as duplicate/not-planned:
552
556
 
553
557
  ```bash
554
558
  gh issue view <number> --repo <org>/<repo> --json labels -q '[.labels[].name] | join(" ")'
555
- gh issue edit <number> --repo <org>/<repo> --add-label "$DONE" <one --remove-label "<role>" per competing role the issue CURRENTLY carries>
559
+ gh issue edit <number> --repo <org>/<repo> <one --remove-label "<role>" per lifecycle role the issue CURRENTLY carries; skip when none>
556
560
  gh issue close <number> --repo <org>/<repo> --reason "not planned"
557
561
  ```
558
562
 
@@ -562,7 +566,7 @@ gh issue close <number> --repo <org>/<repo> --reason "not planned"
562
566
  gh issue view <number> --repo <org>/<repo> --json state,stateReason,labels
563
567
  ```
564
568
 
565
- It must read `state: CLOSED` with `stateReason: NOT_PLANNED`, carry `$DONE`, and carry **no** other lifecycle role. Anything else is an Error naming what is still present. Post the closeout comment only after that passes:
569
+ It must read `state: CLOSED` with `stateReason: NOT_PLANNED` and carry **no** lifecycle role, including `$DONE`. Anything else is an Error naming what is still present. Post the closeout comment only after that passes:
566
570
 
567
571
  ```bash
568
572
  gh issue comment <number> --repo <org>/<repo> --body "[claude-build-intake] Closed as duplicate of <canonical>. Canonical fix: <PR-or-commit>. Evidence: <base-branch-proof>."
@@ -683,7 +683,8 @@ LISA_BLOCKER_NODE
683
683
  invoke `resolveBlockerEdges` as shown above; never create a second resolver in the host.
684
684
  It returns `dissolve` / `keep` / `escalate` per edge.
685
685
  **Dissolve the edge in the SAME write that records the ruling, then read the relation back and
686
- confirm it is gone.** Only when every edge dissolves → move `blocked → claimed`, then run the
686
+ confirm it is gone.** Only when the parsed edge set is non-empty and the resolver returns
687
+ `proceed: true` with every edge dissolved → move `blocked → claimed`, then run the
687
688
  same agent-dispatch + post-agent `claimed → done` sequence as the stalled-`claimed` path above
688
689
  (one-cycle recovery). If the agent re-blocks, move back to `blocked` — a valid outcome.
689
690
 
@@ -773,22 +774,16 @@ native-open / active / unresolved:
773
774
  4. Post a compact `[lisa-repair-intake]` note only when the native close-out changed state or when
774
775
  an actionable setup error must be surfaced. Do not spam already-closed terminal items.
775
776
 
776
- ### Lifecycle label contradicts native state — walk BOTH directions
777
+ ### Lifecycle label contradicts native state — walk every direction
777
778
 
778
- A lifecycle label can lie in two ways, and historically only one of them had an owner:
779
+ Use the existing detector to check native state and closure reason together.
780
+ `directionsWalked` reports all three repair directions:
779
781
 
780
- | label | native state | owned by |
782
+ | Label | Native state | Repair |
781
783
  |---|---|---|
782
- | terminal `done` role | still open / active | the `Build terminal-open` section above |
783
- | non-terminal role (`ready`, `claimed`, `blocked`, or any other `status:` member) | closed / completed | **nothing, until now** |
784
-
785
- A pass that walks one direction leaves the other accumulating silently. Measured on the Linear TUN
786
- board: **TUN-556 and TUN-503 both carry a terminal `status:done` while still natively open in
787
- `On Dev`** — invisible to intake and indistinguishable from handled, exactly like a bot-applied
788
- `status:in-progress` on GitHub.
789
-
790
- Resolve both directions in one pass with the shipped detector, which always reports
791
- `directionsWalked` covering both, so a "clean" verdict is an assertion that both were examined.
784
+ | Terminal `done` role | Open / active | Follow `Build terminal-open` above |
785
+ | Non-terminal lifecycle role | Closed as `COMPLETED` or reason absent | Advance to the configured terminal role |
786
+ | Non-terminal lifecycle role | Closed as `NOT_PLANNED` | Remove the stale role and add nothing |
792
787
 
793
788
  **Build the classifier input inside this cycle. Never consume a temp file another skill wrote.**
794
789
  repair-intake runs as its own cycle, so borrowing `lisa-github-build-intake`'s scratch file fails
@@ -801,6 +796,9 @@ silent-clean verdict this section promises cannot happen.
801
796
  TRUST_DIR=$(mktemp -d)
802
797
  trap 'rm -rf "$TRUST_DIR"' EXIT
803
798
 
799
+ # REST, not `gh issue view`: this payload carries `state_reason`, and the reason is
800
+ # what separates the two closed directions. A read that drops it makes a NOT_PLANNED
801
+ # closure indistinguishable from a completion at the exact moment one of them WRITES.
804
802
  gh api "repos/<org>/<repo>/issues/<n>" > "$TRUST_DIR/issue.json"
805
803
 
806
804
  # --paginate emits ONE ARRAY PER PAGE; --slurp + `add` flattens all of them so a
@@ -835,14 +833,18 @@ The `excluded` array reports what was held back; surface it, do not repair it.
835
833
  1. **`terminal-label-open-state`** → hand to the `Build terminal-open → native close` section above.
836
834
  Do not restate its rules; the terminality test lives there (intermediate env rungs like
837
835
  `status:on-dev` / `status:on-stg` are **not** terminal).
838
- 2. **`open-label-closed-state`** → the previously unowned direction. The item is natively closed or
839
- completed while still wearing a non-terminal lifecycle role. Advance the label to the env-resolved
840
- terminal `done` role and post one idempotent `[lisa-repair-intake]` note. This is a write on
841
- **Lisa's own** lifecycle surface, not a contest with another writer.
836
+ 2. **`open-label-closed-state`** → the previously unowned direction. The item is natively closed as
837
+ **completed** while still wearing a non-terminal lifecycle role. Advance the label to the
838
+ env-resolved terminal `done` role and post one idempotent `[lisa-repair-intake]` note. This is a
839
+ write on **Lisa's own** lifecycle surface, not a contest with another writer.
842
840
  Apply the leaf/container check from the **Lifecycle ownership guard** section *before* this
843
841
  branch: repair-intake owns container repair, so a natively-closed `ready` **leaf** is skipped
844
842
  here and left to the build lane rather than claimed by this pass.
845
- 3. **Vendor caveat — Linear.** On Linear the lifecycle surface is the native workflow **state**, not a
843
+ 3. **`open-label-abandoned-state`** → closed as **`NOT_PLANNED`**. Remove the stale
844
+ non-terminal role and add nothing: declined work has not shipped. Post one idempotent
845
+ `[lisa-repair-intake]` note naming the closure reason. This removal also applies to closed
846
+ ready leaves, before the ordinary ready-leaf skip; it never claims or dispatches them.
847
+ 4. **Vendor caveat — Linear.** On Linear the lifecycle surface is the native workflow **state**, not a
846
848
  `status:*` label (see `config-resolution`). A `status:*` label there is leftover cruft that no
847
849
  repair direction reads, which is precisely why TUN-556 and TUN-503 rotted. Treat Linear's native
848
850
  state as authoritative and remove the contradicting stale label; never move the state to match a
@@ -1417,8 +1419,9 @@ It MAY:
1417
1419
  terminal `done`.
1418
1420
  - Reconcile a **container** wrongly carrying the build-ready `ready` role (a leaf-only-invariant
1419
1421
  violation) by rolling it up from its children and removing the `ready`, with a
1420
- `[lisa-repair-intake]` audit note. This is the one `ready`-touching exception (see MUST NOT) and
1421
- applies only to containers, never to leaves.
1422
+ `[lisa-repair-intake]` audit note.
1423
+ - Remove stale lifecycle labels from a natively closed `NOT_PLANNED` item, including a ready
1424
+ leaf. Add no done label and do not claim or dispatch it.
1422
1425
  - Move a PRD with fully terminal generated work to `shipped` and close/archive the source artifact
1423
1426
  where the source vendor supports native close-out, per `prd-lifecycle-rollup`.
1424
1427
  - Repair missing native GitHub child links by replaying the same-repo, idempotent `addSubIssue`
@@ -1439,9 +1442,8 @@ It MUST NOT:
1439
1442
  (empty parent token / `Top-level work:` entries) may become PRD children.
1440
1443
  - Apply a build `done` value other than via the env-resolution rules, or close a native item at
1441
1444
  any value other than the true terminal `done` (see `leaf-only-lifecycle`).
1442
- - Touch `ready` **leaves** (that is `lisa-intake`'s lane). A container carrying `ready` is the
1443
- documented exception above — repair-intake reconciles it because `ready` on a parent is an
1444
- invariant violation, not the human "claim this leaf" signal intake owns.
1445
+ - Touch `ready` **leaves** except to remove stale labels from a natively closed `NOT_PLANNED`
1446
+ item as above. Open ready leaves remain `lisa-intake`'s lane.
1445
1447
  - Move a GitHub issue that already carries a configured lifecycle label back to `ready` merely
1446
1448
  because some other label looks stale. Official lifecycle labels remain authoritative.
1447
1449
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "4.59.0",
3
+ "version": "4.59.1",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -72,7 +72,7 @@ Three constraints on how it is done:
72
72
 
73
73
  - **Remove only roles the item actually carries.** Naming an absent label is a 404, which fails a clean closure and makes a repeat run fail where the first one succeeded.
74
74
  - **Verify by re-reading.** Confirm the final closed state and the unique terminal role from a **fresh read of the item**, never from the write's own response. A write that reports success is not evidence of the state it intended to produce — asserting otherwise is the same defect as the drift being repaired, one layer up.
75
- - **Never re-complete an abandoned item.** Applying a terminal `done` role to an item someone already closed as not-planned rewrites their decision that the work would not be done, and afterwards the two are indistinguishable. Refuse and say so. This does not restrict the duplicate closeout below, which is a flow deliberately closing an open item as not-planned rather than overwriting a closure that already exists.
75
+ - **Never re-complete an abandoned item.** Refuse to apply a terminal `done` role to work closed as not-planned. Duplicate closeout below remains allowed, but removes lifecycle labels without adding a done label; verify that no lifecycle role remains.
76
76
 
77
77
  Trackers with a native lifecycle field (JIRA, Linear) get exclusivity for free: the field that closes the item is the field a queue scan filters on, so the two cannot disagree. GitHub Issues has no lifecycle beyond open/closed, so Lisa synthesizes one in labels and inherits a reconciliation duty the others do not have. That asymmetry is tracked separately in `CodySwannGT/lisa#3479`; this section is the obligation, not the redesign.
78
78
 
@@ -66,18 +66,16 @@ export const DEFAULT_TERMINAL_LIFECYCLE_LABEL = "status:done";
66
66
  */
67
67
  export const IMPLAUSIBLE_CLAIM_WINDOW_SECONDS = 300;
68
68
 
69
- /**
70
- * Both directions a lifecycle label can contradict native state.
71
- *
72
- * Emitted on every drift result so a repair pass cannot walk one direction and
73
- * silently leave the other accumulating — the asymmetry that let TUN-556 and
74
- * TUN-503 sit on a terminal `status:done` while still natively open.
75
- */
69
+ /** Report each contradiction; abandoned closures must not earn a done label. */
76
70
  export const LIFECYCLE_DRIFT_DIRECTIONS = [
77
71
  "terminal-label-open-state",
78
72
  "open-label-closed-state",
73
+ "open-label-abandoned-state",
79
74
  ];
80
75
 
76
+ /** The closure reason that means the work will deliberately NOT be done. */
77
+ const NOT_PLANNED = "not_planned";
78
+
81
79
  /**
82
80
  * @typedef {{ readonly login?: string, readonly type?: string }} Actor
83
81
  *
@@ -277,22 +275,13 @@ export function resolveClaimability({ trusted, config }) {
277
275
  }
278
276
 
279
277
  /**
280
- * Detect lifecycle labels that contradict native state, in BOTH directions.
281
- *
282
- * `directionsWalked` is always the full direction list, so a caller reporting
283
- * "clean" is asserting it looked at both — the failure mode refinement #1 of
284
- * issue #2539 describes, where only the auto-complete direction was ever
285
- * repaired and the reverse rotted unobserved.
286
- *
287
- * `excludeLabels` removes labels from consideration entirely. Callers MUST pass
288
- * the untrusted set here: `open-label-closed-state` is a repair direction that
289
- * WRITES (it advances the label to the terminal `done` role), so without this a
290
- * bot-applied label the classifier just refused to believe would still drive a
291
- * real label write — the guard would launder the very input it rejected.
278
+ * Detect every native-state contradiction, excluding untrusted labels.
279
+ * Only an explicit not-planned reason selects the retire-only repair.
292
280
  *
293
281
  * @param {{
294
282
  * readonly labels?: readonly (string | { readonly name?: string })[]
295
283
  * readonly state?: string
284
+ * readonly stateReason?: string
296
285
  * readonly terminalLabels?: readonly string[]
297
286
  * readonly excludeLabels?: readonly string[]
298
287
  * }} input
@@ -317,6 +306,11 @@ export function detectLifecycleDrift(input = {}) {
317
306
  String(input.state ?? "")
318
307
  .trim()
319
308
  .toLowerCase() === "closed";
309
+ const abandoned =
310
+ closed &&
311
+ String(input.stateReason ?? "")
312
+ .trim()
313
+ .toLowerCase() === NOT_PLANNED;
320
314
  const allLifecycleLabels = normalizeLabelNames(input.labels).filter(
321
315
  isLifecycleLabel
322
316
  );
@@ -333,7 +327,14 @@ export function detectLifecycleDrift(input = {}) {
333
327
  return [{ direction: "terminal-label-open-state", label }];
334
328
  }
335
329
  if (!isTerminal && closed) {
336
- return [{ direction: "open-label-closed-state", label }];
330
+ return [
331
+ {
332
+ direction: abandoned
333
+ ? "open-label-abandoned-state"
334
+ : "open-label-closed-state",
335
+ label,
336
+ },
337
+ ];
337
338
  }
338
339
  return [];
339
340
  });
@@ -538,6 +539,8 @@ async function main() {
538
539
  const drift = detectLifecycleDrift({
539
540
  labels: issue.labels,
540
541
  state: issue.state,
542
+ // REST and GitHub CLI use different field names for the same reason.
543
+ stateReason: issue.state_reason ?? issue.stateReason,
541
544
  terminalLabels: terminalLifecycleLabels(payload.config),
542
545
  excludeLabels: trust.untrusted.map(entry => entry.label),
543
546
  });
@@ -491,7 +491,11 @@ Before the claim mutation, apply `claim-time-guards` — **Value before claim**,
491
491
  1. **`two-failed-attempts` valve.** Count `[lisa-build-attempt]` markers on the issue from the read bundle's comments (match on the marker, never the title), applying both filters from `claim-time-guards`: count a marker only when it carries `measures=work` (a marker with no `measures=` counts as `work`), and only when its `createdAt` is **after the issue most recently gained the ready label**. The ready-lane entry comes from the read bundle's `LabeledEvent` stream, which is already fetched — no extra call. If that history is `unknown`, count every `measures=work` marker regardless of age and say so in the comment. With two or more surviving markers, do **not** claim: relabel to the configured blocked role (`gh issue edit <number> --repo <org>/<repo> --remove-label "$READY" --add-label "$BLOCKED"`, resolved from `github.labels.build.blocked` per `config-resolution`), post the operator-readable comment naming both attempts, and **stop the cycle** at Phase 3e. Every non-success terminal outcome recorded in 3c/3d also appends a fresh `<!-- [lisa-build-attempt] n=<N> outcome=<outcome> measures=<work|machine> -->` marker so the next cycle can count it — `measures=machine` when the run was terminated by a signal or its outcome was `recovery-required`, `measures=work` when the build ran and did not satisfy the issue.
492
492
  2. **`already-implemented` check.** Probe for this issue's own key — `git log --all --grep "<org>/<repo>#<number>"` and `gh pr list --repo <org>/<repo> --state all --search "<org>/<repo>#<number>" --json number,state,mergedAt,url`. On a hit, claim as normal but route 3c to **verify-and-close** instead of `lisa-implement`: verify what shipped against the issue's acceptance criteria, post evidence via `lisa-github-evidence` naming the shipping PR/commit, then run the ordinary 3d transition and 3d.1 rollup. A partial hit implements only the remaining gap. An unreadable history degrades to "no hit" and the ordinary path proceeds — the guard never blocks the claim. This is not `DUPLICATE_ALREADY_FIXED` (a *different* canonical issue) and not `claim-archaeology` (a *different* ancestor issue); it is this issue's own work already having shipped without a transition.
493
493
 
494
+ Immediately before claiming, re-read native state. If it is closed, skip it without
495
+ relabeling or dispatching; an unreadable state holds the candidate.
496
+
494
497
  ```bash
498
+ gh issue view <number> --repo <org>/<repo> --json state -q '.state' # must be OPEN
495
499
  gh issue edit <number> --repo <org>/<repo> --remove-label "$READY" --add-label "$CLAIMED"
496
500
  # Assign to the authenticated user ONLY when the issue is currently unassigned (attributable claim;
497
501
  # do not pile a second assignee onto an issue that already has an owner):
@@ -536,7 +540,7 @@ The lifecycle run returns one of the following outcomes; resume this scanner wit
536
540
 
537
541
  - **Success** — the build flow completed and a PR exists; evidence posted. The PR may already be **merged** or still **open** (auto-merge enabled, awaiting checks/merge). "Success" means the build work is sound — it does **not** assert the change reached an environment. The env transition in 3d gates on the PR actually being merged; an open PR does not advance the issue to a `done` env status.
538
542
  - **Blocked by github-verify pre-flight gate** — the pre-flight gate (github-agent workflow step 2) relabels the issue to `status:blocked` (or removes `$CLAIMED` and reassigns to the original author). This is correct and expected — let it stand. Record and move on.
539
- - **Duplicate already fixed** — `lisa-ticket-triage` returned `DUPLICATE_ALREADY_FIXED` with a canonical issue reference and empirical base-branch evidence. Post the triage finding, ensure the native `duplicates <canonical>` relationship exists when GitHub exposes it (otherwise leave an explicit cross-reference comment/body link), remove `$CLAIMED`, add the terminal `$DONE` label, close the issue with `gh issue close --reason "not planned"`, and do not open a PR. If the canonical fix is merged but not yet on the production branch, the close comment must say the production error can recur until the canonical issue promotes and that recurrence is tracked by the canonical issue; do not reopen this duplicate for that recurrence.
543
+ - **Duplicate already fixed** — `lisa-ticket-triage` returned `DUPLICATE_ALREADY_FIXED` with a canonical issue reference and empirical base-branch evidence. Follow 3c.1 to link the duplicate, remove lifecycle roles, and close it as not planned without adding a done label or opening a PR. If the canonical fix is merged but not yet on the production branch, the close comment must say the production error can recur until the canonical issue promotes and that recurrence is tracked by the canonical issue; do not reopen this duplicate for that recurrence.
540
544
  - **Blocked by ticket-triage ambiguities** — triage posts findings and the lifecycle stops. The issue stays in `$CLAIMED`. Surface to human; do not auto-relabel. Record under "Errors".
541
545
  - **Errored** — exception, missing config, etc. Leave the issue in `$CLAIMED` for human investigation. Record under "Errors".
542
546
 
@@ -547,12 +551,12 @@ Run this only when the returned triage verdict is exactly `DUPLICATE_ALREADY_FIX
547
551
  1. Verify the structured result includes a canonical issue reference, the canonical PR/commit, and empirical evidence that the canonical fix is present on the base branch. If any piece is missing, treat the outcome as Held instead of closing.
548
552
  2. Post or preserve the triage-finding comment that explains why this issue is a duplicate and names the canonical issue.
549
553
  3. Ensure a native `duplicates <canonical>` link exists when GitHub exposes issue relationships; if this installation cannot create that relationship, leave an explicit issue cross-reference comment/body link and record the limitation in the summary.
550
- 4. Resolve terminal `$DONE` exactly as in Phase 3d. For a single-env repo, `$DONE` is terminal; for env-keyed config, only the production/final value is terminal.
551
- 5. Apply `$DONE` and retire every competing lifecycle role the issue currently carries — not just `$CLAIMED` — per the `leaf-only-lifecycle` rule's "Exactly one lifecycle role survives closure". Then close the issue as duplicate/not-planned:
554
+ 4. Resolve the configured lifecycle role set, including every environment's done value.
555
+ 5. Remove every lifecycle role the issue currently carries. Add no done label: this duplicate is being declined, and the canonical issue records delivery. Close as duplicate/not-planned:
552
556
 
553
557
  ```bash
554
558
  gh issue view <number> --repo <org>/<repo> --json labels -q '[.labels[].name] | join(" ")'
555
- gh issue edit <number> --repo <org>/<repo> --add-label "$DONE" <one --remove-label "<role>" per competing role the issue CURRENTLY carries>
559
+ gh issue edit <number> --repo <org>/<repo> <one --remove-label "<role>" per lifecycle role the issue CURRENTLY carries; skip when none>
556
560
  gh issue close <number> --repo <org>/<repo> --reason "not planned"
557
561
  ```
558
562
 
@@ -562,7 +566,7 @@ gh issue close <number> --repo <org>/<repo> --reason "not planned"
562
566
  gh issue view <number> --repo <org>/<repo> --json state,stateReason,labels
563
567
  ```
564
568
 
565
- It must read `state: CLOSED` with `stateReason: NOT_PLANNED`, carry `$DONE`, and carry **no** other lifecycle role. Anything else is an Error naming what is still present. Post the closeout comment only after that passes:
569
+ It must read `state: CLOSED` with `stateReason: NOT_PLANNED` and carry **no** lifecycle role, including `$DONE`. Anything else is an Error naming what is still present. Post the closeout comment only after that passes:
566
570
 
567
571
  ```bash
568
572
  gh issue comment <number> --repo <org>/<repo> --body "[claude-build-intake] Closed as duplicate of <canonical>. Canonical fix: <PR-or-commit>. Evidence: <base-branch-proof>."