@oisincoveney/pipeline 3.11.4 → 3.11.6

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.
@@ -1,4 +1,5 @@
1
1
  import { uniqueStrings } from "./strings.js";
2
+ import { resolveExecutableDependencyIds } from "./planning/dependency-refs.js";
2
3
  import { z } from "zod";
3
4
  import { Data } from "effect";
4
5
  //#region src/argo-graph.ts
@@ -88,26 +89,7 @@ var ArgoGraphCompiler = class {
88
89
  this.compileNodes(node.children ?? [], [...inheritedNeeds, ...node.needs]);
89
90
  }
90
91
  resolveDependencyTaskNames(nodeIds) {
91
- return uniqueStrings(nodeIds.flatMap((nodeId) => this.resolveDependencyNodeIds(nodeId).map((id) => argoTaskName(id))));
92
- }
93
- resolveDependencyNodeIds(nodeId) {
94
- const node = this.nodeById.get(nodeId);
95
- if (!node) return [];
96
- const kind = node.kind;
97
- switch (kind) {
98
- case "agent":
99
- case "builtin":
100
- case "command": return [node.id];
101
- case "group": return this.resolveGroupNodeIds(node);
102
- case "parallel": return this.resolveParallelNodeIds(node);
103
- default: throw new ArgoGraphCompilerError(String(kind), node.id);
104
- }
105
- }
106
- resolveGroupNodeIds(node) {
107
- return uniqueStrings([...node.nodes ?? [], ...node.needs].flatMap((id) => this.resolveDependencyNodeIds(id)));
108
- }
109
- resolveParallelNodeIds(node) {
110
- return uniqueStrings((node.children ?? []).flatMap((child) => this.resolveDependencyNodeIds(child.id)));
92
+ return uniqueStrings(resolveExecutableDependencyIds(this.nodeById, nodeIds).map((id) => argoTaskName(id)));
111
93
  }
