grepmax 0.26.77 → 0.26.79

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.
@@ -10,7 +10,7 @@
10
10
  "name": "grepmax",
11
11
  "source": "./plugins/grepmax",
12
12
  "description": "Semantic code search for Claude Code. Automatically indexes your project and provides intelligent search capabilities.",
13
- "version": "0.26.77",
13
+ "version": "0.26.79",
14
14
  "author": {
15
15
  "name": "Robert Owens",
16
16
  "email": "robowens@me.com"
package/README.md CHANGED
@@ -528,11 +528,11 @@ The package includes a separate prune-only helper with pinned Lance 12 dependenc
528
528
 
529
529
  `gmax recover --table /path/to/lancedb/chunks.lance --json` reads the durable recovery receipt without starting a daemon or preparing Python. `--check` samples admission without pruning. `--prune --version <current-version> --cutoff <absolute-ISO-timestamp>` explicitly requests one offline prune. A prior uncertain attempt requires `--acknowledge-uncertain <attempt-id>` after inspection. Recovery never creates/clears quarantine, stops other owners, retries automatically or enables rewriting.
530
530
 
531
- Production recovery currently requires macOS, a persistent `autostart-disabled` file in the selected store home, and closed store owners. Recovery alone uses known healthy memory/kernel pressure and the shared aggregate resource budget; normal development retains its configured guard policy. Immediately free RAM is measured for diagnostics but has no fixed minimum: macOS can reclaim cached memory, so a low free-page count alone must not prevent cleanup. The helper reserves 512 MiB of admission capacity; this is not an OS-enforced footprint cap. Recovery samples have an eight-second total ceiling, including the established five-second kernel probe allowance, with fresh sampling at deletion admission and five-second heartbeat scheduling. Unknown, stale, warning or critical measurements refuse/interrupt recovery. Pruning needs at least 1 MiB of measured metadata disk headroom, not full-table rewrite space. Initial wheel setup requires 512 MiB; an existing environment is checked against the lock offline without that download-space requirement.
531
+ Production recovery currently requires macOS, a persistent `autostart-disabled` file in the selected store home, and closed store owners. Recovery uses the shared aggregate resource budget and requires measured OS pressure and healthy kernel pressure. The configured `critical-only` policy permits a known OS memory warning while retaining aggregate accounting; the default `strict` policy pauses on warnings. Immediately free RAM is measured for diagnostics but has no fixed minimum: macOS can reclaim cached memory, so a low free-page count alone must not prevent cleanup. The helper reserves 512 MiB of admission capacity; this is not an OS-enforced footprint cap. Recovery samples have an eight-second total ceiling, including a five-second kernel probe allowance, three-second command allowance and three-second footprint allowance, with fresh sampling at deletion admission and five-second heartbeat scheduling. Unknown, stale, critical, kernel-warning or over-budget measurements refuse/interrupt recovery. A prune has a ten-minute wall-time ceiling so rate-limited deletion of thousands of manifests can finish; the 90-second CPU limit and guarded heartbeat remain. Pruning needs at least 1 MiB of measured metadata disk headroom, not full-table rewrite space. Initial wheel setup requires 512 MiB; an existing environment is checked against the lock offline without that download-space requirement.
532
532
 
533
533
  The child waits for launch and deletion admission tokens, with verified helper PID/start identity recorded as the primary exclusive owner. Existing readers retain exclusion if the parent dies while the helper is alive. Current/tagged/post-cutoff metadata is verified after pruning; recovery refuses more than 256 protected versions before deletion to bound verification. Interrupted attempts require verification and explicit acknowledgement before retry. Linux/APFS fixtures exercise native retention and interruption; supported production host admission is tested separately and still runs freshly for each operation.
534
534
 
535
- If a short-lived client child exits during memory sampling, confirmed dead processes can leave the sample while all surviving processes retain measured footprints. An uncertain exit, new process or changed identity requires a complete fresh measurement; a normal-pressure sample may do that once within the original deadline. It never accepts an unmeasured live process. Continued changes, unavailable measurements, and observed warning or critical pressure still refuse admission.
535
+ If a short-lived client child exits during memory sampling, confirmed dead processes can leave the sample while all surviving processes retain measured footprints. An uncertain exit, new process or changed identity requires a complete fresh measurement; a normal-pressure sample may do that once within the original deadline. It never accepts an unmeasured live process. Continued changes, unavailable measurements and critical pressure still refuse admission; warning admission follows the recovery policy above.
536
536
 
537
537
  For an operator-coordinated recovery window:
538
538
 
@@ -56,6 +56,9 @@ const store_lease_1 = require("./store-lease");
56
56
  const project = path.resolve(__dirname, "../../../lance-maintenance");
57
57
  const MAX_OUTPUT_BYTES = 128 * 1024;
58
58
  const MAX_HELPER_MS = 120000;
59
+ // Pruning deletes at 32 files/second. Thousands of retained manifests and
60
+ // transactions cannot fit a two-minute window even with an idle host.
61
+ const MAX_PRUNE_MS = 600000;
59
62
  /** No shell, inherited service credentials, Python path hooks or source builds.
60
63
  * Thread settings apply before Arrow/Lance imports in the child. */
61
64
  function helperEnvironment() {
@@ -104,7 +107,7 @@ function runCleanupProcess(executable, args, options = {}) {
104
107
  forceKill !== null && forceKill !== void 0 ? forceKill : (forceKill = setTimeout(() => child.kill("SIGKILL"), 1000));
105
108
  };
106
109
  const abort = () => stop("Cleanup cancelled");
107
- const timeout = setTimeout(() => stop("Cleanup timed out"), Math.min((_d = options.timeoutMs) !== null && _d !== void 0 ? _d : MAX_HELPER_MS, MAX_HELPER_MS));
110
+ const timeout = setTimeout(() => stop("Cleanup timed out"), Math.min((_d = options.timeoutMs) !== null && _d !== void 0 ? _d : MAX_HELPER_MS, MAX_PRUNE_MS));
108
111
  (_a = options.signal) === null || _a === void 0 ? void 0 : _a.addEventListener("abort", abort, { once: true });
109
112
  // stderr is deliberately not returned: child diagnostics may contain paths,
110
113
  // tokens or registry URLs. Retain a concrete bounded exit/signal/error code.
@@ -360,6 +363,7 @@ function pruneVersions(runtime, store, version, cutoff, options) {
360
363
  "--require-admission",
361
364
  ], {
362
365
  signal: options.signal,
366
+ timeoutMs: MAX_PRUNE_MS,
363
367
  admission: {
364
368
  nonce: options.lease.owner.nonce,
365
369
  start: (pid) => {
@@ -39,6 +39,7 @@ exports.assertRecoveryAdmission = assertRecoveryAdmission;
39
39
  exports.admitPrune = admitPrune;
40
40
  const fs = __importStar(require("node:fs"));
41
41
  const path = __importStar(require("node:path"));
42
+ const host_guard_policy_1 = require("../utils/host-guard-policy");
42
43
  const resource_budget_1 = require("../utils/resource-budget");
43
44
  const safety_latch_1 = require("../utils/safety-latch");
44
45
  const maintenance_policy_1 = require("./maintenance-policy");
@@ -48,9 +49,18 @@ exports.PRUNE_METADATA_HEADROOM_BYTES = 1024 * 1024;
48
49
  function createRecoveryBudget() {
49
50
  return new resource_budget_1.ResourceBudget({
50
51
  policy: () => "strict",
52
+ // Keep measured aggregate accounting in both policies. The user's
53
+ // critical-only selection permits known OS warning, not missing samples,
54
+ // unknown/kernel pressure or an overcommitted aggregate reservation.
55
+ allowMemoryWarning: () => (0, host_guard_policy_1.hostGuardPolicy)() === "critical-only",
51
56
  quarantine: safety_latch_1.safetyStopReason,
52
57
  requireClientRegistration: false,
53
- samplerOverrides: { sampleTimeoutMs: 8000, kernelProbeTimeoutMs: 5000 },
58
+ samplerOverrides: {
59
+ sampleTimeoutMs: 8000,
60
+ kernelProbeTimeoutMs: 5000,
61
+ commandProbeTimeoutMs: 3000,
62
+ footprintProbeTimeoutMs: 3000,
63
+ },
54
64
  sampleMaxAgeMs: 10000,
55
65
  });
56
66
  }
@@ -163,7 +163,7 @@ function sampleHostResourcesOnce(extraPids, overrides, extraGroups) {
163
163
  return false;
164
164
  throw new Error("process liveness unavailable");
165
165
  }
166
- }, sampleTimeoutMs: exports.HOST_SAMPLE_TIMEOUT_MS, kernelProbeTimeoutMs: 500, run: (command, args, timeoutMs) => (0, node_child_process_1.execFileSync)(command, args, {
166
+ }, sampleTimeoutMs: exports.HOST_SAMPLE_TIMEOUT_MS, kernelProbeTimeoutMs: 500, commandProbeTimeoutMs: 500, footprintProbeTimeoutMs: 1500, run: (command, args, timeoutMs) => (0, node_child_process_1.execFileSync)(command, args, {
167
167
  encoding: "utf8",
168
168
  timeout: timeoutMs,
169
169
  maxBuffer: 512 * 1024,
@@ -185,7 +185,7 @@ function sampleHostResourcesOnce(extraPids, overrides, extraGroups) {
185
185
  if (deps.platform !== "darwin")
186
186
  return snapshot;
187
187
  const deadline = deps.monotonic() + deps.sampleTimeoutMs;
188
- const run = (command, args, maximumMs = 500) => {
188
+ const run = (command, args, maximumMs = deps.commandProbeTimeoutMs) => {
189
189
  const remaining = Math.floor(deadline - deps.monotonic());
190
190
  if (remaining <= 0)
191
191
  throw new Error("resource sample deadline exceeded");
@@ -222,7 +222,7 @@ function sampleHostResourcesOnce(extraPids, overrides, extraGroups) {
222
222
  const footprints = parseBatchFootprints(run("footprint", [
223
223
  "--noCategories",
224
224
  ...snapshot.processes.flatMap((p) => ["-p", String(p.pid)]),
225
- ], 1500));
225
+ ], deps.footprintProbeTimeoutMs));
226
226
  for (const p of snapshot.processes)
227
227
  p.footprintMb = (_c = footprints.get(p.pid)) !== null && _c !== void 0 ? _c : null;
228
228
  const after = parseResourceProcesses(run("ps", PS_ARGS), deps.uid, deps.pid, extraPids, extraGroups);
@@ -77,11 +77,12 @@ function resolveResourceBudgetMb(raw = process.env.GMAX_RESOURCE_BUDGET_MB) {
77
77
  throw new ResourceAdmissionError("resource budget must be 256..6144 MiB");
78
78
  return n;
79
79
  }
80
- function assertResourceSnapshot(snapshot, chargedMb, budgetMb, now = Date.now(), sampleMaxAgeMs = 5000) {
80
+ function assertResourceSnapshot(snapshot, chargedMb, budgetMb, now = Date.now(), sampleMaxAgeMs = 5000, allowMemoryWarning = false) {
81
81
  if (snapshot.memoryPressure === "critical" ||
82
82
  snapshot.kernelPressure === "critical")
83
83
  throw new ResourceAdmissionError("critical host pressure; heavy work refused", true);
84
- if (snapshot.memoryPressure === "warn" || snapshot.kernelPressure === "warn")
84
+ if ((snapshot.memoryPressure === "warn" && !allowMemoryWarning) ||
85
+ snapshot.kernelPressure === "warn")
85
86
  throw new ResourceAdmissionError("warning host pressure; heavy work paused");
86
87
  if (snapshot.platform !== "darwin")
87
88
  return;
@@ -92,7 +93,8 @@ function assertResourceSnapshot(snapshot, chargedMb, budgetMb, now = Date.now(),
92
93
  throw new ResourceAdmissionError("resource sample stale or clock changed; heavy work paused");
93
94
  if (snapshot.incompleteReasons.length ||
94
95
  snapshot.aggregateFootprintMb === null ||
95
- snapshot.memoryPressure !== "normal" ||
96
+ (snapshot.memoryPressure !== "normal" &&
97
+ !(allowMemoryWarning && snapshot.memoryPressure === "warn")) ||
96
98
  snapshot.kernelPressure !== "ok")
97
99
  throw new ResourceAdmissionError(`unknown aggregate resources; heavy work paused: ${snapshot.incompleteReasons.join(", ") || "incomplete sample"}`);
98
100
  if (!Number.isFinite(chargedMb) ||
@@ -110,7 +112,7 @@ class ResourceBudget {
110
112
  this.deps = Object.assign({ root: path.join(config_1.PATHS.sharedRoot, "resource-budget"), platform: process.platform, pid: process.pid, now: Date.now, sample: (extraPids = []) => {
111
113
  const records = this.readExistingRecords();
112
114
  return (0, host_resource_1.sampleHostResources)([...records.map((r) => r.pid), ...extraPids], this.deps.samplerOverrides, records.flatMap((r) => (r.groupPid ? [r.groupPid] : [])));
113
- }, signal: (pid) => process.kill(pid, 0), policy: host_guard_policy_1.hostGuardPolicy, requireClientRegistration: true, samplerOverrides: {}, sampleMaxAgeMs: 5000, criticalSample: host_guard_policy_1.sampleCriticalPressure, quarantine: autostart_1.daemonStartDeniedReason, latch: (reason, diagnostics) => (0, safety_latch_1.latchSafetyStop)(reason, undefined, diagnostics), processStart: () => (0, node_child_process_1.execFileSync)("ps", ["-p", String(process.pid), "-o", "lstart="], {
115
+ }, signal: (pid) => process.kill(pid, 0), policy: host_guard_policy_1.hostGuardPolicy, requireClientRegistration: true, allowMemoryWarning: () => false, samplerOverrides: {}, sampleMaxAgeMs: 5000, criticalSample: host_guard_policy_1.sampleCriticalPressure, quarantine: autostart_1.daemonStartDeniedReason, latch: (reason, diagnostics) => (0, safety_latch_1.latchSafetyStop)(reason, undefined, diagnostics), processStart: () => (0, node_child_process_1.execFileSync)("ps", ["-p", String(process.pid), "-o", "lstart="], {
114
116
  encoding: "utf8",
115
117
  timeout: 500,
116
118
  maxBuffer: 1024,
@@ -267,7 +269,7 @@ class ResourceBudget {
267
269
  }
268
270
  checked(snapshot, records, kind, mb) {
269
271
  try {
270
- assertResourceSnapshot(snapshot, this.charge(snapshot, records), resolveResourceBudgetMb(), this.deps.now(), this.deps.sampleMaxAgeMs);
272
+ assertResourceSnapshot(snapshot, this.charge(snapshot, records), resolveResourceBudgetMb(), this.deps.now(), this.deps.sampleMaxAgeMs, this.deps.allowMemoryWarning());
271
273
  const legacy = snapshot.processes.filter((p) => p.role === "mcp" &&
272
274
  !records.some((r) => r.pid === p.pid && r.kind === "client"));
273
275
  if (legacy.length && this.deps.requireClientRegistration)
@@ -344,7 +346,7 @@ class ResourceBudget {
344
346
  }
345
347
  const records = this.readExistingRecords();
346
348
  const snapshot = this.deps.sample();
347
- assertResourceSnapshot(snapshot, this.charge(snapshot, records), resolveResourceBudgetMb(), this.deps.now(), this.deps.sampleMaxAgeMs);
349
+ assertResourceSnapshot(snapshot, this.charge(snapshot, records), resolveResourceBudgetMb(), this.deps.now(), this.deps.sampleMaxAgeMs, this.deps.allowMemoryWarning());
348
350
  if (this.deps.quarantine())
349
351
  throw new ResourceAdmissionError("host containment");
350
352
  return snapshot;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.26.77",
3
+ "version": "0.26.79",
4
4
  "author": "Robert Owens <78518764+reowens@users.noreply.github.com>",
5
5
  "homepage": "https://github.com/reowens/grepmax",
6
6
  "bugs": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grepmax",
3
- "version": "0.26.77",
3
+ "version": "0.26.79",
4
4
  "description": "Semantic code search for Claude Code. Automatically indexes your project and provides intelligent search capabilities.",
5
5
  "author": {
6
6
  "name": "Robert Owens",