> ## Continuous-process anchor
>
> This spec describes an instance of one of the retired-script themes
> documented in docs/design/retired_scripts_patterns.md. Before
> implementing, read:
>
> 1. The "Design principles for continuous processes" section of that
> atlas — every principle is load-bearing. In particular:
> - LLMs for semantic judgment; rules for syntactic validation.
> - Gap-predicate driven, not calendar-driven.
> - Idempotent + version-stamped + observable.
> - No hardcoded entity lists, keyword lists, or canonical-name tables.
> - Three surfaces: FastAPI + orchestra + MCP.
> - Progressive improvement via outcome-feedback loop.
> 2. The theme entry in the atlas matching this task's capability:
> A3 (pick the closest from Atlas A1–A7, Agora AG1–AG5,
> Exchange EX1–EX4, Forge F1–F2, Senate S1–S8, Cross-cutting X1–X2).
> 3. If the theme is not yet rebuilt as a continuous process, follow
> docs/planning/specs/rebuild_theme_template_spec.md to scaffold it
> BEFORE doing the per-instance work.
>
> **Specific scripts named below in this spec are retired and must not
> be rebuilt as one-offs.** Implement (or extend) the corresponding
> continuous process instead.
Quest: Wiki Priority: P82 Status: open
CI: Add mermaid diagrams to next 5 entity pages
This task is part of the Wiki quest (Atlas layer). It contributes to the broader goal of building out SciDEX's atlas capabilities.
orchestra task get-next.add_mermaid_wiki_entities.py as the base path.add_mermaid_wiki_entities.py to use wiki_pages as the write target (current source of truth; wiki_entities is now a view).knowledge_edges via wiki_pages.kg_node_id) and scoped default processing to the next 5 candidates.validate_mermaid) before insert and compliant edge-label quoting.timeout 300 python3 add_mermaid_wiki_entities.py --limit 5.diseases-gss, diseases-overview, diseases-rankings, proteins-ip3r1, proteins-tab2-protein.curl http://localhost/ -> 301curl http://localhost:8000/api/status -> valid JSON/wiki/... pages returned 200.
timeout 300 python3 link_checker.py -> 0 broken (transient status=0 outage auto-suppressed by checker logic).add_mermaid_wiki_entities.py --limit 5 against postgresql://scidex.cell-types-corticobulbar-tract-fibers, cell-types-corticospinal-tract-fibers-2, cell-types-gigantocellular-nucleus-expanded-v2, cell-types-gonadotrophs, cell-types-primary-motor-cortex-layer-5-betz-cells.als node). All 5 pages verified at HTTP 200.add_mermaid_wiki_entities.py --limit 5 20 times (100 pages total).add_mermaid_wiki_entities.py --limit 5 six more times (30 pages total).add_mermaid_wiki_entities.py --limit 5 25 more times (125 pages total in this session block).add_mermaid_wiki_entities.py --limit 5 against postgresql://scidex.genes-wnt11, ideas-payload-iron-chelation-neurodegeneration, mechanisms-iron-accumulation-psp, mechanisms-iron-metabolism-neurodegeneration, proteins-dynactin.add_mermaid_wiki_entities.py --limit 5 ~100 more times (500+ pages total in this session block).add_mermaid_wiki_entities.py --limit 5 against postgresql://scidex.companies-cytochrome-therapeutics, companies-denali-therapeutics, companies-encoded-therapeutics, companies-finch-therapeutics (1 page skipped - insufficient data).therapeutics node). All 4 updated pages verified at HTTP 200.add_mermaid_wiki_entities.py --limit 5 against postgresql://scidex.genes-egln1, genes-fh, genes-gadd34, genes-gsn (1 page skipped - proteins-pgc-1a-protein insufficient data).add_mermaid_wiki_entities.py --limit 5 against postgresql://scidex.genes-fan1, genes-grm8, genes-hdac10, genes-nct (1 page skipped - proteins-pgc-1a-protein insufficient data).add_mermaid_wiki_entities.py --limit 5 61 times (183 pages total).add_mermaid_wiki_entities.py --limit 5 against postgresql://scidex.proteins-grid1-protein, proteins-grid2-protein, proteins-grik1-protein, proteins-grik2, proteins-grik2-protein.add_mermaid_wiki_entities.py --limit 5 against postgresql://scidex.proteins-iduronate-sulfatase, proteins-ifi16-protein, proteins-ifih1-protein, proteins-ifnar2-protein, proteins-ifrd1-protein.fix_wiki_mermaid_diagrams.py on wiki_pages: fixed 56 additional pages.add_mermaid_wiki_entities.py --limit 5 100 times (500+ pages added).add_mermaid_wiki_entities.py --limit 200 in large batches: processed all remaining pages with kg_node_id.add_mermaid_no_kg.py — new script for pages without kg_node_id; builds flowcharts from markdown headings/bold terms.add_mermaid_no_kg.py in batches (500, 500, 500, ~62 pages); manually added diagram to final page (datasets-mouse-brain-atlas).<br["text""] pattern).fix_wiki_mermaid_diagrams.py — regex-based fixer.<br["text""] → <br/>text" pattern — 171 pages updated (using fix_br_fast.py with 300s SQLite busy timeout).add_wiki_infoboxes.py, add_wiki_infoboxes2.py, add_wiki_infoboxes3.py, apply_infoboxes_fast.py, fix_br_brackets.py._market_consumer_loop thread held WAL write lock indefinitely after uncommitted writes.finally block in _market_consumer_loop to commit thread-local connection at end of each cycle.orchestra sync push, restarted scidex-api.fix_entity_mermaid.py: fixed 144 invalid wiki_entities diagrams (regex pass).add_entity_mermaid_template.py 5972: added type-specific template diagrams to all 5,972 wiki_entities lacking any diagram (proteins, mechanisms, therapeutics, diseases, genes, cell_types).entity["<b["entity</b>""] (double brackets corrupting the <b> tag).["<b[" → ["<b>, </b>""] → </b>"].node[["Unquoted label"]] (subroutine shape) → node["Unquoted label"].node[[Unquoted label]] (missing quotes) → node["Unquoted label"].validate_mermaid.py: wiki_entities 13,639/13,639 valid (0 issues); hypotheses had 5 categories with unicode Greek chars (α, β, γ, κ).validate_mermaid.py: wiki_entities 13,639/13,639 valid (0 issues); hypotheses 301/320 valid, 19 non-mermaid (markdown/ASCII), 0 issues.validate_mermaid.py: wiki_entities 13,639/13,639 valid (0 issues); hypotheses 301 valid, 19 non-mermaid, 0 issues.save_wiki_page helper from db_writes.py.add_mermaid_to_wiki_pages.py --limit 5: updated 5 pages (ai-tool-origene, ai-tool-gyde, ai-tool-elucidata-polly, ai-tool-octotools, ai-tool-molecule-protocol).add_wiki_mermaid.py --limit 5 (wiki_pages target, not wiki_entities).add_mermaid_wiki_entities.py --limit 5 against postgresql://scidex.add_wiki_mermaid.py: unquoted edge labels (-->|rel| → -->|"rel"|) and added --limit arg.add_wiki_mermaid.py --limit 5: updated 5 pages ranked by KG connectivity.cell-types-upper-motor-neurons-als (9930 KG edges)cell-types-spinal-cord-neurons-als (9930 KG edges)cell-types-motor-cortex-als (9930 KG edges)cell-types-spinal-trigeminal-nucleus-neurodegeneration (6771 KG edges)cell-types-vestibular-hair-cells-neurodegeneration (6771 KG edges)
validate_mermaid (0 issues). All 5 pages verified at HTTP 200.add_wiki_mermaid.py --limit 5 against postgresql://scidex.cell-types-spinal-motor-neurons-neurodegenerationcell-types-cerebral-endothelial-cells-neurodegenerationcell-types-claustrum-neurons-in-neurodegenerationcell-types-globus-pallidus-externus-gaba-neurodegenerationcell-types-mesenchymal-stem-cells-neurodegeneration
mermaid/add_mermaid_to_5_pages.py against postgresql://scidex.ai-tool-alibaba-tongyi-qianwen-bio, ai-tools-inference-bio, ai-tool-biorxiv-literature-agent, ai-tool-openai-codex-biology, ai-tool-bioframe (all with 3484 KG edges via neurodegeneration target_id).mermaid/add_mermaid_to_5_pages.py against postgresql://scidex.ai-tool-nucleus-dnastack, cell-types-ventral-pallidum-neurons-neurodegeneration, cell-types-raphe-magnus-pain-modulation-neurodegeneration, cell-types-claustrum-neurons-neurodegeneration, cell-types-red-nucleus-neurons-in-neurodegeneration.mermaid/add_mermaid_to_5_pages.py against postgresql://scidex.cell-types-nicotinic-alpha7-receptor-neurons, cell-types-lateral-habenula-dopamine-neurons, cell-types-trh-neurons, cell-types-sublaterodorsal-nucleus-neurons, cell-types-nitrergic-neurons (all with 1948 KG edges via nicotinic+alpha7+receptor / lateral+habenula / trh / sublaterodorsal / nitrergic target_id).mermaid/add_mermaid_to_5_pages.py against postgresql://scidex.cell-types-anti-nmda-receptor-encephalitis-neurons, cell-types-wdr-neurons, cell-types-perirhinal-cortex-layer-2-3-neurons, cell-types-xcr1-neurons, cell-types-nesfatin-neurons (all with 1948 KG edges via anti+nmda+receptor+encephalitis / wdr / perirhinal+cortex / xcr1 / nesfatin target_id).origin remote: https://x-access-token:[REDACTED]@github.com/SciDEX-AI/SciDEX.git/ — Authentication failed). SSH remote (direct-origin) also unavailable (Host key verification failed).mermaid/add_mermaid_to_5_pages.py against postgresql://scidex.cell-types-ventrolateral-preoptic-area-vlpo-neuronscell-types-gustatory-taste-receptor-neuronscell-types-amygdala-neuronscell-types-olivary-pretectal-neuronscell-types-dorsal-tegmental-nucleus-neurons
mermaid/add_mermaid_to_5_pages.py against postgresql://scidex.cell-types-tail-ventral-tegmental-area-neuronscell-types-pv-neuronscell-types-parasubicular-neuronscell-types-cvlm-neuronscell-types-spinal-lamina-iii-neurons
mermaid/add_mermaid_to_5_pages.py against postgresql://scidex.cell-types-anti-gabab-receptor-encephalitis-neuronscell-types-lateral-spinothalamic-neuronscell-types-homer-neuronscell-types-lateral-hypothalamus-neuronscell-types-muscarinic-m4-receptor-neurons
mermaid/add_mermaid_to_5_pages.py against postgresql://scidex.cell-types-transentorhinal-cortex-neuronscell-types-lamina-i-neuronscell-types-cortical-layer-6b-neuronscell-types-centromedian-nucleus-neuronscell-types-neuromedin-s-neurons
mermaid/add_mermaid_to_5_pages.py against postgresql://scidex.cell-types-argyrophilic-grain-disease-neuronscell-types-interpeduncular-nucleus-cholinergic-neuronscell-types-estrogen-receptor-alpha-neuronscell-types-brainstem-dorsal-raphe-serotonin-neuronscell-types-spinothalamic-tract-neurons
mermaid/add_mermaid_top5_entities.py (new script targeting wiki_entities.mermaid_diagram).ds-83b31ef18d49 (dataset, 1588 edges) - 2583 chars mermaidTemporal Lobe (brain_region, 293 edges) - 2531 charsPyramidal (cell_type, 221 edges) - 2274 charsdendritic cells (cell_type, 202 edges) - 2469 charsNeural Progenitor (cell_type, 119 edges) - 1696 chars
mermaid/add_mermaid_top5_entities.py and pushed branch.scidex/core/llm.py's _complete_via_api() passes no max_retries or timeout to litellm.completion(), causing API calls to fail immediately on transient errors instead of retrying. This triggered 24 consecutive rate_limit_retries_exhausted:glm abandons.max_retries=3 and timeout=120 to the kwargs dict in _complete_via_api() — same fix as task:160ecbc6 but was never merged to main.python3 mermaid/add_mermaid_to_5_pages.py ran successfully, updated 5 pages (cell-types-aging-oligodendrocytes, cell-types-aging-microglia, cell-types-aging-associated-astrocytes, mechanisms-aging-vs-neurodegeneration-comparison, mechanisms-aging-to-ad-switch-trigger). All confirmed in DB. wiki_pages mermaid coverage: 1,724/17,389 (9.9%).[Forge] Add max_retries=3 and timeout=120 to LiteLLM API calls — fix rate_limit retries exhausted [task:46b72376-35f1-4f19-a7f3-ca2ba9a7d08b]orchestra reset unavailable (orchestra.db path issue), original task c4a9a7ae-4d96 will auto-retry on next schedule run with this fix active.{
"requirements": {
"analysis": 6,
"reasoning": 6,
"safety": 6
},
"auto_tagged_at": "2026-04-03T22:29:52.501554",
"completion_shas": [
"cfeb1a0252230f8cae90cdda8b89215820111667"
],
"completion_shas_checked_at": "2026-04-12T23:47:33.814842+00:00",
"completion_shas_missing": [
"d9a3ca85b20c0846c33c9e4dde9619fb07dadfb7",
"bbd022af2698294940761c7d324ddc7ec17beec8",
"21d7111d457871d778b90f1bb103928762c077d6",
"a220d10093386a6574dfbd8b50c1ac79201ea994",
"fc05f82b014ca96a74e79460c907b93746e74538",
"62f547b283c60785670448fab29dc4d7206af82b",
"71629e632cffaea38d93f2753f29685e4f41c4d6",
"a38b54251aa8f35064786dfb78437f9ed2e8030f",
"f8af773285966361ce357b22bc7c71275c0785f4",
"9fd43ade52d06a32e60c23cdca126fdf293954f3",
"930542272d420cebc21f015ef9fffdaa493bace8",
"ebdbc37d296330b79a063aba9279c730de4e55a8",
"32171061ab56f13b05be97ea06f4bc0b6b53e20e",
"1e76ba96fcc564d351376a256494c2b350a4e28d",
"62870ba733f2e182cc9a1971d9f18b0e8fc6b9ff",
"d29f4e7efa4bc0cc58d0aa73e0a5029222bc8893",
"9dc4bb297567ddd34860157c5412df54271f47a9",
"311c673f505228dab7b61a3fbab0620d7ac5f26b",
"fa38554625c3d1b1cf69edceed1ce6d90ca89df4",
"d835f319f51ec3ffd4541d4c48a4221841b27f27"
],
"_stall_skip_providers": [
"glm"
],
"_watchdog_repair_task_id": "8bca8689-05b4-4d70-80b1-4dbb9727cff9",
"_watchdog_repair_created_at": "2026-04-22T20:06:44.920753+00:00"
}