harden against mib007 mention-path 500 (insert-then-error)

Smoke test found: any @handle in a comms message 500s AFTER the row is
inserted (agents.url_key column missing on this instance), so a retry
duplicates the message. Neutralise ALL '@' the bridge emits (incl. its
own @nir escalation, zwsp renders identically) and make comment HTTP
errors non-retryable best-effort drops; posts still retry.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YECpkAwQUwgu7NVy91R8fW
This commit is contained in:
Nirav Patel
2026-08-22 14:45:19 -04:00
co-authored by Claude Fable 5
parent 9a862bee2b
commit 1a3ab878b4
2 changed files with 24 additions and 9 deletions
+9 -4
View File
@@ -68,10 +68,15 @@ launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/ai.shre.pulse-bridge.pli
only (the first `@handle` in a message that matches a workspace agent
triggers an AI reply). There is no user mention/notification hook, so
needs-you escalations are the literal text `@nir NEEDS YOU: …`.
- **Mention trap defence:** all ledger-derived text has `@` neutralised
with a zero-width space so an `@ellie` in an item detail can never
trigger an AI reply in the feed. Only the bridge's own `@nir` (which
matches no agent, hence inert) is emitted raw.
- **Mention path is broken on this instance (found during smoke):** ANY
`@handle` in a message makes `POST …/messages` **500 after the row is
inserted** — the mention agent-lookup queries a nonexistent `url_key`
column on `agents` (`comms.ts` ~line 226; error in mib007 stderr log).
Retrying such a failure duplicates the message. The bridge therefore
(a) zwsp-neutralises **every** `@` it emits, including its own
`@nir` escalation (renders identically in the UI), and (b) treats an
HTTP error on a *comment* as non-retryable (`DROP … comment not
retried` in the log) — comments are best-effort; posts still retry.
- Updates for items that pre-date the bridge and were never seeded
(closed before first run) are skipped with a log line — there is no
post to comment on.