mateclaw/mateclaw-server/src/main/java/vip/mate/memory/service
倪程伟 3ac73623ee
fix(memory): bound mate_memory_recall.filename to VARCHAR(256) (#461) (#463)
mate_memory_recall.filename is VARCHAR(256), but the snippet-level recall
tracker assembles the key as `path + '#' + H2-heading-slug`. When the LLM
writes an over-long daily-note heading (the summarize prompt placed no
length cap on the `##` title), the CJK-preserving slug pushes the filename
past the column, and writes fail with Data too long / string too long.

Three layers of defence, root cause + hard caps:

1. prompt (source) — summarize-system.txt now asks for short (≤30 chars)
   `##` titles; details go in the body, not the heading.
2. slug cap (close to source) — MemoryRecallTracker.sanitizeSectionKey
   caps the slug at MAX_SECTION_SLUG=200, leaving path+'#' well under 256.
3. write-side cap (catches every path) — MemoryRecallService.recordRecall
   truncates filename to MAX_FILENAME_LENGTH=255 at the entry point, so
   the select/insert/update branches share one value and the dup-key
   concurrency fallback still matches. Covers trackActiveRetrieval too,
   which bypasses sanitizeSectionKey.

Tests: MemoryRecallFilenameTruncationTest covers both caps (over-long CJK
heading, normal heading untouched, ascii slug, date prefix survives) plus
an end-to-end assertion that the stored value fits VARCHAR(256). Existing
memory-suite unit tests still green.
2026-07-01 18:42:20 +08:00
..
AlwaysOnFileBudget.java feat(memory): bound always-on memory growth with injection budget, consolidation, and file ceilings 2026-06-17 11:04:19 +08:00
DreamMode.java feat(memory): Dream v2 Phase 1 engine — consolidate refactor, focused endpoint, monthly archive 2026-04-20 20:21:03 +08:00
DreamReport.java feat(memory): Dream v2 Phase 1 engine — consolidate refactor, focused endpoint, monthly archive 2026-04-20 20:21:03 +08:00
DreamStatus.java feat(memory): Dream v2 Phase 1 engine — consolidate refactor, focused endpoint, monthly archive 2026-04-20 20:21:03 +08:00
MemoryEmergenceService.java feat(memory): bound always-on memory growth with injection budget, consolidation, and file ceilings 2026-06-17 11:04:19 +08:00
MemoryHilService.java fix(memory): route long-term memory edits to the file being edited (#148) 2026-05-18 11:28:01 +08:00
MemoryRecallService.java fix(memory): bound mate_memory_recall.filename to VARCHAR(256) (#461) (#463) 2026-07-01 18:42:20 +08:00
MemoryRecallTracker.java fix(memory): bound mate_memory_recall.filename to VARCHAR(256) (#461) (#463) 2026-07-01 18:42:20 +08:00
MemorySummarizationGate.java fix(agent): drop brittle output policing, add evidence-grounded long-task safeguards 2026-05-04 11:55:44 +08:00
MemorySummarizationService.java feat(memory): bound always-on memory growth with injection budget, consolidation, and file ceilings 2026-06-17 11:04:19 +08:00
MorningCardService.java docs: update README title and tagline 2026-04-21 09:27:42 +08:00
PromotedEntry.java feat(memory): Dream v2 Phase 1 engine — consolidate refactor, focused endpoint, monthly archive 2026-04-20 20:21:03 +08:00
RejectedEntry.java feat(memory): Dream v2 Phase 1 engine — consolidate refactor, focused endpoint, monthly archive 2026-04-20 20:21:03 +08:00
SoulSummarizerService.java fix(llm): skip unconfigured provider when resolving default model 2026-04-20 21:50:01 +08:00
StructuredMemoryConsolidationService.java feat(memory): bound always-on memory growth with injection budget, consolidation, and file ceilings 2026-06-17 11:04:19 +08:00
StructuredMemoryService.java feat(memory): bound always-on memory growth with injection budget, consolidation, and file ceilings 2026-06-17 11:04:19 +08:00