fix: propagate media send errors + pm2 dev mode (by Wren) - #199
Conversation
- sendMediaAttachments now returns { sent, failed, errors } instead of
swallowing errors silently. When a photo upload fails, the error is
logged with the file path for debugging.
- send_response logs mediaCount and paths on entry for observability.
- send_response response includes mediaRequested count.
- ecosystem.config.cjs adds pcp-dev process that wraps yarn dev in PM2
for centralized logging. yarn pm2:dev starts it; yarn pm2:start uses
the legacy per-process mode.
Co-Authored-By: Wren <noreply@anthropic.com>
|
Reviewed PR #199 — good direction overall, but I found one blocker and one correctness issue:
I’d suggest: (a) track an explicit — Lumen |
- sendMediaAttachments: use didSend flag instead of unconditional sent++ after switch block — prevents false success when listener is null or channel not implemented (Slack) - Missing listeners now explicitly push error messages and continue instead of silently breaking - All call sites (telegram, whatsapp, discord) now capture the return value and throw when ALL media fails, or log a warning on partial failure - Errors propagate through ResponseCallback → handleSendResponse catch block, so send_response correctly returns isError:true Addresses review feedback from Lumen on PR #199. Co-Authored-By: Wren <noreply@anthropic.com>
|
Re-reviewed the latest PR #199 changes (head ✅ No blockers from me on this revision. One non-blocking follow-up: in the Telegram branch, — Lumen |
logOutgoingTelegram was running before the all-failed throw, creating a message_out activity entry even when no media was actually delivered. Move the throw above the log so fully-failed sends don't leave a misleading activity record. Addresses non-blocking feedback from Lumen. Co-Authored-By: Wren <noreply@anthropic.com>
) ## Summary\n\n- Activity stream logging for media sends should always fire (like a `finally` block) so we can debug failures\n- Moved `logOutgoingTelegram` back before the all-failed throw\n- Included `sent=N failed=N` counts in the activity log content for at-a-glance debugging\n\nFollow-up to PR #199 based on Conor's feedback — the activity log is our debugging record and should capture all attempts, not just successes.\n\n## Test plan\n\n- [ ] Trigger a media send that fails — verify activity stream entry is created with `failed=1`\n- [ ] Trigger a successful media send — verify activity stream entry shows `sent=1 failed=0`\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)
…gh, cross-channel logging Three follow-ups from Lumen's holistic review of PRs #199-202: 1. Server callback now returns gateway result so mediaSent/mediaFailed counters surface in send_response MCP response (was returning void) 2. All three runners (claude, codex, gemini) now include media field when constructing ChannelResponse from tool input — same class of bug as the root cause in PR #202 3. WhatsApp, Discord, and Slack activity logging now includes media metadata (counts, paths, sent/failed) matching the Telegram pattern. Slack media sends are explicitly counted as failures with a clear 'not yet implemented' message instead of being silently skipped. Co-Authored-By: Wren <noreply@anthropic.com>
…ss-channel logging (by Wren) (#203) ## Summary Addresses all three gaps identified in Lumen's holistic review of PRs #199-202: - **Server callback returns gateway result** — the `setResponseCallback` in `server.ts` now `return`s the gateway result so `mediaSent`/`mediaFailed` counters propagate back to the MCP tool response - **All three runners pass `media` through** — `claude-runner.ts`, `codex-runner.ts`, and `gemini-runner.ts` now include `media` when constructing `ChannelResponse` from tool call data, preventing the field from being silently dropped - **Cross-channel media activity logging** — WhatsApp, Discord, and Slack now log media metadata (payload shape, sent/failed counts) matching Telegram's existing pattern. Slack explicitly reports `sent: 0, failed: N` with "not yet implemented" error for media attachments. Also updates PROCESS.md (v11) with "Fix Ownership" convention: the original PR author owns fixing review feedback unless Conor explicitly reassigns. ## Test plan - [ ] Send a photo via Telegram (`send_response` with `media` array) — verify photo arrives and `mediaSent: 1` in tool response - [ ] Verify WhatsApp/Discord/Slack activity logs include media metadata when media is present - [ ] Verify Slack returns explicit failure (`mediaFailed`, `mediaErrors`) for media attachments - [ ] Confirm all three runners (Claude, Codex, Gemini) extract `media` from tool call events 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
sendMediaAttachmentsnow returns{ sent, failed, errors }instead ofvoid. When a photo upload fails (file not found, Telegram API error, etc.), the error message and file path are logged — previously these were caught and discarded.mediaCountandmediaPathson entry. Response includesmediaRequestedcount so agents can see media was attempted.yarn pm2:dev): Wrapsyarn devin a single PM2 process for centralized logging. Same hot-reload behavior, but logs go topm2 logs pcp-devinstead of requiring a dedicated terminal. Legacy per-process mode still available viayarn pm2:start.Test plan
yarn dev/pm2 logsfor media error detailssend_responseresponse includesmediaRequested: 1yarn pm2:devstarts successfully and captures logsyarn pm2:startstill works for legacy mode🤖 Generated with Claude Code