Skip to content

fix(evolution): pipeline bugs - dedup, procedures, backup, model/metrics#15

Merged
electronicBlacksmith merged 2 commits intomainfrom
fix/evolution-pipeline-bugs
Apr 8, 2026
Merged

fix(evolution): pipeline bugs - dedup, procedures, backup, model/metrics#15
electronicBlacksmith merged 2 commits intomainfrom
fix/evolution-pipeline-bugs

Conversation

@electronicBlacksmith
Copy link
Copy Markdown
Owner

Summary

Fixes from the config audit (issues 1-4 in first commit, 5-8 in second):

Medium-priority fixes (commit 2)

  • Procedural memory bug (Issue 5): consolidateSessionWithLLM() counted detected procedures but never called storeProcedure(). Added storage loop with correct Procedure shape, seeding success/failure counts from session outcome.
  • Config backup (Issue 7): Added backupConfig() to EvolutionEngine that copies phantom-config/ to data/config-backups/vN after successful evolution, retaining last 5 versions.
  • Model mismatch visibility (Issue 8): Added model_source field to config, log warning when env overrides yaml model, surface model + source in /health and phantom status. Fixed default model to claude-opus-4-6 across config, schema, and init.
  • Evolution observability (Issue 6): Added session_count, sessions_since_consolidation, session_log_depth to health endpoint and status output. Added Evolution Pipeline health check to phantom doctor.

Earlier fixes (commit 1)

  • Dedup appends, route all observations, complete stuck onboarding

Test plan

  • 7 new tests (3 consolidation, 2 engine backup, 2 loader model_source)
  • 1005 tests pass (1 pre-existing channels.yaml init failure)
  • Typecheck clean
  • Biome lint clean
  • Dual code review (Copilot GPT-5.4 + Claude Sonnet 4.6)
  • After deploy: trigger session, verify Qdrant procedure count > 0
  • Verify backup dir: docker exec phantom ls /app/data/config-backups/
  • Verify health endpoint: curl localhost:3100/health | jq .model
  • Verify phantom status shows model and evolution metrics

… onboarding

Fix 1: Use JUDGE_API_KEY for dedicated judge client cost isolation.

Fix 2: applyDelta() now filters duplicate lines on append instead of
blindly appending. Returns null for no-op appends so version is not
bumped. compressUserProfile() added to consolidation with size gate.

Fix 3: buildCritiqueFromObservations() now routes domain_fact, error,
tool_pattern, and success observations to their respective config files
instead of silently dropping them. affected_files from judge output is
preserved through the pipeline with path traversal validation.

Fix 4: markOnboardingComplete() called after evolution version >= 2,
clearing the onboarding prompt that was re-injecting every restart.
- Fix procedural memory bug: consolidateSessionWithLLM() counted
  detected procedures but never stored them. Add storage loop after
  facts extraction.
- Add post-evolution config backup to data/config-backups/vN with
  5-version retention.
- Surface model mismatch: warn when env overrides yaml model, add
  model + model_source to /health endpoint and phantom status.
- Add evolution observability: session_count, sessions_since_consolidation,
  session_log_depth in health/status. Add Evolution Pipeline doctor check.
- Fix default model to claude-opus-4-6 across config, schema, and init.
@electronicBlacksmith electronicBlacksmith merged commit 4b2dcb6 into main Apr 8, 2026
1 check passed
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