@srobroek/pi-agent-reviewer 0.19.5 → 0.19.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## agent-reviewer [0.19.6](https://github.com/srobroek/harness-plugins/compare/agent-reviewer--v0.19.5...agent-reviewer--v0.19.6) (2026-12-05)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **lib:** settle a subprocess whose pipe a descendant holds, and verify cut-off mutations ([#342](https://github.com/srobroek/harness-plugins/issues/342)) ([8fd6bd8](https://github.com/srobroek/harness-plugins/commit/8fd6bd8df1c19fab2618a0965c620093aa1444c6))
6
+
1
7
  ## agent-reviewer [0.19.5](https://github.com/srobroek/harness-plugins/compare/agent-reviewer--v0.19.4...agent-reviewer--v0.19.5) (2026-12-05)
2
8
 
3
9
  ## agent-reviewer [0.19.4](https://github.com/srobroek/harness-plugins/compare/agent-reviewer--v0.19.3...agent-reviewer--v0.19.4) (2026-12-05)
@@ -118,6 +118,8 @@ function filterDriverOverrides(listing) {
118
118
  import { constants } from "os";
119
119
  var EXIT_GRACE_MS = 2000;
120
120
  var EXIT_POLL_MS = 100;
121
+ var PIPE_DRAIN_MS = 2000;
122
+ var DRAIN_EXTRA_TURNS = 2;
121
123
  function goneWatch(graceMs, pollMs) {
122
124
  const polls = Math.max(1, Math.ceil(graceMs / Math.max(1, pollMs)));
123
125
  let since = null;
@@ -184,6 +186,7 @@ function capture(stream) {
184
186
  }
185
187
  function supervise(child, options = {}) {
186
188
  const grace = Math.max(0, options.graceMs ?? EXIT_GRACE_MS);
189
+ const drainMs = Math.max(0, options.drainMs ?? PIPE_DRAIN_MS);
187
190
  const pollMs = Math.max(1, options.pollMs ?? EXIT_POLL_MS);
188
191
  const alive = options.alive ?? processAlive;
189
192
  const group = options.group ?? false;
@@ -197,6 +200,7 @@ function supervise(child, options = {}) {
197
200
  const gone = goneWatch(grace, pollMs);
198
201
  let deadline;
199
202
  let graceTimer;
203
+ let drainTimer;
200
204
  const settle = (run) => {
201
205
  if (settled)
202
206
  return;
@@ -204,6 +208,7 @@ function supervise(child, options = {}) {
204
208
  clearTimeout(deadline);
205
209
  clearTimeout(graceTimer);
206
210
  clearInterval(poller);
211
+ clearTimeout(drainTimer);
207
212
  signal?.removeEventListener("abort", onAbort);
208
213
  resolve(run);
209
214
  };
@@ -227,7 +232,8 @@ function supervise(child, options = {}) {
227
232
  end("lost");
228
233
  }, pollMs);
229
234
  unref(poller);
230
- if (timeoutMs !== undefined && timeoutMs > 0 && Number.isFinite(timeoutMs)) {
235
+ const bounded = timeoutMs !== undefined && timeoutMs > 0 && Number.isFinite(timeoutMs);
236
+ if (bounded) {
231
237
  deadline = setTimeout(() => end("timeout"), timeoutMs);
232
238
  if (options.unref)
233
239
  unref(deadline);
@@ -235,8 +241,28 @@ function supervise(child, options = {}) {
235
241
  signal?.addEventListener("abort", onAbort, { once: true });
236
242
  if (signal?.aborted)
237
243
  onAbort();
238
- child.exited.then(() => {
244
+ child.exited.then((exitCode) => {
239
245
  exitSeen = true;
246
+ if (bounded || ended !== null || settled)
247
+ return;
248
+ let turns = 0;
249
+ const drain = () => {
250
+ if (ended !== null || settled)
251
+ return;
252
+ if (turns++ < DRAIN_EXTRA_TURNS) {
253
+ drainTimer = setTimeout(drain, 0);
254
+ if (options.unref)
255
+ unref(drainTimer);
256
+ return;
257
+ }
258
+ out.cancel();
259
+ err.cancel();
260
+ const signalCode = signalName(child.signalCode);
261
+ settle({ kind: "incomplete", exitCode, signalCode, stdout: out.snapshot(), stderr: err.snapshot() });
262
+ };
263
+ drainTimer = setTimeout(drain, drainMs);
264
+ if (options.unref)
265
+ unref(drainTimer);
240
266
  }, () => {
241
267
  return;
242
268
  });
@@ -453,7 +479,7 @@ async function gitRead(params, cwd, signal) {
453
479
  ${note}`, isError: false, details: { args, exitCode: null, truncated: true } };
454
480
  }
455
481
  if (run.exitCode === undefined) {
456
- const why = run.ended === "timeout" ? `timed out after ${GIT_READ_TIMEOUT_MS / 1000}s` : "ended without an exit status";
482
+ const why = run.ended === "timeout" ? `timed out after ${GIT_READ_TIMEOUT_MS / 1000}s` : run.ended === "incomplete" ? "exited, but a process it started kept its output open; the output is incomplete" : "ended without an exit status";
457
483
  return { text: `git ${args.join(" ")} ${why}.
458
484
  ${run.stderr}`.trim(), isError: true, details: { args, exitCode: null, truncated: false } };
459
485
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srobroek/pi-agent-reviewer",
3
- "version": "0.19.5",
3
+ "version": "0.19.6",
4
4
  "description": "A security review skill: trace untrusted input to sinks, tag CWE ids and check cross-boundary dispatch.",
5
5
  "keywords": [
6
6
  "pi-package"