AI Initiative logoAI Initiative
Reading room / Manthan

Proof Artefact — Substrate hardening + A2 materialised-pool rollout to /diversity & /feed

A dated rollout/proof record for substrate hardening and materialised diversity pools; preserves its exact scope rather than treating it as present full-system evidence.

Historical audit / evidence record
This is the retained source text, not a new validation of its claims. Numerical results and comparative claims require the accompanying source review before public reuse.

Read the connected case study or article →

automated session (Claude), operator-directed (kulbir) · 2026-06-28

Provenance, authorship and editorial notes

Proof Artefact — Substrate hardening + A2 materialised-pool rollout to /diversity & /feed

Id

manthan-docs-proofs-substrate-hardening-a2-diversity-pool-2026-06-28

Project

Manthan

Source path

manthan/docs/proofs/SUBSTRATE-HARDENING-A2-DIVERSITY-POOL-2026-06-28.md

Source sha256

953aa27d9f0a0ba48ad2f5e02582110b4a01f919770d129ca20b1298fe9a8319

Local copy sha256

953aa27d9f0a0ba48ad2f5e02582110b4a01f919770d129ca20b1298fe9a8319

Repo head

3a94084024a3434cef331fecac91c2c3b43f0313

Date

2026-06-28

Date basis

Explicit document metadata

Author

automated session (Claude), operator-directed (kulbir)

Author basis

Author

Last source commit

d9d75e48071d0c0121f99ff325360fea7fc2adfb

Last source commit date

2026-06-28T11:01:27+01:00

Document status

Historical audit / evidence record

Summary

A dated rollout/proof record for substrate hardening and materialised diversity pools; preserves its exact scope rather than treating it as present full-system evidence.

Topics
  • Adversarial review and case studies
  • 0. TL;DR for the auditor
  • 1. Faults, root causes (file:line), and the fix
  • F1 — Substrate process killed under concurrent `/lineage/graph?include_embeddings=true`
Theme

Adversarial review and case studies

Priority

reference

Related ids
  • manthan-herald-protocol-audits-manthan-cohort1-postmortem
Evidence concerns
  • Recovered source text is preserved verbatim. Assertions, comparisons, commands and results belong to its original context; they were not re-executed or externally re-verified during this corpus review.
  • Historical record: current deployment, task completion and test status must not be inferred from this date-bound document.
Word count

1320

Bytes

10285

Source relative

docs/proofs/SUBSTRATE-HARDENING-A2-DIVERSITY-POOL-2026-06-28.md

Remote mirror

manthan/docs/proofs/SUBSTRATE-HARDENING-A2-DIVERSITY-POOL-2026-06-28.md

Full text preserved

True

Proof Artefact — Substrate hardening + A2 materialised-pool rollout to /diversity & /feed

Date: 2026-06-28
Branch: fix/substrate-hardening-a2-diversity-pool (base: feat/manthan-own-memory)
Scope: services/substrate, services/api, docker-compose.yml
Author: automated session (Claude), operator-directed (kulbir)
Intended reviewer: independent agent (epic-compliance style — re-verify against live ground truth, do not trust this doc's claims; every claim below has a runnable command).

Delivery-honesty note (operator binding): this artefact reports what is live and verified, what is an intentional tradeoff, and what is an open follow-up. Nothing here is "merged but inert" — all fixes are default-on and exercised by the running stack.

0. TL;DR for the auditor

The Manthan viewer (:27000) graph panels were dark and two services were crash-looping. Three independent faults, all now fixed and verified on the live stack (api restarts = 0, substrate restarts = 0 across repeated full sweeps; api 58 + substrate 12 unit tests green):

1. Substrate OOM-kill under concurrent embeddings graphs → bounded-concurrency self-defence.
2. DB two migrations behind its own code → the A2 materialiser + non-blank-content constraint were inert; applied them; proved the empty-content workflow gap is closed at API + DB.
3. api OOM-kill because the A2 materialised-pool perf-fix was wired only to /elites, not /diversity//feed → extended the pool to /diversity; made /feed cached + off-loop.


1. Faults, root causes (file:line), and the fix

F1 — Substrate process killed under concurrent /lineage/graph?include_embeddings=true

F2 — Empty-content artefacts + the A2 fix being inert (the migration-lag root cause)

F3 — api OOM on /diversity (and /elites fallback): A2 pool only wired to /elites


2. Reproduction & evidence (auditor: run these against the live stack)

F1 — substrate no longer killable by concurrency

# BEFORE the fix this drove mem to 510/512 MiB and incremented RestartCount.
docker inspect manthan-substrate-1 --format 'restarts_before={{.RestartCount}}'
for i in $(seq 1 12); do curl -s -m30 -o /dev/null \
  "local-service/lineage/graph?limit_nodes=1000&include_embeddings=true" & done; wait
docker inspect manthan-substrate-1 --format 'restarts_after={{.RestartCount}} oom={{.State.OOMKilled}}'

Observed AFTER fix: peak ~179 MiB, RestartCount unchanged, all 12 → HTTP 200 (serialised 2-at-a-time by the semaphore).

F2 — empty-content rejected at both API and DB

curl -s -m8 -X POST -H 'Content-Type: application/json' \
  -d '{"kind":"idea","content_text":"   "}' local-service/artefacts        # → 422
docker exec manthan-postgres-1 psql -U manthan -d manthan -c \
  "insert into artefact (id,kind,content_text,created_at) values (gen_random_uuid(),'idea','   ',now());"  # → CHECK violation
docker exec manthan-postgres-1 psql -U manthan -d manthan -tA -c \
  "select count(*) from artefact where length(btrim(coalesce(content_text,'')))=0;"  # → 0
docker exec manthan-postgres-1 psql -U manthan -d manthan -tA -c "select version_num from alembic_version;"  # → 0003_elite_candidate

F3 — api stable; /diversity & /elites materialised; /feed cached & non-blocking

docker inspect manthan-api-1 --format 'api_restarts_before={{.RestartCount}}'
base=local-service/proxy/api
for p in /artefacts/recent /agents /opportunities/current /prototypes/list /elites \
         /diversity /signal/feed /patina/leaderboard /ideas/search /feed; do
  printf '%-22s ' "$p"; curl -s -m20 -o /dev/null -w '[%{http_code} %{time_total}s]\n' "$base$p"; done
# stress: 4x heavy sweep
for r in 1 2 3 4; do for p in /elites /diversity /feed /signal/feed; do curl -s -m15 -o /dev/null "$base$p"; done; done
docker inspect manthan-api-1 --format 'api_restarts_after={{.RestartCount}}'
# /feed event-loop not blocked: healthz must stay ~ms under concurrent /feed
( for i in $(seq 1 8); do curl -s -m20 -o /dev/null local-service/feed?limit=5 & done
  curl -s -m5 -o /dev/null -w 'healthz_under_load=%{time_total}s\n' local-service/healthz; wait )

Observed AFTER fix: all 10 endpoints HTTP 200; api & substrate RestartCount = 0 across 4 sweeps; /diversity & /elites report source=materialised; /feed 2nd call ~0.001 s (cache hit); healthz_under_load ≈ 0.002 s.


3. Live-system mutations performed (full disclosure)

4. Tests

5. Residual risk & follow-ups (honest — not blocking, flagged for swarm review)

1. /diversity semantics: coverage (occupied/empty cells) is exact from the pool, but occupancy counts are pool-capped at K=8/cell (flagged in the response note). Novelty bands come from the materialiser's HNSW path (KNN_K=6) vs. the old api pure-Python k=5 — same concept, slightly different values. Needs A2 swarm review before this defines product behaviour.
2. Materialiser lag: /elites + /diversity reflect the pool, which trails live writes by up to one 120 s pass. Acceptable for a viewer.
3. Unembedded corpus: 3,953 / 7,684 artefacts have no embedding (band −1, excluded from the grid) → coverage reads low (4/24). This is a real data signal, not a bug; maestro-bridge-ingested artefacts aren't embedded. Follow-up: decide on an embedding-backfill job (cost: ~3.9k gateway calls) — out of scope here (ops/cost decision).
4. /feed//signal/feed still load the full (embedding-free) graph (~62 MiB, ~2-3 s) — cached now, no OOM; a pool-backed rewrite is a possible later optimisation.

6. Auditor checklist

Continue exploring