[PR #356] [MERGED] Enable Phase‑3 task‑memory filtering and implement semantic suppression in TaskMemoryService #658

Closed
opened 2026-03-13 21:02:23 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AJaySi/ALwrity/pull/356
Author: @AJaySi
Created: 3/1/2026
Status: Merged
Merged: 3/1/2026
Merged by: @AJaySi

Base: mainHead: codex/enable-phase-3-call-and-fix-async-usage


📝 Commits (1)

  • e2718e3 Enable phase-3 task memory filtering and add coverage

📊 Changes

3 files changed (+147 additions, -14 deletions)

View changed files

📝 backend/services/task_memory_service.py (+45 -12)
📝 backend/services/today_workflow_service.py (+1 -2)
backend/test/test_task_memory_service.py (+101 -0)

📄 Description

Motivation

  • Avoid proposing tasks that are exact duplicates or semantically similar to tasks the user already dismissed or rejected by applying a memory-based suppression step after agent dedupe.

Description

  • Enable the Phase 3 call in generate_agent_enhanced_plan to pass deduped proposals through TaskMemoryService.filter_redundant_proposals for memory-based filtering.
  • Fix async usage by awaiting the txtai search (await self.intelligence.search(...)) and add clear constants EXACT_DUPLICATE_LOOKBACK_DAYS, SEMANTIC_SUPPRESSION_SCORE_THRESHOLD, and SUPPRESSED_STATUSES for tuning.
  • Replace the placeholder semantic branch with real suppression logic that first checks indexed metadata (via _extract_indexed_status) and then falls back to a TaskHistory lookup by vector_id when needed, while preserving exact-hash filtering.
  • Add a helper _extract_indexed_status to extract status from txtai search result metadata and use it to suppress proposals when status is dismissed or rejected.

Testing

  • Added async pytest coverage in backend/test/test_task_memory_service.py covering exact-hash suppression, semantic suppression via vector_id lookup, and non‑duplicate pass-through.
  • Ran PYTHONPATH=backend pytest -q backend/test/test_task_memory_service.py and all tests passed (3 passed).

Codex Task


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AJaySi/ALwrity/pull/356 **Author:** [@AJaySi](https://github.com/AJaySi) **Created:** 3/1/2026 **Status:** ✅ Merged **Merged:** 3/1/2026 **Merged by:** [@AJaySi](https://github.com/AJaySi) **Base:** `main` ← **Head:** `codex/enable-phase-3-call-and-fix-async-usage` --- ### 📝 Commits (1) - [`e2718e3`](https://github.com/AJaySi/ALwrity/commit/e2718e3b79e0fd3b4e8894b95c58b68d789dc733) Enable phase-3 task memory filtering and add coverage ### 📊 Changes **3 files changed** (+147 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `backend/services/task_memory_service.py` (+45 -12) 📝 `backend/services/today_workflow_service.py` (+1 -2) ➕ `backend/test/test_task_memory_service.py` (+101 -0) </details> ### 📄 Description ### Motivation - Avoid proposing tasks that are exact duplicates or semantically similar to tasks the user already dismissed or rejected by applying a memory-based suppression step after agent dedupe. ### Description - Enable the Phase 3 call in `generate_agent_enhanced_plan` to pass deduped proposals through `TaskMemoryService.filter_redundant_proposals` for memory-based filtering. - Fix async usage by awaiting the txtai search (`await self.intelligence.search(...)`) and add clear constants `EXACT_DUPLICATE_LOOKBACK_DAYS`, `SEMANTIC_SUPPRESSION_SCORE_THRESHOLD`, and `SUPPRESSED_STATUSES` for tuning. - Replace the placeholder semantic branch with real suppression logic that first checks indexed metadata (via `_extract_indexed_status`) and then falls back to a `TaskHistory` lookup by `vector_id` when needed, while preserving exact-hash filtering. - Add a helper `_extract_indexed_status` to extract status from txtai search result metadata and use it to suppress proposals when status is `dismissed` or `rejected`. ### Testing - Added async pytest coverage in `backend/test/test_task_memory_service.py` covering exact-hash suppression, semantic suppression via `vector_id` lookup, and non‑duplicate pass-through. - Ran `PYTHONPATH=backend pytest -q backend/test/test_task_memory_service.py` and all tests passed (`3 passed`). ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69a46178c93c8328a49a6f484227dcbf) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-13 21:02:23 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ALwrity#658
No description provided.