pi-better-goal 0.12.0 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -65,10 +65,12 @@ After every successful context compaction (Pi's `session_compact` event) while a
65
65
 
66
66
  ### Scheduler-backed workflow gates
67
67
 
68
- A coordinator that ships the resolve-issues scheduler (`scripts/next-actions.mjs` in its skill directory, or in a sibling `resolve-issues` skill) keeps its Goal from ending while the run still has work. The extension first runs `node next-actions.mjs --run <run dir> --slots 1 --peek --json` (read-only, 20-second timeout), where the run directory is the folder of the task plan bound through `update_plan`. For completion and handback only, if the sole due action is `sync`, it reruns with `--sync` to obtain a fresh issue tree. This live check has a four-minute timeout to accommodate the tree fetcher's network attempts and follow-ups. Because `--peek` suppresses scheduler bookkeeping but not issue-tree cache writes, the live check uses a temporary copy of the scheduler's plan, tree, bookkeeping, review, and result inputs; it does not write the bound run. Heartbeat probes never request live synchronization. A failed or incomplete tree fetch that produces `sync` still refuses completion or handback; cached evidence is not treated as live. Every gate retains its fail-open behavior for execution failures: if the scheduler is missing, errors, times out, prints bad output, or no plan is bound yet, the call proceeds and its result carries a warning, so nothing deadlocks.
68
+ A coordinator that ships the resolve-issues scheduler (`scripts/next-actions.mjs` in its skill directory, or in a sibling `resolve-issues` skill) keeps its Goal from ending while the run still has work. The extension first runs `node next-actions.mjs --run <run dir> --slots 1 --peek --json` (read-only, 20-second timeout), where the run directory is the folder of the task plan bound through `update_todo` with `workflow.path` and `workflow.revision`. For completion and handback only, if the sole due action is `sync`, it reruns with `--sync` to obtain a fresh issue tree. This live check has a four-minute timeout to accommodate the tree fetcher's network attempts and follow-ups. Because `--peek` suppresses scheduler bookkeeping but not issue-tree cache writes, the live check uses a temporary copy of the scheduler's plan, tree, bookkeeping, review, and result inputs; it does not write the bound run. Heartbeat probes never request live synchronization. A failed or incomplete tree fetch that produces `sync` still refuses completion or handback; cached evidence is not treated as live. Output that is not a well-formed due list is a failure, not an empty run: a due entry without an `action` invalidates the whole answer instead of being dropped, so it cannot hide due work.
69
69
 
70
- - **Completion.** `update_goal` complete is refused, with each due action (action, unit, first 200 characters of detail), unless the scheduler reports `finish` and nothing else is due (an empty due list means workers are still running, so it is refused too). The Goal stays active.
71
- - **Pause.** `release_workflow` is refused unless every unfinished unit is quiet (nothing due for it) or blocked `human-decision` with `humanItem` 2-5. A unit blocked `retry-ci` or any other reason the run retries itself, or a `human-decision` item 1, is named in the refusal and the Goal stays active.
70
+ How a gate reports an unverifiable run follows the workflow that owns it. The issue workflows (`rush-issues` and `resolve-issues`) always have a scheduler available (rush-issues through its `resolve-issues` dependency), so only that scheduler can declare their run finished: a missing plan, a missing scheduler, a scheduler error, a timeout, or invalid output refuses completion and leaves the Goal active and the workflow bound. A coordinator that ships no scheduler, such as a release workflow, has no run authority to consult, so its completion gate keeps the fail-open warning that avoids deadlocking it.
71
+
72
+ - **Completion.** `update_goal` complete is refused, with each due action (action, unit, first 200 characters of detail), unless the scheduler reports `finish` and nothing else is due (an empty due list means workers are still running, so it is refused too). An unverifiable issue-workflow run is refused as well, with the step that restores it: bind the task plan with `update_todo({workflow:{path,revision}})`, rebind the run with `/skill:<coordinator>`, or fix the scheduler. The Goal stays active.
73
+ - **Pause.** `release_workflow` is refused unless every unfinished unit is quiet (nothing due for it) or blocked `human-decision` with `humanItem` 2-5. A unit blocked `retry-ci` or any other reason the run retries itself, or a `human-decision` item 1, is named in the refusal and the Goal stays active. Execution failures keep the fail-open warning here, so a genuine human hold can always hand the run back.
72
74
  - **Auto-bind.** Invoking `/skill:rush-issues` or `/skill:resolve-issues` with no active goal (none, or a completed one) creates and activates a Goal whose objective is the invocation text, exactly as `/goal <invocation>` would, without sending the command a second time. A paused or active Goal is left alone.
73
75
  - **Wait timer.** When the scheduler's only due action is `wait` with a "next automatic attempt is at <ISO time>" detail, the next automatic continuation is scheduled for that time (at most the maximum timer delay, at least 5 seconds) and the wake-up is not counted as a no-progress retry. Other due work, or an unparseable time, uses the ordinary retry schedule. `autoContinue` off disables this timer.
74
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-goal",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "description": "Pi extension for goal tracking with background-aware continuation.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -30,6 +30,7 @@ import {
30
30
  } from "./goal-state.js";
31
31
  import { continuationEvidence, type ContinuationEvidence } from "./continuation.js";
32
32
  import { currentPermissionHold, logicalPermissionBlockerKey, MAX_PERMISSION_BLOCKERS, MAX_PERMISSION_RECORDS, permissionHoldRecord, permissionInstruction, permissionRecord, reportedPermissionBlockers, reportedPermissionGap, type PermissionHold } from "./permission-hold.js";
33
+ import { publishGoalGuidance } from "./prompt.js";
33
34
  import { observeGoalStall } from "./stall.js";
34
35
  import {
35
36
  flattenObjectiveForRail,
@@ -41,7 +42,7 @@ import {
41
42
  import { createRenderScheduler } from "./shared-render-scheduler.js";
42
43
  import { initializeNavigatorPanels, setNavigatorPanel } from "./shared-navigator-panels.js";
43
44
  import { collectSubagentActivity } from "./subagents.js";
44
- import { currentWorkflowOwner, skillCommandName, workflowEntry, workflowOwnerFromSkill, WORKFLOW_ENTRY_TYPE } from "./workflow.js";
45
+ import { currentWorkflowOwner, ISSUE_WORKFLOW_SKILLS, skillCommandName, workflowEntry, workflowOwnerFromSkill, WORKFLOW_ENTRY_TYPE } from "./workflow.js";
45
46
  import { completionGate, pauseGate, schedulerWaitUntil, operationResumeSchedulerGate } from "./workflow-gates.js";
46
47
  import { workflowRehydrateMessage, WORKFLOW_REHYDRATE_MESSAGE_TYPE } from "./rehydrate.js";
47
48
  import { requestTaskContext } from "./task-context.js";
@@ -65,7 +66,7 @@ const MAX_TIMER_DELAY_MS = 2_147_483_647;
65
66
  /** Never re-poll a workflow's scheduler sooner than this, even when its stated attempt time has passed. */
66
67
  const MIN_WAIT_DELAY_MS = 5_000;
67
68
  /** Workflow skills whose invocation binds a goal when none is active, so the run cannot stop silently. */
68
- const AUTO_BIND_SKILLS = new Set(["rush-issues", "resolve-issues"]);
69
+ const AUTO_BIND_SKILLS = ISSUE_WORKFLOW_SKILLS;
69
70
  const WAKE_DISABLED =
70
71
  process.env.PI_BETTER_GOAL_DISABLE_WAKE === "1" ||
71
72
  process.env.PI_BETTER_EXTENSION_DISABLE_WAKE === "1";
@@ -1360,12 +1361,12 @@ export default function (pi: ExtensionAPI): void {
1360
1361
  (permissions.blockers.length === 0 ? "\nBlocker evidence is unavailable. Stay held; do not invent a retry scope." : "") : "";
1361
1362
  // A held goal overrides workflow ownership without invoking or invalidating that workflow.
1362
1363
  if (permissionPrompt && goal?.status === "paused") {
1363
- return { systemPrompt: `${event.systemPrompt}\n\n${permissionPrompt}` };
1364
+ return publishGoalGuidance(event, permissionPrompt);
1364
1365
  }
1365
1366
  const pausedInstruction = permissionPrompt || (goal?.status === "paused" && (goal.pauseReason === "interrupt" || goal.pauseReason === "handback")
1366
1367
  ? pausedGoalPrompt(goal, preferences.conversationalResume, !harnessPresent) : "");
1367
1368
  if (!isPokeable(goal) && !owner) {
1368
- return pausedInstruction ? { systemPrompt: `${event.systemPrompt}\n\n${pausedInstruction}` } : undefined;
1369
+ return publishGoalGuidance(event, pausedInstruction);
1369
1370
  }
1370
1371
 
1371
1372
  const questionInstruction = snapshot.backgroundRunning
@@ -1379,31 +1380,28 @@ export default function (pi: ExtensionAPI): void {
1379
1380
  if (!workflowAvailable(owner)) {
1380
1381
  if (isPokeable(goal)) setGoal(goalWithStatus(goal, "paused"), ctx, "runtime");
1381
1382
  recordWorkflow(null);
1382
- return { systemPrompt: `${event.systemPrompt}\n\nWorkflow ${owner.name} is no longer a registered, valid skill. Stop work and ask the user to reinvoke the skill.` };
1383
+ return publishGoalGuidance(event, `Workflow ${owner.name} is no longer a registered, valid skill. Stop work and ask the user to reinvoke the skill.`);
1383
1384
  }
1384
1385
  let instructions: string;
1385
1386
  try {
1386
1387
  instructions = readFileSync(owner.path, "utf8");
1387
1388
  } catch {
1388
1389
  if (isPokeable(goal)) setGoal(goalWithStatus(goal, "paused"), ctx, "runtime");
1389
- return { systemPrompt: `${event.systemPrompt}\n\nWorkflow ${owner.name} is unavailable. Stop work and ask the user to restore or reinvoke the skill.` };
1390
+ return publishGoalGuidance(event, `Workflow ${owner.name} is unavailable. Stop work and ask the user to restore or reinvoke the skill.`);
1390
1391
  }
1391
- return {
1392
- systemPrompt: `${event.systemPrompt}\n\n` +
1393
- (pausedInstruction
1394
- ? `${pausedInstruction}\n` + (permissionPrompt
1395
- ? "These permission constraints override the workflow instructions below.\n\n"
1396
- : "While the goal is paused, this overrides the workflow instructions below: do not advance the workflow until the goal is resumed.\n\n")
1397
- : "") +
1398
- `Active workflow: ${owner.name} (${owner.path}). Its task plan owns planning and the parent is a coordinator, not a product-code implementer. Follow the workflow instructions below, including on resumed turns:\n\n${instructions}` +
1399
- (isPokeable(goal)
1400
- ? harnessPresent
1401
- ? "\n\nComplete the goal only after the workflow completion audit."
1402
- : `\n\nActive objective: ${goal.objective}. Complete it only after the workflow completion audit.`
1403
- : "") +
1404
- (questionInstruction ? `\n\n${questionInstruction.trim()}` : "") +
1405
- (heldInstruction ? `\n\n${heldInstruction}` : ""),
1406
- };
1392
+ return publishGoalGuidance(
1393
+ event,
1394
+ pausedInstruction &&
1395
+ `${pausedInstruction}\n` + (permissionPrompt
1396
+ ? "These permission constraints override the workflow instructions below.\n\n"
1397
+ : "While the goal is paused, this overrides the workflow instructions below: do not advance the workflow until the goal is resumed.\n\n"),
1398
+ `Active workflow: ${owner.name} (${owner.path}). Its task plan owns planning and the parent is a coordinator, not a product-code implementer. Follow the workflow instructions below, including on resumed turns:\n\n${instructions}`,
1399
+ isPokeable(goal) && (harnessPresent
1400
+ ? "Complete the goal only after the workflow completion audit."
1401
+ : `Active objective: ${goal.objective}. Complete it only after the workflow completion audit.`),
1402
+ questionInstruction && questionInstruction.trim(),
1403
+ heldInstruction,
1404
+ );
1407
1405
  }
1408
1406
 
1409
1407
  if (!isPokeable(goal)) return;
@@ -1413,18 +1411,19 @@ export default function (pi: ExtensionAPI): void {
1413
1411
  if (harnessPresent) {
1414
1412
  // Harness owns the outcome text. Retain only the Goal-specific guidance
1415
1413
  // that the Outcome & Todo prompt cannot replace.
1416
- const retained = [heldInstruction, backgroundInstruction.trim(), questionInstruction.trim(), permissionPrompt]
1417
- .filter((part) => part.length > 0);
1418
- return retained.length > 0
1419
- ? { systemPrompt: `${event.systemPrompt}\n\n${retained.join("\n\n")}` }
1420
- : undefined;
1421
- }
1422
- return {
1423
- systemPrompt:
1424
- `${event.systemPrompt}\n\n` +
1425
- `Pi Better Goal active objective: ${goal.objective}. ${heldInstruction || "Keep working through clear low-risk next steps, and mark complete only after an evidence-backed completion audit."}${backgroundInstruction}${questionInstruction}` +
1426
- (permissionPrompt ? `\n\n${permissionPrompt}` : ""),
1427
- };
1414
+ return publishGoalGuidance(
1415
+ event,
1416
+ heldInstruction,
1417
+ backgroundInstruction.trim(),
1418
+ questionInstruction.trim(),
1419
+ permissionPrompt,
1420
+ );
1421
+ }
1422
+ return publishGoalGuidance(
1423
+ event,
1424
+ `Pi Better Goal active objective: ${goal.objective}. ${heldInstruction || "Keep working through clear low-risk next steps, and mark complete only after an evidence-backed completion audit."}${backgroundInstruction}${questionInstruction}`,
1425
+ permissionPrompt,
1426
+ );
1428
1427
  });
1429
1428
 
1430
1429
  pi.on("agent_start", async (_event, ctx) => {
package/src/prompt.ts ADDED
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Goal-owned system-prompt guidance.
3
+ *
4
+ * Published as a named section on hosts that render sections, never as a returned
5
+ * `systemPrompt` there: returning text sets `forceSystemPrompt`, and the request
6
+ * then carries an opaque rendered snapshot, so a section published afterwards
7
+ * never reaches the model.
8
+ *
9
+ * On older hosts (this package declares support back to pi 0.84.4) custom sections
10
+ * do not render at all, so the same text is appended instead. Publishing alone
11
+ * would silently deliver nothing on those versions.
12
+ */
13
+ export const GOAL_SECTION = "goal";
14
+
15
+ /** The minimum shape this module needs; both the event options and a test double satisfy it. */
16
+ export interface PromptSectionTarget {
17
+ sections?: Record<string, string>;
18
+ }
19
+
20
+ /** What a handler receives; only these two fields are used. */
21
+ export interface BeforeAgentStartEvent {
22
+ systemPrompt: string;
23
+ systemPromptOptions?: unknown;
24
+ }
25
+
26
+ /** Mirrors `supportsPromptSections` in the vendored execution policy. */
27
+ function rendersSections(options: unknown): boolean {
28
+ const sections = (options as { sections?: unknown } | undefined)?.sections;
29
+ return typeof sections === "object" && sections !== null;
30
+ }
31
+
32
+ /**
33
+ * Deliver guidance, choosing the channel this host understands.
34
+ *
35
+ * Appending within one turn is safe: pi normalizes a fresh options object for
36
+ * every `before_agent_start`, so this never accumulates between requests, and
37
+ * within a turn the parts belong together and keep their order.
38
+ */
39
+ export function publishGoalGuidance(
40
+ event: BeforeAgentStartEvent,
41
+ ...parts: Array<string | undefined | false>
42
+ ): { systemPrompt: string } | undefined {
43
+ const text = parts.filter((part): part is string => typeof part === "string" && part.trim().length > 0).join("\n\n");
44
+ if (!text) return undefined;
45
+ if (!rendersSections(event.systemPromptOptions)) {
46
+ return { systemPrompt: `${event.systemPrompt}\n\n${text}` };
47
+ }
48
+ const target = event.systemPromptOptions as PromptSectionTarget;
49
+ const sections = (target.sections ??= {});
50
+ const existing = sections[GOAL_SECTION];
51
+ sections[GOAL_SECTION] = existing ? `${existing}\n\n${text}` : text;
52
+ return undefined;
53
+ }
@@ -3,7 +3,7 @@ import { cpSync, existsSync, mkdtempSync, readFileSync, rmSync, statSync } from
3
3
  import { tmpdir } from "node:os";
4
4
  import { dirname, join } from "node:path";
5
5
 
6
- import type { WorkflowOwner } from "./workflow.js";
6
+ import { ISSUE_WORKFLOW_SKILLS, type WorkflowOwner } from "./workflow.js";
7
7
 
8
8
  /** Branch entry the plan extension writes when it binds a workflow-owned task plan. */
9
9
  const WORKFLOW_PLAN_ENTRY = "pi-better-workflow-plan";
@@ -88,13 +88,18 @@ function parseSchedulerOutput(stdout: string): SchedulerRun {
88
88
  return { ok: false, reason: "the scheduler printed output that is not JSON" };
89
89
  }
90
90
  if (!isRecord(parsed) || !Array.isArray(parsed.due)) return { ok: false, reason: "the scheduler output has no due list" };
91
- const due = parsed.due.flatMap((item): SchedulerAction[] => isRecord(item) && typeof item.action === "string"
92
- ? [{
91
+ const due: SchedulerAction[] = [];
92
+ for (const item of parsed.due) {
93
+ // A malformed entry could hide due work, so it invalidates the answer instead of being dropped.
94
+ if (!isRecord(item) || typeof item.action !== "string") {
95
+ return { ok: false, reason: "the scheduler output has a due entry without an action" };
96
+ }
97
+ due.push({
93
98
  action: item.action,
94
99
  unit: item.unit === null || item.unit === undefined ? null : String(item.unit),
95
100
  detail: typeof item.detail === "string" ? item.detail : "",
96
- }]
97
- : []);
101
+ });
102
+ }
98
103
  return { ok: true, due };
99
104
  }
100
105
 
@@ -114,6 +119,10 @@ function executeScheduler(script: string, runDir: string, timeoutMs: number, liv
114
119
  if (error) {
115
120
  // An exit status of 1 means "actions due"; any other failure (exit 2, timeout, spawn error) is real.
116
121
  if ((error as { code?: unknown }).code !== 1) {
122
+ if ((error as { killed?: unknown }).killed === true) {
123
+ resolve({ ok: false, reason: `the scheduler timed out after ${timeoutMs} ms` });
124
+ return;
125
+ }
117
126
  const detail = String(stderr).trim().split("\n")[0] || error.message;
118
127
  resolve({ ok: false, reason: `the scheduler failed (${detail.slice(0, DETAIL_LIMIT)})` });
119
128
  return;
@@ -150,11 +159,14 @@ interface PlannedRun {
150
159
  script: string;
151
160
  }
152
161
 
153
- function locateRun(entries: Iterable<EntryLike>, owner: WorkflowOwner): PlannedRun | { warning: string } {
162
+ /** The run a gate would check, or what it could not locate, so each gate decides how to report it. */
163
+ type RunLocation = PlannedRun | { missing: "scheduler" | "plan"; problem: string };
164
+
165
+ function locateRun(entries: Iterable<EntryLike>, owner: WorkflowOwner): RunLocation {
154
166
  const script = findScheduler(owner);
155
- if (!script) return { warning: `${owner.name} ships no scheduler, so the run was not checked` };
167
+ if (!script) return { missing: "scheduler", problem: `${owner.name} ships no scheduler` };
156
168
  const plan = boundPlanPath(entries, owner);
157
- if (!plan) return { warning: `no task plan is bound for ${owner.name} yet, so the run was not checked` };
169
+ if (!plan) return { missing: "plan", problem: `no task plan is bound for ${owner.name} yet` };
158
170
  return { runDir: dirname(plan), script };
159
171
  }
160
172
 
@@ -167,16 +179,50 @@ function describe(action: SchedulerAction): string {
167
179
  return `- ${action.action}${action.unit ? ` (unit ${action.unit})` : ""}: ${detail}`;
168
180
  }
169
181
 
170
- /** Completion is allowed only when the scheduler reports `finish` and nothing else is due. */
182
+ /** Coordinators whose runs the resolve-issues scheduler drives, so only it can declare the run finished. */
183
+ function schedulerOwnsCompletion(owner: WorkflowOwner): boolean {
184
+ return ISSUE_WORKFLOW_SKILLS.has(owner.name);
185
+ }
186
+
187
+ function unverifiedCompletion(owner: WorkflowOwner, problem: string, recovery: string): GateVerdict {
188
+ return {
189
+ allow: false,
190
+ due: [],
191
+ message: `Goal not marked complete: ${problem}, so the run's completion is not verified. ${recovery} ` +
192
+ `The ${owner.name} workflow stays bound and the Goal stays active.`,
193
+ };
194
+ }
195
+
196
+ /**
197
+ * Completion is allowed only when the scheduler reports `finish` and nothing else is due. For the
198
+ * issue workflows an unavailable plan or scheduler never counts as permission: the run has a
199
+ * completion authority, and only that authority may declare it finished. Any other coordinator has
200
+ * no scheduler to consult, so its gate keeps the fail-open warning that avoids deadlocking it.
201
+ */
171
202
  export async function completionGate(
172
203
  entries: Iterable<EntryLike>,
173
204
  owner: WorkflowOwner,
174
205
  options: { timeoutMs?: number } = {},
175
206
  ): Promise<GateVerdict> {
207
+ const owned = schedulerOwnsCompletion(owner);
176
208
  const located = locateRun(entries, owner);
177
- if ("warning" in located) return unchecked(located.warning);
209
+ if ("missing" in located) {
210
+ if (!owned) return unchecked(`${located.problem}, so the run was not checked`);
211
+ const recovery = located.missing === "plan"
212
+ ? `Bind the run's task plan with update_todo({workflow:{path,revision}}), or rebind the run with /skill:${owner.name}, ` +
213
+ "then call update_goal again once the scheduler reports finish."
214
+ : `Restore the run's scheduler or rebind the run with /skill:${owner.name}, ` +
215
+ "then call update_goal again once the scheduler reports finish.";
216
+ return unverifiedCompletion(owner, located.problem, recovery);
217
+ }
178
218
  const run = await settlementScheduler(located.script, located.runDir, options.timeoutMs);
179
- if (!run.ok) return unchecked(`could not check the ${owner.name} run (${run.reason})`);
219
+ if (!run.ok) {
220
+ const problem = `the ${owner.name} run could not be checked (${run.reason})`;
221
+ if (!owned) return unchecked(problem);
222
+ return unverifiedCompletion(owner, problem,
223
+ `Fix the scheduler, or rebind the run with /skill:${owner.name} if its plan moved, ` +
224
+ "then call update_goal again once the scheduler reports finish.");
225
+ }
180
226
  const open = run.due.filter((action) => action.action !== "finish");
181
227
  if (open.length === 0 && run.due.length > 0) return { allow: true };
182
228
  if (open.length === 0) {
@@ -215,7 +261,7 @@ export async function pauseGate(
215
261
  options: { timeoutMs?: number } = {},
216
262
  ): Promise<GateVerdict> {
217
263
  const located = locateRun(entries, owner);
218
- if ("warning" in located) return unchecked(located.warning);
264
+ if ("missing" in located) return unchecked(`${located.problem}, so the run was not checked`);
219
265
  const units = readUnits(located.runDir);
220
266
  if (!units) return unchecked(`could not read the ${owner.name} task plan`);
221
267
  const run = await settlementScheduler(located.script, located.runDir, options.timeoutMs);
@@ -271,7 +317,7 @@ export async function operationResumeSchedulerGate(
271
317
  options: { timeoutMs?: number } = {},
272
318
  ): Promise<OperationResumeSchedulerGate> {
273
319
  const located = locateRun(entries, owner);
274
- if ("warning" in located) return { ok: false, reason: located.warning };
320
+ if ("missing" in located) return { ok: false, reason: `${located.problem}, so the run was not checked` };
275
321
  const run = await runScheduler(located.script, located.runDir, options.timeoutMs);
276
322
  if (!run.ok) return { ok: false, reason: `Workflow admission evidence unavailable: ${run.reason}` };
277
323
  return { ok: true, waitUntil: waitUntil(run.due) };
@@ -284,7 +330,7 @@ export async function schedulerWaitUntil(
284
330
  options: { timeoutMs?: number } = {},
285
331
  ): Promise<number | undefined> {
286
332
  const located = locateRun(entries, owner);
287
- if ("warning" in located) return undefined;
333
+ if ("missing" in located) return undefined;
288
334
  const run = await runScheduler(located.script, located.runDir, options.timeoutMs);
289
335
  return run.ok ? waitUntil(run.due) : undefined;
290
336
  }
package/src/workflow.ts CHANGED
@@ -3,6 +3,13 @@ import { parse } from "yaml";
3
3
 
4
4
  export const WORKFLOW_ENTRY_TYPE = "pi-better-workflow";
5
5
 
6
+ /**
7
+ * Coordinators whose runs the resolve-issues scheduler drives, so only its next-actions scheduler can
8
+ * declare the run finished. Other coordinators (a release workflow, say) ship no scheduler, and their
9
+ * completion gates keep the fail-open behavior that avoids deadlocking them.
10
+ */
11
+ export const ISSUE_WORKFLOW_SKILLS: ReadonlySet<string> = new Set(["rush-issues", "resolve-issues"]);
12
+
6
13
  export interface WorkflowOwner {
7
14
  name: string;
8
15
  path: string;