@integrity-labs/agt-cli 0.28.763 → 0.28.764

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 (24) hide show
  1. package/dist/bin/agt.js +5 -5
  2. package/dist/{chunk-L4KDOGHB.js → chunk-23KTLVYX.js} +15 -1
  3. package/dist/{chunk-L4KDOGHB.js.map → chunk-23KTLVYX.js.map} +1 -1
  4. package/dist/{chunk-EU6RSU5V.js → chunk-LVBINNTQ.js} +157 -40
  5. package/dist/chunk-LVBINNTQ.js.map +1 -0
  6. package/dist/{chunk-HVOHM3PB.js → chunk-SMY25FCN.js} +70 -27
  7. package/dist/{chunk-HVOHM3PB.js.map → chunk-SMY25FCN.js.map} +1 -1
  8. package/dist/{claude-pair-runtime-5CKIB2IM.js → claude-pair-runtime-U6WDTNK3.js} +2 -2
  9. package/dist/lib/manager-worker.js +57 -62
  10. package/dist/lib/manager-worker.js.map +1 -1
  11. package/dist/mcp/direct-chat-channel.js +14 -0
  12. package/dist/mcp/index.js +14 -0
  13. package/dist/mcp/origami.js +14 -0
  14. package/dist/mcp/slack-channel.js +14 -0
  15. package/dist/mcp/telegram-channel.js +14 -0
  16. package/dist/{persistent-session-VS44QKVB.js → persistent-session-3OBDKYWF.js} +3 -3
  17. package/dist/{responsiveness-probe-CNSUJALX.js → responsiveness-probe-ULIAXSCT.js} +3 -3
  18. package/dist/{session-auth-dead-3AK3MDNT.js → session-auth-dead-67XFJWMA.js} +2 -2
  19. package/package.json +1 -1
  20. package/dist/chunk-EU6RSU5V.js.map +0 -1
  21. /package/dist/{claude-pair-runtime-5CKIB2IM.js.map → claude-pair-runtime-U6WDTNK3.js.map} +0 -0
  22. /package/dist/{persistent-session-VS44QKVB.js.map → persistent-session-3OBDKYWF.js.map} +0 -0
  23. /package/dist/{responsiveness-probe-CNSUJALX.js.map → responsiveness-probe-ULIAXSCT.js.map} +0 -0
  24. /package/dist/{session-auth-dead-3AK3MDNT.js.map → session-auth-dead-67XFJWMA.js.map} +0 -0
@@ -7,13 +7,14 @@ import {
7
7
  buildRemoteMcpEntry,
8
8
  expandTemplateVars,
9
9
  getProjectDir,
10
+ hardBoundedExecFile,
10
11
  isolationMode,
11
12
  log,
12
13
  mergeEnvIntegrationsContent,
13
14
  parseEnvFileEntries,
14
15
  parseEnvIntegrations,
15
16
  shellQuote
16
- } from "./chunk-EU6RSU5V.js";
17
+ } from "./chunk-LVBINNTQ.js";
17
18
  import {
18
19
  BIND_FAILURE_QUARANTINE_THRESHOLD,
19
20
  INTEGRATIONS_SECTION_END,
@@ -63,7 +64,7 @@ import {
63
64
  sessionTranscriptDir,
64
65
  worseConnectivityOutcome,
65
66
  wrapScheduledTaskPrompt
66
- } from "./chunk-L4KDOGHB.js";
67
+ } from "./chunk-23KTLVYX.js";
67
68
  import {
68
69
  parsePsRows
69
70
  } from "./chunk-XWVM4KPK.js";
@@ -6436,7 +6437,7 @@ function exchangeFailureKind(err) {
6436
6437
  }
6437
6438
 
6438
6439
  // src/lib/api-client.ts
6439
- var agtCliVersion = true ? "0.28.763" : "dev";
6440
+ var agtCliVersion = true ? "0.28.764" : "dev";
6440
6441
  var lastConfigHash = null;
6441
6442
  function setConfigHash(hash) {
6442
6443
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -7043,6 +7044,12 @@ var HostFlagStore = class {
7043
7044
 
7044
7045
  // src/lib/stale-mcp-reaper.ts
7045
7046
  import { execFileSync } from "child_process";
7047
+ function livenessFromProbe(r, onNoAnswer) {
7048
+ if (r.kind === "ok") return true;
7049
+ if (r.kind === "failed" && r.status !== null) return false;
7050
+ onNoAnswer?.(r.kind === "timed-out" ? "did not answer within its bound" : `could not run: ${r.message}`);
7051
+ return true;
7052
+ }
7046
7053
  var rotationTimestamps = /* @__PURE__ */ new Map();
7047
7054
  var DEFAULT_ROTATION_GRACE_MS = 15e3;
7048
7055
  function rotationKey(codeName, serverKey) {
@@ -7256,19 +7263,30 @@ function findMcpChildrenForAgent(args) {
7256
7263
  function reapStaleMcpChildren(args) {
7257
7264
  const { log: log2, codeName, serverKeys, mcpJson, graceMs = 5e3, isolated = false } = args;
7258
7265
  if (serverKeys.length === 0) return [];
7259
- const runPs = args.runPs ?? (isolated ? () => execFileSync("docker", ["exec", `agt-${codeName}`, "ps", "-eo", "pid,ppid,args"], {
7260
- encoding: "utf-8",
7261
- timeout: 8e3
7262
- }) : () => execFileSync("ps", ["-eo", "pid,ppid,args"], { encoding: "utf-8", timeout: 5e3 }));
7263
- const killProcess = args.killProcess ?? (isolated ? (pid, signal) => {
7264
- try {
7265
- execFileSync(
7266
+ const runPs = args.runPs ?? (isolated ? (
7267
+ // ENG-9781: hard-bounded. See bounded-exec.ts — `execFileSync`'s own
7268
+ // `timeout` is not a bound, and this runs per isolated agent per cycle
7269
+ // on the manager-worker's critical path. Throws on a non-answer so the
7270
+ // caller's existing catch skips the agent rather than acting on an
7271
+ // empty process list.
7272
+ () => {
7273
+ const r = hardBoundedExecFile(
7266
7274
  "docker",
7267
- ["exec", `agt-${codeName}`, "kill", signal === "SIGKILL" ? "-KILL" : "-TERM", String(pid)],
7268
- { timeout: 8e3, stdio: "ignore" }
7275
+ ["exec", `agt-${codeName}`, "ps", "-eo", "pid,ppid,args"],
7276
+ { timeoutMs: 8e3, log: log2 }
7277
+ );
7278
+ if (r.kind === "ok") return r.stdout;
7279
+ throw new Error(
7280
+ r.kind === "timed-out" ? `docker exec ps did not answer within its bound (bounded=${r.bounded})` : `docker exec ps failed (status=${r.status}): ${r.message}`
7269
7281
  );
7270
- } catch {
7271
7282
  }
7283
+ ) : () => execFileSync("ps", ["-eo", "pid,ppid,args"], { encoding: "utf-8", timeout: 5e3 }));
7284
+ const killProcess = args.killProcess ?? (isolated ? (pid, signal) => {
7285
+ hardBoundedExecFile(
7286
+ "docker",
7287
+ ["exec", `agt-${codeName}`, "kill", signal === "SIGKILL" ? "-KILL" : "-TERM", String(pid)],
7288
+ { timeoutMs: 8e3, log: log2 }
7289
+ );
7272
7290
  } : (pid, signal) => {
7273
7291
  try {
7274
7292
  process.kill(pid, signal);
@@ -7276,15 +7294,17 @@ function reapStaleMcpChildren(args) {
7276
7294
  }
7277
7295
  });
7278
7296
  const isAlive = args.isAlive ?? (isolated ? (pid) => {
7279
- try {
7280
- execFileSync("docker", ["exec", `agt-${codeName}`, "kill", "-0", String(pid)], {
7281
- timeout: 8e3,
7282
- stdio: "ignore"
7283
- });
7284
- return true;
7285
- } catch {
7286
- return false;
7287
- }
7297
+ const r = hardBoundedExecFile(
7298
+ "docker",
7299
+ ["exec", `agt-${codeName}`, "kill", "-0", String(pid)],
7300
+ { timeoutMs: 8e3, log: log2 }
7301
+ );
7302
+ return livenessFromProbe(
7303
+ r,
7304
+ (why) => log2(
7305
+ `[stale-mcp-reaper] liveness probe for pid ${pid} in 'agt-${codeName}' ${why} \u2014 treating as ALIVE (no reap) rather than guessing`
7306
+ )
7307
+ );
7288
7308
  } : (pid) => {
7289
7309
  try {
7290
7310
  process.kill(pid, 0);
@@ -7453,10 +7473,33 @@ function reapMissingMcpSessions(args) {
7453
7473
  currentGenerationExternallyStarted = false
7454
7474
  } = args;
7455
7475
  const now = args.now ?? Date.now;
7456
- const runPs = args.runPs ?? (isolated ? () => execFileSync2("docker", ["exec", `agt-${codeName}`, "ps", "-eo", "pid,ppid,args"], {
7457
- encoding: "utf-8",
7458
- timeout: 8e3
7459
- }) : () => execFileSync2("ps", ["-eo", "pid,ppid,args"], { encoding: "utf-8", timeout: 5e3 }));
7476
+ const runPs = args.runPs ?? (isolated ? (
7477
+ // ENG-9781: HARD-bounded, and the distinction is the whole ticket. The
7478
+ // previous `execFileSync(..., { timeout: 8_000 })` bounded nothing —
7479
+ // Node fires SIGTERM at the deadline and then keeps waiting, so a
7480
+ // docker CLI talking to a wedged daemon blocked the manager-worker's
7481
+ // event loop and stopped scheduling for EVERY agent on the host
7482
+ // (33m46s, twice, on 2026-09-01). This call runs once per isolated
7483
+ // agent per poll cycle, so it is the single worst place on the manager
7484
+ // for an unbounded subprocess.
7485
+ //
7486
+ // Throwing on a non-answer is deliberate rather than lazy: the caller
7487
+ // already catches, logs and SKIPS the agent for the cycle, which is
7488
+ // exactly right. A timeout must not become an empty process list —
7489
+ // that reads as "every declared MCP server is missing" and restarts the
7490
+ // session, turning a docker hiccup into a fleet-wide restart storm.
7491
+ () => {
7492
+ const r = hardBoundedExecFile(
7493
+ "docker",
7494
+ ["exec", `agt-${codeName}`, "ps", "-eo", "pid,ppid,args"],
7495
+ { timeoutMs: 8e3, log: log2 }
7496
+ );
7497
+ if (r.kind === "ok") return r.stdout;
7498
+ throw new Error(
7499
+ r.kind === "timed-out" ? `docker exec ps did not answer within its bound (bounded=${r.bounded})` : `docker exec ps failed (status=${r.status}): ${r.message}`
7500
+ );
7501
+ }
7502
+ ) : () => execFileSync2("ps", ["-eo", "pid,ppid,args"], { encoding: "utf-8", timeout: 5e3 }));
7460
7503
  if (!mcpJson?.mcpServers) {
7461
7504
  return { missing: [], restarted: false, reason: "no-mcp-json" };
7462
7505
  }
@@ -10593,4 +10636,4 @@ export {
10593
10636
  managerInstallSystemUnitCommand,
10594
10637
  managerUninstallSystemUnitCommand
10595
10638
  };
10596
- //# sourceMappingURL=chunk-HVOHM3PB.js.map
10639
+ //# sourceMappingURL=chunk-SMY25FCN.js.map