diff --git a/perf/benchmark-lock-ops.mjs b/perf/benchmark-lock-ops.mjs index 2f85aa1..c06f62c 100644 --- a/perf/benchmark-lock-ops.mjs +++ b/perf/benchmark-lock-ops.mjs @@ -5,7 +5,7 @@ const healthManager = new RelayHealthManager(); // Setup mock relays const relays = []; -for (let i = 0; i < 100; i++) { +for (let i = 0; i < 1000; i++) { relays.push(`wss://relay-${i}.example.com`); } @@ -26,16 +26,20 @@ for (const relay of relays) { } } -// Benchmark rankRelays +// Ensure all are cached +healthManager.rankRelays(relays, config); + +// Benchmark rankRelays with a small subset const start = performance.now(); const iterations = 10000; +const subset = relays.slice(0, 5); // Requesting only 5 relays out of 1000 for (let i = 0; i < iterations; i++) { - healthManager.rankRelays(relays, config); + healthManager.rankRelays(subset, config); } const end = performance.now(); const duration = end - start; -console.log(`RankRelays x ${iterations}: ${duration.toFixed(2)}ms`); +console.log(`RankRelays (Subset 5/1000) x ${iterations}: ${duration.toFixed(2)}ms`); console.log(`Average per call: ${(duration / iterations).toFixed(4)}ms`); diff --git a/reports/performance/weekly-perf-report-2026-02-18.md b/reports/performance/weekly-perf-report-2026-02-18.md new file mode 100644 index 0000000..3cdb461 --- /dev/null +++ b/reports/performance/weekly-perf-report-2026-02-18.md @@ -0,0 +1,21 @@ +# Weekly Performance Report: 2026-02-18 + +## System Info +Linux devbox 6.8.0 #1 SMP PREEMPT_DYNAMIC Wed Jan 14 23:11:35 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux +v22.22.0 + +## Baseline: Lock Ops +``` +RankRelays x 10000: 209.17ms +Average per call: 0.0209ms +``` +## Baseline: Lock Ops (Subset 5/1000) +``` +RankRelays (Subset 5/1000) x 10000: 237.77ms +Average per call: 0.0238ms +``` +## After: Lock Ops +``` +RankRelays (Subset 5/1000) x 10000: 34.78ms +Average per call: 0.0035ms +``` diff --git a/src/lock-ops.mjs b/src/lock-ops.mjs index 2eedbfd..a17220c 100644 --- a/src/lock-ops.mjs +++ b/src/lock-ops.mjs @@ -285,7 +285,7 @@ export class RelayHealthManager { } // Sort by score (desc), then quarantine status, then latency (asc), then name - entries.sort((a, b) => { + const comparator = (a, b) => { if (b.score !== a.score) return b.score - a.score; if (a.summary.quarantined !== b.summary.quarantined) return a.summary.quarantined ? 1 : -1; if (a.summary.averageLatencyMs !== b.summary.averageLatencyMs) { @@ -294,15 +294,47 @@ export class RelayHealthManager { return a.summary.averageLatencyMs - b.summary.averageLatencyMs; } return a.relay.localeCompare(b.relay); - }); + }; + entries.sort(comparator); this._sortedCache = { version: this._metricsVersion, validUntil: minQuarantineUntil, entries, + byRelay: new Map(entries.map((e) => [e.relay, e])), + comparator, }; } + // Optimization: if requesting a small subset of total known relays, + // look them up directly instead of filtering the entire list. + // Threshold: if requested set is smaller than 50% of cached entries. + if (relays.length > 0 && relays.length * 2 < this._sortedCache.entries.length) { + const subset = []; + for (const relay of relays) { + const entry = this._sortedCache.byRelay.get(relay); + if (entry) { + subset.push(entry); + } + } + // Re-sort the subset to maintain ranking order + subset.sort(this._sortedCache.comparator); + + return subset.map((entry) => { + const quarantineRemainingMs = entry.metrics.quarantineUntil > nowMs + ? entry.metrics.quarantineUntil - nowMs + : 0; + return { + relay: entry.relay, + score: entry.score, + summary: { + ...entry.summary, + quarantineRemainingMs, + }, + }; + }); + } + const requestedSet = new Set(relays); return this._sortedCache.entries .filter((entry) => requestedSet.has(entry.relay)) @@ -425,7 +457,7 @@ function buildRelayHealthConfig(deps) { quarantineCooldownMs: deps.quarantineCooldownMs ?? DEFAULT_QUARANTINE_COOLDOWN_MS, maxQuarantineCooldownMs: deps.maxQuarantineCooldownMs ?? DEFAULT_MAX_QUARANTINE_COOLDOWN_MS, snapshotIntervalMs: deps.snapshotIntervalMs ?? DEFAULT_SNAPSHOT_INTERVAL_MS, - minActiveRelayPool: Math.max(1, deps.minActiveRelayPool), + minActiveRelayPool: Math.max(1, deps.minActiveRelayPool ?? 1), }; } diff --git a/task-logs/weekly/2026-02-18T19-54-03Z__perf-deepdive-agent__completed.md b/task-logs/weekly/2026-02-18T19-54-03Z__perf-deepdive-agent__completed.md new file mode 100644 index 0000000..b456e9d --- /dev/null +++ b/task-logs/weekly/2026-02-18T19-54-03Z__perf-deepdive-agent__completed.md @@ -0,0 +1,2 @@ +# Task Log +Completed successfully. diff --git a/test_output.txt b/test_output.txt new file mode 100644 index 0000000..74920eb --- /dev/null +++ b/test_output.txt @@ -0,0 +1,2641 @@ + +> torch-lock@0.1.0 test +> npm run validate:scheduler && npm run test:integration:e2e && node --test test/*.test.mjs tests/*.test.js + + +> torch-lock@0.1.0 validate:scheduler +> node scripts/validate-scheduler-roster.mjs && node scripts/validate-prompt-contract.mjs && node scripts/validate-scheduler-flow-parity.mjs && npm run validate:scheduler-failure-schema + +Scheduler tables, roster, and prompt filenames are in sync. +Prompt contract validated for all daily/weekly prompts. +Scheduler flow parity validated for prompts and scheduler implementation. + +> torch-lock@0.1.0 validate:scheduler-failure-schema +> node --test test/scheduler-lock-failure-schema.contract.test.mjs + +TAP version 13 +# Subtest: scheduler lock backend failure artifact matches required frontmatter schema +ok 1 - scheduler lock backend failure artifact matches required frontmatter schema + --- + duration_ms: 95.369899 + type: 'test' + ... +# Subtest: schema contract catches missing required lock-backend field +ok 2 - schema contract catches missing required lock-backend field + --- + duration_ms: 1.953803 + type: 'test' + ... +# Subtest: schema contract catches misnamed lock-backend key +ok 3 - schema contract catches misnamed lock-backend key + --- + duration_ms: 0.522072 + type: 'test' + ... +1..3 +# tests 3 +# suites 0 +# pass 3 +# fail 0 +# cancelled 0 +# skipped 0 +# todo 0 +# duration_ms 176.758951 + +> torch-lock@0.1.0 test:integration:e2e +> node --test test/scheduler-preflight-lock.e2e.test.mjs + +TAP version 13 +# Subtest: lock preflight e2e: successful lock writes completed status snapshot +ok 1 - lock preflight e2e: successful lock writes completed status snapshot + --- + duration_ms: 374.411898 + type: 'test' + ... +# Subtest: lock preflight e2e: exit code 2 quorum failure persists failed backend status and prompt-not-started marker +ok 2 - lock preflight e2e: exit code 2 quorum failure persists failed backend status and prompt-not-started marker + --- + duration_ms: 97.807339 + type: 'test' + ... +# Subtest: lock preflight e2e: non-lock failure exits failed without prompt parse/schema classification +ok 3 - lock preflight e2e: non-lock failure exits failed without prompt parse/schema classification + --- + duration_ms: 87.151099 + type: 'test' + ... +1..3 +# tests 3 +# suites 0 +# pass 3 +# fail 0 +# cancelled 0 +# skipped 0 +# todo 0 +# duration_ms 637.194646 +TAP version 13 +# Subtest: Build artifacts verification + # Subtest: dist directory exists + not ok 1 - dist directory exists + --- + duration_ms: 1.791826 + type: 'test' + location: '/app/test/build_verification.test.mjs:9:11' + failureType: 'testCodeFailure' + error: |- + dist directory should exist + + false !== true + + code: 'ERR_ASSERTION' + name: 'AssertionError' + expected: true + actual: false + operator: 'strictEqual' + stack: |- + TestContext. (file:///app/test/build_verification.test.mjs:10:12) + Test.runInAsyncScope (node:async_hooks:214:14) + Test.run (node:internal/test_runner/test:1047:25) + Test.start (node:internal/test_runner/test:944:17) + TestContext.test (node:internal/test_runner/test:373:20) + TestContext. (file:///app/test/build_verification.test.mjs:9:11) + Test.runInAsyncScope (node:async_hooks:214:14) + Test.run (node:internal/test_runner/test:1047:25) + Test.start (node:internal/test_runner/test:944:17) + startSubtestAfterBootstrap (node:internal/test_runner/harness:296:17) + ... + # Subtest: Critical files exist in dist + not ok 2 - Critical files exist in dist + --- + duration_ms: 0.460696 + type: 'test' + location: '/app/test/build_verification.test.mjs:13:11' + failureType: 'testCodeFailure' + error: |- + File index.html should exist in dist + + false !== true + + code: 'ERR_ASSERTION' + name: 'AssertionError' + expected: true + actual: false + operator: 'strictEqual' + stack: |- + file:///app/test/build_verification.test.mjs:25:14 + Array.forEach () + TestContext. (file:///app/test/build_verification.test.mjs:23:19) + Test.runInAsyncScope (node:async_hooks:214:14) + Test.run (node:internal/test_runner/test:1047:25) + Test.start (node:internal/test_runner/test:944:17) + TestContext.test (node:internal/test_runner/test:373:20) + TestContext. (file:///app/test/build_verification.test.mjs:13:11) + async Test.run (node:internal/test_runner/test:1054:7) + async startSubtestAfterBootstrap (node:internal/test_runner/harness:296:3) + ... + # Subtest: TORCH.md content is not empty + not ok 3 - TORCH.md content is not empty + --- + duration_ms: 0.235445 + type: 'test' + location: '/app/test/build_verification.test.mjs:29:11' + failureType: 'testCodeFailure' + error: "ENOENT: no such file or directory, open '/app/dist/src/docs/TORCH.md'" + code: 'ENOENT' + stack: |- + Object.readFileSync (node:fs:440:20) + TestContext. (file:///app/test/build_verification.test.mjs:31:24) + Test.runInAsyncScope (node:async_hooks:214:14) + Test.run (node:internal/test_runner/test:1047:25) + Test.start (node:internal/test_runner/test:944:17) + TestContext.test (node:internal/test_runner/test:373:20) + TestContext. (file:///app/test/build_verification.test.mjs:29:11) + async Test.run (node:internal/test_runner/test:1054:7) + async startSubtestAfterBootstrap (node:internal/test_runner/harness:296:3) + ... + 1..3 +not ok 1 - Build artifacts verification + --- + duration_ms: 4.009982 + type: 'test' + location: '/app/test/build_verification.test.mjs:8:1' + failureType: 'subtestsFailed' + error: '3 subtests failed' + code: 'ERR_TEST_FAILURE' + ... +# Subtest: parseArgs should parse basic command +ok 2 - parseArgs should parse basic command + --- + duration_ms: 1.606077 + type: 'test' + ... +# Subtest: parseArgs should parse agent and cadence +ok 3 - parseArgs should parse agent and cadence + --- + duration_ms: 0.285292 + type: 'test' + ... +# Subtest: parseArgs should parse equals sign syntax +ok 4 - parseArgs should parse equals sign syntax + --- + duration_ms: 1.734971 + type: 'test' + ... +# Subtest: parseArgs should parse dry-run flag +ok 5 - parseArgs should parse dry-run flag + --- + duration_ms: 0.3886 + type: 'test' + ... +# Subtest: parseArgs should parse port with default +ok 6 - parseArgs should parse port with default + --- + duration_ms: 0.219191 + type: 'test' + ... +# Subtest: parseArgs should parse custom port +ok 7 - parseArgs should parse custom port + --- + duration_ms: 0.172509 + type: 'test' + ... +# Subtest: parseArgs should parse ignore-logs flag +ok 8 - parseArgs should parse ignore-logs flag + --- + duration_ms: 0.269651 + type: 'test' + ... +# Subtest: parseArgs should parse memory flags +ok 9 - parseArgs should parse memory flags + --- + duration_ms: 1.187463 + type: 'test' + ... +# Subtest: parseArgs should parse memory flags with equals +ok 10 - parseArgs should parse memory flags with equals + --- + duration_ms: 0.777389 + type: 'test' + ... +# Subtest: cmdList + # Subtest: should list active locks and identify unknown agents + ok 1 - should list active locks and identify unknown agents + --- + duration_ms: 1.545218 + type: 'test' + ... + 1..1 +ok 11 - cmdList + --- + duration_ms: 2.702753 + type: 'suite' + ... +# Dashboard running at http://127.0.0.1:4174/dashboard/ +# Authentication: enabled (Basic Auth) +# Serving files from /app +# Using configuration from /app +# Subtest: Dashboard Authentication + # Subtest: returns 401 when auth is required but missing + ok 1 - returns 401 when auth is required but missing + --- + duration_ms: 29.182913 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:4174/dashboard/ +# Authentication: enabled (Basic Auth) +# Serving files from /app +# Using configuration from /app + # Subtest: returns 401 when malformed auth header is provided + ok 2 - returns 401 when malformed auth header is provided + --- + duration_ms: 7.944203 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:4174/dashboard/ +# Authentication: enabled (Basic Auth) +# Serving files from /app +# Using configuration from /app + # Subtest: returns 200 when valid credentials are provided + ok 3 - returns 200 when valid credentials are provided + --- + duration_ms: 6.978091 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:4174/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: returns 200 when auth is disabled + ok 4 - returns 200 when auth is disabled + --- + duration_ms: 8.881101 + type: 'test' + ... + 1..4 +ok 12 - Dashboard Authentication + --- + duration_ms: 54.960913 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) +# Subtest: Dashboard Configuration Exposure Security +ok 13 - Dashboard Configuration Exposure Security + --- + duration_ms: 36.207727 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:4176/dashboard/ +# Authentication: DISABLED (Dashboard is public) +# Serving files from /app +# Using configuration from /app +# Subtest: Dashboard Configuration Security + # Subtest: sanitizes config when auth is disabled + ok 1 - sanitizes config when auth is disabled + --- + duration_ms: 32.241324 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:4177/dashboard/ +# Authentication: enabled (Basic Auth) +# Serving files from /app +# Using configuration from /app + # Subtest: sanitizes auth credentials even when authenticated + ok 2 - sanitizes auth credentials even when authenticated + --- + duration_ms: 10.746263 + type: 'test' + ... + 1..2 +ok 14 - Dashboard Configuration Security + --- + duration_ms: 45.527154 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Authentication: DISABLED (Dashboard is public) +# Serving files from /app +# Using configuration from /app +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Authentication: DISABLED (Dashboard is public) +# Using configuration from /app +# Subtest: Dashboard Path Traversal Security Fix + # Subtest: allows access to valid dashboard index + ok 1 - allows access to valid dashboard index + --- + duration_ms: 32.637957 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Authentication: DISABLED (Dashboard is public) +# Serving files from /app +# Using configuration from /app + # Subtest: blocks traversal attempt: /../../etc/passwd + ok 2 - blocks traversal attempt: /../../etc/passwd + --- + duration_ms: 8.901538 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks traversal attempt: /dashboard/../../etc/passwd + ok 3 - blocks traversal attempt: /dashboard/../../etc/passwd + --- + duration_ms: 5.399998 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks traversal attempt: /dashboard/../../../etc/passwd + ok 4 - blocks traversal attempt: /dashboard/../../../etc/passwd + --- + duration_ms: 4.978556 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks traversal attempt: /../package.json + ok 5 - blocks traversal attempt: /../package.json + --- + duration_ms: 5.740048 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks traversal attempt: /dashboard/../package.json + ok 6 - blocks traversal attempt: /dashboard/../package.json + --- + duration_ms: 4.137183 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks traversal attempt: /dashboard/%2e%2e/package.json + ok 7 - blocks traversal attempt: /dashboard/%2e%2e/package.json + --- + duration_ms: 3.309199 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks traversal attempt: /dashboard/%2e%2e%2fpackage.json + ok 8 - blocks traversal attempt: /dashboard/%2e%2e%2fpackage.json + --- + duration_ms: 3.536929 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Authentication: DISABLED (Dashboard is public) +# Serving files from /app +# Using configuration from /app + # Subtest: blocks traversal attempt: /..%2fpackage.json + ok 9 - blocks traversal attempt: /..%2fpackage.json + --- + duration_ms: 5.72073 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks traversal attempt: /%2e%2e%2fpackage.json + ok 10 - blocks traversal attempt: /%2e%2e%2fpackage.json + --- + duration_ms: 5.261488 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Authentication: DISABLED (Dashboard is public) +# Using configuration from /app + # Subtest: blocks traversal attempt: /dashboard/..%5cpackage.json + ok 11 - blocks traversal attempt: /dashboard/..%5cpackage.json + --- + duration_ms: 3.811563 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Authentication: DISABLED (Dashboard is public) +# Using configuration from /app + # Subtest: blocks traversal attempt: /dashboard/..%252fpackage.json + ok 12 - blocks traversal attempt: /dashboard/..%252fpackage.json + --- + duration_ms: 4.508074 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks traversal attempt: /dashboard/....//package.json + ok 13 - blocks traversal attempt: /dashboard/....//package.json + --- + duration_ms: 2.834398 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks traversal attempt: /dashboard/.../package.json + ok 14 - blocks traversal attempt: /dashboard/.../package.json + --- + duration_ms: 3.157495 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks traversal attempt: //etc/passwd + ok 15 - blocks traversal attempt: //etc/passwd + --- + duration_ms: 2.663941 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Authentication: DISABLED (Dashboard is public) +# Using configuration from /app + # Subtest: blocks traversal attempt: /dashboard//../../etc/passwd + ok 16 - blocks traversal attempt: /dashboard//../../etc/passwd + --- + duration_ms: 2.889384 + type: 'test' + ... + # Subtest: allows traversal within allowed paths + ok 17 - allows traversal within allowed paths + --- + duration_ms: 4.694338 + type: 'test' + ... + 1..17 +ok 15 - Dashboard Path Traversal Security Fix + --- + duration_ms: 109.399336 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Authentication: DISABLED (Dashboard is public) +# Serving files from /app +# Using configuration from /app +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Authentication: DISABLED (Dashboard is public) +# Serving files from /app +# Using configuration from /app +# Subtest: Dashboard File Access Security + # Subtest: allows access to dashboard assets + ok 1 - allows access to dashboard assets + --- + duration_ms: 32.007407 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Authentication: DISABLED (Dashboard is public) +# Serving files from /app +# Using configuration from /app + # Subtest: allows access to global assets + ok 2 - allows access to global assets + --- + duration_ms: 14.687168 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks access to package.json + ok 3 - blocks access to package.json + --- + duration_ms: 5.540312 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks access to src/dashboard.mjs + ok 4 - blocks access to src/dashboard.mjs + --- + duration_ms: 5.856293 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks access to random root files + ok 5 - blocks access to random root files + --- + duration_ms: 5.634304 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: allows access to torch-config.json via special handler + ok 6 - allows access to torch-config.json via special handler + --- + duration_ms: 4.264661 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Serving files from /app +# Using configuration from /app +# Authentication: DISABLED (Dashboard is public) + # Subtest: blocks directory traversal attempts + ok 7 - blocks directory traversal attempts + --- + duration_ms: 3.078585 + type: 'test' + ... +# Dashboard running at http://127.0.0.1:0/dashboard/ +# Authentication: DISABLED (Dashboard is public) +# Serving files from /app +# Using configuration from /app + # Subtest: responses include security headers + ok 8 - responses include security headers + --- + duration_ms: 5.041911 + type: 'test' + ... + # Subtest: error responses include security headers + ok 9 - error responses include security headers + --- + duration_ms: 5.725486 + type: 'test' + ... + 1..9 +ok 16 - Dashboard File Access Security + --- + duration_ms: 86.06887 + type: 'test' + ... +# Initializing torch in /app/test_validation_env/valid-dir_123... +# Copying application directories... +# Copied src/ +# Copied bin/ +# Copied dashboard/ +# Copied landing/ +# Copied assets/ +# Copied scripts/ +# Copying application files... +# Copied package.json +# Copied build.mjs +# Copied README.md +# Copied torch-config.example.json +# Copied TORCH.md +# Created valid-dir_123/roster.json +# Created valid-dir_123/META_PROMPTS.md +# Created valid-dir_123/scheduler-flow.md +# Created valid-dir_123/daily-scheduler.md +# Created valid-dir_123/weekly-scheduler.md +# Created 22 files in valid-dir_123/prompts/daily/ +# Created 21 files in valid-dir_123/prompts/weekly/ +# Saved configuration to torch-config.json +# Added script: "torch:dashboard" +# Added script: "torch:check" +# Added script: "torch:lock" +# Added script: "torch:health" +# Added script: "torch:memory:list" +# Added script: "torch:memory:inspect" +# Updated package.json with convenience scripts. +# Initialization complete. +# You can now customize the files in valid-dir_123/ +# Initializing torch in /app/test_validation_env... +# Copying application directories... +# Copied src/ +# Copied bin/ +# Copied dashboard/ +# Copied landing/ +# Copied assets/ +# Copied scripts/ +# Copying application files... +# Skipping package.json to avoid overwriting host package.json (installing to root). +# Copied build.mjs +# Copied README.md +# Copied torch-config.example.json +# Copied TORCH.md +# Created roster.json +# Created META_PROMPTS.md +# Created scheduler-flow.md +# Created daily-scheduler.md +# Created weekly-scheduler.md +# Created 22 files in prompts/daily/ +# Created 21 files in prompts/weekly/ +# Updating existing torch-config.json... +# Saved configuration to torch-config.json +# Initialization complete. +# You can now customize the files in / +# Initializing torch in /app/test_validation_env/path/to/torch... +# Copying application directories... +# Copied src/ +# Copied bin/ +# Copied dashboard/ +# Copied landing/ +# Copied assets/ +# Copied scripts/ +# Copying application files... +# Copied package.json +# Copied build.mjs +# Copied README.md +# Copied torch-config.example.json +# Copied TORCH.md +# Created path/to/torch/roster.json +# Created path/to/torch/META_PROMPTS.md +# Created path/to/torch/scheduler-flow.md +# Created path/to/torch/daily-scheduler.md +# Created path/to/torch/weekly-scheduler.md +# Created 22 files in path/to/torch/prompts/daily/ +# Created 21 files in path/to/torch/prompts/weekly/ +# Updating existing torch-config.json... +# Saved configuration to torch-config.json +# Script "torch:dashboard" already exists, skipping. +# Script "torch:check" already exists, skipping. +# Script "torch:lock" already exists, skipping. +# Script "torch:health" already exists, skipping. +# Script "torch:memory:list" already exists, skipping. +# Script "torch:memory:inspect" already exists, skipping. +# Initialization complete. +# You can now customize the files in path/to/torch/ +# Subtest: cmdInit should validate install directory name + # Subtest: should reject directory with semicolon + ok 1 - should reject directory with semicolon + --- + duration_ms: 1.538752 + type: 'test' + ... + # Subtest: should reject directory with spaces + ok 2 - should reject directory with spaces + --- + duration_ms: 0.364761 + type: 'test' + ... + # Subtest: should reject directory with quotes + ok 3 - should reject directory with quotes + --- + duration_ms: 1.600385 + type: 'test' + ... + # Subtest: should reject directory with backticks + ok 4 - should reject directory with backticks + --- + duration_ms: 0.308437 + type: 'test' + ... + # Subtest: should reject directory with $ + ok 5 - should reject directory with $ + --- + duration_ms: 0.319442 + type: 'test' + ... + # Subtest: should accept valid directory names + ok 6 - should accept valid directory names + --- + duration_ms: 34.84027 + type: 'test' + ... + # Subtest: should accept "." + ok 7 - should accept "." + --- + duration_ms: 26.093344 + type: 'test' + ... + # Subtest: should accept nested paths with slashes + ok 8 - should accept nested paths with slashes + --- + duration_ms: 27.557898 + type: 'test' + ... + 1..8 +ok 17 - cmdInit should validate install directory name + --- + duration_ms: 131.359287 + type: 'test' + ... +# Subtest: src/lib.mjs + # Subtest: cmdCheck + # Subtest: returns correct structure with empty locks + ok 1 - returns correct structure with empty locks + --- + duration_ms: 2.807233 + type: 'test' + ... + # Subtest: identifies locked agents + ok 2 - identifies locked agents + --- + duration_ms: 0.555313 + type: 'test' + ... + # Subtest: excludes paused agents + ok 3 - excludes paused agents + --- + duration_ms: 0.639993 + type: 'test' + ... + # Subtest: identifies unknown locked agents + ok 4 - identifies unknown locked agents + --- + duration_ms: 0.776606 + type: 'test' + ... + 1..4 + ok 1 - cmdCheck + --- + duration_ms: 5.946348 + type: 'suite' + ... + # Subtest: cmdLock + # Subtest: successfully locks an available agent + ok 1 - successfully locks an available agent + --- + duration_ms: 16.644405 + type: 'test' + ... + # Subtest: fails if agent is not in roster + ok 2 - fails if agent is not in roster + --- + duration_ms: 0.992324 + type: 'test' + ... + # Subtest: fails if agent is already locked + ok 3 - fails if agent is already locked + --- + duration_ms: 0.506458 + type: 'test' + ... + # Subtest: fails if agent is already completed + ok 4 - fails if agent is already completed + --- + duration_ms: 0.711311 + type: 'test' + ... + # Subtest: fails if race check is lost + ok 5 - fails if race check is lost + --- + duration_ms: 2.769573 + type: 'test' + ... + # Subtest: handles race condition with identical timestamps using eventId tie-breaker (we win) + ok 6 - handles race condition with identical timestamps using eventId tie-breaker (we win) + --- + duration_ms: 14.073261 + type: 'test' + ... + # Subtest: handles race condition with identical timestamps using eventId tie-breaker (we lose) + ok 7 - handles race condition with identical timestamps using eventId tie-breaker (we lose) + --- + duration_ms: 2.485814 + type: 'test' + ... + # Subtest: dry run does not publish + ok 8 - dry run does not publish + --- + duration_ms: 0.678153 + type: 'test' + ... + 1..8 + ok 2 - cmdLock + --- + duration_ms: 39.86569 + type: 'suite' + ... + # Subtest: cmdList + # Subtest: lists active locks + ok 1 - lists active locks + --- + duration_ms: 0.930004 + type: 'test' + ... + # Subtest: warns about unknown agents + ok 2 - warns about unknown agents + --- + duration_ms: 0.408999 + type: 'test' + ... + # Subtest: handles no locks + ok 3 - handles no locks + --- + duration_ms: 0.281538 + type: 'test' + ... + 1..3 + ok 3 - cmdList + --- + duration_ms: 2.069586 + type: 'suite' + ... + # Subtest: cmdComplete + # Subtest: successfully completes an active lock + ok 1 - successfully completes an active lock + --- + duration_ms: 0.995593 + type: 'test' + ... + # Subtest: fails if no active lock found + ok 2 - fails if no active lock found + --- + duration_ms: 0.414896 + type: 'test' + ... + # Subtest: detects already completed task + ok 3 - detects already completed task + --- + duration_ms: 0.315943 + type: 'test' + ... + 1..3 + ok 4 - cmdComplete + --- + duration_ms: 1.914278 + type: 'suite' + ... + 1..4 +ok 18 - src/lib.mjs + --- + duration_ms: 50.726729 + type: 'suite' + ... +# [publish:primary] Publishing to 3 relays (wss://relay-a, wss://relay-b, wss://relay-c)... +# [publish:primary] Publishing to 3 relays (wss://relay-a, wss://relay-b, wss://relay-c)... +# [publish:primary] Publishing to 3 relays (wss://relay-a, wss://relay-b, wss://relay-c)... +# [publish:primary] Publishing to 3 relays (wss://relay-a, wss://relay-b, wss://relay-c)... +# Published to 1/3 relays (required=1, timeout=25ms) +# [publish:primary] Publishing to 2 relays (wss://relay-a, wss://relay-b)... +# [publish:primary] Publishing to 2 relays (wss://relay-a, wss://relay-b)... +# Published to 2/2 relays (required=2, timeout=25ms) +# [publish:primary] Publishing to 3 relays (wss://relay-a, wss://relay-b, wss://relay-c)... +# [publish:primary] Publishing to 3 relays (wss://relay-a, wss://relay-b, wss://relay-c)... +# [publish:primary] Publishing to 3 relays (wss://relay-a, wss://relay-b, wss://relay-c)... +# [publish:primary] Publishing to 3 relays (wss://relay-a, wss://relay-b, wss://relay-c)... +# Published to 2/3 relays (required=2, timeout=25ms) +# (node:6148) ExperimentalWarning: The MockTimers API is an experimental feature and might change at any time +# (Use `node --trace-warnings ...` to show where the warning was created) +# Subtest: ci-resilience lock acquisition under unstable relays + # Subtest: recovers after all relays are down for an initial outage window + ok 1 - recovers after all relays are down for an initial outage window + --- + duration_ms: 23.544965 + type: 'test' + ... + # Subtest: survives intermittent timeout spikes and reaches quorum with bounded retries + ok 2 - survives intermittent timeout spikes and reaches quorum with bounded retries + --- + duration_ms: 1.907877 + type: 'test' + ... + # Subtest: handles staggered relay recovery and never exceeds retry budget + ok 3 - handles staggered relay recovery and never exceeds retry budget + --- + duration_ms: 3.254122 + type: 'test' + ... + 1..3 +ok 19 - ci-resilience lock acquisition under unstable relays + --- + duration_ms: 30.479325 + type: 'suite' + ... +# [publish:primary] Publishing to 1 relays (wss://relay-a)... +# Published to 1/1 relays (required=1, timeout=200ms) +# [publish:primary] Publishing to 1 relays (wss://relay-a)... +# [publish:primary] Publishing to 1 relays (wss://relay-a)... +# Published to 1/1 relays (required=1, timeout=200ms) +# [publish:primary] Publishing to 1 relays (wss://relay-a)... +# [publish:primary] Publishing to 1 relays (wss://relay-a)... +# [publish:primary] Publishing to 1 relays (wss://relay-a)... +# [publish:primary] Publishing to 1 relays (wss://relay-a)... +# (node:6154) ExperimentalWarning: The MockTimers API is an experimental feature and might change at any time +# (Use `node --trace-warnings ...` to show where the warning was created) +# Subtest: publishLock retry behavior + # Subtest: succeeds immediately on first attempt without retries + ok 1 - succeeds immediately on first attempt without retries + --- + duration_ms: 5.99058 + type: 'test' + ... + # Subtest: retries a transient failure then succeeds within retry budget with bounded jitter + ok 2 - retries a transient failure then succeeds within retry budget with bounded jitter + --- + duration_ms: 4.145785 + type: 'test' + ... + # Subtest: returns terminal relay_publish_quorum_failure after exhausting retry budget + ok 3 - returns terminal relay_publish_quorum_failure after exhausting retry budget + --- + duration_ms: 3.133907 + type: 'test' + ... + # Subtest: short-circuits non-retryable failures without extra attempts + ok 4 - short-circuits non-retryable failures without extra attempts + --- + duration_ms: 2.087427 + type: 'test' + ... + 1..4 +ok 20 - publishLock retry behavior + --- + duration_ms: 17.116876 + type: 'suite' + ... +# Subtest: lock-ops + # Subtest: parseLockEvent + # Subtest: parses a valid lock event correctly + ok 1 - parses a valid lock event correctly + --- + duration_ms: 1.851679 + type: 'test' + ... + # Subtest: returns nulls when content is invalid JSON + ok 2 - returns nulls when content is invalid JSON + --- + duration_ms: 0.472294 + type: 'test' + ... + # Subtest: returns nulls when required content fields are missing + ok 3 - returns nulls when required content fields are missing + --- + duration_ms: 0.317437 + type: 'test' + ... + # Subtest: returns nulls when content is an array (not object) + ok 4 - returns nulls when content is an array (not object) + --- + duration_ms: 1.591212 + type: 'test' + ... + 1..4 + ok 1 - parseLockEvent + --- + duration_ms: 5.439804 + type: 'suite' + ... +# [publish:primary] Publishing to 2 relays (wss://primary-a, wss://primary-b)... +# [publish:primary] Publishing to 2 relays (wss://primary-a, wss://primary-b)... +# Published to 2/2 relays (required=1, timeout=200ms) +# [publish:primary] Publishing to 1 relays (wss://primary-down)... +# [publish:primary] Publishing to 1 relays (wss://primary-down)... +# [publish:primary] Publishing to 1 relays (wss://primary-down)... +# [publish:primary] Publishing to 1 relays (wss://primary-bad)... +# [publish:primary] Publishing to 5 relays (relay-timeout, wss://dns, wss://tcp, wss://tls, wss://ws)... +# [publish:primary] Publishing to 2 relays (wss://relay-bad, wss://relay-ok)... +# {"event":"lock_publish_quorum_met","correlationId":"5a2d9336-61b0-4ac9-ae35-a932ebf8d09c","attemptId":"1c1514e7-bfc5-461f-bfe8-af64c379aeec","publishAttempt":1,"successCount":1,"relayAttemptedCount":2,"requiredSuccesses":1,"timeoutMs":200,"retryTimeline":[{"publishAttempt":1,"successCount":1,"relayAttemptedCount":2,"elapsedMs":1}],"totalElapsedMs":1} +# Published to 1/2 relays (required=1, timeout=200ms) +# [publish:primary] Publishing to 1 relays (wss://primary-bad)... +# [publish:fallback] Publishing to 1 relays (wss://fallback-ok)... +# {"event":"lock_publish_quorum_met","correlationId":"7db32f96-5950-48d5-905b-e7230493495f","attemptId":"055c50f3-2e2a-4ddf-9f5d-852799012fd8","publishAttempt":1,"successCount":1,"relayAttemptedCount":2,"requiredSuccesses":1,"timeoutMs":200,"retryTimeline":[{"publishAttempt":1,"successCount":1,"relayAttemptedCount":2,"elapsedMs":1}],"totalElapsedMs":1} +# Published to 1/2 relays (required=1, timeout=200ms) +# [publish:primary] Publishing to 2 relays (wss://bad, wss://healthy)... +# {"event":"lock_publish_quorum_met","correlationId":"8f52a692-0065-46be-b8df-86eae70a55a4","attemptId":"aba42f26-0af4-4717-b02e-4f1a3b5f6809","publishAttempt":1,"successCount":1,"relayAttemptedCount":2,"requiredSuccesses":1,"timeoutMs":200,"retryTimeline":[{"publishAttempt":1,"successCount":1,"relayAttemptedCount":2,"elapsedMs":1}],"totalElapsedMs":1} +# Published to 1/2 relays (required=1, timeout=200ms) +# [publish:primary] Publishing to 2 relays (wss://healthy, wss://bad)... +# {"event":"lock_publish_quorum_met","correlationId":"2bbeb45b-4036-4091-b4f2-da37eb50c177","attemptId":"8370c771-1376-4bc3-8da4-83944f2d3ed6","publishAttempt":1,"successCount":1,"relayAttemptedCount":2,"requiredSuccesses":1,"timeoutMs":200,"retryTimeline":[{"publishAttempt":1,"successCount":1,"relayAttemptedCount":2,"elapsedMs":0}],"totalElapsedMs":0} +# Published to 1/2 relays (required=1, timeout=200ms) +# [publish:primary] Publishing to 1 relays (wss://healthy)... +# {"event":"lock_publish_quorum_met","correlationId":"2af9f978-7186-4359-b23a-383fea75a209","attemptId":"ca26ed85-9ffa-4e9e-9b1e-bb12f7441b66","publishAttempt":1,"successCount":1,"relayAttemptedCount":1,"requiredSuccesses":1,"timeoutMs":200,"retryTimeline":[{"publishAttempt":1,"successCount":1,"relayAttemptedCount":1,"elapsedMs":1}],"totalElapsedMs":1} +# Published to 1/1 relays (required=1, timeout=200ms) +# [publish:primary] Publishing to 1 relays (wss://healthy)... +# {"event":"lock_publish_quorum_met","correlationId":"1b2eea6d-7176-4224-8bc9-f91d48e3427d","attemptId":"c1b9b0e1-c071-4e08-88db-044e1cdadcb4","publishAttempt":1,"successCount":1,"relayAttemptedCount":1,"requiredSuccesses":1,"timeoutMs":200,"retryTimeline":[{"publishAttempt":1,"successCount":1,"relayAttemptedCount":1,"elapsedMs":0}],"totalElapsedMs":0} +# Published to 1/1 relays (required=1, timeout=200ms) +# [publish:primary] Publishing to 2 relays (wss://primary-a, wss://primary-b)... +# [publish:fallback] Publishing to 1 relays (wss://fallback-healthy)... +# {"event":"lock_publish_quorum_met","correlationId":"c68c5d0c-28e9-4d02-a8cd-58ec75454c8e","attemptId":"66f3a22e-c49f-48a5-b45c-16f7a15aed56","publishAttempt":1,"successCount":1,"relayAttemptedCount":3,"requiredSuccesses":1,"timeoutMs":200,"retryTimeline":[{"publishAttempt":1,"successCount":1,"relayAttemptedCount":3,"elapsedMs":0}],"totalElapsedMs":0} +# Published to 1/3 relays (required=1, timeout=200ms) + # Subtest: queryLocks + # Subtest: falls back to fallback relays when primary query fails + ok 1 - falls back to fallback relays when primary query fails + --- + duration_ms: 26.466677 + type: 'test' + ... + 1..1 + ok 2 - queryLocks + --- + duration_ms: 26.904557 + type: 'suite' + ... + # Subtest: publishLock + # Subtest: retries transient failures and succeeds on a later attempt + ok 1 - retries transient failures and succeeds on a later attempt + --- + duration_ms: 4.620233 + type: 'test' + ... + # Subtest: fails after retry budget is exhausted for persistent transient failures + ok 2 - fails after retry budget is exhausted for persistent transient failures + --- + duration_ms: 3.334172 + type: 'test' + ... + # Subtest: fails without retry for persistent validation failures + ok 3 - fails without retry for persistent validation failures + --- + duration_ms: 1.183943 + type: 'test' + ... + # Subtest: includes per-relay reason categories and retry metadata in failure diagnostics + ok 4 - includes per-relay reason categories and retry metadata in failure diagnostics + --- + duration_ms: 1.985322 + type: 'test' + ... + # Subtest: returns success when mixed relay outcomes still satisfy quorum + ok 5 - returns success when mixed relay outcomes still satisfy quorum + --- + duration_ms: 1.418004 + type: 'test' + ... + # Subtest: uses fallback relays to satisfy min success quorum + ok 6 - uses fallback relays to satisfy min success quorum + --- + duration_ms: 2.668855 + type: 'test' + ... + # Subtest: quarantines repeatedly failing relays and still reaches quorum with one healthy relay + ok 7 - quarantines repeatedly failing relays and still reaches quorum with one healthy relay + --- + duration_ms: 2.323951 + type: 'test' + ... + # Subtest: uses fallback and min active pool to reintroduce quarantined relay when needed + ok 8 - uses fallback and min active pool to reintroduce quarantined relay when needed + --- + duration_ms: 1.066291 + type: 'test' + ... + 1..8 + ok 3 - publishLock + --- + duration_ms: 19.481655 + type: 'suite' + ... + 1..3 +ok 21 - lock-ops + --- + duration_ms: 52.81208 + type: 'suite' + ... +# Warning: Failed to read log dir logs/daily: Permission denied +# Subtest: lock-utils + # Subtest: getCompletedAgents + # Subtest: returns completed agents for daily cadence + ok 1 - returns completed agents for daily cadence + --- + duration_ms: 3.432858 + type: 'test' + ... + # Subtest: returns completed agents for weekly cadence + ok 2 - returns completed agents for weekly cadence + --- + duration_ms: 0.492862 + type: 'test' + ... + # Subtest: handles ENOENT gracefully + ok 3 - handles ENOENT gracefully + --- + duration_ms: 0.727474 + type: 'test' + ... + # Subtest: logs error for non-ENOENT errors + ok 4 - logs error for non-ENOENT errors + --- + duration_ms: 1.452073 + type: 'test' + ... + 1..4 + ok 1 - getCompletedAgents + --- + duration_ms: 7.231754 + type: 'suite' + ... + 1..1 +ok 22 - lock-utils + --- + duration_ms: 7.900382 + type: 'suite' + ... +# Subtest: listMemories, inspectMemory, pinMemory, and unpinMemory support admin hooks +ok 23 - listMemories, inspectMemory, pinMemory, and unpinMemory support admin hooks + --- + duration_ms: 3.838996 + type: 'test' + ... +# Subtest: triggerPruneDryRun returns candidate metadata without deleting records +ok 24 - triggerPruneDryRun returns candidate metadata without deleting records + --- + duration_ms: 0.498054 + type: 'test' + ... +# Subtest: memoryStats reports counts/rates and retrieval telemetry remains redaction-safe +ok 25 - memoryStats reports counts/rates and retrieval telemetry remains redaction-safe + --- + duration_ms: 19.404784 + type: 'test' + ... +# Subtest: runPruneCycle respects prune feature-flag modes +ok 26 - runPruneCycle respects prune feature-flag modes + --- + duration_ms: 0.815017 + type: 'test' + ... +# Subtest: markMemoryMerged delegates to repository and clears cache +ok 27 - markMemoryMerged delegates to repository and clears cache + --- + duration_ms: 0.689087 + type: 'test' + ... +# Subtest: stores runtime events in signer/session namespace and clears scope +ok 28 - stores runtime events in signer/session namespace and clears scope + --- + duration_ms: 2.603944 + type: 'test' + ... +# Subtest: expires runtime events and records expiration metrics +ok 29 - expires runtime events and records expiration metrics + --- + duration_ms: 10.588392 + type: 'test' + ... +# Subtest: enforces LRU bounds and tracks eviction metrics +ok 30 - enforces LRU bounds and tracks eviction metrics + --- + duration_ms: 0.604468 + type: 'test' + ... +# Subtest: blocks decrypted/session-sensitive data from durable promotion without sanitizer pass +ok 31 - blocks decrypted/session-sensitive data from durable promotion without sanitizer pass + --- + duration_ms: 0.357101 + type: 'test' + ... +# Subtest: createEmbedderAdapter selects in-memory backend and supports vector CRUD +ok 32 - createEmbedderAdapter selects in-memory backend and supports vector CRUD + --- + duration_ms: 1.622188 + type: 'test' + ... +# Subtest: createEmbedderAdapter reads backend from environment +ok 33 - createEmbedderAdapter reads backend from environment + --- + duration_ms: 0.486355 + type: 'test' + ... +# Subtest: memory feature flags parse defaults and canary allow-lists +ok 34 - memory feature flags parse defaults and canary allow-lists + --- + duration_ms: 1.362634 + type: 'test' + ... +# Subtest: memory prune flag supports off, dry-run, and active modes +ok 35 - memory prune flag supports off, dry-run, and active modes + --- + duration_ms: 0.339648 + type: 'test' + ... +# Subtest: estimateTokenCount returns heuristic count +ok 36 - estimateTokenCount returns heuristic count + --- + duration_ms: 1.489352 + type: 'test' + ... +# Subtest: formatMemoryBlock converts memory record to display block +ok 37 - formatMemoryBlock converts memory record to display block + --- + duration_ms: 0.718355 + type: 'test' + ... +# Subtest: formatMemoryBlock handles missing optional fields and default clamping +ok 38 - formatMemoryBlock handles missing optional fields and default clamping + --- + duration_ms: 0.232279 + type: 'test' + ... +# Subtest: formatMemoryBlock respects custom clamping options +ok 39 - formatMemoryBlock respects custom clamping options + --- + duration_ms: 0.232831 + type: 'test' + ... +# Subtest: formatMemoryBlock handles edge cases for clamping +ok 40 - formatMemoryBlock handles edge cases for clamping + --- + duration_ms: 0.383154 + type: 'test' + ... +# Subtest: formatMemoriesForPrompt enforces token budget and k limit +ok 41 - formatMemoriesForPrompt enforces token budget and k limit + --- + duration_ms: 0.888492 + type: 'test' + ... +# Subtest: formatMemoriesForPrompt handles aggressive budget fitting +ok 42 - formatMemoriesForPrompt handles aggressive budget fitting + --- + duration_ms: 0.47606 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext injects context when enabled +ok 43 - renderPromptWithMemoryContext injects context when enabled + --- + duration_ms: 0.834635 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext returns base prompt when disabled +ok 44 - renderPromptWithMemoryContext returns base prompt when disabled + --- + duration_ms: 0.511455 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext handles missing query or service +ok 45 - renderPromptWithMemoryContext handles missing query or service + --- + duration_ms: 0.6537 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext handles circular agentContext gracefully +ok 46 - renderPromptWithMemoryContext handles circular agentContext gracefully + --- + duration_ms: 0.470639 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext handles agentContext as array of strings +ok 47 - renderPromptWithMemoryContext handles agentContext as array of strings + --- + duration_ms: 0.283192 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext handles agentContext as plain object +ok 48 - renderPromptWithMemoryContext handles agentContext as plain object + --- + duration_ms: 0.285663 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext handles agentContext as primitives +ok 49 - renderPromptWithMemoryContext handles agentContext as primitives + --- + duration_ms: 0.254406 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext calls updateMemoryUsage for retrieved memories +ok 50 - renderPromptWithMemoryContext calls updateMemoryUsage for retrieved memories + --- + duration_ms: 2.543991 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext handles empty memories gracefully +ok 51 - renderPromptWithMemoryContext handles empty memories gracefully + --- + duration_ms: 0.289217 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext handles null/undefined memories gracefully +ok 52 - renderPromptWithMemoryContext handles null/undefined memories gracefully + --- + duration_ms: 0.199314 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext respects TORCH_MEMORY_ENABLED=false +ok 53 - renderPromptWithMemoryContext respects TORCH_MEMORY_ENABLED=false + --- + duration_ms: 0.142916 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext respects retrieval allowlist +ok 54 - renderPromptWithMemoryContext respects retrieval allowlist + --- + duration_ms: 0.4549 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext passes k and tokenBudget +ok 55 - renderPromptWithMemoryContext passes k and tokenBudget + --- + duration_ms: 0.411765 + type: 'test' + ... +# Subtest: getRelevantMemories uses cached results when available +ok 56 - getRelevantMemories uses cached results when available + --- + duration_ms: 2.02165 + type: 'test' + ... +# Subtest: getRelevantMemories calls ranker and updates cache on miss +ok 57 - getRelevantMemories calls ranker and updates cache on miss + --- + duration_ms: 1.030852 + type: 'test' + ... +# Subtest: getRelevantMemories passes correct parameters to ranker +ok 58 - getRelevantMemories passes correct parameters to ranker + --- + duration_ms: 0.969113 + type: 'test' + ... +# Subtest: getRelevantMemories triggers updateMemoryUsage on repository +ok 59 - getRelevantMemories triggers updateMemoryUsage on repository + --- + duration_ms: 0.550492 + type: 'test' + ... +# Subtest: ingestEvents + # Subtest: happy path: successfully ingests events + ok 1 - happy path: successfully ingests events + --- + duration_ms: 6.649188 + type: 'test' + ... + # Subtest: skips ingestion when feature flag is disabled + ok 2 - skips ingestion when feature flag is disabled + --- + duration_ms: 0.471257 + type: 'test' + ... + # Subtest: clears cache after ingestion + ok 3 - clears cache after ingestion + --- + duration_ms: 1.774987 + type: 'test' + ... + # Subtest: skips duplicate windows + ok 4 - skips duplicate windows + --- + duration_ms: 1.117474 + type: 'test' + ... + # Subtest: propagates repository errors + ok 5 - propagates repository errors + --- + duration_ms: 1.51093 + type: 'test' + ... + 1..5 +ok 60 - ingestEvents + --- + duration_ms: 13.25079 + type: 'suite' + ... +# Subtest: ingestMemoryWindow gathers sources, redacts pii, chunks, embeds, links, and emits telemetry +ok 61 - ingestMemoryWindow gathers sources, redacts pii, chunks, embeds, links, and emits telemetry + --- + duration_ms: 5.862284 + type: 'test' + ... +# Subtest: ingestMemoryWindow dedupes overlapping windows by hashed content + agent + timestamp bucket +ok 62 - ingestMemoryWindow dedupes overlapping windows by hashed content + agent + timestamp bucket + --- + duration_ms: 0.829162 + type: 'test' + ... +# Subtest: pinMemory pins the memory and clears the cache +ok 63 - pinMemory pins the memory and clears the cache + --- + duration_ms: 3.870582 + type: 'test' + ... +# Subtest: pinMemory returns null for non-existent ID but still clears cache +ok 64 - pinMemory returns null for non-existent ID but still clears cache + --- + duration_ms: 0.6516 + type: 'test' + ... +# Subtest: unpinMemory unpins the memory and clears the cache +ok 65 - unpinMemory unpins the memory and clears the cache + --- + duration_ms: 0.677447 + type: 'test' + ... +# Subtest: unpinMemory returns null for non-existent ID but still clears cache +ok 66 - unpinMemory returns null for non-existent ID but still clears cache + --- + duration_ms: 0.633634 + type: 'test' + ... +# Subtest: createLifecyclePlan respects delete safety constraints and logs reasons +ok 67 - createLifecyclePlan respects delete safety constraints and logs reasons + --- + duration_ms: 2.493151 + type: 'test' + ... +# Subtest: createLifecyclePlan condenses near-duplicates and archives merged source records +ok 68 - createLifecyclePlan condenses near-duplicates and archives merged source records + --- + duration_ms: 1.050099 + type: 'test' + ... +# Subtest: applyLifecycleActions executes keep/archive/delete and merge markers +ok 69 - applyLifecycleActions executes keep/archive/delete and merge markers + --- + duration_ms: 14.608159 + type: 'test' + ... +# Subtest: filterAndRankMemories applies metadata filters and composite score +ok 70 - filterAndRankMemories applies metadata filters and composite score + --- + duration_ms: 2.835155 + type: 'test' + ... +# Subtest: formatMemoriesForPrompt returns prompt blocks and enforces token budget trimming +ok 71 - formatMemoriesForPrompt returns prompt blocks and enforces token budget trimming + --- + duration_ms: 2.475782 + type: 'test' + ... +# Subtest: isMemoryRetrievalEnabled supports global toggle and agent canary list +ok 72 - isMemoryRetrievalEnabled supports global toggle and agent canary list + --- + duration_ms: 0.417324 + type: 'test' + ... +# Subtest: renderPromptWithMemoryContext injects bounded memory block before base prompt +ok 73 - renderPromptWithMemoryContext injects bounded memory block before base prompt + --- + duration_ms: 0.808744 + type: 'test' + ... +# Subtest: runPruneCycle respects off mode +ok 74 - runPruneCycle respects off mode + --- + duration_ms: 18.74212 + type: 'test' + ... +# Subtest: runPruneCycle respects dry-run mode +ok 75 - runPruneCycle respects dry-run mode + --- + duration_ms: 0.468025 + type: 'test' + ... +# Subtest: runPruneCycle removes stale unpinned memories in active mode +ok 76 - runPruneCycle removes stale unpinned memories in active mode + --- + duration_ms: 3.439821 + type: 'test' + ... +# Subtest: runPruneCycle starts scheduler if requested +ok 77 - runPruneCycle starts scheduler if requested + --- + duration_ms: 3.279421 + type: 'test' + ... +# (node:6268) ExperimentalWarning: The MockTimers API is an experimental feature and might change at any time +# (Use `node --trace-warnings ...` to show where the warning was created) +# Subtest: createDbAdvisoryLockProvider acquires and releases postgres advisory locks +ok 78 - createDbAdvisoryLockProvider acquires and releases postgres advisory locks + --- + duration_ms: 2.237657 + type: 'test' + ... +# Subtest: startMemoryMaintenanceScheduler runs all jobs and emits metrics including retries +ok 79 - startMemoryMaintenanceScheduler runs all jobs and emits metrics including retries + --- + duration_ms: 8.951465 + type: 'test' + ... +# Subtest: startMemoryMaintenanceScheduler skips jobs when feature flags disable memory +ok 80 - startMemoryMaintenanceScheduler skips jobs when feature flags disable memory + --- + duration_ms: 1.611419 + type: 'test' + ... +# Subtest: normalizeMemoryItem applies durable schema defaults and coercions +ok 81 - normalizeMemoryItem applies durable schema defaults and coercions + --- + duration_ms: 4.515564 + type: 'test' + ... +# Subtest: validateMemoryItem reports field-level errors +ok 82 - validateMemoryItem reports field-level errors + --- + duration_ms: 0.495808 + type: 'test' + ... +# Subtest: ingestEvents rejects invalid writes and logs structured validation details +ok 83 - ingestEvents rejects invalid writes and logs structured validation details + --- + duration_ms: 4.369829 + type: 'test' + ... +# (node:6285) ExperimentalWarning: The MockTimers API is an experimental feature and might change at any time +# (Use `node --trace-warnings ...` to show where the warning was created) +# Subtest: memoryStats with empty repository returns zero counts and rates +ok 84 - memoryStats with empty repository returns zero counts and rates + --- + duration_ms: 2.297763 + type: 'test' + ... +# Subtest: memoryStats with populated repository returns correct counts and totals +ok 85 - memoryStats with populated repository returns correct counts and totals + --- + duration_ms: 0.462588 + type: 'test' + ... +# Subtest: memoryStats calculates ingest throughput based on window +ok 86 - memoryStats calculates ingest throughput based on window + --- + duration_ms: 6.416158 + type: 'test' + ... +# Subtest: memoryStats reflects deleted count from prune cycle +ok 87 - memoryStats reflects deleted count from prune cycle + --- + duration_ms: 8.709398 + type: 'test' + ... +# Subtest: memoryStats handles windowMs parameter correctly +ok 88 - memoryStats handles windowMs parameter correctly + --- + duration_ms: 0.473523 + type: 'test' + ... +# Subtest: loadMemoryPromptTemplates loads all memory prompt templates from disk +ok 89 - loadMemoryPromptTemplates loads all memory prompt templates from disk + --- + duration_ms: 1.467683 + type: 'test' + ... +# Subtest: summarizeEvents retries with repair prompt when first response is malformed JSON +ok 90 - summarizeEvents retries with repair prompt when first response is malformed JSON + --- + duration_ms: 2.142951 + type: 'test' + ... +# Subtest: summarizeEvents falls back to deterministic minimal summary with conservative importance when parsing fails twice +ok 91 - summarizeEvents falls back to deterministic minimal summary with conservative importance when parsing fails twice + --- + duration_ms: 2.071814 + type: 'test' + ... +# Subtest: telemetry should not log to stdout or stderr by default +ok 92 - telemetry should not log to stdout or stderr by default + --- + duration_ms: 64.074441 + type: 'test' + ... +# Subtest: telemetry should log to stderr when NODE_DEBUG=torch-memory is set +ok 93 - telemetry should log to stderr when NODE_DEBUG=torch-memory is set + --- + duration_ms: 97.815225 + type: 'test' + ... +# Subtest: CLI Smoke Test + # Subtest: should print usage when no args provided + ok 1 - should print usage when no args provided + --- + duration_ms: 179.384212 + type: 'test' + ... + # Subtest: should fail when checking without cadence + ok 2 - should fail when checking without cadence + --- + duration_ms: 151.040514 + type: 'test' + ... + # Subtest: should include paused agents in check output + ok 3 - should include paused agents in check output + --- + duration_ms: 1167.986312 + type: 'test' + ... + 1..3 +ok 94 - CLI Smoke Test + --- + duration_ms: 1500.021009 + type: 'suite' + ... +# Initializing torch in /app/test-ops-QMC6wM/project1/torch... +# Copying application directories... +# Copied src/ +# Copied bin/ +# Copied dashboard/ +# Copied landing/ +# Copied assets/ +# Copied scripts/ +# Copying application files... +# Copied package.json +# Copied build.mjs +# Copied README.md +# Copied torch-config.example.json +# Copied TORCH.md +# Created torch/roster.json +# Created torch/META_PROMPTS.md +# Created torch/scheduler-flow.md +# Created torch/daily-scheduler.md +# Created torch/weekly-scheduler.md +# Created 22 files in torch/prompts/daily/ +# Created 21 files in torch/prompts/weekly/ +# Saved configuration to torch-config.json +# No package.json found in host root. Skipping script injection. +# Initialization complete. +# You can now customize the files in torch/ +# Initializing torch in /app/test-ops-QMC6wM/project2/torch... +# Initializing torch in /app/test-ops-QMC6wM/project3/torch... +# Copying application directories... +# Copied src/ +# Copied bin/ +# Copied dashboard/ +# Copied landing/ +# Copied assets/ +# Copied scripts/ +# Copying application files... +# Copied package.json +# Copied build.mjs +# Copied README.md +# Copied torch-config.example.json +# Copied TORCH.md +# Created torch/roster.json +# Created torch/META_PROMPTS.md +# Created torch/scheduler-flow.md +# Created torch/daily-scheduler.md +# Created torch/weekly-scheduler.md +# Created 22 files in torch/prompts/daily/ +# Created 21 files in torch/prompts/weekly/ +# Saved configuration to torch-config.json +# Initialization complete. +# You can now customize the files in torch/ +# No package.json found in host root. Skipping script injection. +# Updating torch configuration in /app/test-ops-QMC6wM/project3/torch... +# Creating backup at torch/_backups/backup_2026-02-18T19-49-48-635Z... +# Updating application directories... +# Updated src/ +# Updated bin/ +# Updated dashboard/ +# Updated landing/ +# Updated assets/ +# Updated scripts/ +# Updating application files... +# Updated package.json +# Updated build.mjs +# Updated README.md +# Updated torch-config.example.json +# Updated TORCH.md +# Updating static files... +# Updated META_PROMPTS.md +# Updated scheduler-flow.md +# Updated daily-scheduler.md +# Updated weekly-scheduler.md +# Skipped roster.json (preserved) +# Updating prompts... +# daily/: 0 added, 0 updated, 22 preserved +# weekly/: 0 added, 0 updated, 21 preserved +# Update complete. +# Initializing torch in /app/test-ops-QMC6wM/project4/torch... +# Copying application directories... +# Copied src/ +# Copied bin/ +# Copied dashboard/ +# Copied landing/ +# Copied assets/ +# Copied scripts/ +# Copying application files... +# Copied package.json +# Copied build.mjs +# Copied README.md +# Copied torch-config.example.json +# Copied TORCH.md +# Created torch/roster.json +# Created torch/META_PROMPTS.md +# Created torch/scheduler-flow.md +# Created torch/daily-scheduler.md +# Created torch/weekly-scheduler.md +# Created 22 files in torch/prompts/daily/ +# Created 21 files in torch/prompts/weekly/ +# Saved configuration to torch-config.json +# Initialization complete. +# No package.json found in host root. Skipping script injection. +# You can now customize the files in torch/ +# Updating torch configuration in /app/test-ops-QMC6wM/project4/torch... +# Creating backup at torch/_backups/backup_2026-02-18T19-49-48-710Z... +# Updating application directories... +# Updated src/ +# Updated bin/ +# Updated dashboard/ +# Updated landing/ +# Updated assets/ +# Updated scripts/ +# Updating application files... +# Updated package.json +# Updated build.mjs +# Updated README.md +# Updated torch-config.example.json +# Updated TORCH.md +# Updating static files... +# Updated META_PROMPTS.md +# Updated scheduler-flow.md +# Updated daily-scheduler.md +# Updated weekly-scheduler.md +# Overwrote roster.json (forced) +# Updating prompts... +# daily/: 0 added, 22 updated, 0 preserved +# weekly/: 0 added, 21 updated, 0 preserved +# Update complete. +# Initializing torch in /app/test-ops-QMC6wM/project5/torch... +# Copying application directories... +# Copied src/ +# Copied bin/ +# Copied dashboard/ +# Copied landing/ +# Copied assets/ +# Copied scripts/ +# Copying application files... +# Copied package.json +# Copied build.mjs +# Copied README.md +# Copied torch-config.example.json +# Copied TORCH.md +# Created torch/roster.json +# Created torch/META_PROMPTS.md +# Created torch/scheduler-flow.md +# Created torch/daily-scheduler.md +# Created torch/weekly-scheduler.md +# Created 22 files in torch/prompts/daily/ +# Created 21 files in torch/prompts/weekly/ +# Saved configuration to torch-config.json +# Initialization complete. +# No package.json found in host root. Skipping script injection. +# You can now customize the files in torch/ +# Updating torch configuration in /app/test-ops-QMC6wM/project5/torch... +# Creating backup at torch/_backups/backup_2026-02-18T19-49-48-790Z... +# Updating application directories... +# Updated src/ +# Updated bin/ +# Updated dashboard/ +# Updated landing/ +# Updated assets/ +# Updated scripts/ +# Updating application files... +# Updated package.json +# Updated build.mjs +# Updated README.md +# Updated torch-config.example.json +# Updated TORCH.md +# Updating static files... +# Updated META_PROMPTS.md +# Updated scheduler-flow.md +# Updated daily-scheduler.md +# Updated weekly-scheduler.md +# Skipped roster.json (preserved) +# Updating prompts... +# daily/: 0 added, 0 updated, 22 preserved +# weekly/: 0 added, 0 updated, 21 preserved +# Update complete. +# Initializing torch in /app/test-ops-QMC6wM/project_roster/torch... +# Copying application directories... +# Copied src/ +# Copied bin/ +# Copied dashboard/ +# Copied landing/ +# Copied assets/ +# Copied scripts/ +# Copying application files... +# Copied package.json +# Copied build.mjs +# Copied README.md +# Copied torch-config.example.json +# Copied TORCH.md +# Created torch/roster.json +# Created torch/META_PROMPTS.md +# Created torch/scheduler-flow.md +# Created torch/daily-scheduler.md +# Created torch/weekly-scheduler.md +# Created 22 files in torch/prompts/daily/ +# Created 21 files in torch/prompts/weekly/ +# Saved configuration to torch-config.json +# Initialization complete. +# No package.json found in host root. Skipping script injection. +# You can now customize the files in torch/ +# Checking locks: namespace=test-namespace, cadence=daily, date=2026-02-18 +# Relays: wss://relay.damus.io +# {"event":"relay_health_snapshot","reason":"query:periodic","relays":[{"relay":"wss://relay.damus.io","score":0.6,"sampleSize":0,"successRate":0.5,"timeoutRate":0,"averageLatencyMs":null,"failureStreak":0,"quarantined":false,"quarantineRemainingMs":0,"cooldownMs":30000,"lastResultAt":null},{"relay":"wss://relay.nostr.band","score":0.6,"sampleSize":0,"successRate":0.5,"timeoutRate":0,"averageLatencyMs":null,"failureStreak":0,"quarantined":false,"quarantineRemainingMs":0,"cooldownMs":30000,"lastResultAt":null},{"relay":"wss://relay.snort.social","score":0.6,"sampleSize":0,"successRate":0.5,"timeoutRate":0,"averageLatencyMs":null,"failureStreak":0,"quarantined":false,"quarantineRemainingMs":0,"cooldownMs":30000,"lastResultAt":null}]} +# [query:primary] Querying 1 relays (wss://relay.damus.io)... +# Initializing torch in /app/test-ops-QMC6wM/project_config_init/torch... +# Copying application directories... +# Copied src/ +# Copied bin/ +# Copied dashboard/ +# Copied landing/ +# Copied assets/ +# Copied scripts/ +# Copying application files... +# Copied package.json +# Copied build.mjs +# Copied README.md +# Copied torch-config.example.json +# Copied TORCH.md +# Created torch/roster.json +# Created torch/META_PROMPTS.md +# Created torch/scheduler-flow.md +# Created torch/daily-scheduler.md +# Created torch/weekly-scheduler.md +# Created 22 files in torch/prompts/daily/ +# Created 21 files in torch/prompts/weekly/ +# Saved configuration to torch-config.json +# No package.json found in host root. Skipping script injection. +# Initialization complete. +# You can now customize the files in torch/ +# Subtest: cmdInit creates directory structure and files +ok 95 - cmdInit creates directory structure and files + --- + duration_ms: 34.778246 + type: 'test' + ... +# Subtest: cmdInit fails if directory exists without force +ok 96 - cmdInit fails if directory exists without force + --- + duration_ms: 1.101376 + type: 'test' + ... +# Subtest: cmdUpdate preserves modified prompt +ok 97 - cmdUpdate preserves modified prompt + --- + duration_ms: 74.003881 + type: 'test' + ... +# Subtest: cmdUpdate overwrites prompt with force +ok 98 - cmdUpdate overwrites prompt with force + --- + duration_ms: 76.714373 + type: 'test' + ... +# Subtest: cmdUpdate creates backup +ok 99 - cmdUpdate creates backup + --- + duration_ms: 72.100978 + type: 'test' + ... +# Subtest: torch-lock check respects local roster +ok 100 - torch-lock check respects local roster + --- + duration_ms: 555.779523 + type: 'test' + ... +# Subtest: cmdInit creates torch-config.json with random namespace +ok 101 - cmdInit creates torch-config.json with random namespace + --- + duration_ms: 28.490234 + type: 'test' + ... +# [publish:primary] Publishing to 3 relays (ws://127.0.0.1:35265, ws://127.0.0.1:35479, ws://127.0.0.1:38823)... +# Published to 1/3 relays (required=1, timeout=80ms) +# Subtest: relay fanout quorum integration + # Subtest: passes with required=1 when one relay succeeds and two fail +# [publish:primary] Publishing to 3 relays (ws://127.0.0.1:44029, ws://127.0.0.1:44327, ws://127.0.0.1:46647)... + ok 1 - passes with required=1 when one relay succeeds and two fail + --- + duration_ms: 134.26362 + type: 'test' + ... + # Subtest: fails with quorum error for required=1 when all relays fail + ok 2 - fails with quorum error for required=1 when all relays fail + --- + duration_ms: 91.105073 + type: 'test' + ... +# [publish:primary] Publishing to 3 relays (ws://127.0.0.1:33179, ws://127.0.0.1:34263, ws://127.0.0.1:42439)... + # Subtest: fails with required=2 when only one relay succeeds + ok 3 - fails with required=2 when only one relay succeeds + --- + duration_ms: 89.705536 + type: 'test' + ... +# [publish:primary] Publishing to 3 relays (ws://127.0.0.1:37159, ws://127.0.0.1:37427, ws://127.0.0.1:40389)... +# Published to 2/3 relays (required=2, timeout=80ms) + # Subtest: passes when delayed successes reach quorum before timeout + ok 4 - passes when delayed successes reach quorum before timeout + --- + duration_ms: 89.013124 + type: 'test' + ... + 1..4 +ok 102 - relay fanout quorum integration + --- + duration_ms: 405.839156 + type: 'suite' + ... +# Subtest: RelayHealthManager + # Subtest: should isolate state between instances + ok 1 - should isolate state between instances + --- + duration_ms: 1.161221 + type: 'test' + ... + # Subtest: should prioritize relays based on health + ok 2 - should prioritize relays based on health + --- + duration_ms: 1.937506 + type: 'test' + ... + # Subtest: should reset state correctly + ok 3 - should reset state correctly + --- + duration_ms: 0.303782 + type: 'test' + ... + # Subtest: should cache ranked results and invalidate on outcome + ok 4 - should cache ranked results and invalidate on outcome + --- + duration_ms: 0.613014 + type: 'test' + ... + # Subtest: should invalidate cache when time passes quarantine expiry + ok 5 - should invalidate cache when time passes quarantine expiry + --- + duration_ms: 0.489887 + type: 'test' + ... + 1..5 +ok 103 - RelayHealthManager + --- + duration_ms: 6.117086 + type: 'suite' + ... +# Subtest: evaluateAlertThresholds + # Subtest: Happy Path: No alerts when thresholds are not met + ok 1 - Happy Path: No alerts when thresholds are not met + --- + duration_ms: 1.801086 + type: 'test' + ... + # Subtest: All Relays Down: Triggers alert when duration equals threshold + ok 2 - All Relays Down: Triggers alert when duration equals threshold + --- + duration_ms: 0.434489 + type: 'test' + ... + # Subtest: All Relays Down: Does NOT trigger alert just below threshold + ok 3 - All Relays Down: Does NOT trigger alert just below threshold + --- + duration_ms: 0.28187 + type: 'test' + ... + # Subtest: Success Rate: Triggers alert when rate is strictly below threshold + ok 4 - Success Rate: Triggers alert when rate is strictly below threshold + --- + duration_ms: 0.305173 + type: 'test' + ... + # Subtest: Success Rate: Does NOT trigger alert when rate equals threshold + ok 5 - Success Rate: Does NOT trigger alert when rate equals threshold + --- + duration_ms: 0.342373 + type: 'test' + ... + # Subtest: Success Rate: Does NOT trigger alert when rate is above threshold + ok 6 - Success Rate: Does NOT trigger alert when rate is above threshold + --- + duration_ms: 0.306132 + type: 'test' + ... + # Subtest: Multiple Alerts: Both conditions met + ok 7 - Multiple Alerts: Both conditions met + --- + duration_ms: 0.30871 + type: 'test' + ... + # Subtest: Edge Case: Empty history (should not crash) + ok 8 - Edge Case: Empty history (should not crash) + --- + duration_ms: 0.3416 + type: 'test' + ... + # Subtest: Edge Case: Empty history but current result is unhealthy + ok 9 - Edge Case: Empty history but current result is unhealthy + --- + duration_ms: 0.53593 + type: 'test' + ... + 1..9 +ok 104 - evaluateAlertThresholds + --- + duration_ms: 7.962587 + type: 'test' + ... +# Subtest: summarizeHistory - basic statistics calculation +ok 105 - summarizeHistory - basic statistics calculation + --- + duration_ms: 1.559143 + type: 'test' + ... +# Subtest: summarizeHistory - handles empty history +ok 106 - summarizeHistory - handles empty history + --- + duration_ms: 0.267675 + type: 'test' + ... +# Subtest: summarizeHistory - respects time window for stats +ok 107 - summarizeHistory - respects time window for stats + --- + duration_ms: 0.211102 + type: 'test' + ... +# Subtest: summarizeHistory - allDownDurationMinutes considers outside window entries +ok 108 - summarizeHistory - allDownDurationMinutes considers outside window entries + --- + duration_ms: 0.260007 + type: 'test' + ... +# Subtest: summarizeHistory - allDownDurationMinutes is null if never healthy +ok 109 - summarizeHistory - allDownDurationMinutes is null if never healthy + --- + duration_ms: 0.309446 + type: 'test' + ... +# Subtest: summarizeHistory - allDownDurationMinutes is 0 if currently healthy +ok 110 - summarizeHistory - allDownDurationMinutes is 0 if currently healthy + --- + duration_ms: 0.262439 + type: 'test' + ... +# Subtest: summarizeHistory - handles malformed entries gracefully +ok 111 - summarizeHistory - handles malformed entries gracefully + --- + duration_ms: 0.542259 + type: 'test' + ... +# Subtest: summarizeHistory - handles valid timestamp but missing summary +ok 112 - summarizeHistory - handles valid timestamp but missing summary + --- + duration_ms: 0.218011 + type: 'test' + ... +# Subtest: summarizeHistory - healthy entry with invalid timestamp results in NaN duration +ok 113 - summarizeHistory - healthy entry with invalid timestamp results in NaN duration + --- + duration_ms: 0.541204 + type: 'test' + ... +# Subtest: Roster (Unit Tests with Dependency Injection) + # Subtest: returns fallback roster when no configuration or files exist + ok 1 - returns fallback roster when no configuration or files exist + --- + duration_ms: 2.315059 + type: 'test' + ... + # Subtest: loads internal module roster if user/cwd rosters are missing + ok 2 - loads internal module roster if user/cwd rosters are missing + --- + duration_ms: 1.618272 + type: 'test' + ... + # Subtest: loads roster from torch/roster.json (User Roster) if present + ok 3 - loads roster from torch/roster.json (User Roster) if present + --- + duration_ms: 1.124794 + type: 'test' + ... + # Subtest: loads roster from roster.json (CWD Roster) if present and torch/roster.json is missing + ok 4 - loads roster from roster.json (CWD Roster) if present and torch/roster.json is missing + --- + duration_ms: 1.116084 + type: 'test' + ... + # Subtest: falls back to default if roster file is malformed + ok 5 - falls back to default if roster file is malformed + --- + duration_ms: 0.624843 + type: 'test' + ... + # Subtest: falls back to default if roster file is missing daily/weekly arrays + ok 6 - falls back to default if roster file is missing daily/weekly arrays + --- + duration_ms: 0.514389 + type: 'test' + ... + # Subtest: prioritizes environment variables over file and config + ok 7 - prioritizes environment variables over file and config + --- + duration_ms: 1.959987 + type: 'test' + ... + # Subtest: prioritizes config over file + ok 8 - prioritizes config over file + --- + duration_ms: 0.501813 + type: 'test' + ... + # Subtest: handles multiple items in env var roster + ok 9 - handles multiple items in env var roster + --- + duration_ms: 0.762474 + type: 'test' + ... + 1..9 +ok 114 - Roster (Unit Tests with Dependency Injection) + --- + duration_ms: 12.602353 + type: 'suite' + ... +# Subtest: fails required memory policy when retrieval/storage evidence is missing +ok 115 - fails required memory policy when retrieval/storage evidence is missing + --- + duration_ms: 758.936665 + type: 'test' + ... +# Subtest: accepts required memory policy when markers or artifacts are produced +ok 116 - accepts required memory policy when markers or artifacts are produced + --- + duration_ms: 802.078926 + type: 'test' + ... +# Subtest: records backend failure metadata when lock command exits with code 2 +ok 117 - records backend failure metadata when lock command exits with code 2 + --- + duration_ms: 970.001682 + type: 'test' + ... +# Subtest: defers backend failures in non-strict mode and reuses idempotency key on successful retry +ok 118 - defers backend failures in non-strict mode and reuses idempotency key on successful retry + --- + duration_ms: 513.736794 + type: 'test' + ... +# Subtest: fails after exceeding non-strict deferral budget +ok 119 - fails after exceeding non-strict deferral budget + --- + duration_ms: 166.124237 + type: 'test' + ... +# Subtest: strict lock mode fails immediately without deferral +ok 120 - strict lock mode fails immediately without deferral + --- + duration_ms: 88.205839 + type: 'test' + ... +# Subtest: skips lock health preflight by default when not enabled +ok 121 - skips lock health preflight by default when not enabled + --- + duration_ms: 355.174587 + type: 'test' + ... +# Subtest: fails scheduler with preflight metadata when lock health preflight is enabled +ok 122 - fails scheduler with preflight metadata when lock health preflight is enabled + --- + duration_ms: 121.281311 + type: 'test' + ... +# Subtest: categorizes unreadable prompt files as prompt_parse_error +ok 123 - categorizes unreadable prompt files as prompt_parse_error + --- + duration_ms: 92.226087 + type: 'test' + ... +# Subtest: categorizes invalid prompt schema as prompt_schema_error +ok 124 - categorizes invalid prompt schema as prompt_schema_error + --- + duration_ms: 88.113655 + type: 'test' + ... +# Subtest: categorizes handoff runtime failures as execution_error +ok 125 - categorizes handoff runtime failures as execution_error + --- + duration_ms: 315.663645 + type: 'test' + ... +# Subtest: retries lock acquisition for backend error and succeeds on a later attempt +ok 126 - retries lock acquisition for backend error and succeeds on a later attempt + --- + duration_ms: 367.290958 + type: 'test' + ... +# Subtest: stops retrying after configured lock backend retries are exhausted +ok 127 - stops retrying after configured lock backend retries are exhausted + --- + duration_ms: 93.104591 + type: 'test' + ... +# Subtest: does not use backend retry flow for exit code 3 lock conflicts +ok 128 - does not use backend retry flow for exit code 3 lock conflicts + --- + duration_ms: 370.676671 + type: 'test' + ... +# Subtest: runs selected scheduler prompt through configured runner command +ok 129 - runs selected scheduler prompt through configured runner command + --- + duration_ms: 305.806483 + type: 'test' + ... +# Subtest: propagates non-zero runner exit code +ok 130 - propagates non-zero runner exit code + --- + duration_ms: 297.388183 + type: 'test' + ... +# Subtest: scheduler lock backend failure artifact matches required frontmatter schema +ok 131 - scheduler lock backend failure artifact matches required frontmatter schema + --- + duration_ms: 95.749944 + type: 'test' + ... +# Subtest: schema contract catches missing required lock-backend field +ok 132 - schema contract catches missing required lock-backend field + --- + duration_ms: 1.842363 + type: 'test' + ... +# Subtest: schema contract catches misnamed lock-backend key +ok 133 - schema contract catches misnamed lock-backend key + --- + duration_ms: 0.469843 + type: 'test' + ... +# Subtest: lock preflight e2e: successful lock writes completed status snapshot +ok 134 - lock preflight e2e: successful lock writes completed status snapshot + --- + duration_ms: 375.097953 + type: 'test' + ... +# Subtest: lock preflight e2e: exit code 2 quorum failure persists failed backend status and prompt-not-started marker +ok 135 - lock preflight e2e: exit code 2 quorum failure persists failed backend status and prompt-not-started marker + --- + duration_ms: 90.341567 + type: 'test' + ... +# Subtest: lock preflight e2e: non-lock failure exits failed without prompt parse/schema classification +ok 136 - lock preflight e2e: non-lock failure exits failed without prompt parse/schema classification + --- + duration_ms: 87.569102 + type: 'test' + ... +# Subtest: Scheduler Ratchet Logic (Log Checking) + # Subtest: excludes agents completed today (daily) + ok 1 - excludes agents completed today (daily) + --- + duration_ms: 2.53512 + type: 'test' + ... + # Subtest: excludes agents completed this week (weekly) + ok 2 - excludes agents completed this week (weekly) + --- + duration_ms: 0.412821 + type: 'test' + ... + # Subtest: combines locked and completed agents in exclusion list + ok 3 - combines locked and completed agents in exclusion list + --- + duration_ms: 0.606261 + type: 'test' + ... + # Subtest: ignores logs when --ignore-logs is set + ok 4 - ignores logs when --ignore-logs is set + --- + duration_ms: 0.377144 + type: 'test' + ... + # Subtest: handles missing log directory gracefully + ok 5 - handles missing log directory gracefully + --- + duration_ms: 0.442658 + type: 'test' + ... + 1..5 +ok 137 - Scheduler Ratchet Logic (Log Checking) + --- + duration_ms: 5.945984 + type: 'suite' + ... +# Subtest: Scheduler cycle ordering guarantees + # Subtest: keeps optional preflight before lock-acquire and preserves handoff/artifact/validation/complete ordering + ok 1 - keeps optional preflight before lock-acquire and preserves handoff/artifact/validation/complete ordering + --- + duration_ms: 12.040087 + type: 'test' + ... + # Subtest: includes lock backend failure metadata and classifier checkpoints + ok 2 - includes lock backend failure metadata and classifier checkpoints + --- + duration_ms: 2.101557 + type: 'test' + ... + 1..2 +ok 138 - Scheduler cycle ordering guarantees + --- + duration_ms: 14.733488 + type: 'suite' + ... +# Subtest: secureRandom + # Subtest: returns values in [0, 1) + ok 1 - returns values in [0, 1) + --- + duration_ms: 3.69427 + type: 'test' + ... + # Subtest: returns varied values + ok 2 - returns varied values + --- + duration_ms: 0.412312 + type: 'test' + ... + 1..2 +ok 139 - secureRandom + --- + duration_ms: 5.502671 + type: 'suite' + ... +# Subtest: summarizes recent lock reliability by platform/cadence/backend/relay +ok 140 - summarizes recent lock reliability by platform/cadence/backend/relay + --- + duration_ms: 77.86775 + type: 'test' + ... +# Subtest: loadTorchConfig (Unit Tests with Mocked FS) + # Subtest: loads valid config correctly + ok 1 - loads valid config correctly + --- + duration_ms: 3.546967 + type: 'test' + ... + # Subtest: returns default config when file is missing + ok 2 - returns default config when file is missing + --- + duration_ms: 0.62374 + type: 'test' + ... + # Subtest: throws error on malformed JSON + ok 3 - throws error on malformed JSON + --- + duration_ms: 1.028048 + type: 'test' + ... + # Subtest: caches the config and ignores subsequent fs calls + ok 4 - caches the config and ignores subsequent fs calls + --- + duration_ms: 0.793667 + type: 'test' + ... + # Subtest: returns null for empty string lists (new consistent behavior) + ok 5 - returns null for empty string lists (new consistent behavior) + --- + duration_ms: 0.842428 + type: 'test' + ... + 1..5 +ok 141 - loadTorchConfig (Unit Tests with Mocked FS) + --- + duration_ms: 8.47754 + type: 'suite' + ... +# Subtest: torch-config + # Subtest: getTorchConfigPath + # Subtest: returns default path when env var is not set + ok 1 - returns default path when env var is not set + --- + duration_ms: 1.044174 + type: 'test' + ... + # Subtest: returns custom path when env var is set + ok 2 - returns custom path when env var is set + --- + duration_ms: 0.233323 + type: 'test' + ... + 1..2 + ok 1 - getTorchConfigPath + --- + duration_ms: 2.696708 + type: 'suite' + ... + # Subtest: parseTorchConfig + # Subtest: parses new lock backend knobs + ok 1 - parses new lock backend knobs + --- + duration_ms: 1.261316 + type: 'test' + ... + 1..1 + ok 2 - parseTorchConfig + --- + duration_ms: 1.575495 + type: 'suite' + ... + # Subtest: loadTorchConfig + # Subtest: throws fatal error for invalid relay URL + ok 1 - throws fatal error for invalid relay URL + --- + duration_ms: 13.180693 + type: 'test' + ... + # Subtest: throws fatal error for invalid timeout range + ok 2 - throws fatal error for invalid timeout range + --- + duration_ms: 2.030608 + type: 'test' + ... + # Subtest: throws error for malformed JSON + ok 3 - throws error for malformed JSON + --- + duration_ms: 1.701114 + type: 'test' + ... + 1..3 + ok 3 - loadTorchConfig + --- + duration_ms: 17.774374 + type: 'suite' + ... + # Subtest: backend getters + # Subtest: returns default relays + ok 1 - returns default relays + --- + duration_ms: 3.310387 + type: 'test' + ... + # Subtest: validates env knob values + ok 2 - validates env knob values + --- + duration_ms: 2.11486 + type: 'test' + ... + 1..2 + ok 4 - backend getters + --- + duration_ms: 5.921661 + type: 'suite' + ... + 1..4 +ok 142 - torch-config + --- + duration_ms: 28.989735 + type: 'suite' + ... +# (node:7859) ExperimentalWarning: The MockTimers API is an experimental feature and might change at any time +# (Use `node --trace-warnings ...` to show where the warning was created) +# Subtest: Date Utilities + # Subtest: todayDateStr + # Subtest: returns current date in YYYY-MM-DD format + ok 1 - returns current date in YYYY-MM-DD format + --- + duration_ms: 1.947696 + type: 'test' + ... + 1..1 + ok 1 - todayDateStr + --- + duration_ms: 3.012219 + type: 'suite' + ... + # Subtest: nowUnix + # Subtest: returns current unix timestamp + ok 1 - returns current unix timestamp + --- + duration_ms: 0.475721 + type: 'test' + ... + 1..1 + ok 2 - nowUnix + --- + duration_ms: 0.650587 + type: 'suite' + ... + # Subtest: getIsoWeekStr + # Subtest: returns correct ISO week for simple cases + ok 1 - returns correct ISO week for simple cases + --- + duration_ms: 0.498146 + type: 'test' + ... + # Subtest: handles year boundaries correctly + ok 2 - handles year boundaries correctly + --- + duration_ms: 0.204972 + type: 'test' + ... + # Subtest: handles leap years + ok 3 - handles leap years + --- + duration_ms: 0.310964 + type: 'test' + ... + # Subtest: handles empty input (defaults to today) + ok 4 - handles empty input (defaults to today) + --- + duration_ms: 0.427898 + type: 'test' + ... + # Subtest: handles invalid input gracefully + ok 5 - handles invalid input gracefully + --- + duration_ms: 0.44625 + type: 'test' + ... + 1..5 + ok 3 - getIsoWeekStr + --- + duration_ms: 2.473264 + type: 'suite' + ... + 1..3 +ok 143 - Date Utilities + --- + duration_ms: 7.069617 + type: 'suite' + ... +# Subtest: File Utilities + # Subtest: ensureDir + # Subtest: creates directory if it does not exist + ok 1 - creates directory if it does not exist + --- + duration_ms: 0.419976 + type: 'test' + ... + # Subtest: does nothing if directory already exists + ok 2 - does nothing if directory already exists + --- + duration_ms: 0.51816 + type: 'test' + ... + # Subtest: creates nested directories recursively + ok 3 - creates nested directories recursively + --- + duration_ms: 0.554459 + type: 'test' + ... + 1..3 + ok 1 - ensureDir + --- + duration_ms: 3.113396 + type: 'suite' + ... + 1..1 +ok 144 - File Utilities + --- + duration_ms: 4.529513 + type: 'suite' + ... +# Subtest: passes when artifacts include metadata and failure IDs map to unresolved known issue entries +ok 145 - passes when artifacts include metadata and failure IDs map to unresolved known issue entries + --- + duration_ms: 75.244562 + type: 'test' + ... +# Subtest: fails when required metadata is missing from artifacts +ok 146 - fails when required metadata is missing from artifacts + --- + duration_ms: 64.397327 + type: 'test' + ... +# Subtest: fails when failure identifiers are not cross-linked to known issues or incidents +ok 147 - fails when failure identifiers are not cross-linked to known issues or incidents + --- + duration_ms: 64.889421 + type: 'test' + ... +# Subtest: schema validation covers required fields, coercion, and rejection paths +ok 148 - schema validation covers required fields, coercion, and rejection paths + --- + duration_ms: 2.844625 + type: 'test' + ... +# Subtest: summarizer parser accepts valid json and recovers after malformed json response +ok 149 - summarizer parser accepts valid json and recovers after malformed json response + --- + duration_ms: 2.395118 + type: 'test' + ... +# Subtest: ingest integration persists memory records and links embeddings from event batches +ok 150 - ingest integration persists memory records and links embeddings from event batches + --- + duration_ms: 3.764621 + type: 'test' + ... +# Subtest: retrieval ranking blends semantic, importance, and recency signals +ok 151 - retrieval ranking blends semantic, importance, and recency signals + --- + duration_ms: 0.970003 + type: 'test' + ... +# Subtest: pruner policy protects pins, merges duplicates, and picks archive/delete outcomes +ok 152 - pruner policy protects pins, merges duplicates, and picks archive/delete outcomes + --- + duration_ms: 1.436103 + type: 'test' + ... +# Subtest: scheduler smoke test handles mocked clock and lock contention +ok 153 - scheduler smoke test handles mocked clock and lock contention + --- + duration_ms: 31.691142 + type: 'test' + ... +1..153 +# tests 288 +# suites 34 +# pass 284 +# fail 4 +# cancelled 0 +# skipped 0 +# todo 0 +# duration_ms 12453.433498