@codyswann/lisa 8.1.1 → 8.2.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.
Files changed (228) hide show
  1. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  2. package/dist/core/upstream-evidence-manifest.json +138 -11
  3. package/package.json +4 -4
  4. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  5. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  6. package/plugins/lisa/.codex-plugin/scripts/queue-contract-resolution.mjs +583 -0
  7. package/plugins/lisa/.codex-plugin/scripts/ready-queue-order.mjs +99 -25
  8. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-comment.mjs +185 -0
  9. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-confirm.mjs +130 -0
  10. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-edges.mjs +466 -0
  11. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-pending.mjs +257 -0
  12. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-restore.mjs +180 -0
  13. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-summary.mjs +222 -0
  14. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-sweep.mjs +394 -0
  15. package/plugins/lisa/.codex-plugin/scripts/stale-blocker-verify.mjs +193 -0
  16. package/plugins/lisa/.codex-plugin/skills/lisa-atlassian-access/SKILL.md +1 -0
  17. package/plugins/lisa/.codex-plugin/skills/lisa-github-build-intake/SKILL.md +2 -7
  18. package/plugins/lisa/.codex-plugin/skills/lisa-jira-build-intake/SKILL.md +2 -0
  19. package/plugins/lisa/.codex-plugin/skills/lisa-linear-access/SKILL.md +44 -0
  20. package/plugins/lisa/.codex-plugin/skills/lisa-linear-build-intake/SKILL.md +2 -0
  21. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +127 -2
  22. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  23. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  24. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  25. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  26. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  27. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  28. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  29. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
  30. package/plugins/lisa/scripts/ready-queue-order.mjs +99 -25
  31. package/plugins/lisa/scripts/stale-blocker-comment.mjs +185 -0
  32. package/plugins/lisa/scripts/stale-blocker-confirm.mjs +130 -0
  33. package/plugins/lisa/scripts/stale-blocker-edges.mjs +466 -0
  34. package/plugins/lisa/scripts/stale-blocker-pending.mjs +257 -0
  35. package/plugins/lisa/scripts/stale-blocker-restore.mjs +180 -0
  36. package/plugins/lisa/scripts/stale-blocker-summary.mjs +222 -0
  37. package/plugins/lisa/scripts/stale-blocker-sweep.mjs +394 -0
  38. package/plugins/lisa/scripts/stale-blocker-verify.mjs +193 -0
  39. package/plugins/lisa/skills/lisa-atlassian-access/SKILL.md +1 -0
  40. package/plugins/lisa/skills/lisa-github-build-intake/SKILL.md +2 -7
  41. package/plugins/lisa/skills/lisa-jira-build-intake/SKILL.md +2 -0
  42. package/plugins/lisa/skills/lisa-linear-access/SKILL.md +44 -0
  43. package/plugins/lisa/skills/lisa-linear-build-intake/SKILL.md +2 -0
  44. package/plugins/lisa/skills/lisa-session-manager/SKILL.md +127 -2
  45. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  46. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  47. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  48. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  49. package/plugins/lisa/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  50. package/plugins/lisa/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  51. package/plugins/lisa/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  52. package/plugins/lisa/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
  53. package/plugins/lisa-agy/plugin.json +1 -1
  54. package/plugins/lisa-agy/scripts/ready-queue-order.mjs +99 -25
  55. package/plugins/lisa-agy/scripts/stale-blocker-comment.mjs +185 -0
  56. package/plugins/lisa-agy/scripts/stale-blocker-confirm.mjs +130 -0
  57. package/plugins/lisa-agy/scripts/stale-blocker-edges.mjs +466 -0
  58. package/plugins/lisa-agy/scripts/stale-blocker-pending.mjs +257 -0
  59. package/plugins/lisa-agy/scripts/stale-blocker-restore.mjs +180 -0
  60. package/plugins/lisa-agy/scripts/stale-blocker-summary.mjs +222 -0
  61. package/plugins/lisa-agy/scripts/stale-blocker-sweep.mjs +394 -0
  62. package/plugins/lisa-agy/scripts/stale-blocker-verify.mjs +193 -0
  63. package/plugins/lisa-agy/skills/lisa-atlassian-access/SKILL.md +1 -0
  64. package/plugins/lisa-agy/skills/lisa-github-build-intake/SKILL.md +2 -7
  65. package/plugins/lisa-agy/skills/lisa-jira-build-intake/SKILL.md +2 -0
  66. package/plugins/lisa-agy/skills/lisa-linear-access/SKILL.md +44 -0
  67. package/plugins/lisa-agy/skills/lisa-linear-build-intake/SKILL.md +2 -0
  68. package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +127 -2
  69. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  70. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  71. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  72. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  73. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  74. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  75. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  76. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
  77. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  79. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  80. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  81. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  84. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  85. package/plugins/lisa-copilot/scripts/ready-queue-order.mjs +99 -25
  86. package/plugins/lisa-copilot/scripts/stale-blocker-comment.mjs +185 -0
  87. package/plugins/lisa-copilot/scripts/stale-blocker-confirm.mjs +130 -0
  88. package/plugins/lisa-copilot/scripts/stale-blocker-edges.mjs +466 -0
  89. package/plugins/lisa-copilot/scripts/stale-blocker-pending.mjs +257 -0
  90. package/plugins/lisa-copilot/scripts/stale-blocker-restore.mjs +180 -0
  91. package/plugins/lisa-copilot/scripts/stale-blocker-summary.mjs +222 -0
  92. package/plugins/lisa-copilot/scripts/stale-blocker-sweep.mjs +394 -0
  93. package/plugins/lisa-copilot/scripts/stale-blocker-verify.mjs +193 -0
  94. package/plugins/lisa-copilot/skills/lisa-atlassian-access/SKILL.md +1 -0
  95. package/plugins/lisa-copilot/skills/lisa-github-build-intake/SKILL.md +2 -7
  96. package/plugins/lisa-copilot/skills/lisa-jira-build-intake/SKILL.md +2 -0
  97. package/plugins/lisa-copilot/skills/lisa-linear-access/SKILL.md +44 -0
  98. package/plugins/lisa-copilot/skills/lisa-linear-build-intake/SKILL.md +2 -0
  99. package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +127 -2
  100. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  101. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  102. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  103. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  104. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  105. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  106. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  107. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
  108. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  109. package/plugins/lisa-cursor/scripts/ready-queue-order.mjs +99 -25
  110. package/plugins/lisa-cursor/scripts/stale-blocker-comment.mjs +185 -0
  111. package/plugins/lisa-cursor/scripts/stale-blocker-confirm.mjs +130 -0
  112. package/plugins/lisa-cursor/scripts/stale-blocker-edges.mjs +466 -0
  113. package/plugins/lisa-cursor/scripts/stale-blocker-pending.mjs +257 -0
  114. package/plugins/lisa-cursor/scripts/stale-blocker-restore.mjs +180 -0
  115. package/plugins/lisa-cursor/scripts/stale-blocker-summary.mjs +222 -0
  116. package/plugins/lisa-cursor/scripts/stale-blocker-sweep.mjs +394 -0
  117. package/plugins/lisa-cursor/scripts/stale-blocker-verify.mjs +193 -0
  118. package/plugins/lisa-cursor/skills/lisa-atlassian-access/SKILL.md +1 -0
  119. package/plugins/lisa-cursor/skills/lisa-github-build-intake/SKILL.md +2 -7
  120. package/plugins/lisa-cursor/skills/lisa-jira-build-intake/SKILL.md +2 -0
  121. package/plugins/lisa-cursor/skills/lisa-linear-access/SKILL.md +44 -0
  122. package/plugins/lisa-cursor/skills/lisa-linear-build-intake/SKILL.md +2 -0
  123. package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +127 -2
  124. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  125. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  126. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  127. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  128. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  129. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  130. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  131. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
  132. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  133. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  134. package/plugins/lisa-devin/scripts/ready-queue-order.mjs +99 -25
  135. package/plugins/lisa-devin/scripts/stale-blocker-comment.mjs +185 -0
  136. package/plugins/lisa-devin/scripts/stale-blocker-confirm.mjs +130 -0
  137. package/plugins/lisa-devin/scripts/stale-blocker-edges.mjs +466 -0
  138. package/plugins/lisa-devin/scripts/stale-blocker-pending.mjs +257 -0
  139. package/plugins/lisa-devin/scripts/stale-blocker-restore.mjs +180 -0
  140. package/plugins/lisa-devin/scripts/stale-blocker-summary.mjs +222 -0
  141. package/plugins/lisa-devin/scripts/stale-blocker-sweep.mjs +394 -0
  142. package/plugins/lisa-devin/scripts/stale-blocker-verify.mjs +193 -0
  143. package/plugins/lisa-devin/skills/lisa-atlassian-access/SKILL.md +1 -0
  144. package/plugins/lisa-devin/skills/lisa-github-build-intake/SKILL.md +2 -7
  145. package/plugins/lisa-devin/skills/lisa-jira-build-intake/SKILL.md +2 -0
  146. package/plugins/lisa-devin/skills/lisa-linear-access/SKILL.md +44 -0
  147. package/plugins/lisa-devin/skills/lisa-linear-build-intake/SKILL.md +2 -0
  148. package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +127 -2
  149. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  150. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  151. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  152. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  153. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  154. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  155. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  156. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
  157. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  158. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  159. package/plugins/lisa-expo-agy/plugin.json +1 -1
  160. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  161. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  162. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  163. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  164. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  165. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  166. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  167. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  168. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  169. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  170. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  171. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  172. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  173. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  174. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  175. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  176. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  177. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  178. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  179. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  180. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  181. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  182. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  183. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  184. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  185. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  186. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  187. package/plugins/lisa-rails-agy/plugin.json +1 -1
  188. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  189. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  190. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  191. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  192. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  193. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  194. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  195. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  196. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  197. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  198. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  199. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  200. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  201. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  202. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  203. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  204. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  205. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  206. package/plugins/src/base/scripts/ready-queue-order.mjs +99 -25
  207. package/plugins/src/base/scripts/stale-blocker-comment.mjs +185 -0
  208. package/plugins/src/base/scripts/stale-blocker-confirm.mjs +130 -0
  209. package/plugins/src/base/scripts/stale-blocker-edges.mjs +466 -0
  210. package/plugins/src/base/scripts/stale-blocker-pending.mjs +257 -0
  211. package/plugins/src/base/scripts/stale-blocker-restore.mjs +180 -0
  212. package/plugins/src/base/scripts/stale-blocker-summary.mjs +222 -0
  213. package/plugins/src/base/scripts/stale-blocker-sweep.mjs +394 -0
  214. package/plugins/src/base/scripts/stale-blocker-verify.mjs +193 -0
  215. package/plugins/src/base/skills/lisa-atlassian-access/SKILL.md +1 -0
  216. package/plugins/src/base/skills/lisa-github-build-intake/SKILL.md +2 -7
  217. package/plugins/src/base/skills/lisa-jira-build-intake/SKILL.md +2 -0
  218. package/plugins/src/base/skills/lisa-linear-access/SKILL.md +44 -0
  219. package/plugins/src/base/skills/lisa-linear-build-intake/SKILL.md +2 -0
  220. package/plugins/src/base/skills/lisa-session-manager/SKILL.md +127 -2
  221. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-queue.mjs +90 -20
  222. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-stale-links-results.mjs +254 -0
  223. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-stale-links.mjs +243 -0
  224. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +60 -0
  225. package/plugins/src/base/skills/lisa-session-manager/scripts/queue-github.mjs +68 -8
  226. package/plugins/src/base/skills/lisa-session-manager/scripts/session-manager.mjs +49 -0
  227. package/plugins/src/base/skills/lisa-session-manager/scripts/stale-links-github.mjs +196 -0
  228. package/plugins/src/base/skills/lisa-session-manager/scripts/stale-links-state.mjs +173 -0
