Skip to content

fix(notify): notify on inbound post_publish messages - #39

Merged
antonyevans merged 1 commit into
mainfrom
fix/notify-post-publish
Jun 18, 2026
Merged

antonyevans merged 1 commit into
mainfrom
fix/notify-post-publish

Conversation

@antonyevans

Copy link
Copy Markdown
Owner

Problem

NOTIFY_POLICIES (in store-notify.ts) had no post_publish entry, so notificationIntent returned null for every post-type message — signal, query, answer, endorse, coordinate. Result: a friend sending a coordinate/query message produced no notification at all, while friend requests and privileged messages notified normally.

This bites any agent that surfaces inbound mail only through the notify hook (e.g. a file-logging --notify-cmd): a real incoming message leaves no breadcrumb. Hit in practice — a coordinate greeting from a freshly-connected friend never reached the notifier, only the friend-acceptance events did.

Fix

Add a post_publish policy that resolves the sender's display name and renders a short body preview:

<name> (<post_type>): <preview>

(falls back to <name> sent a <post_type>. when the body is empty). Body is read from post.body (string), then post.text, else JSON — truncated to 280 chars, matching the privileged_message preview behaviour. Other types are unchanged.

Test

Extends test/inbound-notify.test.ts: a post_publish envelope carrying a coordinate post now yields a non-null intent with kind: "post_publish", the post type, a body preview, and the resolved sender name.

  • npm test → 508 pass (was 507)
  • npm run typecheck clean, npm run lint clean (pre-existing warnings only), sync-readme:check clean

Bumps to 0.18.3 for publish.

🤖 Generated with Claude Code

NOTIFY_POLICIES had no post_publish entry, so every post-type message
(signal/query/answer/endorse/coordinate) returned a null intent and arrived
silently — a friend sending a coordinate/query message produced no
notification at all, while friend requests and privileged messages notified
fine. Agents that surface mail only via the notify hook never saw these.

Add a post_publish policy that resolves the sender name and renders a short
body preview ("<name> (<post_type>): <preview>"). Regression test asserts a
coordinate post now yields a notifiable intent. Bumps to 0.18.3.
@antonyevans
antonyevans merged commit 6b06431 into main Jun 18, 2026
1 check passed
@antonyevans
antonyevans deleted the fix/notify-post-publish branch June 18, 2026 22:57

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b3907f96d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/store-notify.ts
Comment on lines +72 to +75
const raw =
typeof post.body === "string" ? post.body :
typeof post.text === "string" ? post.text :
post.body != null ? JSON.stringify(post.body) : "";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include endorsement statements in post previews

For delivered endorse posts, the current post schema stores the human-readable content in statement, not body or text; this policy therefore falls through to an empty preview and emits only "<name> sent a endorse." for every endorsement notification. Since endorsements are one of the post types this change is intended to surface, hosts relying on the notify hook still won't see the actual endorsement content unless this also checks post.statement.

Useful? React with 👍 / 👎.

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