Design persistent-agent mail notifications for Ava inbox

t-787·WorkTask·
·
·
Created5 days ago·Updated4 days ago·pipeline runs →

Description

Edit

Sketch design to reinstate reliable mail-style notifications (previously from ~/.pi/agent/extensions/*.ts) in Omni/Agentd + Omni/Agent infrastructure, so Ava can run ~/.local/bin/ava-inbox to check messages. Include architecture, event triggers, delivery mechanism, failure handling, and migration plan.

Timeline (12)

🔄[human]Open → InProgress5 days ago
💬[human]5 days ago

Design sketch prepared (no code yet): implement native maildir notifications in Omni/Agent runtime, gated for persistent sessions (detected via AGENTD_AGENT_NAME or explicit env), triggered on Trace.EventCustom agent_complete/agent_error. Keep old ava-notify.ts RFC822 contract (X-Ava-Type/X-Ava-Agent-Id/X-Ava-Status), deliver atomically to ~/ava/inbox/tmp then rename into new. Wire run_id to persistent agent name so heartbeat can map directly to . Optional env in agentd env writer: AGENT_NOTIFY_ENABLED=1 + AGENT_NOTIFY_MAILDIR. No Ava code changes required; ava-inbox continues to work. Add tests for event->notification mapping and maildir delivery. Deployment requires shipping Agent (and Agentd if env writer changed) + restarting persistent agents.

💬[human]5 days ago

Implemented Unix-style notification bridge in agentd/persistent runtime. Changes: (1) Persistent wrapper now mirrors agent stdout JSONL to per-agent files at $AGENTD_STATE_DIR/sessions/<agent>.jsonl via tee while still streaming to journald. (2) Added new command agentd notifyd that tails those session JSONL files from byte offsets, parses custom events (agent_complete, agent_error), and delivers RFC822 maildir messages to Ava inbox (tmp->new atomic rename) with X-Ava-Type / X-Ava-Agent-Id / X-Ava-Status headers. (3) Added durable cursor+dedupe state at $AGENTD_STATE_DIR/notifyd-state.json to survive restarts and avoid duplicate notifications. (4) Added user systemd unit agentd-notifyd.service generation in ensurePersistentRuntimeAssets and auto-start/enable on create/start/restart best-effort. (5) Added unit tests for notify parser, notifyd unit template, and updated exec script assertions. Verification: typecheck.sh Omni/Agentd.hs + Omni/Agentd/Daemon.hs pass; bild Omni/Agentd.hs pass; bild --test Omni/Agentd/Daemon.hs pass; live smoke test by appending synthetic agent_complete JSON line to sessions file increased ava-inbox unread count 0->1 and produced expected subject/header from agentd-notifyd, then marked read.

🔄[human]InProgress → Review5 days ago
🔄[human]Review → InProgress5 days ago
💬[human]5 days ago

Post-ship rollout steps completed on beryllium: restarted all active persistent agents (cfg-coder, intent-coder, omni-coder, paracoder, sd-coder) via agentd restart <name> --mode persistent; all units returned active/running and agentd status --mode persistent --json shows running+active for each. Verified notify bridge service healthy: agentd-notifyd.service enabled+active with ExecStart /home/ben/omni/live/_/bin/agentd notifyd. Verified end-to-end delivery into Ava inbox by appending a synthetic agent_complete event to sessions JSONL; unread count increased with subject [success] notify-rollout-smoke: rollout smoke notification, then cleaned up by marking just that message read (unread back to 0).}

🔄[human]InProgress → Review5 days ago
💬[human]4 days ago

Committed notification bridge changes as 7a57e289 (feat(agentd): add notifyd maildir bridge for persistent agents) and rebased live onto ava to sync branch history. live now contains ava commit f9629d38 plus the new notifyd commit.