@@ -52,6 +52,14 @@ import { orphanPlan } from "./cli-orphans.mjs";
52
52
  import { overruledPlan } from "./cli-overruled.mjs";
53
53
  import { repoDir, start, status, stop, validate } from "./cli-manager.mjs";
54
54
  import { queue } from "./cli-queue.mjs";
55
+ import { staleLinksConfirm, staleLinksPlan } from "./cli-stale-links.mjs";
56
+ import {
57
+ staleLinksPending,
58
+ staleLinksPosted,
59
+ staleLinksReport,
60
+ staleLinksRestored,
61
+ staleLinksVerify,
62
+ } from "./cli-stale-links-results.mjs";
55
63
  import { CliError, EXIT } from "./cli-runtime.mjs";
56
64
  import {
57
65
  coexistence,
@@ -134,6 +142,47 @@ const COMMANDS = {
134
142
  options: { input: text, max: text },
135
143
  positionals: 0,
136
144
  },
145
+ "stale-links-plan": {
146
+ run: staleLinksPlan,
147
+ options: { tracker: text, input: text, max: text, "github-repo": text },
148
+ positionals: 0,
149
+ },
150
+ "stale-links-confirm": {
151
+ run: staleLinksConfirm,
152
+ options: { tracker: text, input: text, plan: text, "github-repo": text },
153
+ positionals: 0,
154
+ },
155
+ "stale-links-verify": {
156
+ run: staleLinksVerify,
157
+ options: {
158
+ tracker: text,
159
+ input: text,
160
+ plan: text,
161
+ blockers: text,
162
+ "github-repo": text,
163
+ },
164
+ positionals: 0,
165
+ },
166
+ "stale-links-pending": {
167
+ run: staleLinksPending,
168
+ options: {},
169
+ positionals: 0,
170
+ },
171
+ "stale-links-posted": {
172
+ run: staleLinksPosted,
173
+ options: { ref: text, removed: text, failed: flag },
174
+ positionals: 0,
175
+ },
176
+ "stale-links-restored": {
177
+ run: staleLinksRestored,
178
+ options: { tracker: text, input: text, ref: text, "github-repo": text },
179
+ positionals: 0,
180
+ },
181
+ "stale-links-report": {
182
+ run: staleLinksReport,
183
+ options: { input: text },
184
+ positionals: 0,
185
+ },
137
186
  "orphan-plan": {
138
187
  run: orphanPlan,
139
188
  options: { input: text, max: text, "stale-hours": text },
@@ -0,0 +1,196 @@
1
+ /**
2
+ * The GitHub reads behind `stale-links-plan --tracker github`
3
+ * (CodySwannGT/lisa#5065): every open issue, the native `blocked_by`
4
+ * dependencies of those that have any, the issue each `Blocked by` body line
5
+ * names, and the comments of every issue with a blocker (for the marker
6
+ * dedupe). Every read goes through `gh`, GitHub's access layer, with
7
+ * the scrubbed worker env. A blocker that cannot be read is passed on as
8
+ * null, so the plan reports it as inaccessible instead of guessing.
9
+ * @module session-manager/stale-links-github
10
+ */
11
+ import { parseBlockedByRefs } from "../../../scripts/stale-blocker-edges.mjs";
12
+ import { CliError, mustRun, run } from "./cli-runtime.mjs";
13
+ import { parseJson } from "./json-input.mjs";
14
+ import { scrubWorkerEnv } from "./workers.mjs";
15
+
16
+ /**
17
+ * Every page of one paginated `gh api` list, flattened.
18
+ * @param {object} ctx - CLI context
19
+ * @param {string} endpoint
20
+ * @returns {object[]}
21
+ */
22
+ function listAll(ctx, endpoint) {
23
+ const stdout = mustRun("gh", ["api", "--paginate", "--slurp", endpoint], {
24
+ env: scrubWorkerEnv(ctx.env),
25
+ });
26
+ const pages = parseJson(stdout, `gh api ${endpoint}`);
27
+ return Array.isArray(pages) ? pages.flat() : [];
28
+ }
29
+
30
+ /**
31
+ * One issue by canonical ref, or null when it cannot be read.
32
+ *
33
+ * probe-direction: fail-closed — a null blocker is judged inaccessible, so its
34
+ * link is kept and reported, never removed; a failed read can only shrink what
35
+ * the sweep clears.
36
+ * @param {object} ctx - CLI context
37
+ * @param {string} ref - `owner/repo#n`
38
+ * @returns {object | null}
39
+ */
40
+ function readIssue(ctx, ref) {
41
+ const [repo, number] = ref.split("#");
42
+ const result = run("gh", ["api", `repos/${repo}/issues/${number}`], {
43
+ env: scrubWorkerEnv(ctx.env),
44
+ });
45
+ if (result.missing) throw new CliError("gh is not on PATH.", 1);
46
+ if (result.status !== 0) return null;
47
+ try {
48
+ return JSON.parse(result.stdout);
49
+ } catch {
50
+ return null;
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Whether an issue has any native blocker, open or closed.
56
+ * @param {Record<string, any>} row - REST issue
57
+ * @returns {boolean}
58
+ */
59
+ const hasNativeBlockers = row =>
60
+ Number(row?.issue_dependencies_summary?.total_blocked_by ?? 0) > 0;
61
+
62
+ /**
63
+ * A cached reader for blocker issues, so a blocker named by several items is
64
+ * read once per command.
65
+ * @param {object} ctx - CLI context
66
+ * @returns {(ref: string) => object | null}
67
+ */
68
+ export function blockerReader(ctx) {
69
+ const cache = new Map();
70
+ return ref => {
71
+ if (!cache.has(ref)) cache.set(ref, readIssue(ctx, ref));
72
+ return cache.get(ref);
73
+ };
74
+ }
75
+
76
+ /**
77
+ * Whether a REST issue names any blocker, natively or in its body.
78
+ * @param {Record<string, any>} row - REST issue
79
+ * @param {string} repo - `owner/repo`
80
+ * @returns {boolean}
81
+ */
82
+ export const hasBlockers = (row, repo) =>
83
+ hasNativeBlockers(row) ||
84
+ parseBlockedByRefs(row?.body, repo.toLowerCase()).length > 0;
85
+
86
+ /**
87
+ * The REST issue with its blockers attached, in the shape the shared rule
88
+ * reads (`nativeBlockers`, `bodyBlockers`). An issue with no blocker gets
89
+ * empty ones without a single read.
90
+ * @param {object} ctx - CLI context
91
+ * @param {string} repo - `owner/repo`
92
+ * @param {Record<string, any>} row - REST issue
93
+ * @param {(ref: string) => object | null} blocker - From {@link blockerReader}
94
+ * @returns {Record<string, any>}
95
+ */
96
+ export function withBlockers(ctx, repo, row, blocker) {
97
+ const own = repo.toLowerCase();
98
+ const nativeBlockers = hasNativeBlockers(row)
99
+ ? listAll(
100
+ ctx,
101
+ `repos/${repo}/issues/${row.number}/dependencies/blocked_by?per_page=100`
102
+ )
103
+ : [];
104
+ const bodyBlockers = Object.fromEntries(
105
+ parseBlockedByRefs(row.body, own).map(ref => [ref, blocker(ref)])
106
+ );
107
+ return { ...row, nativeBlockers, bodyBlockers };
108
+ }
109
+
110
+ /**
111
+ * One issue with its blockers and comments, as the plan reads it.
112
+ * @param {object} ctx - CLI context
113
+ * @param {string} repo - `owner/repo`
114
+ * @param {Record<string, any>} row - REST issue
115
+ * @param {(ref: string) => object | null} blocker - From {@link blockerReader}
116
+ * @returns {Record<string, any>}
117
+ */
118
+ function staleLinkItem(ctx, repo, row, blocker) {
119
+ const enriched = readOrUnreadable(() =>
120
+ withBlockers(ctx, repo, row, blocker)
121
+ );
122
+ const comments = readOrUnreadable(() =>
123
+ listAll(ctx, `repos/${repo}/issues/${row.number}/comments?per_page=100`)
124
+ );
125
+ // probe-direction: fail-closed — a candidate whose dependency list or
126
+ // comments could not be read gets `nativeBlockers: null`, which the plan
127
+ // reads as "blocker list not read": it is reported and nothing of it is
128
+ // removed (without its comments, a link a person put back could not be
129
+ // told apart). Every other candidate is still planned.
130
+ const unreadable = enriched === null || comments === null;
131
+ return {
132
+ repo: repo.toLowerCase(),
133
+ number: row.number,
134
+ // Carried so confirm can skip an issue closed since the plan, and the
135
+ // ready claim can apply the queue's own container rule.
136
+ state: row.state ?? "",
137
+ sub_issues_summary: row.sub_issues_summary ?? null,
138
+ body: row.body ?? "",
139
+ labels: row.labels ?? [],
140
+ nativeBlockers: unreadable ? null : enriched.nativeBlockers,
141
+ bodyBlockers: unreadable ? {} : enriched.bodyBlockers,
142
+ // Every candidate can hold a stale link, so its comments are read for
143
+ // the marker dedupe; issues with no blocker are never read.
144
+ comments: comments ?? [],
145
+ };
146
+ }
147
+
148
+ /**
149
+ * Run one read, or return null when it fails (the caller decides what an
150
+ * unread result means; here it always holds the candidate back).
151
+ * @template T
152
+ * @param {() => T} read
153
+ * @returns {T | null}
154
+ */
155
+ function readOrUnreadable(read) {
156
+ try {
157
+ return read();
158
+ } catch {
159
+ // probe-direction: fail-closed — see staleLinkItem: null means "not
160
+ // read", which removes nothing.
161
+ return null;
162
+ }
163
+ }
164
+
165
+ /**
166
+ * Read every open issue with a blocker, ready for `planStaleLinkSweep`.
167
+ * @param {object} ctx - CLI context
168
+ * @param {string} repo - `owner/repo`
169
+ * @returns {{ items: object[] }}
170
+ */
171
+ export function collectGithubStaleLinkInput(ctx, repo) {
172
+ const blocker = blockerReader(ctx);
173
+ const items = listAll(ctx, `repos/${repo}/issues?state=open&per_page=100`)
174
+ .filter(row => !row.pull_request && hasBlockers(row, repo))
175
+ .map(row => staleLinkItem(ctx, repo, row, blocker));
176
+ return { items };
177
+ }
178
+
179
+ /**
180
+ * Re-read one issue, every blocker it names and its comments, right before
181
+ * the writes (`stale-links-confirm`).
182
+ * @param {object} ctx - CLI context
183
+ * @param {string} repo - `owner/repo`
184
+ * @param {number} number - Issue number
185
+ * @returns {Record<string, any>}
186
+ */
187
+ export function readGithubStaleLinkItem(ctx, repo, number) {
188
+ const row = readIssue(ctx, `${repo}#${number}`);
189
+ if (!row) {
190
+ throw new CliError(
191
+ `Could not read ${repo}#${number} to confirm the plan.`,
192
+ 1
193
+ );
194
+ }
195
+ return staleLinkItem(ctx, repo, row, blockerReader(ctx));
196
+ }
@@ -0,0 +1,173 @@
1
+ /**
2
+ * The session manager's stale-link state across cycles (CodySwannGT/lisa#5065),
3
+ * kept in its state directory:
4
+ *
5
+ * - `stale-links-pending.json`: comments owed for confirmed removals, until
6
+ * they post.
7
+ * - `stale-links-failures.json`: items whose planned removals did not
8
+ * happen, so the planner puts them after every other candidate.
9
+ * - `stale-links-inflight.json`: plans confirmed before their deletes, until
10
+ * a read-back succeeds, so a failed read-back is retried, not lost.
11
+ * - `stale-links-restores.json`: links put back after a blocker reopened,
12
+ * until a read-back shows them present; the queue holds those items.
13
+ *
14
+ * All are replaced atomically. Only a missing file reads as empty. Every
15
+ * read-change-write of either file runs inside {@link withStateLock}, the
16
+ * ledger's cross-process lock, so two overlapping commands on one project
17
+ * root never drop each other's owed comment or failure count.
18
+ * @module session-manager/stale-links-state
19
+ */
20
+ import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
21
+ import path from "node:path";
22
+
23
+ import { CliError } from "./cli-runtime.mjs";
24
+ import { withLedgerLock } from "./ledger-lock.mjs";
25
+
26
+ /**
27
+ * @param {string} root - Project root
28
+ * @param {string} name - File name
29
+ * @returns {string} The state file
30
+ */
31
+ const stateFile = (root, name) =>
32
+ path.join(root, ".lisa", "session-manager", name);
33
+
34
+ /**
35
+ * Run one whole read-change-write of the stale-link state under the
36
+ * project root's lock.
37
+ * @template T
38
+ * @param {string} root - Project root
39
+ * @param {() => T | Promise<T>} operation - Reads, changes and writes
40
+ * @returns {Promise<T>}
41
+ */
42
+ export async function withStateLock(root, operation) {
43
+ const target = stateFile(root, "stale-links-state");
44
+ mkdirSync(path.dirname(target), { recursive: true });
45
+ return withLedgerLock(target, undefined, async () => operation());
46
+ }
47
+
48
+ /**
49
+ * @param {string} root - Project root
50
+ * @returns {string} The pending-comments file
51
+ */
52
+ export const pendingPath = root => stateFile(root, "stale-links-pending.json");
53
+
54
+ /**
55
+ * @param {string} root - Project root
56
+ * @returns {string} The removal-failures file
57
+ */
58
+ export const failuresPath = root =>
59
+ stateFile(root, "stale-links-failures.json");
60
+
61
+ /**
62
+ * Read one state file.
63
+ * @param {string} file
64
+ * @param {(parsed: unknown) => boolean} valid - Shape check
65
+ * @param {unknown} empty - Value when the file does not exist yet
66
+ * @returns {any}
67
+ */
68
+ function readState(file, valid, empty) {
69
+ try {
70
+ const parsed = JSON.parse(readFileSync(file, "utf8"));
71
+ if (!valid(parsed)) throw new Error("unexpected shape");
72
+ return parsed;
73
+ } catch (error) {
74
+ // probe-direction: fail-closed — only a missing file reads as empty; an
75
+ // unreadable or corrupt one throws, so no owed comment or failure count
76
+ // is silently dropped.
77
+ if (error?.code === "ENOENT") return empty;
78
+ throw new CliError(`${file}: ${error.message}`, 1);
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Replace one state file atomically.
84
+ * @param {string} file
85
+ * @param {unknown} value
86
+ * @returns {void}
87
+ */
88
+ function writeState(file, value) {
89
+ mkdirSync(path.dirname(file), { recursive: true });
90
+ const temp = `${file}.${process.pid}.tmp`;
91
+ writeFileSync(temp, `${JSON.stringify(value, null, 2)}\n`);
92
+ renameSync(temp, file);
93
+ }
94
+
95
+ /**
96
+ * @param {unknown} value
97
+ * @returns {boolean}
98
+ */
99
+ const isRecord = value =>
100
+ Boolean(value) && typeof value === "object" && !Array.isArray(value);
101
+
102
+ /**
103
+ * @param {string} root
104
+ * @returns {import("../../../scripts/stale-blocker-pending.mjs").PendingComment[]}
105
+ */
106
+ export const readPending = root =>
107
+ readState(pendingPath(root), Array.isArray, []);
108
+
109
+ /**
110
+ * @param {string} root
111
+ * @param {readonly object[]} pending
112
+ * @returns {void}
113
+ */
114
+ export const writePending = (root, pending) =>
115
+ writeState(pendingPath(root), pending);
116
+
117
+ /**
118
+ * @param {string} root
119
+ * @returns {import("../../../scripts/stale-blocker-pending.mjs").RemovalFailures}
120
+ */
121
+ export const readFailures = root => readState(failuresPath(root), isRecord, {});
122
+
123
+ /**
124
+ * @param {string} root
125
+ * @param {object} failures
126
+ * @returns {void}
127
+ */
128
+ export const writeFailures = (root, failures) =>
129
+ writeState(failuresPath(root), failures);
130
+
131
+ /**
132
+ * @param {string} root - Project root
133
+ * @returns {string} The in-flight file: plans confirmed whose read-back has
134
+ * not succeeded yet
135
+ */
136
+ export const inFlightPath = root =>
137
+ stateFile(root, "stale-links-inflight.json");
138
+
139
+ /**
140
+ * @param {string} root - Project root
141
+ * @returns {string} The owed-restores file: links put back whose read-back
142
+ * has not shown them present yet
143
+ */
144
+ export const restoresPath = root =>
145
+ stateFile(root, "stale-links-restores.json");
146
+
147
+ /**
148
+ * @param {string} root
149
+ * @returns {import("../../../scripts/stale-blocker-pending.mjs").InFlight}
150
+ */
151
+ export const readInFlight = root => readState(inFlightPath(root), isRecord, {});
152
+
153
+ /**
154
+ * @param {string} root
155
+ * @param {object} inflight
156
+ * @returns {void}
157
+ */
158
+ export const writeInFlight = (root, inflight) =>
159
+ writeState(inFlightPath(root), inflight);
160
+
161
+ /**
162
+ * @param {string} root
163
+ * @returns {import("../../../scripts/stale-blocker-pending.mjs").OwedRestores}
164
+ */
165
+ export const readRestores = root => readState(restoresPath(root), isRecord, {});
166
+
167
+ /**
168
+ * @param {string} root
169
+ * @param {object} restores
170
+ * @returns {void}
171
+ */
172
+ export const writeRestores = (root, restores) =>
173
+ writeState(restoresPath(root), restores);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "8.1.1",
3
+ "version": "8.2.0",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "8.1.1",
3
+ "version": "8.2.0",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -53,6 +53,12 @@ import {
53
53
  isHumanGated,
54
54
  } from "./intake-blocker-reprobe.mjs";
55
55
  import { entryMatches, parseIdEntries } from "./operator-id-kinds.mjs";
56
+ import {
57
+ countUnresolvedBlockers,
58
+ githubBlockerEdges,
59
+ jiraBlockerEdges,
60
+ linearBlockerEdges,
61
+ } from "./stale-blocker-edges.mjs";
56
62
 
57
63
  /** Rank for GitHub `priority:<value>` labels; no label ranks 4. */
58
64
  const GITHUB_PRIORITY_RANKS = Object.freeze({
@@ -84,9 +90,6 @@ const LINEAR_NO_PRIORITY = 4;
84
90
  /** Linear workflow state types that leave a child finished. */
85
91
  const LINEAR_FINISHED_STATE_TYPES = new Set(["completed", "canceled"]);
86
92
 
87
- /** Jira link types whose inward side reads as "this item is blocked by". */
88
- const JIRA_BLOCKED_BY = /blocked by/i;
89
-
90
93
  /**
91
94
  * @param {unknown} value
92
95
  * @returns {string}
@@ -133,7 +136,7 @@ function nodesOf(list) {
133
136
  * @param {unknown} labels
134
137
  * @returns {string[]}
135
138
  */
136
- function labelNames(labels) {
139
+ export function labelNames(labels) {
137
140
  const list = Array.isArray(labels)
138
141
  ? labels
139
142
  : Array.isArray(labels?.nodes)
@@ -159,10 +162,11 @@ function repoLabelsOf(labels) {
159
162
  /**
160
163
  * Flatten an Atlassian Document Format node to plain text, one line per block.
161
164
  * A string description (the Markdown some access paths return) passes through.
165
+ * Also reads Jira comment bodies for the stale-link marker dedupe (#5065).
162
166
  * @param {unknown} node
163
167
  * @returns {string}
164
168
  */
165
- function adfText(node) {
169
+ export function adfText(node) {
166
170
  if (typeof node === "string") return node;
167
171
  if (!node || typeof node !== "object") return "";
168
172
  if (node.type === "text") return text(node.text);
@@ -172,12 +176,45 @@ function adfText(node) {
172
176
  return children.map(adfText).join(joiner);
173
177
  }
174
178
 
179
+ /**
180
+ * How many blockers still hold a GitHub issue.
181
+ *
182
+ * When the fetch attached the blockers (`nativeBlockers`, `bodyBlockers`, as
183
+ * the session manager's queue does), the shared stale-link rule decides
184
+ * (#5065): native dependencies AND `Blocked by` body lines, a blocker in the
185
+ * configured terminal done label counting as finished, as intake judges it.
186
+ * A row fetched without them falls back to GitHub's own summary, whose
187
+ * `blocked_by` counts open native blockers only.
188
+ * @param {Record<string, any>} issue - REST issue, optionally with blockers
189
+ * @param {string} repo - `owner/repo`
190
+ * @param {{ doneRoles?: readonly string[], landedRoles?: readonly string[] }} options - Configured terminal and non-terminal done labels
191
+ * @returns {number}
192
+ */
193
+ function githubOpenBlockers(issue, repo, options) {
194
+ // Blockers that could not be read hold the item: at least one.
195
+ if (issue.blockersUnreadable === true) {
196
+ return Math.max(1, count(issue.issue_dependencies_summary?.blocked_by));
197
+ }
198
+ if (!Array.isArray(issue.nativeBlockers) && !issue.bodyBlockers) {
199
+ return count(issue.issue_dependencies_summary?.blocked_by);
200
+ }
201
+ return countUnresolvedBlockers(
202
+ githubBlockerEdges({ ...issue, repo }),
203
+ options.doneRoles ?? [],
204
+ repo,
205
+ options.landedRoles
206
+ );
207
+ }
208
+
175
209
  /**
176
210
  * Normalize one GitHub REST issue row. Returns null for a pull-request row,
177
211
  * which the issues endpoint returns alongside issues and which is never a
178
212
  * dispatchable leaf.
179
213
  * @param {Record<string, any>} issue - REST `issues` list row
180
- * @param {{ repo?: string }} [options] - `owner/repo`, else read from repository_url
214
+ * @param {{ repo?: string, doneRoles?: readonly string[], landedRoles?: readonly string[] }} [options] -
215
+ * `owner/repo`, else read from repository_url; the configured terminal done
216
+ * labels (`terminalDoneRoles`) for the blocker rule, and the intermediate
217
+ * ones (`landedDoneRoles`), which hold nothing
181
218
  * @returns {ReturnType<typeof shape> | null}
182
219
  */
183
220
  export function normalizeGithubIssue(issue, options = {}) {
@@ -214,8 +251,8 @@ export function normalizeGithubIssue(issue, options = {}) {
214
251
  // `id:` like any author. No integration-only authorship exists here.
215
252
  authorIntegration: null,
216
253
  isContainer: Number(summary?.total ?? 0) > Number(summary?.completed ?? 0),
217
- // `blocked_by` in the dependency summary counts only OPEN blockers.
218
- openBlockers: count(issue.issue_dependencies_summary?.blocked_by),
254
+ openBlockers: githubOpenBlockers(issue, repo, options),
255
+ blockersUnreadable: issue.blockersUnreadable === true,
219
256
  });
220
257
  }
221
258
 
@@ -223,9 +260,12 @@ export function normalizeGithubIssue(issue, options = {}) {
223
260
  * Normalize one Jira REST/MCP issue. An epic (hierarchy level above 0) or an
224
261
  * issue with any subtask not yet in the done category is a container.
225
262
  * @param {Record<string, any>} issue - Issue with `key` and `fields`
263
+ * @param {{ doneRoles?: readonly string[], landedRoles?: readonly string[] }} [options] - Configured terminal
264
+ * done names (`terminalDoneRoles`), so a blocker there is finished, and
265
+ * the intermediate ones (`landedDoneRoles`), so a blocker there holds nothing
226
266
  * @returns {ReturnType<typeof shape>}
227
267
  */
228
- export function normalizeJiraIssue(issue) {
268
+ export function normalizeJiraIssue(issue, options = {}) {
229
269
  const fields = issue?.fields ?? {};
230
270
  const labels = labelNames(fields.labels);
231
271
  const priority = text(fields.priority?.name).trim().toLowerCase();
@@ -233,12 +273,15 @@ export function normalizeJiraIssue(issue) {
233
273
  const openSubtasks = (Array.isArray(fields.subtasks) ? fields.subtasks : [])
234
274
  .map(sub => sub?.fields?.status?.statusCategory?.key)
235
275
  .filter(category => category !== "done");
236
- const openBlockers = nodesOf(fields.issuelinks).filter(
237
- link =>
238
- link?.inwardIssue &&
239
- JIRA_BLOCKED_BY.test(text(link.type?.inward)) &&
240
- link.inwardIssue.fields?.status?.statusCategory?.key !== "done"
241
- ).length;
276
+ // One rule with the stale-link sweep (#5065): a blocker in the configured
277
+ // done status is finished even where its status category is not `done`,
278
+ // but only in this item's own project, which is the one that declares it.
279
+ const openBlockers = countUnresolvedBlockers(
280
+ jiraBlockerEdges(issue),
281
+ options.doneRoles ?? [],
282
+ text(issue?.key).split("-")[0],
283
+ options.landedRoles
284
+ );
242
285
 
243
286
  return shape({
244
287
  ref: text(issue?.key),
@@ -299,9 +342,12 @@ function linearIntegrationAuthor(issue) {
299
342
  * Normalize one Linear GraphQL issue. An issue with any child not completed
300
343
  * or canceled is a container.
301
344
  * @param {Record<string, any>} issue - Issue node
345
+ * @param {{ doneRoles?: readonly string[], landedRoles?: readonly string[] }} [options] - Configured terminal
346
+ * done names (`terminalDoneRoles`), so a blocker there is finished, and
347
+ * the intermediate ones (`landedDoneRoles`), so a blocker there holds nothing
302
348
  * @returns {ReturnType<typeof shape>}
303
349
  */
304
- export function normalizeLinearIssue(issue) {
350
+ export function normalizeLinearIssue(issue, options = {}) {
305
351
  const native = Number(issue?.priority ?? 0);
306
352
  const children = Array.isArray(issue?.children?.nodes)
307
353
  ? issue.children.nodes
@@ -310,12 +356,16 @@ export function normalizeLinearIssue(issue) {
310
356
  : [];
311
357
  const labels = labelNames(issue?.labels);
312
358
  // Linear has no "blocked by" relation type: B blocked by A is A's `blocks`
313
- // relation, read from B as an inverse relation.
314
- const openBlockers = nodesOf(issue?.inverseRelations).filter(
315
- relation =>
316
- relation?.type === "blocks" &&
317
- !LINEAR_FINISHED_STATE_TYPES.has(relation.issue?.state?.type)
318
- ).length;
359
+ // relation, read from B as an inverse
360
+ // relation. One rule with the stale-link sweep (#5065): a promotion
361
+ // workflow can type its configured done state `started`, so the configured
362
+ // name also counts as finished, in this item's own team only.
363
+ const openBlockers = countUnresolvedBlockers(
364
+ linearBlockerEdges(issue),
365
+ options.doneRoles ?? [],
366
+ text(issue?.team?.key) || text(issue?.identifier).split("-")[0],
367
+ options.landedRoles
368
+ );
319
369
 
320
370
  return shape({
321
371
  ref: text(issue?.identifier),
@@ -349,7 +399,7 @@ export function normalizeLinearIssue(issue) {
349
399
  * none) and `assigneeAccountId` the assignee's account id, for kind-keyed
350
400
  * entries (#4623). `authorIntegration` names the integration that filed an
351
401
  * item no person authored, for `integration:` entries (#4895).
352
- * @param {{ ref: string, title: string, assigneeId: string | null, assigneeLogin: string | null, assigneeAccountId: string | null, priorityRank: number, createdAt: string, updatedAt: string, labels: string[], body: string, authorId: string | null, authorLogin: string | null, authorIntegration: string | null, isContainer: boolean, openBlockers: number }} input
402
+ * @param {{ ref: string, title: string, assigneeId: string | null, assigneeLogin: string | null, assigneeAccountId: string | null, priorityRank: number, createdAt: string, updatedAt: string, labels: string[], body: string, authorId: string | null, authorLogin: string | null, authorIntegration: string | null, isContainer: boolean, openBlockers: number, blockersUnreadable?: boolean }} input
353
403
  */
354
404
  function shape(input) {
355
405
  return {
@@ -368,6 +418,9 @@ function shape(input) {
368
418
  authorIntegration: input.authorIntegration,
369
419
  isContainer: input.isContainer,
370
420
  openBlockers: input.openBlockers,
421
+ // The item's blocker list could not be read this fetch (GitHub only;
422
+ // Jira and Linear fetch blockers with the item, or the envelope fails).
423
+ blockersUnreadable: input.blockersUnreadable === true,
371
424
  repoLabels: repoLabelsOf(input.labels),
372
425
  };
373
426
  }
@@ -478,13 +531,34 @@ function compareWithinGroup(left, right) {
478
531
  * normalized assignee id: GitHub login, Jira accountId, Linear user id. A
479
532
  * `login:` entry matches only a GitHub assignee login, an `id:` entry only
480
533
  * the assignee's account id (#4623).
534
+ *
535
+ * An item whose blocker list could not be read is excluded with reason
536
+ * `blockers-unreadable` (CodySwannGT/lisa#5065); every other item is still
537
+ * offered.
481
538
  * @param {readonly Record<string, any>[]} items - Normalized items
482
539
  * @param {{ me?: string | null, operators?: readonly unknown[], trustedAuthorIds?: readonly unknown[], humanNeededLabel?: string, humanOnly?: unknown, humanGateMode?: unknown }} [options]
483
540
  * @returns {{ ordered: Record<string, any>[], excluded: { ref: string, reason: string }[] }}
484
541
  */
485
542
  export function orderReadyQueue(items, options = {}) {
486
543
  const context = orderingContext(options);
487
- return rank(items, item => exclusionReason(item, context), context);
544
+ return rank(
545
+ items,
546
+ item => exclusionReason(item, context) ?? unreadableBlockers(item),
547
+ context
548
+ );
549
+ }
550
+
551
+ /**
552
+ * An item whose blocker list could not be read is held in both tiers: it
553
+ * might be blocked by open work, so dispatching it is not known safe. Only
554
+ * that item waits; the next fetch reads it again.
555
+ * @param {Record<string, any>} item - Normalized item
556
+ * @returns {"blockers-unreadable" | null}
557
+ */
558
+ function unreadableBlockers(item) {
559
+ // probe-direction: fail-closed — an unread blocker list never reads as
560
+ // "nothing blocks this".
561
+ return item.blockersUnreadable === true ? "blockers-unreadable" : null;
488
562
  }
489
563
 
490
564
  /**
@@ -507,7 +581,7 @@ export function orderBacklogQueue(items, options = {}) {
507
581
  return rank(
508
582
  items,
509
583
  item => {
510
- const reason = exclusionReason(item, context);
584
+ const reason = exclusionReason(item, context) ?? unreadableBlockers(item);
511
585
  if (reason !== null) return reason;
512
586
  if (count(item.openBlockers) > 0) return "blocked-by-open-item";
513
587
  const failed = Object.hasOwn(failures, item.ref)