112
94
  terminalTasks() {
113
95
  const dependedOn = new Set(this.tasks.flatMap((task) => task.dependencies));
@@ -13,7 +13,7 @@ const RUNNER_WORKFLOW_PAYLOAD_PATH = "/etc/pipeline/payload.json";
13
13
  const RUNNER_WORKFLOW_SCHEDULE_PATH = "/etc/pipeline/schedule.yaml";
14
14
  const RUNNER_GIT_CREDENTIALS_PATH = "/etc/pipeline/git-credentials";
15
15
  const RUNNER_RETRY_STRATEGY = {
16
- expression: "lastRetry.status == 'Error' || asInt(lastRetry.exitCode) == 70",
16
+ expression: "lastRetry.status == 'Error' || lastRetry.exitCode == '70' || lastRetry.exitCode == '137'",
17
17
  limit: "3",
18
18
  retryPolicy: "Always"
19
19
  };
@@ -5,13 +5,13 @@ import { z } from "zod";
5
5
  //#region src/moka-submit.d.ts
6
6
  declare const mokaSubmitDirectHooksSchema: z.ZodRecord<z.ZodEnum<{
7
7
  "workflow.start": "workflow.start";
8
+ "node.finish": "node.finish";
9
+ "node.start": "node.start";
8
10
  "workflow.success": "workflow.success";
9
11
  "workflow.failure": "workflow.failure";
10
12
  "workflow.complete": "workflow.complete";
11
- "node.start": "node.start";
12
13
  "node.success": "node.success";
13
14
  "node.error": "node.error";
14
- "node.finish": "node.finish";
15
15
  "gate.failure": "gate.failure";
16
16
  }> & z.core.$partial, z.ZodDiscriminatedUnion<[z.ZodObject<{
17
17
  failure: z.ZodDefault<z.ZodEnum<{
@@ -94,13 +94,13 @@ declare const mokaSubmitOptionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
94
94
  }, z.core.$strict>>;
95
95
  hooks: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
96
96
  "workflow.start": "workflow.start";
97
+ "node.finish": "node.finish";
98
+ "node.start": "node.start";
97
99
  "workflow.success": "workflow.success";
98
100
  "workflow.failure": "workflow.failure";
99
101
  "workflow.complete": "workflow.complete";
100
- "node.start": "node.start";
101
102
  "node.success": "node.success";
102
103
  "node.error": "node.error";
103
- "node.finish": "node.finish";
104
104
  "gate.failure": "gate.failure";
105
105
  }> & z.core.$partial, z.ZodDiscriminatedUnion<[z.ZodObject<{
106
106
  failure: z.ZodDefault<z.ZodEnum<{
@@ -207,13 +207,13 @@ declare const mokaSubmitOptionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
207
207
  }, z.core.$strict>>;
208
208
  hooks: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
209
209
  "workflow.start": "workflow.start";
210
+ "node.finish": "node.finish";
211
+ "node.start": "node.start";
210
212
  "workflow.success": "workflow.success";
211
213
  "workflow.failure": "workflow.failure";
212
214
  "workflow.complete": "workflow.complete";
213
- "node.start": "node.start";
214
215
  "node.success": "node.success";
215
216
  "node.error": "node.error";
216
- "node.finish": "node.finish";
217
217
  "gate.failure": "gate.failure";
218
218
  }> & z.core.$partial, z.ZodDiscriminatedUnion<[z.ZodObject<{
219
219
  failure: z.ZodDefault<z.ZodEnum<{
@@ -0,0 +1,43 @@
1
+ import { uniqueStrings } from "../strings.js";
2
+ //#region src/planning/dependency-refs.ts
3
+ /**
4
+ * Index every planned node — including the children nested inside `parallel`
5
+ * containers — by id, so a dependency id can be resolved regardless of nesting.
6
+ */
7
+ function indexPlannedNodesById(nodes, into = /* @__PURE__ */ new Map()) {
8
+ for (const node of nodes) {
9
+ into.set(node.id, node);
10
+ indexPlannedNodesById(node.children ?? [], into);
11
+ }
12
+ return into;
13
+ }
14
+ /**
15
+ * Expand dependency ids to the executable (branch-producing) leaf node ids,
16
+ * making `group`/`parallel` container nodes transparent.
17
+ *
18
+ * A container produces no output of its own: a `parallel` lowers to its children
19
+ * and a `group` is a pure dependency anchor, so neither pushes a `nodes/<id>`
20
+ * result branch. A downstream node that lists the container in `needs` actually
21
+ * depends on the container's executable descendants. Both the Argo DAG ordering
22
+ * and the runner's upstream-output (git ref) materialization resolve dependencies
23
+ * through this one function so the two representations never diverge — divergence
24
+ * is what made review nodes fetch a non-existent `nodes/mechanical-checks` branch.
25
+ */
26
+ function resolveExecutableDependencyIds(nodeById, needs) {
27
+ const resolveOne = (nodeId) => {
28
+ const node = nodeById.get(nodeId);
29
+ if (!node) return [];
30
+ const kind = node.kind;
31
+ switch (kind) {
32
+ case "agent":
33
+ case "builtin":
34
+ case "command": return [node.id];
35
+ case "group": return uniqueStrings([...node.nodes ?? [], ...node.needs].flatMap(resolveOne));
36
+ case "parallel": return uniqueStrings((node.children ?? []).flatMap((child) => resolveOne(child.id)));
37
+ default: throw new Error(`resolveExecutableDependencyIds: unsupported node kind '${String(kind)}' on '${node.id}'`);
38
+ }
39
+ };
40
+ return uniqueStrings(needs.flatMap(resolveOne));
41
+ }
42
+ //#endregion
43
+ export { indexPlannedNodesById, resolveExecutableDependencyIds };
@@ -1,3 +1,4 @@
1
+ import { indexPlannedNodesById, resolveExecutableDependencyIds } from "../planning/dependency-refs.js";
1
2
  import { loadPipelineConfig } from "../config/load.js";
2
3
  import "../config.js";
3
4
  import { findPlannedNode } from "../planned-node.js";
@@ -120,20 +121,21 @@ function runRunnerCommandEffect(options, runtime) {
120
121
  workflowId: compiled.workflowId
121
122
  }, "schedule.compile finish");
122
123
  const node = yield* resolveRunnerTargetNode(payload, compiled, descriptor);
124
+ const dependencyNodeIds = resolveExecutableDependencyIds(indexPlannedNodesById(compiled.plan.topologicalOrder), node.needs);
123
125
  logger.info({
124
- dependencyCount: node.needs.length,
126
+ dependencyCount: dependencyNodeIds.length,
125
127
  nodeId: descriptor.nodeId,
126
128
  phase: "dependency.merge",
127
129
  status: "start"
128
130
  }, "dependency.merge start");
129
131
  yield* io.mergeDependencyRefs({
130
132
  committer: compiled.config.runner_command.git.committer,
131
- dependencyNodeIds: node.needs,
133
+ dependencyNodeIds,
132
134
  payload,
133
135
  worktreePath
134
136
  });
135
137
  logger.info({
136
- dependencyCount: node.needs.length,
138
+ dependencyCount: dependencyNodeIds.length,
137
139
  nodeId: descriptor.nodeId,
138
140
  phase: "dependency.merge",
139
141
  status: "finish"
@@ -11,8 +11,8 @@ declare const runnerEventRecordSchema: z.ZodUnion<readonly [z.ZodObject<{
11
11
  runId: z.ZodString;
12
12
  sequence: z.ZodNumber;
13
13
  type: z.ZodEnum<{
14
- "workflow.start": "workflow.start";
15
14
  "workflow.planned": "workflow.planned";
15
+ "workflow.start": "workflow.start";
16
16
  }>;
17
17
  workflowPlan: z.ZodObject<{
18
18
  edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -58,10 +58,10 @@ declare const runnerEventRecordSchema: z.ZodUnion<readonly [z.ZodObject<{
58
58
  }>;
59
59
  }, z.core.$strip>;
60
60
  type: z.ZodEnum<{
61
- "node.start": "node.start";
62
- "node.finish": "node.finish";
63
61
  "agent.finish": "agent.finish";
64
62
  "agent.start": "agent.start";
63
+ "node.finish": "node.finish";
64
+ "node.start": "node.start";
65
65
  }>;
66
66
  }, z.core.$strip>, z.ZodObject<{
67
67
  at: z.ZodOptional<z.ZodString>;
@@ -189,8 +189,8 @@ declare const runnerEventBatchSchema: z.ZodObject<{
189
189
  runId: z.ZodString;
190
190
  sequence: z.ZodNumber;
191
191
  type: z.ZodEnum<{
192
- "workflow.start": "workflow.start";
193
192
  "workflow.planned": "workflow.planned";
193
+ "workflow.start": "workflow.start";
194
194
  }>;
195
195
  workflowPlan: z.ZodObject<{
196
196
  edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -236,10 +236,10 @@ declare const runnerEventBatchSchema: z.ZodObject<{
236
236
  }>;
237
237
  }, z.core.$strip>;
238
238
  type: z.ZodEnum<{
239
- "node.start": "node.start";
240
- "node.finish": "node.finish";
241
239
  "agent.finish": "agent.finish";
242
240
  "agent.start": "agent.start";
241
+ "node.finish": "node.finish";
242
+ "node.start": "node.start";
243
243
  }>;
244
244
  }, z.core.$strip>, z.ZodObject<{
245
245
  at: z.ZodOptional<z.ZodString>;
package/package.json CHANGED
@@ -127,7 +127,7 @@
127
127
  "prepack": "bun run build:cli"
128
128
  },
129
129
  "type": "module",
130
- "version": "3.11.4",
130
+ "version": "3.11.6",
131
131
  "description": "Config-driven multi-agent pipeline runner for repository work",
132
132
  "main": "./dist/index.js",
133
133
  "types": "./dist/index.d.ts",