feat(reminders): lifecycle-aware source task check#58
Merged
Conversation
Tasks: e032bc49 (urgent) + f00e36ac (high). Before firing a task-backed reminder policy, fetch the source task and classify its lifecycle: - Terminal (completed/closed/done/cancelled/canceled/archived/resolved, or completed_at set) → disable the policy + emit a skipped-result. No message is sent, fired_count does NOT advance. - Pending review (status=pending_review, tags contains pending_review, requirements.pending_review truthy, or requirements.review_owner* set) → reroute to review_owner → creator_fallback, prefix the reason with [pending review]. Do not wake the assignee. - Active → unchanged default (assignee / creator fallback). Adds _task_lifecycle() in alerts.py; reminders.py wires it through _fire_policy and the run loop (skipped results do not advance). Docs: docs/reminder-lifecycle.md with the full state table, routing priority, envelope changes, and backward-compat notes. Tests: 3 new — terminal skip+disable, pending_review → review_owner, pending_review fallback → creator. 220 total pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the reminder-runner gap surfaced by tasks
e032bc49(urgent) andf00e36ac(high).completed/closed/done/cancelled/archived/resolved(orcompleted_atis set), disable the policy and skip the send. No more stale reminder floods after a task closes.requirements.pending_review, orrequirements.review_owner*), reroute the alert toreview_owner→creator_fallback, prefixed with[pending review]. Stops pinging the worker about a task that isn't theirs to move.fired_countor reschedulenext_fire_at.Files
ax_cli/commands/alerts.py— new_task_lifecycle()helper +_TERMINAL_TASK_STATUSESconstant.ax_cli/commands/reminders.py—_fire_policyuses the helper; run loop short-circuits onskipped.docs/reminder-lifecycle.md— full contract doc with state table, routing priority, envelope changes, backward-compat notes, test coverage.tests/test_reminders_commands.py— 3 new tests (terminal skip+disable, pending_review → review_owner, pending_review fallback → creator). 220 total pass.Test plan
pytest tests/test_reminders_commands.py— 8 pass (5 existing + 3 new)pytest -qfull suite — 220 passruff format --check+ruff checkclean/home/ax-agent/shared/worktrees/ax-cli-alerts-dogfoodto pick up the new logic (separate follow-up under task 3948361d scheduler hygiene)🤖 Generated with Claude Code