Skip to content

feat(alerts): embed task snapshot in reminder alert metadata#54

Merged
madtank merged 1 commit intofeat/alerts-cli-mvpfrom
orion/task-e55be7c8-reminder-task-snapshot
Apr 16, 2026
Merged

feat(alerts): embed task snapshot in reminder alert metadata#54
madtank merged 1 commit intofeat/alerts-cli-mvpfrom
orion/task-e55be7c8-reminder-task-snapshot

Conversation

@madtank
Copy link
Copy Markdown
Member

@madtank madtank commented Apr 16, 2026

Summary

Task `e55be7c8` — CLI-side half of making task reminder alerts task-aware.

Today the reminder alert card surfaces raw implementation fields and truncates. The alert payload already carries `source_task_id`, but the frontend has to round-trip to `/tasks/{id}` at render time. This enriches the envelope with a compact task snapshot so the card can render task title / priority / status / assignee inline.

Changes

  • `alerts.py`: extract `_agent_name_for` + `_fetch_task_snapshot` helpers (shared with existing `_resolve_target_from_task`)
  • `alerts.py`: `_build_alert_metadata` accepts `task_snapshot` kwarg; embeds at `alert.task` and `card_payload.task`
  • `reminders.py`: `_fire_policy` fetches snapshot once per fire and passes it through
  • `tests`: positive case (snapshot embedded with all fields) + negative case (fetch failure still fires reminder with `source_task_id` link fallback)

Shape

`alert.task` / `card_payload.task`:

```jsonc
{
"id": "task-snap",
"title": "Ship delivery receipts",
"priority": "urgent",
"status": "in_progress",
"assignee_id": "agent-orion",
"assignee_name": "orion",
"creator_id": "agent-chatgpt",
"deadline": "2026-04-17T00:00:00Z"
}
```

`card_payload.resource_uri` remains `ui://tasks/{source_task_id}` — frontend's Open Task button links here.

Coordination

Task `e55be7c8` is frontend_sentinel's — they render the task block on the alert card + wire Open Task. This PR is the CLI-side payload enrichment, unblocking their slice so it doesn't need a per-card `tasks.get` round-trip.

Composes with PR #53 (ax alerts MVP). Targeting `feat/alerts-cli-mvp` to stack cleanly.

Validation

```
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest tests/test_alerts_commands.py tests/test_reminders_commands.py
21 passed in 11.88s
```

Test plan

  • Existing 19 alert + reminder tests still pass
  • New test: reminder with source_task_id embeds full task snapshot
  • New test: reminder with unreachable task still fires without snapshot (source_task_id link fallback)
  • Frontend e55be7c8 slice consumes `alert.task` + `card_payload.task`

🤖 Generated with Claude Code

Task e55be7c8: task reminder alert cards today truncate and surface raw
implementation fields, with no Open Task action even though the payload
includes source_task_id. This commit does the CLI-side half — enrich the
reminder envelope with a compact task snapshot (id, title, priority,
status, assignee_id, assignee_name, creator_id, deadline) so the frontend
can render task context inline without a second round-trip.

Changes
- alerts.py: extract _agent_name_for + _fetch_task_snapshot helpers
  (shared by _resolve_target_from_task).
- alerts.py: _build_alert_metadata grows a task_snapshot kwarg; when
  present, embeds at alert.task and card_payload.task.
- reminders.py: _fire_policy fetches the snapshot once per fire and passes
  it to _build_alert_metadata.
- tests: positive case (snapshot embedded with all fields) + negative case
  (fetch failure still fires reminder with source_task_id fallback).

Frontend half (task e55be7c8 assignee frontend_sentinel) renders the task
block on the alert card + wires an Open Task button to resource_uri
ui://tasks/{source_task_id}. The MCP widget ui://tasks/detail already
exists; the button is a simple MCP app link.

Validation
- PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest tests/test_alerts_commands.py tests/test_reminders_commands.py
- Result: 21 passed (19 existing + 2 new)

Task: e55be7c8-4758-434c-bea9-1a35b27a769a

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant