Conversation
…OS / iMessage / Telegram)
Closes the last item from Phase 3.5 backlog. `manifest.notification_channels`
already existed (set at agent spawn); this PR makes it actually do something
beyond the default `pwa`.
## What changes
`codec_agent_messaging.py`:
- New helper `_agent_notification_channels(agent_id)` reads
manifest.notification_channels (defaults to ["pwa"])
- New helper `_dispatch_to_channel(channel, ...)` with handlers for:
- "macos" — `osascript display notification` (works out of the box)
- "imessage" — calls `skills/imessage_send._send(recipient, text)` if
`~/.codec/config.json:notifications.imessage_recipient` is set
- "telegram" — direct Bot API call to `api.telegram.org/sendMessage`
if `~/.codec/config.json:notifications.{telegram_token,telegram_chat_id}`
are set
- New helper `_channel_config(key)` reads `~/.codec/config.json:notifications.<key>`
- `post_message` iterates manifest channels after writing notifications.json
and dispatches to each non-pwa channel. Best-effort — failures logged
at debug level, don't block the post
`tests/test_agent_messaging.py`:
- 5 new tests:
- pwa-only default → no extra dispatch
- 'macos' in manifest → _dispatch_to_channel called for macos
- macos dispatch invokes osascript with title + body
- imessage skipped when recipient unset (no exception)
- telegram skipped when unconfigured (no exception)
## Configuration model
For iMessage and Telegram, the user adds to `~/.codec/config.json`:
{
"notifications": {
"imessage_recipient": "+33612345678",
"telegram_token": "...",
"telegram_chat_id": "..."
}
}
If absent, channel is silently skipped. No env vars required.
For macOS notifications, no config needed — osascript is built into macOS.
## To use
At agent spawn time, set `notification_channels`:
POST /api/agents
{
"title": "...",
"description": "...",
"notification_channels": ["pwa", "macos", "telegram"]
}
Each `agent_update` / `agent_blocked` / `agent_done` now dispatches to all
listed channels.
## Test plan
- [x] tests/test_agent_messaging.py → 21 passed (was 16, +5)
- [x] Full suite — 943 passed / 20 failed / 73 skipped (same baseline)
- [x] macOS dispatch verified via subprocess monkeypatch
- [x] iMessage / Telegram gracefully skip when unconfigured
## Compat
- Existing agents with `notification_channels: ["pwa"]` (the default)
see no behavior change
- Manifest field unchanged (was already there since Step 8)
- Failure modes are conservative — bad config = silent skip, never
crashes post_message
## Phase 3.5 status after this PR
All Phase 3.5 backlog items shipped:
- Step 11: Project mode UI ✅
- Project folder creation ✅
- Step 13: Proactive intelligence overlay ✅ (PR #29)
- Step 9 review C2 (blocked_on_qwen) ✅ (PR #30)
- Step 9 review M4 (read_paths enforcement) ✅ (PR #30)
- Multi-channel notifications ✅ (this PR)
Pending: anchor example run (user-driven test) + Phase 3 release tag.
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
Last Phase 3.5 backlog item.
manifest.notification_channelsalready existed (set at agent spawn since Step 8) — this PR makes it actually do something beyond the defaultpwa.When you spawn an agent with
notification_channels: ["pwa", "macos", "telegram"], everyagent_update/agent_blocked/agent_donenow dispatches to all 3 channels.What ships
pwa~/.codec/notifications.json(existing)macososascript display notificationimessageskills/imessage_send._send(recipient, text)~/.codec/config.json:notifications.imessage_recipienttelegramsendMessage~/.codec/config.json:notifications.{telegram_token,telegram_chat_id}If iMessage / Telegram config is missing, channel silently skips. macOS works without any setup. PWA is always-on.
Configuration example
If absent, channels gracefully skip. Never breaks
post_message.To use
The PWA's Project mode currently sends
notification_channelsis unset → defaults to["pwa"]. Future UI enhancement (small): checkbox set in the Project mode submit.Tests
5 new tests in
tests/test_agent_messaging.py:_dispatch_to_channelcalled for macososascriptcommand with title + bodyFull suite: 943 passed / 20 failed / 73 skipped — same 20/73 baseline, +5 from this PR.
Phase 3.5 status
All backlog items shipped:
blocked_on_qwen)Remaining: anchor example run (your test of the property bot) + Phase 3 release tag.
🤖 Generated with Claude Code