[PR #357] [MERGED] Add pillar coverage guardrails to today workflow generation #327

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

📋 Pull Request Information

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

Base: mainHead: codex/enhance-agent-plan-for-pillar-coverage


📝 Commits (1)

  • e7935af Add pillar coverage guardrails for today workflow plans

📊 Changes

2 files changed (+229 additions, -4 deletions)

View changed files

📝 backend/services/today_workflow_service.py (+124 -4)
backend/tests/test_today_workflow_pillar_coverage.py (+105 -0)

📄 Description

Motivation

  • Ensure the Today workflow always contains at least one actionable task per lifecycle pillar after agent committee dedupe so the user sees a balanced, actionable daily plan.
  • Preserve agent/committee-generated tasks as the authoritative items and only append backfills for pillars the committee did not cover.
  • Support configurable guardrails to allow disabling or loosening coverage enforcement via runtime workflow_config.

Description

  • Added coverage guardrail helpers in backend/services/today_workflow_service.py: _is_coverage_guardrail_enabled, _sanitize_task, _build_single_task_for_missing_pillar, and _ensure_pillar_coverage to normalize tasks, check config flags, attempt LLM backfills for missing pillars, and fall back to controlled tasks when LLM generation fails.
  • Integrated the coverage step into generate_agent_enhanced_plan after committee dedupe (preserving committee tasks) and after the LLM/fallback branch so the final output consistently covers all PILLAR_IDS when guardrails are enabled.
  • Made onboarding import lazy (moved import of OnboardingDataIntegrationService into build_grounding_context) to avoid heavy import-time side effects during tests.
  • Added tests at backend/tests/test_today_workflow_pillar_coverage.py validating full-committee coverage, partial-committee backfill behavior, and the full fallback path (committee empty + LLM failure) while ensuring agent tasks are preserved.

Testing

  • Ran PYTHONPATH=/workspace/ALwrity/backend pytest -q backend/tests/test_today_workflow_pillar_coverage.py and all tests passed (3 passed).
  • During development an initial pytest run failed due to an import-time spaCy model dependency, which was resolved by deferring the onboarding import into function scope and re-running tests.
  • Final automated test run after fixes succeeded with 3 passed (no failing tests remain for the added test file).

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/357 **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/enhance-agent-plan-for-pillar-coverage` --- ### 📝 Commits (1) - [`e7935af`](https://github.com/AJaySi/ALwrity/commit/e7935af42a2ff3fbb49042b1820691b6e56fb1a1) Add pillar coverage guardrails for today workflow plans ### 📊 Changes **2 files changed** (+229 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `backend/services/today_workflow_service.py` (+124 -4) ➕ `backend/tests/test_today_workflow_pillar_coverage.py` (+105 -0) </details> ### 📄 Description ### Motivation - Ensure the Today workflow always contains at least one actionable task per lifecycle pillar after agent committee dedupe so the user sees a balanced, actionable daily plan. - Preserve agent/committee-generated tasks as the authoritative items and only append backfills for pillars the committee did not cover. - Support configurable guardrails to allow disabling or loosening coverage enforcement via runtime `workflow_config`. ### Description - Added coverage guardrail helpers in `backend/services/today_workflow_service.py`: ` _is_coverage_guardrail_enabled`, ` _sanitize_task`, ` _build_single_task_for_missing_pillar`, and ` _ensure_pillar_coverage` to normalize tasks, check config flags, attempt LLM backfills for missing pillars, and fall back to controlled tasks when LLM generation fails. - Integrated the coverage step into `generate_agent_enhanced_plan` after committee dedupe (preserving committee tasks) and after the LLM/fallback branch so the final output consistently covers all `PILLAR_IDS` when guardrails are enabled. - Made onboarding import lazy (moved import of `OnboardingDataIntegrationService` into `build_grounding_context`) to avoid heavy import-time side effects during tests. - Added tests at `backend/tests/test_today_workflow_pillar_coverage.py` validating full-committee coverage, partial-committee backfill behavior, and the full fallback path (committee empty + LLM failure) while ensuring agent tasks are preserved. ### Testing - Ran `PYTHONPATH=/workspace/ALwrity/backend pytest -q backend/tests/test_today_workflow_pillar_coverage.py` and all tests passed (`3 passed`). - During development an initial `pytest` run failed due to an import-time spaCy model dependency, which was resolved by deferring the onboarding import into function scope and re-running tests. - Final automated test run after fixes succeeded with `3 passed` (no failing tests remain for the added test file). ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69a4618c127883288f382ae58523654c) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 23:35:09 +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#327
No description provided.