Commit Graph

308 Commits

Author SHA1 Message Date
Dragan Spiridonov e5585582cb chore(release): bump version to v3.10.0
Minor bump — new opt-in feature: external embedder endpoint (#503, ADR-097).
2026-05-20 08:04:18 +00:00
Dragan Spiridonov eea53fcdef chore(release): bump version to v3.9.36
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 14:41:30 +00:00
Dragan Spiridonov 91d9ab19a0 chore(release): bump version to v3.9.35
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 12:44:25 +00:00
Dragan Spiridonov c6b3142f09 test(learning): split aqe-learning-engine.test.ts into three forks (issue #448 step 2)
Mirrors the qe-reasoning-bank split: the original 622-line file ran
~43 tests in a single fork, most of which spun up a full
AQELearningEngine (transformer + HNSW + WASM coherence) via
beforeEach. Distributing across three sequential forks (pool=forks,
maxForks=1, fileParallelism=false) caps per-fork heap.

  - _aqe-engine-test-helpers.ts (NEW, not a test file)
    Shared createMockMemoryBackend() and createMockEventBus() factories
    pulled out of the original so the splits don't duplicate. Underscore
    prefix keeps it out of vitest's test-file include glob.

  - aqe-learning-engine-factory.test.ts (NEW, 4 tests, no init)
    Factory Functions + DEFAULT_ENGINE_CONFIG. Tests only call the
    constructor — no engine.initialize() — so transformer / HNSW /
    WASM aren't loaded. Safe to include in test:unit:fast.

  - aqe-learning-engine-patterns.test.ts (NEW, 15 tests, full engine)
    The three heaviest sub-describes: Pattern Learning, Task Tracking,
    Experience Capture Integration. Each test runs a full engine init.
    Excluded from test:unit:fast until step 3's dispose hooks are
    proven in CI.

  - aqe-learning-engine.test.ts (SLIMMED, ~21 tests, full engine)
    Init / Status / Task Routing / Model Routing / Codebase Analysis /
    Guidance / Dispose. Header comment updated to reference the two
    companion files. Inline mock factories replaced with imports from
    the shared helper.

Coverage preserved: ~43 tests still run under test:ci, across three
forks instead of one.

Issue: #448
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 12:02:12 +00:00
Dragan Spiridonov ea3566f9a2 test(learning): split qe-reasoning-bank.test.ts into three forks (issue #448 step 2)
The original 1019-line file ran 58 tests in a single vitest fork, each
spinning up a full QEReasoningBank (transformer embeddings + HNSW + WASM
coherence). Cumulative per-test memory growth blew past the heap ceiling
and the publish workflow timed out on multiple v3.9.x releases.

This commit extracts the file into three forks so the heap pressure is
distributed across three sequential processes (vitest config:
pool=forks, maxForks=1, fileParallelism=false):

  - qe-reasoning-bank-utilities.test.ts (NEW, 29 tests, no bank)
    Pure-function tests for qe-patterns + qe-guidance. Module-graph weight
    is negligible — runs in ~10ms with no transformer load. Safe to
    include in test:unit:fast.

  - qe-reasoning-bank-feedback-loop.test.ts (NEW, 9 tests, full bank)
    recordOutcome / qe_pattern_usage feedback-loop tests with vi.doMock
    churn over '../../../src/kernel/unified-memory.js'. Carries the
    heaviest mocking surface, so isolated to its own fork.

  - qe-reasoning-bank.test.ts (SLIMMED, 20 tests, full bank)
    Init / Pattern Storage / Task Routing / Learning Outcomes /
    Guidance Generation / Statistics / Embedding. Header comment
    updated to reference the two companion files.

Both heavy files (-feedback-loop and the slim core) remain excluded from
test:unit:fast for now. Re-enabling them is acceptance #2 of the issue
and requires step 3 of the proposed solution (lazy / disposable hooks on
real-embeddings.ts and coherence-service.ts) — local repro in a 16GB
Codespace shows even the slim 9-test fork still OOMs at 6GB heap,
indicating per-test cumulative growth that file-splitting alone doesn't
cure. The split is preparatory and reduces the leak slope from
58×Δ to max(20,9,0)×Δ per fork, which should give CI headroom and
clear the way for the dispose-hooks fix in step 3.

Issue: #448
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 09:45:16 +00:00
JLMA 4123ef6774 fix: add ./kernel/hnsw-adapter to package exports map (#497)
The HnswAdapter class is shipped in dist/kernel/hnsw-adapter.js but the
subpath was not registered in the package.json exports map. In Node.js
ESM strict mode, unlisted subpaths throw ERR_PACKAGE_PATH_NOT_EXPORTED,
making direct imports like:

  import { HnswAdapter } from 'agentic-qe/kernel/hnsw-adapter'

fail at runtime even though the compiled file is present.

Fix: add the ./kernel/hnsw-adapter entry alongside the existing
./kernel barrel export.
2026-05-19 11:09:49 +02:00
Dragan Spiridonov c83c0345b3 chore(release): bump version to v3.9.34
Stops unbounded growth of patterns.rvf / brain.rvf.

- #495: AbortSignal in HybridMemoryBackend.initialize() so a 5s
  createHybridBackendWithTimeout abort actually cancels the work
  instead of leaking a 14-min runaway init (~20 GB / 12 MB/s leak
  observed in the field). UnifiedMemoryManager.initialize() also
  accepts {signal} with throwIfAborted() at each await seam.
- Post-dream compaction in DreamScheduler — threshold-gated compact()
  against patterns.rvf and brain.rvf so append-only growth has a
  steady-state janitor.
- Boot-time size guard in getSharedRvfAdapter() for one-shot recovery
  of installations already in the bad state.
- Bounded SQLite→RVF backfill (top-1000 by last_used_at) so
  `: > patterns.rvf` for disk recovery doesn't trigger an unbounded
  replay (the "regrew to 59 GB" pathology).
- RvfDualWriter.compact() for brain.rvf parity.

Three operator env knobs added (no rebuild needed):
- AQE_RVF_SIZE_GUARD_BYTES (default 256 MB)
- AQE_RVF_DEAD_RATIO_THRESHOLD (default 0.30)
- AQE_RVF_BACKFILL_LIMIT (default 1000)

29 new unit tests. Performance gate 15/15 pass. test:ci 4035 pass
(3 pre-existing failures, verified identical on main).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 17:42:55 +00:00
Dragan Spiridonov 33096de66d chore(release): bump version to v3.9.33 2026-05-18 09:49:18 +00:00
Dragan Spiridonov 122f223c9a fix(security): migrate from @xenova/transformers to @huggingface/transformers
@xenova/transformers v2.17.2 (last publish 2024-05-29) pins
onnxruntime-web@1.14.0, which pulls onnx-proto → protobufjs <=7.5.5.
That chain has 8 GHSA advisories including a critical arbitrary-code-
execution one (GHSA-xq3m-2v4x-88gg). Our top-level `overrides` block
forced protobufjs@^7.5.6 in our own tree, hiding the vulns from
`npm audit` in this repo — but `overrides` are root-only by design and
do not propagate to downstream consumers. End users running
`npm install agentic-qe` were getting 5 vulns (4 high, 1 critical).

@huggingface/transformers@4.2.0 is the official maintained successor
(same project, renamed). It pulls onnxruntime-web@1.26 which depends
on protobufjs@^7.2.4 directly (no onnx-proto), so the version range
resolves cleanly to the patched line.

API changes handled:
- pipeline()/Tensor: drop-in compatible, just the import path changes
- `quantized: bool` → `dtype: DataType` (mapped from our QuantizationType
  enum: 'none'→'fp32', 'fp16'→'fp16', 'int8'→'int8', 'binary'→'q8';
  binary stays a post-process step downstream)
- progress_callback signature: ProgressInfo is now a discriminated union;
  `progress` only exists on the "progress" variant — narrowed accordingly

Also added onnxruntime-node and onnxruntime-web to the CLI and MCP
bundle externals lists. @huggingface/transformers ships both runtimes
(node for Node.js, web as fallback); esbuild can't bundle the
native .node binary so it must remain external.

End-user verification (npm pack + clean install in /tmp/aqe-canary):
- 183 packages (was 180 pre-migration; same order of magnitude)
- 0 vulnerabilities (was 5: 4 high, 1 critical)
- aqe init --auto runs in 93 ms; all 13 phases pass; optional-peers
  hint renders correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 09:27:22 +00:00
Dragan Spiridonov bb2e9a4090 chore(deps): declare @claude-flow/browser as optional peer
Mirrors the previous @claude-flow/guidance treatment: moves
@claude-flow/browser from optionalDependencies to peerDependencies +
peerDependenciesMeta{optional:true}.

Why this is the high-leverage change in this cleanup pass:
@claude-flow/browser peers on @claude-flow/cli@^3.0.0-alpha.140, which
in turn pulls @claude-flow/embeddings whose peers disagree with cli's
own optional deps — that mismatch is the entire source of the ERESOLVE
warnings users see during `npm install agentic-qe`. With browser moved
to an optional peer, that whole transitive chain is no longer pulled by
default.

Tree shrinkage: 1207 → 725 packages (482 transitives removed,
~7,924 fewer lines in package-lock.json). Includes @claude-flow/cli,
@claude-flow/embeddings, agentic-flow, plus their long tail of
deprecated transitives (koa-router@14, prebuild-install@7, uuid@9,
node-domexception@1) — all of the deprecation warnings called out at
the start of this dep-cleanup pass.

Zero runtime risk: grep confirms zero `import`/`require` of
@claude-flow/browser anywhere in src/, tests/, or scripts/. The package
was only ever a marker for the separately-run @claude-flow/browser MCP
server; src/domains/visual-accessibility/services/browser-security-scanner.ts
talks to it over the MCP protocol, not via a Node import.

Verified: `npm run build` passes, `npm audit --audit-level=high
--omit=dev` clean, `node dist/cli/bundle.js --version` runs. `npm ls
@claude-flow/cli` is now empty.

Users who want the browser MCP server can still install it explicitly:
`npm install -g @claude-flow/browser@3.0.0-alpha.1`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 08:54:49 +00:00
Dragan Spiridonov 016eda1421 chore(deps): declare @claude-flow/guidance as optional peer
Moves @claude-flow/guidance from optionalDependencies to:
- peerDependencies + peerDependenciesMeta{optional:true}: tells
  consumers of agentic-qe that this is an optional integration they
  can opt into, without forcing npm to install it for everyone.
- devDependencies: keeps our own build/CI deterministic without
  depending on the transitive chain (@claude-flow/cli pulls guidance
  as one of its own optional deps).

End-user impact: zero. The package was already transitively installed
via @claude-flow/browser → @claude-flow/cli, and runtime governance
integrations in src/governance/*-integration.ts already use lazy
`await import('@claude-flow/guidance/...')` with try/catch fallback,
so the declared-dep change does not alter what ends up in node_modules.

Type-surface check: dist/**/*.d.ts contains zero `import('@claude-flow/guidance')`
references — the internal type aliases compile away, so downstream
TypeScript consumers of agentic-qe/governance are unaffected.

Signals intent more cleanly. A bigger reducer of the upstream ERESOLVE
peer noise would be giving @claude-flow/browser the same treatment, but
that is out of scope here.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 08:51:45 +00:00
Dragan Spiridonov 713652cd81 chore(deps): tier C — runtime-safe breaking bumps
- web-tree-sitter ~0.24.7 → ~0.26.8 (API moved Parser.init onto the
  Parser class; adapter shim added in tree-sitter-wasm-parser.ts so we
  also still work against the legacy 0.24 surface).
- @types/node ^20.19.17 → ^25.8.0 (engine "node >=18.0.0" is unchanged;
  type widening only).

Deferred from Tier C (each needs its own migration PR, not a bump):
- @ruvector/attention 0.1.3 → 2.2.2: full API rewrite, classes
  (FlashAttention, DotProductAttention, MultiHeadAttention,
  HyperbolicAttention, LinearAttention, MoEAttention) replaced by
  free functions (flashAttention, scaledDotProductAttention, …).
  Requires rewriting integrations/ruvector/attention-wrapper.ts and
  updating all 6 platform-binary optional deps in lockstep.
- vibium 0.1.8 → 26.x: package no longer ships dist/ — repurposed as a
  CLI binary. `import { browser } from 'vibium'` no longer resolves.
  Requires a different integration strategy.
- typescript 5.9 → 6.0 and eslint 8 → 10: released 1-4 weeks ago; need
  their own validation pass (flat config migration for eslint).
- @ruvector/sona 0.1.5 → 0.1.6: published manifest references files
  missing from the tarball (broken publish upstream).

Build passes (tsc + cli + mcp bundles). npm audit: 0 vulnerabilities.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 07:23:38 +00:00
Dragan Spiridonov d90093544c chore(deps): tier B — tooling majors, fixes 6 high CVEs
- @typescript-eslint/eslint-plugin ^6.13.0 → ^8.59.3
- @typescript-eslint/parser       ^6.13.0 → ^8.59.3
- commander                       ^12.1.0 → ^14.0.3
- esbuild                         ^0.27.2 → ^0.28.0

Clears all 6 high-severity advisories (minimatch chain via
@typescript-eslint/typescript-estree). npm audit: 0 vulnerabilities.

Deferred to Tier C: @ruvector/sona@0.1.6 (broken npm publish, manifest
points to non-existent files) and web-tree-sitter@0.26 (breaking API
move of Parser.init onto the Parser class).

Build passes (tsc + cli + mcp bundles).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 07:20:14 +00:00
Dragan Spiridonov c67942026b chore(release): bump version to v3.9.32 2026-05-17 09:31:05 +00:00
Dragan Spiridonov 2f39f2210b ci(release): gate publish on daemon-runtime integration tests (#491)
Issue #491 exposed a structural gap in the release process: integration
coverage of the daemon-runtime seam existed (bridge-end-to-end test was
already in the repo), but it was never run on the release path —
`tests-on-tag-sha` only ran `test:unit:fast`, which excludes
`tests/integration/` by design. Every one of the four bugs in #491
lived in that unrun surface.

Two changes:

1. `package.json` — define `test:integration:fast` and
   `test:integration` scripts. The "fast" variant runs the focused
   daemon-runtime seam suite in ~6s:
     - tests/integration/mcp/fleet-init-wires-daemon.test.ts (Bug 1+4b)
     - tests/integration/workers/workers-reach-domains.test.ts (Bug 1 generalized)
     - tests/integration/learning/coordinator-roundtrip.test.ts (Bug 2+3)
     - tests/integration/bridge/bridge-end-to-end.test.ts (existing)
   The broader `test:integration` runs all of `tests/integration/`
   excluding browser/e2e for local development use.

2. `.github/workflows/npm-publish.yml` — add a new
   `integration-tests-on-tag-sha` job that runs `test:integration:fast`,
   wired into the publish job's `needs` and `if` conditions in the same
   shape as the existing `tests-on-tag-sha`. Picked the "fast" variant
   deliberately: it covers exactly the regressions #491 reported and
   keeps the release gate budget tight (~10-min job ceiling, but the
   work itself is ~6s). The broader integration suite is too noisy for
   a release gate; the fast subset is the floor.

This is the structural complement to issue #401's pre-publish init
gate: that one catches `aqe init` regressions before users, this one
catches daemon-runtime regressions before users.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 09:03:53 +00:00
Dragan Spiridonov 33eb0020d6 chore(release): bump version to v3.9.31
Self-learning loop ships end-to-end. Closes #480, #486, #487, #488.
Introduces ADR-094 (kernel-side dream cycles + hooks-as-producers
boundary) and ADR-095 (three-signal routing with Q-blend + ε-greedy +
mincut safety gate).

8 commits in this release:
  - 66553141 fix(hooks): post-edit dream trigger (#480) + pre-task gate (#487)
  - be32ff09 feat(workers): mineExperiences auto-trigger (#486 Gap A)
  - e266bae9 refactor(learning): single writer for pattern usage (#486 Gap B)
  - 4c0bdfaf feat(observability): daemon pidfile + loop-health (#488 Phase 1)
  - 6236a2cd feat(kernel): kernel-side dream cycles (ADR-094, #488 Phase 2)
  - 874ae39c feat(learning,bridge): dream_insights TTL + cursor guard (#488 Phase 3)
  - 70154c1b feat(routing): three-signal routing (ADR-095, #488 Phase 4)
  - 43ebcaa3 fix(routing,kernel,cli): brutal-honesty audit follow-ups

Version sites updated:
  - package.json + package-lock.json
  - .claude/skills/skills-manifest.json fleetVersion
  - assets/skills/skills-manifest.json fleetVersion
  - .claude-plugin/plugin.json version

CHANGELOG and docs/releases/v3.9.31.md added.
docs/releases/README.md row added.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 16:54:00 +00:00
Dragan Spiridonov a664b679e0 chore(release): bump version to v3.9.30
Six user-reported MCP fixes (see CHANGELOG and docs/releases/v3.9.30.md):

- #467 __dirname ESM polyfill across 7 source files
- #469 real all-MiniLM-L6-v2 embeddings (was random-vector mock)
- #470 NaN guard in coherence_collapse risk categorization
- #472 default test phases when MCP wrapper omits the list
- #473 wire SessionOperationCache into MCP tools/call dispatch
- #474 validate language and auto-derive framework in test_generate

Also fixes a pre-existing field-name typo in
tests/integrations/agentic-flow/e2e-integration.test.ts (.similarity →
.score) that was vacuously passing because the previous mock embedding
generator rarely cleared the threshold to exercise the assertion.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 14:32:40 +00:00
Dragan Spiridonov f7acdd5707 chore(release): bump version to v3.9.29
Hotfix for v3.9.28 — bridge payload shape (#482 round 3)

After v3.9.28 fixed the subscriber-loading order, handlers fired for
every bridge event but immediately short-circuited because
event.payload.experience was undefined. The bridge had been publishing a
flat payload { experienceId, domain, agent, task, ... } that didn't
match handleExperienceCaptured's destructure.

Fix: bridge now publishes the canonical nested
{ experience: TaskExperience-shaped, reward } shape that matches the
existing publisher in src/learning/experience-capture.ts:1043.

Also dropped the domain-specific fan-out events (test-execution.TestRunCompleted,
coverage-analysis.CoverageGapDetected, etc.) — their handlers expect
domain-event-specific fields (runId, passed, failed, gapId, riskScore)
that hooks don't capture, so publishing them with undefined fields
recorded degenerate experiences. Universal learning.ExperienceCaptured
is now the bridge's sole publication.

Integration test now uses requirements-validation domain (per Jordi's
suggestion) so the universal-event path is the sole thing being tested,
not masked by a fan-out side effect.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 11:56:00 +00:00
Dragan Spiridonov 062b413b70 chore(release): bump version to v3.9.28
Hotfix for v3.9.27 — bridge subscriber wiring (#482)

The CapturedExperienceBridge shipped in v3.9.27 published events into a
kernel with no subscribers because lazyLoading: true left domain plugins
un-initialized when the bridge's first drain ran. Cursor advanced past
the rows; events were silently lost.

Fix: kernel.initialize() now eagerly loads all enabled domain plugins
before starting the bridge. CLI commands opt out via the new
enableExperienceBridge: false flag to keep their fast startup. Added
end-to-end integration test (real kernel + real plugin + real drain →
asserts kv_store has learning:experience:* key).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 09:50:54 +00:00
Dragan Spiridonov 4e011a81d0 chore(release): bump version to v3.9.27
- AbortSignal threading bounds ReasoningBank.initialize() (#478)
  prevents leaked init from runaway patterns.rvf writes
- CapturedExperienceBridge wires hook activity to domain plugins (#479)
  via kernel-side drain of captured_experiences
- Removes dead v3-qe-bridge.sh, two stale planning docs, five orphan
  workers in qe-workers.ts (subsumed by LearningConsolidationWorker)

Net: +430 / -2,090 lines

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 09:10:11 +00:00
Dragan Spiridonov bb34aeace4 chore(release): bump version to v3.9.26
Ten learning-pipeline fixes (#453, #454, #455, #456, #460, #461, #462,
#463, #464, #465) plus dup closures (#457-#459). Tightens the #465
sentinel sweep with the same task_json discriminator the LIMIT-1 close
uses, preserving the #451 ownership split (route sentinels owned by
post-route, pre-task sentinels by post-task). Updates the regression
suite to reflect the new sweep behavior.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 14:20:24 +00:00
Dragan Spiridonov fe373e28ff fix(deps): patch 11 Dependabot alerts (protobufjs + OpenTelemetry) (#476)
Bump transitive deps to safe versions via resolutions/overrides:

protobufjs 7.5.5 -> 7.5.8 (resolves GHSA-685m-2w69-288q, GHSA-66ff-xgx4-vchm,
GHSA-2pr8-phx7-x9h3, GHSA-fx83-v9x8-x52w, GHSA-75px-5xx7-5xc7,
GHSA-jvwf-75h9-cwgg, GHSA-q6x5-8v7m-xcrf)

@protobufjs/utf8 1.1.0 -> 1.1.1 (resolves GHSA-q6x5-8v7m-xcrf in utf8 sub-pkg)

@opentelemetry/sdk-node 0.52.1 -> 0.218.0
@opentelemetry/auto-instrumentations-node 0.47.1 -> 0.76.0
@opentelemetry/exporter-prometheus 0.52.1 -> 0.218.0
(all resolve GHSA-q7rr-3cgh-j5r3 - Prometheus exporter process crash via
malformed HTTP request)

All patches verified:
- npm audit --omit=dev: 0 vulnerabilities
- npm run build: clean
- Fast unit suite: 7477/7477 passing

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 13:24:12 +02:00
Dragan Spiridonov b2e6090c6d chore(release): v3.9.25 (#452)
* feat(hooks): post-route Stop hook closes route sentinels 1:1 (#451)

The `route` hook fires on UserPromptSubmit and writes a sentinel row to
routing_outcomes with quality_score=-1, expecting `post-task` to close
it. But `post-task` only fires on PostToolUse ^(Task|Agent)$, which is
rare in direct-work sessions (Bash/Edit/Read without spawning sub-
agents). Sentinels accumulated indefinitely — Jordi reported 123+
unresolved rows per session. Stream D never converged.

Changes:

1. New `aqe hooks post-route` subcommand
   (src/cli/commands/hooks-handlers/routing-hooks.ts)
   Closes the most-recent unresolved route sentinel using a
   `task_json NOT LIKE '%"taskId"%'` discriminator that isolates
   route entries from pre-task entries. Quality formula collapses the
   6-dim outcome formula for unknown duration:
     0.325 + 0.25·success + 0.10·1.0
   = 0.675 (success) / 0.425 (failure)

2. Inverse discriminator on updateRoutingOutcomeQuality
   (src/cli/commands/hooks-handlers/hooks-dream-learning.ts)
   Added `task_json LIKE '%"taskId"%'` to the WHERE clause so
   post-task only ever closes pre-task sentinels. Without this,
   post-task could grab a stale route sentinel by accident and
   miscredit duration to a row that wasn't about a Task() call.
   Symmetric counterpart to the post-route filter.

3. Stop-hook wiring in both init template paths
   (src/init/phases/07-hooks.ts + src/init/init-wizard-hooks.ts)
   Added `npx agentic-qe hooks post-route --success true --json`
   to the Stop block. Timeout 5000ms, continueOnError: true, so a
   failed post-route cannot block session teardown.

4. CLI help text (src/cli/commands/hooks.ts)
   Added example for the new subcommand.

5. Regression test (tests/unit/cli/commands/post-route.test.ts)
   4 tests using in-memory better-sqlite3:
   - Closes most-recent route sentinel; leaves pre-task sentinels
     and resolved rows untouched
   - quality_score = 0.425 when --success false
   - No-op when only pre-task sentinels exist (discriminator works)
   - No-op on second invocation when only one sentinel was outstanding

Bug-introduce verification: stashed routing-hooks.ts, ran new test —
all 4 cases failed (Commander rejects unknown subcommand). Restored
fix, all 4 pass. Test distinguishes pre-fix and post-fix states.

Co-authored-by: Jordi Izquierdo <noreply@github.com>

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(release): bump version to v3.9.25

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 15:05:29 +02:00
Dragan Spiridonov ca714ac1a7 chore(release): v3.9.24 (#450)
* fix(hooks): post-task runs Stream B/D/F when --task-id is missing (#449)

The shipped PostToolUse hook command for Task/Agent matchers is
  `npx agentic-qe hooks post-task --task-id "$TOOL_RESULT_agent_id" --success --json`
Claude Code does not populate $TOOL_RESULT_agent_id, so the flag arrives
empty and options.taskId is falsy on every real hook invocation. The
`if (options.taskId)` gate inside post-task then short-circuited the
entire Stream B/D/F learning chain:

- reasoningBank.recordOutcome — never called
- persistTaskOutcome — never called (no captured_experiences,
  experience_applications, qe_trajectories, dream_insights.applied)
- updateRoutingOutcomeQuality — never called (routing_outcomes
  sentinels accumulated unfilled at success=0/quality_score=-1)
- updateHookRouterQValue — never called (rl_q_values stayed empty
  forever)

Same regression was fixed in v3.9.21 (patch 030) and silently came
back in v3.9.23.

Fix:
- Remove the `if (options.taskId)` gate in post-task. Use
  `hook-${Date.now()}` fallback for the patternId / experience id
  when the caller didn't supply one. The bridge lookup in
  persistTaskOutcome keys by `ORDER BY created_at DESC LIMIT 1`
  (not by taskId), so Stream F's Bellman Q-update still finds the
  bridge payload it needs.
- Remove the parallel `&& options.taskId` clause from the pre-task
  routing_outcomes sentinel write at line 195 — same root cause.
- Add `DO NOT REINTRODUCE` comment blocks at both sites pointing
  at #449 and patch 030.

Test: tests/unit/cli/commands/task-hooks-no-taskid.test.ts mocks
hooks-shared and asserts persistTaskOutcome / updateHookRouterQValue
fire when --task-id is absent. Bug-introduce verification:
re-introducing the gate makes the no-taskId test fail with the
expected "called 1 times, but got 0 times".

Co-authored-by: Jordi Izquierdo <noreply@github.com>

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(release): bump version to v3.9.24

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 09:54:33 +02:00
Dragan Spiridonov 1967be2928 fix(learning): qe_pattern_usage stays 0 + exclude flaky tests from fast suite
Closes #447. Three-layer fix for the upsert-returns-wrong-UUID bug that
silently broke Stream C of self-learning:

* sqlite-persistence.ts: SELECT actual id after ON CONFLICT(name,
  qe_domain, pattern_type) — the upsert keeps the existing row's UUID
  but we were returning the input one, leaving downstream callers with
  a UUID that didn't exist in qe_patterns.

* rvf-pattern-store.ts: capture the SQLite return value and realign
  pattern.id BEFORE the HNSW ingest so the index keys stay consistent
  with the source-of-truth table.

* qe-hooks.ts QEAgentCompletion: change const → let on
  effectivePatternId, capture storeResult.value.id from the auto-create
  storePattern call, feed it into recordOutcome. Without this, every
  auto-created pattern's outcome silently failed with "Pattern not
  found", which is why qe_pattern_usage stayed at 0 forever.

Also (#448): excluded tests/unit/learning/qe-reasoning-bank.test.ts and
aqe-learning-engine.test.ts from test:unit:fast — both chronically hang
the vitest fork worker on heavy module graph load. Same pattern as
domain-handlers.test.ts already excluded from test:ci. Issue #448 tracks
the root-cause investigation.

Thanks to @Jordi-Izquierdo-DDS for the #447 diagnosis.

Co-Authored-By: Jordi Izquierdo <jordi-izquierdo-dds@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 14:54:21 +00:00
Dragan Spiridonov 806ade7e25 chore(release): bump version to v3.9.23 (#446)
Fixes routing learning loop — bootstrap patterns now reach HNSW index
(#445). After this release, `patternCount` in routing hook output is
non-zero, existing installs auto-backfill `.agentic-qe/patterns.rvf` from
SQLite on next startup.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 14:49:17 +02:00
Dragan Spiridonov 2ee349d59c chore(release): bump version to v3.9.22
- package.json + package-lock.json: 3.9.21 → 3.9.22
- .claude-plugin/plugin.json: 3.9.21 → 3.9.22
- .claude/skills/skills-manifest.json: fleetVersion 3.9.21 → 3.9.22
- assets/skills/skills-manifest.json: fleetVersion 3.9.21 → 3.9.22
- CHANGELOG.md: add 3.9.22 entry
- docs/releases/v3.9.22.md: new release notes
- docs/releases/README.md: add 3.9.22 row

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 13:33:55 +00:00
Dragan Spiridonov c09343c92a chore(release): bump version to v3.9.21
Bumps version + fleetVersion across package.json, plugin.json, and the
two skills-manifest.json copies. Adds CHANGELOG entry and release notes.

Includes one fix discovered during the release-prep e2e: stale-lock
recovery in shared-rvf-adapter's openOrCreateRvf ladder. The native
@ruvector/rvf-node binding leaves a `<file>.lock` artifact when a
process exits without calling close() — a behaviour that frequently
happens in CLI flows and that the previous always-create code path
masked. With open-or-create, those stale locks now surfaced as
`LockHeld` errors. The ladder now detects that, removes the stale
lock file, and retries open exactly once. E2E confirms RVF native
recovers cleanly across init → CLI invocation boundaries.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 12:55:36 +00:00
Dragan Spiridonov 5d187de2a1 fix(install,rvf,hypergraph): unblock Windows install, fix RVF FsyncFailed, synthesize covers edges
Bundles fixes for issue #439 (Windows install) and Jordi RUFLO patches
P020 (RVF init) + P220 (hypergraph blindness).

Windows install (#439):
- Move hnswlib-node from dependencies to optionalDependencies so
  installs no longer fail on Windows boxes without VS C++ Build Tools;
  HnswAdapter already routes around a missing native binary at runtime.
- Replace HNSWIndex.ts top-level static `import hnswlib from
  'hnswlib-node'` with a lazy require so package load survives the
  optional dep being absent.
- README + preinstall.cjs: document toolchain requirement and disclose
  that the JS fallback degrades to O(N) brute-force when @ruvector/gnn
  is also unavailable (Windows default — no win32 prebuilds ship).
- ADR-090 amendment reconciling the move with ADR-081's optional-dep +
  JS-fallback intent.

RVF init (Jordi P020):
- Root cause: shared-rvf-adapter and pattern-store factory always called
  RvfDatabase.create(), which throws `0x0303 FsyncFailed` when the .rvf
  file already exists from a prior init phase. Reproduced and confirmed
  against both 0.1.7 and 0.1.8 native binaries — not a version
  regression.
- Fix: race-tolerant open-or-create ladder (try open → fall back to
  create → retry open on create-race) with dim() verification after
  open. Mismatched-dim files are closed and the caller degrades rather
  than corrupting silently.

Hypergraph (Jordi P220):
- Drop the original flushEdgesToHypergraph (wrote `call`/`extends`
  edges that no production query reads — devil's-advocate review caught
  it as dead infrastructure).
- Add HypergraphEngine.synthesizeTestCoverage that re-tags test files
  type='test' and writes `covers` edges from each test file to
  functions in the source files it imports. This is the shape
  findUntestedFunctions / findImpactedTests actually filter on.
- E2E verified: untested correctly excludes covered functions;
  impacted-tests returns the right test file.

Verification:
- `npm run build` clean
- 276/276 tests pass across HNSW, RVF, KG, coordinator, hypergraph
  suites (5 new synthesizeTestCoverage tests; replaced 4 obsolete
  flush tests)
- E2E on fresh project: aqe init clean, hooks stats shows
  nativeAvailable: true, code index logs `Test coverage synthesized`,
  hg untested + hg impacted return useful results

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 12:22:58 +00:00
Dragan Spiridonov 1a4a7ff9fb chore(release): bump version to v3.9.20
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 07:47:01 +00:00
Dragan Spiridonov ec451c419f chore(release): bump version to v3.9.19 2026-05-05 16:53:24 +00:00
Dragan Spiridonov 25b6bd732a chore(release): v3.9.18
Bundles 4 MCP bug fixes + new agentic-qe-fleet plugin.

Fixed:
- coverage_analyze_sublinear and other domain MCP tools blocked by governance
  after 1-2 calls (synthetic token-slope estimate replaced with 0; throttle
  decisions are no longer treated as hard blocks)
- test_generate_enhanced framework=jest produced unrunnable tests (now emits
  @jest/globals imports instead of invalid 'jest' package import)
- generated test imports referenced /tmp/aqe-temp-* paths (importPathOverrides
  plumbed through IGenerateTestsRequest end-to-end)
- qe/coverage/gaps error message misled callers about which input failed
  (distinguishes coverageFile-empty vs autodiscovery-miss)

Added:
- test_generate_enhanced schema exposes framework, filePath, coverageGoal,
  aiEnhancement, detectAntiPatterns parameters
- agentic-qe-fleet Claude Code plugin (11 agents, 9 commands, 9 skills)
- scripts/smoke-test-fixes.sh and scripts/plugin-load-test.sh

Verification:
- 1301 MCP unit tests pass (zero regressions)
- 734 targeted unit tests pass across changed code
- aqe init --auto in fresh project succeeds (85 skills, 60 agents)
- End-to-end MCP smoke test passes 5/5
- qe-coverage-specialist agent re-spawn confirms NO_GOVERNANCE_BLOCK
- Plugin structural validation: 14/14 checks pass

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 14:39:10 +00:00
Dragan Spiridonov 5f711b5b3e fix(hooks): UserPromptSubmit reads stdin event JSON for routing (v3.9.17)
The shipped `aqe init` template wired the UserPromptSubmit hook to
`npx agentic-qe hooks route --task "$PROMPT" --json`, but Claude Code
never exposed `$PROMPT` as an env var — only stdin event JSON. The
shell expanded `"$PROMPT"` to `""`, so every prompt routed as empty
and `routing_outcomes.task_json` was persisted as `{"description":""}`,
silently breaking the routing learning loop.

- routing-hooks.ts: demote --task to optional, read stdin (500ms
  timeout) and extract prompt/user_prompt/command/tool_input.{prompt,
  description}; explicit error when neither source has content
- 07-hooks.ts and init-wizard-hooks.ts: drop --task "\$PROMPT", let
  the CLI read stdin directly. isAqeHookEntry still matches both
  shapes, so existing projects upgrade on `aqe init --upgrade`
- tests/unit/cli/commands/hooks-routing.test.ts: 10 unit tests
  covering all event shapes, fallback ordering, malformed JSON, and
  empty-field skip

Verified end-to-end: piped a Claude Code-shaped event into a fresh
project's configured route command and confirmed task_json captures
the real prompt instead of "". Backward-compat manual --task usage
preserved.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 06:19:05 +00:00
dependabot[bot] 099b1588dc chore(deps): bump uuid in the npm_and_yarn group across 1 directory
Bumps the npm_and_yarn group with 1 update in the / directory: [uuid](https://github.com/uuidjs/uuid).


Updates `uuid` from 9.0.1 to 14.0.0
- [Release notes](https://github.com/uuidjs/uuid/releases)
- [Changelog](https://github.com/uuidjs/uuid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/uuidjs/uuid/compare/v9.0.1...v14.0.0)

---
updated-dependencies:
- dependency-name: uuid
  dependency-version: 14.0.0
  dependency-type: direct:production
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-24 12:50:56 +00:00
Dragan Spiridonov baecaf9865 chore(release): bump version to v3.9.16
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 12:20:33 +00:00
Dragan Spiridonov 5f58b279d6 chore(release): bump version to v3.9.15
ADR-091 (qe-browser) promoted to Implemented, trust tier 3:
- new aqe eval run --skill <skill> CLI executes skill eval YAMLs as real CommandRunner evals
- aqe init --auto on Linux ARM64 now prints an exact VIBIUM_BROWSER_PATH hint
- docs/guides/qe-browser-getting-started.md for new users
- .github/workflows/test-qe-browser.yml gates PRs with vitest + smoke + eval jobs
- qe-browser eval YAML reworked to use httpbin.org (no fixture server needed)
- Vibium pin comment corrected: ^26.3.18 is a major-line pin, not major.minor

No breaking changes. CLI surface additions only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 07:17:14 +00:00
Dragan Spiridonov e7a78910d5 chore(release): bump version to v3.9.14
Security + supply-chain hardening closes five P0 release blockers from
the v3.9.13 QE audit. Shipped tarball drops 52% (19.9 MB → 9.6 MB),
15 critical runtime npm vulnerabilities are eliminated, and a
command-injection path in `aqe learning repair` is closed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 14:14:14 +00:00
Dragan Spiridonov 9d3b514ee2 fix(v3.9.14): second P0/P1 wave from QE audit follow-up
Security (M-01):
- src/cli/commands/learning.ts: replace execSync shell-interpolation of
  the user-controlled --file path with execFileSync + file-descriptor
  redirect (dump) and stdin input (import). Closes the command-injection
  vector where a crafted --file="x.db\"; rm -rf ~; \"" would escape
  shell quoting.

Build / supply chain:
- Move @claude-flow/guidance from dependencies to optionalDependencies
  alongside @claude-flow/browser. No stable successor exists on npm;
  usage is already guarded by try/await-import/catch fallbacks so
  demotion is safe. Documented in the follow-up research memo.
- Lazy-load @faker-js/faker via dynamic import in
  test-data-generator.ts and mark it external in build-cli.mjs /
  build-mcp.mjs. Faker is a devDep that previously got statically
  bundled into shipped artefacts because of a top-level import. Tarball
  drops 11.5 MB → 9.6 MB.

MCP API contracts:
- Add required:true to semantically load-bearing first parameters on
  agent_metrics (agentId), coverage_analyze_sublinear (target),
  accessibility_test (url), defect_predict (target), code_index
  (target). Verified via live MCP tools/list handshake — required
  arrays now match the intent documented in each tool's description.

CI hygiene:
- Rewrite the "Commit telemetry data" step in
  qcsd-production-trigger.yml to push to a bot branch and open a PR
  instead of `git push` direct to protected main. That push failed 8/10
  runs on the last audit cycle because of branch protection. Artifact
  upload (already present) continues to preserve the raw payload for 90
  days regardless of whether the PR lands.

Verification:
- npm audit --omit=dev: 0 critical, 0 high (1 moderate in
  @mapbox/node-pre-gyp — extraneous, pre-existing, unrelated).
- npm run typecheck: clean.
- CLI + MCP bundles rebuild successfully.
- 253/253 test-generation unit tests pass.
- Live MCP protocol smoke: new required flags visible on tools/list;
  advisor_consult guard from v3.9.14 round 1 still fires.

Memory note: see feedback_cli_is_aqe.md — CLAUDE.md ruflo refs were
audited. Only 2 lines (204, 260-261) are stale AQE-product refs; the
other 11 swarm/memory/daemon ruflo commands are legitimate
orchestration-layer invocations and are intentionally retained.
Deferred to a dedicated docs PR so the user can review each.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 12:47:06 +00:00
Dragan Spiridonov 6dd39a9938 fix(v3.9.14): close all 5 P0 blockers identified by v3.9.13 QE audit
Security (15 criticals → 0):
- Pin protobufjs to ^7.5.5 via overrides + resolutions to break the
  @xenova/transformers → @claude-flow/{browser,guidance,embeddings}
  → onnxruntime-web → onnx-proto chain reaching the CVE-94 payload
  (GHSA-xq3m-2v4x-88gg). npm audit --omit=dev now reports 0 vulns.

Tarball bloat (-42%):
- Add rmSync(dist/cli/chunks) to build-cli.mjs before the code-split
  build so only fresh chunks ship. 799 → 240 chunks, dist/cli 44 → 11
  MB, npm tarball 19.9 → 11.5 MB.

Retiring-model refs (ADR-093 tier-1 hardcodes):
- Replace 'claude-3-haiku-20240307' with 'claude-haiku-4-5' in
  MODEL_TIERS[1] at constants.ts:608 and in five mirror implementations
  across test-execution, contract-testing, chaos-resilience,
  learning-optimization, and visual-accessibility services. Haiku 3
  retirement will no longer 404 these tier-1 fallback paths. Backward-
  compat refs retained intentionally in bedrock ARN table, cost
  tracker, type unions, and RETIRING_MODELS schedule.

ESLint harness:
- package.json lint script invoked eslint on both `src` and `tests`
  but .eslintrc.cjs explicitly ignores `tests`, causing ESLint to
  abort. Narrow the script to `eslint src --ext .ts` so the harness
  runs. (955 pre-existing rule violations remain as separate backlog.)

advisor_consult MCP contract (ADR-092 F-01):
- Mark `agent` and `task` parameters as required:true in the schema.
- Validate via trim() guard in the handler and return a structured
  error when either is empty/whitespace instead of shelling out to
  `aqe llm advise` with placeholder values. Verified via live MCP
  stdio handshake: both empty-string and whitespace-only `agent`
  produce the expected rejection without any child process spawn.

Verification:
- npm audit --omit=dev → 0 vulnerabilities (verified from node_modules,
  not just lockfile).
- npm run typecheck → clean.
- npm run build → CLI + MCP bundles both build.
- 94/94 tests pass across the patterns touched (security-compliance
  scanners + task-executor-errors).
- MCP protocol smoke test confirms advisor_consult guard fires.

Restores Dependency/Build from Grade C to Grade B and lifts the
composite quality score from 7.0 to ~7.3.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 11:13:05 +00:00
Dragan Spiridonov 4a2d8a66da chore(release): bump version to v3.9.13
Ships ADR-093 Opus 4.7 migration: Sonnet 4.6 becomes the fleet-wide
default, xhigh effort level is on everywhere, Opus 4.7 is the opt-in
escalation target via MultiModelExecutor, and cyber-sensitive agents
stay pinned to Sonnet 4.6 pending Cyber Verification Program approval.

Also fixes two stale integration-test assertions that still expected
the retiring claude-haiku-3-5 ID; both now assert the current
claude-haiku-4-5 per the model registry.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 17:01:37 +00:00
Dragan Spiridonov a85a987e3c chore(release): bump version to v3.9.12
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 09:31:13 +00:00
Dragan Spiridonov dca7dc53d0 chore(release): bump version to v3.9.11
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 11:05:28 +00:00
Dragan Spiridonov b02ace1c80 chore(release): bump version to v3.9.10
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 07:40:25 +00:00
Dragan Spiridonov 9befc9a647 chore(release): bump version to v3.9.9
Ships qe-browser fleet skill (Vibium engine, ADR-091) — a ~10MB Go binary
replacement for 300MB Playwright with typed assertions, batch execution,
visual-diff, prompt-injection scanning, and semantic intents. 11 skills
migrated to the new engine.

Total skills: 84 → 85. Tier 3 verified: 49 → 50. Manifest: 1.3.0 → 1.4.0.
fleetVersion bumped to 3.9.9 in skills-manifest.json.

See CHANGELOG.md and docs/releases/v3.9.9.md for details.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 11:44:07 +00:00
Dragan Spiridonov 9f5d967aed chore(release): bump version to v3.9.8
Release-process maturity release. No source code changes since v3.9.7
— every commit lands in CI infrastructure, fixtures, scripts, or docs.
The published package is functionally identical to v3.9.7 except for
a refreshed lockfile carrying two transitive security patches.

Closes 4 of the 5 #401 follow-up issues:
- #408 PR template CI enforcement (#416)
- #409 VERIFICATION.md + matrix embed (#417)
- #410 Weekly chaos workflow (#417)
- #411 Mirror init-corpus tarballs to GitHub Releases (#415)

Plus #414 (dependabot transitive bumps: hono 4.12.9→4.12.12,
@hono/node-server 1.19.11→1.19.13).

The remaining #401 follow-up is #407 (worker_threads phase 06
isolation), which stays deferred per its own definition — none of
its 4 trigger conditions have fired.

Verification (per docs/policies/release-verification.md):
- npm run build — clean (CLI + MCP bundles report v3.9.8)
- npm run typecheck — clean (zero errors)
- 711/711 unit tests pass on the critical CLI subset + the load-
  bearing phase 06 watchdog test
- 15/15 performance gates pass
- Clean-room install: npm pack -> fresh project -> npm install ->
  aqe --version returns 3.9.8 with exit 0
- aqe init --auto --json in fresh project: zero step errors, 84
  skills installed, 60 agents installed, MCP configured, CLAUDE.md
  generated, workers started

Full test:ci suite intentionally not run locally per CLAUDE.md
("DO NOT run local tests in Codespace if they OOM — CI tests in
the workflow are sufficient"). The release-gate corpus + post-
publish canary will exercise the full surface in CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 10:31:15 +00:00
Dragan Spiridonov 65b2599390 chore(release): bump version to v3.9.7
Release notes + CHANGELOG + fleetVersion bump for v3.9.7. See
docs/releases/v3.9.7.md for the user-facing summary.

Highlights:
  - Release-gate corpus with 4 pinned real public repo fixtures
    (mitt, p-queue, RuView with sha256-pinned regression marker,
    agentic-qe self-dogfood) running `aqe init --auto` end-to-end
    before every publish
  - `aqe init --json` with stable schemaVersion 1 contract and
    stricter exit codes
  - Phase 06 no longer hides non-critical failures behind
    result.success:true (the v3.9.3 failure shape is now structurally
    impossible to ship silently)
  - Post-publish canary re-runs the corpus against the freshly
    published package via real npm CDN edge
  - Watchdog effectiveness unit test covering async-stall branches
  - AQE_SKIP_CODE_INDEX promoted to permanent supported flag

Verification:
  - npm run build — clean
  - npm run typecheck — clean
  - tests/unit/init/ + tests/unit/cli/ — 1084/1084 pass
  - Full corpus gate against /tmp/agentic-qe-3.9.7.tgz — 4/4 pass
    with 22 assertions each
  - Isolated install probe (npm install + aqe --version) — OK
  - aqe security --sast on all touched files — 0 findings

Refs: #401, #412

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 17:28:54 +00:00
Dragan Spiridonov 77d3f09159 chore(release): bump version to v3.9.6
Headline change: native HNSW search actually works again. The previous
NativeHnswBackend wrapped @ruvector/router 0.1.28's VectorDb, which a
fresh investigation found to have four serious bugs:

  1. HNSW search returned essentially random results — recall@10 ≈ 0%
     on the project's FNV fixture and 10% on textbook unit-Gaussian
     random vectors. The graph walk could not find self-vectors when
     querying with a stored vector.
  2. The VectorDb constructor unconditionally wrote a vectors.db redb
     file to the user's project root, polluting CWD with multi-MB
     files outside .agentic-qe/, in a non-SQLite format that no AQE
     migration or backup tooling knew about.
  3. Process-wide singleton lock — only ONE VectorDb instance could
     exist per process. Subsequent constructors threw "Database error:
     Database already open. Cannot acquire lock."
  4. NAPI dispose did not synchronously release the redb lock — root
     cause of v3.9.5's futex deadlock.

NativeHnswBackend was rewritten to wrap hnswlib-node@^3.0.0 (the
canonical Yury Malkov C++ Hnswlib reference implementation, used by
Pinecone, Weaviate, Qdrant, LangChain, ChromaDB). All four bugs are
gone in one swap. Empirical verification: 100% recall@10 vs the old
10%, faster inserts, multiple instances coexist, no CWD pollution.

useNativeHNSW default is flipped back from false to true (reverting
the v3.9.5 hotfix). Users with large codebases get sublinear HNSW
search by default again.

aqe init now warns when it detects a stale `vectors.db` from the
previous version and suggests `rm vectors.db`. It does NOT auto-delete
(per the data protection rules).

No new dependency was added — hnswlib-node was already in package.json.

Bumps fleetVersion in skills-manifest.json from 3.9.2 (stale) to
3.9.6 to match.

Adds release notes at docs/releases/v3.9.6.md and updates the
release index.

Closes #399. Closes #396 (test-suite cleanup carried over from the
closed PR #403, also in this release).

See ADR-090 for the full decision record and CHANGELOG.md for the
user-facing summary.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 19:13:42 +00:00
Dragan Spiridonov 3a1d9636b3 fix(kernel): disable native HNSW by default — deadlocks on certain inputs (v3.9.5)
ROOT CAUSE FOUND for the ruview / ruview_live.py hang.

Investigation
-------------
v3.9.4's per-file log gave the user the exact stalling file:
examples/ruview_live.py from the public RuView project. I downloaded
the file (28 KB, 776 lines, 95 entities — normal-shaped Python),
reproduced the hang locally against v3.9.4, then dumped kernel
state of the hung process via /proc/<pid>/wchan and strace.

Findings:

  Main thread: futex(0x3c6ded50, FUTEX_WAIT_PRIVATE, 1, NULL)
               (NULL timeout = wait forever)
  17 total threads:
    - MainThread (blocked in futex)
    - V8Worker × 4 (blocked in futex)
    - DelayedTaskScheduler (epoll_wait — normal libuv)
    - SignalInspector (blocked in futex)
    - tokio-runtime-w × 6 (blocked in futex)
    - libuv-worker × 4 (blocked in futex)
  Native modules loaded:
    - ruvector-router.linux-arm64-gnu.node
    - ruvector-gnn.linux-arm64-gnu.node
    - better_sqlite3.node

The deadlock is reproducible: every run against this file produces
the same futex_wait_queue state. After 7 successful VectorDb.insert()
calls (7 rows visible in the vectors table), the 8th never returns.

This is a futex deadlock inside the @ruvector/router native NAPI
module, triggered by VectorDb.insert() against certain vector content
shapes. The Rust tokio runtime threads inside the module hold a lock
the main thread is waiting for, and never release it. The setTimeout-
based watchdog v3.9.3 added cannot interrupt this — setTimeout
callbacks queue between event loop iterations and the event loop is
frozen inside a kernel futex syscall. That's a Node.js architectural
limitation, not a bug in our watchdog code.

The fix
-------
One-line change: useNativeHNSW feature flag default flipped from
true to false in src/integrations/ruvector/feature-flags.ts. All
HNSW operations now route through ProgressiveHnswBackend instead of
NativeHnswBackend. The native module is still loaded and still
available to anyone who explicitly opts in via
setRuVectorFeatureFlags({ useNativeHNSW: true }) — the default path
just no longer touches the deadlock-prone code.

Why this isn't a regression
---------------------------
ProgressiveHnswBackend was already updated in v3.9.3 commit 2bd601b0
to use brute-force exact cosine for the cosine metric. For AQE's
typical KG sizes (<10k vectors @ 384 dim), brute-force cosine is
*faster* than HNSW because it skips the per-query graph-walk
overhead:

  1k vectors:    brute-force ~0.4 ms vs native HNSW ~0.8 ms (BF wins)
  10k vectors:   brute-force ~4 ms   vs native HNSW ~1.5 ms (HNSW wins)
  100k vectors:  brute-force ~40 ms  vs native HNSW ~3 ms (HNSW wins)

For workloads AQE actually runs in production, brute-force is
faster. Native HNSW only matters above ~10k vectors, which is rare.
And critically, brute-force cannot deadlock — it's a deterministic
loop in pure JS.

Verification
------------
- examples/ruview_live.py: was deadlock, now 258 ms / 95 entries / exit 0
- 200-file synthetic fixture: 1761 ms / 2600 entries / exit 0
- 1-file empty fixture: 380 ms total init / exit 0
- HNSW + memory + init test suites: 152/152 + 452/452 = 604/604 pass

Test updates: native-hnsw-backend.test.ts had three tests asserting
the OLD `useNativeHNSW: true` default. Updated to assert the new
`false` default with a comment explaining v3.9.5's reasoning so
future contributors understand why the flag was flipped.

What's still v3.9.6 scope (#401)
---------------------------------
The architectural fix — running phase 06 inside a killable
worker_threads.Worker so any future native deadlock can be
terminated by the parent — remains tracked in #401. v3.9.5
disables the deadlock-prone path; v3.9.6 will make the watchdog
actually effective for any native code regardless of the underlying
library. Both layers are needed for long-term reliability. The
verification gap that allowed v3.9.3 to ship (no real-world
fixtures, no watchdog effectiveness test, no post-publish canary)
is also tracked in #401 with concrete release-gate changes that
will land alongside v3.9.6.

What we kept from v3.9.4
------------------------
- AQE_SKIP_CODE_INDEX env var + --skip-code-index flag (kept as
  user-facing emergency overrides for any future native-layer issue)
- Per-file progress logging in phase 06 (diagnostic transparency)
- Governance / kiro / sync installer findPackageRoot walk-up fixes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 12:02:35 +00:00
Dragan Spiridonov 245a99ec5a chore(release): v3.9.4 — governance phase fix + code index escape hatch
Same-day hotfix for two issues v3.9.3 did not catch:

1. Governance phase failing on chunked bundles (cf-devpod).
2. Phase 06 hang on codespaces (ruview) — watchdog unable to
   interrupt synchronous native code blocking the event loop.

v3.9.4 ships:
- Fix C: findPackageRoot() walk-up for governance/kiro/sync
  installers — repairs the chunk-split regression class of bugs.
- Fix A: AQE_SKIP_CODE_INDEX env var + --skip-code-index flag —
  escape hatch for the phase 06 stall until the proper killable-
  worker fix lands in v3.9.5.
- Fix B: Per-file progress logging — exposes the exact file the
  indexer is processing when a stall happens, providing the
  diagnostic evidence needed for a targeted fix.

The proper fix for the phase 06 stall (running the indexer in a
killable worker_thread or child_process.fork) is deferred to
v3.9.5 and tracked in a separate issue. v3.9.4 is a unblock-first
release, not an architectural change.

All v3.9.1 feature benefits (RVF pattern store, unified HNSW,
agent memory branching, KG semantic search) remain enabled.

Local verification: 440/440 init + kernel + optimizer unit tests
pass. Build + typecheck clean. Three real fixture runs confirm
the escape hatch works, per-file logging works, and governance
phase succeeds with asterisk.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 11:17:52 +00:00
Dragan Spiridonov 1da52afb16 chore(release): v3.9.3 — proper init fix with watchdog + lazy bootstrap
Version bump and release docs for the 5-fix init reliability release.

v3.9.3 addresses the remaining root causes the v3.9.2 hotfix did not
cover:

  Fix 1: HnswAdapter dispose() plumbing for test/shutdown paths.
  Fix 2: Lazy TokenOptimizerService — no more bootstrap noise at
         CLI startup. CLI commands that don't use the token optimizer
         no longer open patterns.rvf or memory.db.
  Fix 3: Phase 10 no longer spawns the MCP daemon — the spawn was
         racing the parent for file locks and producing cosmetic
         error spam. Claude Code starts MCP on demand via .mcp.json.
  Fix 4: findMcpEntry() works with esbuild code-split chunks
         (regression of v3.7.10 fix introduced in v3.9.0).
  Fix 5: Phase 06 now has a 30 s per-file and 180 s whole-phase
         watchdog with progress logs every 100 files. KG semantic
         search and vector embeddings remain fully enabled.

All v3.9.1 feature flags (useRVFPatternStore, useUnifiedHnsw,
useAgentMemoryBranching) remain true — this release preserves the
v3.9.1 benefits and fixes the rollout bugs.

User-perspective verification (all passing):
  Empty fresh project: 427 ms exit 0
  200-file fixture: 672 ms with progress logs
  15k-entity heavy fixture: 3120 ms exit 0
  Pre-existing .agentic-qe + aqe --version: 1 line "3.9.3"
  aqe mcp --help: exits 0 with usage text

Targeted test results:
  token-optimizer-service: 17/17
  HNSW (native/legacy/unification): 99/99
  unified-memory: 53/53
  pattern-store / rvf-pattern-store: 65/65
  init/orchestrator + init/phases/database-phase: 32/32

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 09:07:59 +00:00