fix(memory): unify Outcome enum and add ABANDONED support

- Add ABANDONED value to core Outcome enum in types.py
- Replace duplicate OutcomeType class in mcp/tools.py with alias to Outcome
- Simplify mcp/service.py to use outcome directly (no more silent mapping)
- Add migration 0006 to extend PostgreSQL episode_outcome enum
- Add missing constraints to migration 0005 (ix_facts_unique_triple_global)

This fixes the semantic issue where ABANDONED outcomes were silently
converted to FAILURE, losing information about task abandonment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-06 01:46:48 +01:00
parent 3edce9cd26
commit 192237e69b
5 changed files with 75 additions and 18 deletions

View File

@@ -12,6 +12,9 @@ from typing import Any
from pydantic import BaseModel, Field
# OutcomeType alias - uses core Outcome enum from types module for consistency
from app.services.memory.types import Outcome as OutcomeType
class MemoryType(str, Enum):
"""Types of memory for storage operations."""
@@ -32,15 +35,6 @@ class AnalysisType(str, Enum):
LEARNING_PROGRESS = "learning_progress"
class OutcomeType(str, Enum):
"""Outcome types for record_outcome tool."""
SUCCESS = "success"
PARTIAL = "partial"
FAILURE = "failure"
ABANDONED = "abandoned"
# ============================================================================
# Tool Argument Schemas (Pydantic models for validation)
# ============================================================================