[PR #384] [CLOSED] Unify canonical task outcome statuses across workflow and memory services #691

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

📋 Pull Request Information

Original PR: https://github.com/AJaySi/ALwrity/pull/384
Author: @AJaySi
Created: 3/6/2026
Status: Closed

Base: mainHead: codex/define-canonical-outcome-model-across-services


📝 Commits (1)

  • 17e09de Unify workflow outcome statuses across frontend and backend

📊 Changes

6 files changed (+83 additions, -26 deletions)

View changed files

📝 backend/api/today_workflow.py (+8 -8)
📝 backend/services/task_memory_service.py (+28 -14)
📝 backend/services/today_workflow_service.py (+8 -2)
📝 backend/test/test_task_memory_service.py (+28 -1)
📝 backend/test/test_today_workflow_service.py (+10 -0)
📝 frontend/src/stores/workflowStore.ts (+1 -1)

📄 Description

Motivation

  • Establish a single canonical outcome model for tasks (e.g. completed, skipped_not_today, dismissed_dont_show, rejected) used consistently across frontend, API, and memory/indexing to drive suppression and indexing behavior.

Description

  • Frontend now posts skipped_not_today when a user skips a server-backed task in frontend/src/stores/workflowStore.ts so the API receives canonical outcomes.
  • Backend status coercion in backend/services/today_workflow_service.py normalizes aliases (skipped -> skipped_not_today, dismissed -> dismissed_dont_show) and returns only the canonical set (including rejected).
  • API serialization and txtai indexing in backend/api/today_workflow.py were updated to preserve canonical outcomes, include a suppression metadata flag for suppressed outcomes, and map legacy DB values to canonical outcomes for responses and indexing.
  • TaskMemoryService.record_task_outcome in backend/services/task_memory_service.py now normalizes legacy statuses before persisting TaskHistory, indexes all meaningful outcomes into txtai with consistent metadata/tags (status, outcome, suppression, pillar_id, task_hash), and SUPPRESSED_STATUSES is aligned to canonical suppressed outcomes (dismissed_dont_show, rejected).
  • Semantic filtering was aligned to the canonical outcomes and _extract_indexed_status was broadened to read status or outcome from txtai results.
  • Added unit-level checks: parameterized filter_redundant_proposals coverage for each outcome path and a unit test validating _coerce_status canonical behavior in backend/test/*.

Testing

  • Ran the backend unit tests with PYTHONPATH=backend pytest -q backend/test/test_task_memory_service.py backend/test/test_today_workflow_service.py, and the test suite passed (10 passed, warnings only).

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/384 **Author:** [@AJaySi](https://github.com/AJaySi) **Created:** 3/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/define-canonical-outcome-model-across-services` --- ### 📝 Commits (1) - [`17e09de`](https://github.com/AJaySi/ALwrity/commit/17e09de9e7bdb46d8d3b20ada28fdd9bd1363b8d) Unify workflow outcome statuses across frontend and backend ### 📊 Changes **6 files changed** (+83 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `backend/api/today_workflow.py` (+8 -8) 📝 `backend/services/task_memory_service.py` (+28 -14) 📝 `backend/services/today_workflow_service.py` (+8 -2) 📝 `backend/test/test_task_memory_service.py` (+28 -1) 📝 `backend/test/test_today_workflow_service.py` (+10 -0) 📝 `frontend/src/stores/workflowStore.ts` (+1 -1) </details> ### 📄 Description ### Motivation - Establish a single canonical outcome model for tasks (e.g. `completed`, `skipped_not_today`, `dismissed_dont_show`, `rejected`) used consistently across frontend, API, and memory/indexing to drive suppression and indexing behavior. ### Description - Frontend now posts `skipped_not_today` when a user skips a server-backed task in `frontend/src/stores/workflowStore.ts` so the API receives canonical outcomes. - Backend status coercion in `backend/services/today_workflow_service.py` normalizes aliases (`skipped` -> `skipped_not_today`, `dismissed` -> `dismissed_dont_show`) and returns only the canonical set (including `rejected`). - API serialization and txtai indexing in `backend/api/today_workflow.py` were updated to preserve canonical outcomes, include a `suppression` metadata flag for suppressed outcomes, and map legacy DB values to canonical outcomes for responses and indexing. - `TaskMemoryService.record_task_outcome` in `backend/services/task_memory_service.py` now normalizes legacy statuses before persisting `TaskHistory`, indexes all meaningful outcomes into txtai with consistent metadata/tags (`status`, `outcome`, `suppression`, `pillar_id`, `task_hash`), and `SUPPRESSED_STATUSES` is aligned to canonical suppressed outcomes (`dismissed_dont_show`, `rejected`). - Semantic filtering was aligned to the canonical outcomes and `_extract_indexed_status` was broadened to read `status` or `outcome` from txtai results. - Added unit-level checks: parameterized `filter_redundant_proposals` coverage for each outcome path and a unit test validating `_coerce_status` canonical behavior in `backend/test/*`. ### Testing - Ran the backend unit tests with `PYTHONPATH=backend pytest -q backend/test/test_task_memory_service.py backend/test/test_today_workflow_service.py`, and the test suite passed (`10 passed`, warnings only). ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69aaf767c45883289f02a648202f740e) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-13 21:04:00 +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#691
No description provided.