feat: consolidate NEURAL as an independently deployable monorepo service

Merged
GL
16d ago
+12035-3

User description

Summary

Moves NEURAL's standalone service source into services/neural/ in the primary GLORIFIER repository, while retaining an independent Python/FastAPI runtime and Cloudflare Worker deployment.

Included

  • Imports 67 source files from GLORIFIER7/GLORIFIER-NEURAL at source commit 9a32356ee4fa7d517e74db936b69312de488ae85.
  • Preserves the Python project, uv.lock, Dockerfile, FastAPI application, provider adapters, tests, database contracts/migrations, and Cloudflare Python Worker package.
  • Adds root-level neural-ci.yml, neural-cloudflare-worker.yml, and neural-database-integration.yml workflows, scoped to NEURAL paths.
  • Extends CodeQL to analyze Python alongside the existing JavaScript/TypeScript code.
  • Adds Dependabot coverage for the Python service.
  • Updates the root README and NEURAL integration architecture to define a single monorepo with separately deployable services.
  • Updates NEURAL workflow regression tests to validate the monorepo-level workflow paths.

Architecture decision

  • One authoritative source repository: GLORIFIER7/GLORIFIER.
  • Two independent runtimes: GLORIFIER Node.js/TypeScript and NEURAL Python/FastAPI.
  • Separate dependency locks, tests, container contexts, deployment workflows, health/readiness and runtime controls.
  • The existing API boundary, bearer-token validation, rate limits, exact-host allowlist and fail-closed controls are retained.

Explicitly not changed

  • No production deployment or Cloudflare configuration changes.
  • No secrets, provider credentials, egress settings or API tokens changed.
  • No database migrations executed.
  • No wallet signing, asset transfers, minting, financial actions or paid actions.
  • The original GLORIFIER7/GLORIFIER-NEURAL repository remains intact and is not archived or deleted.

Cutover blockers

  1. Validate all NEURAL CI, Cloudflare dry-run, CodeQL and disposable PostgreSQL jobs on this PR.
  2. Verify staging health, readiness, invalid-token rejection and a harmless read-only task through GLORIFIER's existing Worker adapter.
  3. Reconcile original NEURAL open PRs #62 and #63; their changes are not part of the source snapshot.
  4. Complete production parity and rollback verification before changing the production source or archiving the old repository.
  5. The import is a content snapshot, not a history-preserving subtree transfer. The source commit is recorded in services/neural/MONOREPO_MIGRATION.md; full commit-history preservation remains a separate cutover task.

This PR intentionally remains draft until the migration checks and review are complete.


Summary by cubic

Consolidates the NEURAL Python/FastAPI service into the GLORIFIER monorepo under services/neural/, keeping it independently deployable while the standalone GLORIFIER-NEURAL repository remains intact. Runtime behavior and security controls are unchanged.

Operational notes

  • Adds root-level CI, Cloudflare Worker, and disposable PostgreSQL workflows for services/neural/; CodeQL now analyzes Python and Dependabot covers pip.
  • NEURAL CI evaluates AI bot reviews against trusted base-SHA or pinned review-policy code outside the service directory; unresolved AI blockers are preserved across head commits and on non-outdated review threads, the Worker build smoke is lint-safe, and validation jobs disable persisted checkout credentials.
  • Rate limits key by client address with aligned Worker rate-limit namespace fixtures and a trusted CI client identity; invalid task-run metadata is classified separately from storage failures, request-size errors return validated JSON, free-form action classes are rejected before audit, and the Supabase audit sink requires a redirect-rejecting transport. Task-run retention is enforced as an exact 720-hour window so it holds across daylight-saving transitions, and percent-encoded credentials in Worker DSNs are decoded before connecting.
  • OpenAI remains the default provider but now requires an explicitly configured model; a governed self-hosted vLLM adapter is wired through explicit runtime consent alongside the optional NVIDIA NIM adapter.
  • vLLM streamed responses are bounded by byte and time limits with lint-clean cleanup paths, readiness cache is keyed on the vLLM runtime configuration, and a bounded Kubernetes deployment template with a guarded single-GPU runbook provisions secrets before worker start and bounds ingress request size and timeouts.
  • The import is a content snapshot (source commit in services/neural/MONOREPO_MIGRATION.md), not a history-preserving transfer.
  • No production deployment, secrets, provider credentials, database migrations, or financial actions are included.
  • Open PRs #62 and #63 in the source repository are not part of the snapshot and must be reconciled before cutover.

CodeAnt-AI Description

Move NEURAL into the monorepo while keeping its deployment independent

What Changed

  • NEURAL is now maintained at services/neural/ with its own Python dependencies, tests, container, and Cloudflare Worker deployment.
  • Task requests require bearer authentication and client-based rate limiting. Risky actions are denied, and inference requires explicit egress, inference, credentials, and model configuration.
  • /ready checks provider and optional database availability without submitting prompts. Optional audit and task-run writes store bounded metadata; failed initial audit writes block execution, while later persistence failures return the completed outcome marked as degraded.
  • Adds Python, Worker packaging, and disposable database checks, plus a PR review check requiring current reviews from both configured AI reviewers and no unresolved explicit blockers.

Impact

✅ Independent NEURAL releases from the monorepo
✅ Unconfigured or risky task execution is blocked
✅ Completed task outcomes are returned when optional persistence fails

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.