agenr 0.7.18 → 0.7.19

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,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.19] - 2026-02-21
4
+
5
+ ### Fixed
6
+ - fix(ingest): WriteQueue backpressure deadlock when processing large session files; raised default highWatermark from 500 to 2000 and added configurable backpressure timeout (default 120s) that surfaces a clear error instead of hanging forever (#125)
7
+
8
+ ### Added
9
+ - feat(ingest): --queue-high-watermark and --queue-backpressure-timeout-ms CLI flags for tuning write queue behavior on large ingest jobs
10
+ - feat(ingest): verbose mode now logs "[X/N] file -- starting" before extraction begins, eliminating the silent gap during large-file processing (#124)
11
+
3
12
  ## [0.7.18] - 2026-02-21
4
13
 
5
14
  ### Fixed
package/dist/cli-main.js CHANGED
@@ -12448,6 +12448,7 @@ var WriteQueue = class {
12448
12448
  dbPath;
12449
12449
  batchSize;
12450
12450
  highWatermark;
12451
+ backpressureTimeoutMs;
12451
12452
  retryOnFailure;
12452
12453
  isShutdownRequested;
12453
12454
  queue = [];
@@ -12467,7 +12468,8 @@ var WriteQueue = class {
12467
12468
  this.llmClient = options.llmClient;
12468
12469
  this.dbPath = options.dbPath;
12469
12470
  this.batchSize = Math.max(1, Math.floor(options.batchSize ?? 40));
12470
- this.highWatermark = Math.max(1, Math.floor(options.highWatermark ?? 500));
12471
+ this.highWatermark = Math.max(1, Math.floor(options.highWatermark ?? 2e3));
12472
+ this.backpressureTimeoutMs = Math.max(1, options.backpressureTimeoutMs ?? 12e4);
12471
12473
  this.retryOnFailure = options.retryOnFailure !== false;
12472
12474
  this.isShutdownRequested = options.isShutdownRequested;
12473
12475
  void this.runWriterLoop();
@@ -12479,10 +12481,16 @@ var WriteQueue = class {
12479
12481
  if (this.destroyed) {
12480
12482
  throw new ShutdownError("WriteQueue has been destroyed and cannot accept new items.");
12481
12483
  }
12484
+ const backpressureStart = Date.now();
12482
12485
  while (this.pendingEntries > 0 && this.pendingEntries + entries.length > this.highWatermark) {
12483
12486
  if (this.destroyed) {
12484
12487
  throw new ShutdownError("WriteQueue has been destroyed and cannot accept new items.");
12485
12488
  }
12489
+ if (Date.now() - backpressureStart > this.backpressureTimeoutMs) {
12490
+ throw new Error(
12491
+ `WriteQueue backpressure timeout after ${this.backpressureTimeoutMs}ms: ${this.pendingEntries} pending entries, limit=${this.highWatermark} (--queue-high-watermark). The writer may be stalled. Try reducing --workers or --concurrency, increase --queue-high-watermark, or increase --queue-backpressure-timeout-ms if the writer is just slow.`
12492
+ );
12493
+ }
12486
12494
  await sleep(50);
12487
12495
  }
12488
12496
  if (entries.length === 0) {
@@ -13162,6 +13170,12 @@ async function runIngestCommand(inputPaths, options, deps) {
13162
13170
  const globPattern = options.glob?.trim() || DEFAULT_GLOB;
13163
13171
  const llmConcurrency = parsePositiveInt3(options.concurrency, 5, "--concurrency");
13164
13172
  const requestedFileWorkers = parsePositiveInt3(options.workers, 10, "--workers");
13173
+ const queueHighWatermark = parsePositiveInt3(options.queueHighWatermark, 2e3, "--queue-high-watermark");
13174
+ const queueBackpressureTimeoutMs = parsePositiveInt3(
13175
+ options.queueBackpressureTimeoutMs,
13176
+ 12e4,
13177
+ "--queue-backpressure-timeout-ms"
13178
+ );
13165
13179
  const retryEnabled = options.retry !== false;
13166
13180
  const maxRetries = retryEnabled ? parsePositiveInt3(options.maxRetries, 3, "--max-retries") : 0;
13167
13181
  const platformRaw = options.platform?.trim();
@@ -13268,7 +13282,8 @@ async function runIngestCommand(inputPaths, options, deps) {
13268
13282
  llmClient: client,
13269
13283
  dbPath,
13270
13284
  batchSize: 40,
13271
- highWatermark: 500,
13285
+ highWatermark: queueHighWatermark,
13286
+ backpressureTimeoutMs: queueBackpressureTimeoutMs,
13272
13287
  retryOnFailure: retryEnabled,
13273
13288
  isShutdownRequested: resolvedDeps.shouldShutdownFn
13274
13289
  });
@@ -13558,11 +13573,14 @@ async function runIngestCommand(inputPaths, options, deps) {
13558
13573
  if (!target) {
13559
13574
  return;
13560
13575
  }
13576
+ const label = `[${target.index + 1}/${sortedTargets.length}] ${path26.basename(target.file)} (${formatBytes(target.size)})`;
13577
+ if (verbose) {
13578
+ clack4.log.step(`${label} -- starting`, clackOutput);
13579
+ }
13561
13580
  const result = await processTarget(target);
13562
13581
  results[target.index] = result;
13563
13582
  completed += 1;
13564
13583
  updateProgress(completed, total, passVerb);
13565
- const label = `[${target.index + 1}/${sortedTargets.length}] ${path26.basename(target.file)} (${formatBytes(target.size)})`;
13566
13584
  if (verbose) {
13567
13585
  if (result.error) {
13568
13586
  clack4.log.warn(`${label} -- ${formatError(result.error)}`, clackOutput);
@@ -18105,6 +18123,22 @@ function createProgram() {
18105
18123
  "Number of files to process in parallel (default: 10). Each worker uses --concurrency chunk parallelism. Total concurrent LLM calls = workers x concurrency. Reduce if hitting rate limits. Writes retry once per sub-batch unless --no-retry is set.",
18106
18124
  parseIntOption,
18107
18125
  10
18126
+ ).option(
18127
+ "--queue-high-watermark <n>",
18128
+ "Max pending entries in write queue before workers apply backpressure (default: 2000)",
18129
+ (v) => {
18130
+ const n = Number.parseInt(v, 10);
18131
+ if (!Number.isInteger(n) || n < 1) throw new Error("--queue-high-watermark must be a positive integer");
18132
+ return n;
18133
+ }
18134
+ ).option(
18135
+ "--queue-backpressure-timeout-ms <n>",
18136
+ "Max milliseconds workers wait for write-queue backpressure to clear before failing with guidance (default: 120000ms = 2 min)",
18137
+ (v) => {
18138
+ const n = Number.parseInt(v, 10);
18139
+ if (!Number.isInteger(n) || n < 1) throw new Error("--queue-backpressure-timeout-ms must be a positive integer");
18140
+ return n;
18141
+ }
18108
18142
  ).option("--skip-ingested", "Skip already-ingested files", true).option("--no-retry", "Disable auto-retry for failed files").option("--no-pre-fetch", "Disable elaborative encoding pre-fetch").option("--max-retries <n>", "Maximum auto-retry attempts", parseIntOption, 3).option("--force", "Clean re-ingest: delete previous rows for each file before processing", false).action(async (paths, opts) => {
18109
18143
  const result = await runIngestCommand(paths, {
18110
18144
  ...opts,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agenr",
3
- "version": "0.7.18",
3
+ "version": "0.7.19",
4
4
  "openclaw": {
5
5
  "extensions": [
6
6
  "dist/openclaw-plugin/index.js"
@@ -11,13 +11,6 @@
11
11
  "bin": {
12
12
  "agenr": "dist/cli.js"
13
13
  },
14
- "scripts": {
15
- "build": "tsup src/cli.ts src/cli-main.ts src/openclaw-plugin/index.ts --format esm --dts",
16
- "dev": "tsup src/cli.ts src/cli-main.ts --format esm --watch",
17
- "test": "vitest run",
18
- "test:watch": "vitest",
19
- "typecheck": "tsc --noEmit"
20
- },
21
14
  "dependencies": {
22
15
  "@clack/prompts": "^1.0.1",
23
16
  "@libsql/client": "^0.17.0",
@@ -61,9 +54,11 @@
61
54
  "README.md"
62
55
  ],
63
56
  "author": "agenr-ai",
64
- "pnpm": {
65
- "overrides": {
66
- "fast-xml-parser": "^5.3.6"
67
- }
57
+ "scripts": {
58
+ "build": "tsup src/cli.ts src/cli-main.ts src/openclaw-plugin/index.ts --format esm --dts",
59
+ "dev": "tsup src/cli.ts src/cli-main.ts --format esm --watch",
60
+ "test": "vitest run",
61
+ "test:watch": "vitest",
62
+ "typecheck": "tsc --noEmit"
68
63
  }
69
- }
64
+ }