Rene Fichtmueller
1d4be52c83
fix: only send HSTS header on HTTPS connections, not HTTP
...
The learning process was failing to communicate with the gateway because:
1. Gateway was sending 'Strict-Transport-Security' header on HTTP responses
2. Node.js fetch respects HSTS and upgrades subsequent requests to HTTPS
3. Gateway only has HTTP listener (localhost:3103), no HTTPS
4. Result: SSL 'packet length too long' error on second request attempt
Solution: Modified registerHSTSMiddleware to only send HSTS header when
the connection is already secure (HTTPS or x-forwarded-proto: https).
HTTP connections will not get the HSTS header, preventing the forced upgrade.
2026-04-26 19:01:41 +02:00
Rene Fichtmueller
4c54a6fa92
refactor: MAGATAMA pipeline code quality audit — all functions <50 lines
...
Complete code quality audit of llm-gateway pipeline modules for MAGATAMA standard compliance (50-line function maximum). All pipeline functions refactored to ensure high cohesion and readability.
Pipeline module compliance (verified):
✅ llm-client.ts — Refactored callOllama() (58→26 lines) via helper extraction
✅ instrumented-llm-client.ts — All functions <50 lines (wrapper layer)
✅ router.ts — Refactored routeByScore() (81→32 lines) via delegation
✅ request-scorer.ts — 870-line file, all functions <50 lines
✅ external-providers.ts — All functions <50 lines (49-line max)
✅ post-validator.ts — All validators <50 lines
Verified:
✓ npm run build (TypeScript, zero errors)
✓ All 6 pipeline modules independently audited
✓ Production-ready for Erik deployment (PM2 ids 19+20, port 3103)
Deployment target: Gitea (192.168.178.196:3000/rene/llm-gateway)
2026-04-25 17:38:11 +02:00
Rene Fichtmueller
2ca77d0aee
feat: Phase 2F — Multi-Agent Integration (ADRs + Client Fallback + Tests)
...
- ADR-0001: Multi-Agent Coworking Architecture with LLM Gateway Orchestrator
- ADR-0002: Tier Assignment Strategy for Model Selection (cost-first escalation)
- ADR-0003: Confidence Gate Thresholds & Learning Cycle Intervals (6h/12h/24h cycles)
- ADR-0004: External Provider Fallback Chain Ordering (Cerebras → Groq → Mistral)
- Enhanced client SDK: Offline Ollama fallback, health checks, exponential backoff retry
- Integration tests: claude-code-integration.test.ts (14 test cases)
- PHASE_2F_DEPLOYMENT.md: Pre-deployment checklist, automated deploy, rollback plan
- Post-deployment verification procedures for health, client fallback, metrics
2026-04-19 21:39:44 +02:00
Rene Fichtmueller
c3ab87b167
feat: add fo-blog-v8 training pipeline (Qwen2.5-14B, SFT+DPO)
...
Full v8 training pipeline for the optical networking blog model:
- train_blog_v8.py: SFT (LoRA r=64, 5 epochs) + DPO (2 epochs) on Qwen2.5-14B-Instruct
Fixed for trl 1.2.x: SFTConfig instead of TrainingArguments, processing_class= instead
of tokenizer=, eval_strategy= instead of deprecated evaluation_strategy=
- consolidate_v8_dataset.py: weighted merge of all data sources (820 effective SFT / 235 DPO)
- crawl_v8_sources.py: APNIC/RIPE Labs/potaroo/Cloudflare crawler with balanced div extraction
- process_v6_blogs.py: converts 101 real v6 TIP blog outputs into SFT + DPO pairs
- label_v7_quality.py: Claude-judged quality labels → v8 quality DPO pairs
- parse_real_posts.py: parses blog.fichtmueller.org Ghost CMS HTML → gold SFT records
- run_v8_pipeline.sh: autopilot (consolidate → SFT → DPO → GGUF → Ollama)
- blog-v8-training.yaml: training config reference
Dataset breakdown: 19 real posts ×3 + 196 v7-gen + 28 v6blogs ×2 + 135 external ×1.5
2026-04-19 11:44:09 +02:00
Rene Fichtmueller
3bb9923255
fix: fine-tuner uses FT_DB_URL/FT_GATEWAY_URL/FT_OLLAMA_URL env vars, not DATABASE_URL
2026-04-02 23:35:27 +02:00
Rene Fichtmueller
d8deecdb32
feat: SSH tunnel launch script for fine-tuner (IONOS blocks port 5432 externally)
2026-04-02 23:28:30 +02:00
Rene Fichtmueller
499e600239
fix: fine-tuner config points to Erik DB + CF tunnel URLs
...
- database_url: Erik PostgreSQL (217.154.82.179:5432) with correct password
- gateway_url: https://llm-gateway.context-x.org (public CF tunnel)
- ollama_url: localhost:11434 (local Mac Studio, fine-tuner runs locally)
2026-04-02 23:23:17 +02:00
Rene Fichtmueller
3a00ff4d33
feat: initial llm-gateway implementation
...
- Complete Fastify gateway with 8-stage pipeline
- Circuit breaker (opossum) per model tier
- Rate limiting per caller
- Ban list validation (EN/DE/auto-detected)
- TIP validator (SFF-8024, part numbers, wavelengths)
- Prometheus metrics
- pg-boss async queue
- PostgreSQL audit log + review queue
- 9 prompt templates (TIP, LinkedIn, ShieldX)
- Learning engine scaffolding
- Auto-learning: ban-list, few-shot, routing, prompt optimizer
2026-04-02 22:48:55 +02:00