Skip to content

fix(neural): wire LearningScheduler→force_cycle + RBF restore at init#275

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/neural-training-loop-wire
May 18, 2026
Merged

fix(neural): wire LearningScheduler→force_cycle + RBF restore at init#275
hyperpolymath merged 1 commit into
mainfrom
fix/neural-training-loop-wire

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Root cause (issue #274, epic #273)

Ground-truth audit found the 8 neural organs were wired and consumed but UNFED: Hypatia.LearningScheduler (supervised, 5-min poll) ingested outcomes but never called Hypatia.Neural.Coordinator.force_cycle/0; Coordinator.init/1 never called Persistence.load_all/0 (zero callers). Networks ran on init-defaults forever and pattern_analyzer defensively ignored their untrained output — the root cause of the token-cost/scattergun symptom.

Change

  • learning_scheduler.exrun_learning_cycle now triggers the Neural Coordinator cycle (N6) after ingesting outcomes, so ESN/RBF train on accumulated trajectories every poll (~5s after boot, then every 5 min). Guarded + non-fatal.
  • neural/coordinator.exinit/1 best-effort restores the RBF network from persisted state (the one cleanly-invertible learned network; trust rebuilt per cycle, MoE/ESN/LSM train per cycle, ESN/LSM persistence is summary-only by design). Safe fallback to defaults on any mismatch — never crashes the supervisor.

Validation

Training data was already sufficient (recipe-shell-quote-vars 166-pt series ≥60; registry.json 9 patterns ≥5) — only the trigger was missing. Targeted tests green: neural (28), training_pipeline, cross_repo_learning (11). Compiles cleanly.

Out of scope / follow-ups

  • Pre-existing --warnings-as-errors drift (prover_recommender.ex:123 unused default arg; vcl/client.ex:133 ungrouped handle_call/3) — unrelated, not touched.
  • Lossless ESN/LSM persistence (currently summary-only, so reservoir not restored across restarts; retrains on first cycle) — tracked follow-up.

Refs #274

The 8 neural organs were wired and consumed but UNFED: nothing called
Coordinator.force_cycle/0 and Coordinator.init/1 never called
Persistence.load_all/0 (zero callers). Networks ran on init-defaults
forever and pattern_analyzer defensively ignored their untrained output
-- the root cause of the token-cost/scattergun symptom.

- LearningScheduler.run_learning_cycle now triggers the Neural
  Coordinator cycle (N6) after ingesting outcomes, so ESN/RBF train on
  the accumulated trajectories every poll (~5s after boot, then 5-min).
  Guarded + non-fatal: scheduler survives a down neural layer.
- Coordinator.init now best-effort restores the RBF network from
  persisted state (the one cleanly-invertible learned network; trust is
  rebuilt per cycle, MoE/ESN/LSM train per cycle, ESN/LSM persistence is
  summary-only by design). Safe fallback to defaults on any mismatch.

Training data was already sufficient (recipe-shell-quote-vars 166-pt
series; registry.json 9 patterns) -- only the trigger was missing.
Targeted tests green (neural 28, training_pipeline, cross_repo 11).
Pre-existing --warnings-as-errors drift (prover_recommender:123,
vcl/client:133) is unrelated and out of scope.

Refs #274

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyperpolymath hyperpolymath enabled auto-merge (squash) May 18, 2026 05:12
@hyperpolymath hyperpolymath merged commit f5257ef into main May 18, 2026
21 of 30 checks passed
@hyperpolymath hyperpolymath deleted the fix/neural-training-loop-wire branch May 18, 2026 09:41
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 13 issues detected

Severity Count
🔴 Critical 2
🟠 High 3
🟡 Medium 8

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Issue in quality.yml",
    "type": "missing_workflow",
    "file": "quality.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in mirror.yml",
    "type": "missing_workflow",
    "file": "mirror.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in security-policy.yml",
    "type": "missing_workflow",
    "file": "security-policy.yml",
    "action": "create",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
    "type": "unpinned_action",
    "file": "governance.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "believe_me undermines formal verification (2 occurrences, CWE-704)",
    "type": "believe_me",
    "file": "/home/runner/work/hypatia/hypatia/src/abi/RuleEngine.idr",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "critical"
  },
  {
    "reason": "Nickel file missing SPDX-License-Identifier header (1 occurrences, CWE-1104)",
    "type": "ncl_missing_spdx",
    "file": "/home/runner/work/hypatia/hypatia/configs/config.ncl",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "unsafe block -- requires SAFETY comment (22 occurrences, CWE-676)",
    "type": "unsafe_block",
    "file": "/home/runner/work/hypatia/hypatia/clients/rust/hypatia-client/src/ffi.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "as_ptr exposes raw pointer that may dangle or alias unsafely (10 occurrences, CWE-676)",
    "type": "as_ptr",
    "file": "/home/runner/work/hypatia/hypatia/clients/rust/hypatia-client/src/ffi.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "expect() in hot path (1 occurrences, CWE-754)",
    "type": "expect_in_hot_path",
    "file": "/home/runner/work/hypatia/hypatia/adapters/src/codeberg.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  },
  {
    "reason": "expect() in hot path (1 occurrences, CWE-754)",
    "type": "expect_in_hot_path",
    "file": "/home/runner/work/hypatia/hypatia/adapters/src/radicle.rs",
    "action": "flag",
    "rule_module": "code_safety",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant