fix(atxp): send account_id for notification matching, fix heartbeat p…#55
fix(atxp): send account_id for notification matching, fix heartbeat p…#55R-M-Naveen wants to merge 2 commits intomainfrom
Conversation
…ayload - Use accountId directly instead of stripping email prefix, so notifications match on atxp_acct_* rather than agent_* identities - Fix heartbeat instruction: use 'message' field (not 'text'), reference /hooks/agent endpoint, add sender name Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
AI Code Review - COMMENT
Summary: This PR fixes two issues in push notifications: (1) sending accountId directly instead of parsing the email local part for notification matching, and (2) correcting the heartbeat payload to use the message field, reference /hooks/agent, and include a sender name.
Actionable Feedback (1 item):
- notifications.ts:116 - The request body still uses the field name email_user_id even though the value is now accountId (an atxp_acct_* identifier). If the server API expects account_id instead, this will silently fail to match. Confirm the server accepts email_user_id with an account ID value, or rename the field.
Code Quality: The rename from getEmailUserId to getAccountId is clean. Returning account?.accountId directly rather than parsing the email removes a fragile implicit contract. The heartbeat fixes (field text->message, endpoint /hooks/wake->/hooks/agent, adding name field) are small, consistent corrections.
Security: No concerns. No credentials are logged or exposed.
Suggestion: Consider renaming the email_user_id key in the request body to account_id to match the semantics of what is being sent. Keeping the old key name is confusing for future maintainers.
Positive Notes: Removing email-parsing logic (split on @) is a good simplification. The PR description clearly explains the intent of each change.
…equest Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
AI Code Review
Recommendation: APPROVE
Summary
This PR fixes two bugs in the ATXP notification system: it corrects the identifier sent to the notifications API (using account_id directly instead of parsing an email string), and fixes the heartbeat payload (message/name fields, /hooks/agent endpoint reference).
Actionable Feedback
- General: Existing agents with a HEARTBEAT.md file will still reference /hooks/wake instead of the new /hooks/agent endpoint. If the old endpoint is being deprecated, consider whether a migration path is needed for existing sessions.
Code Quality
The rename from getEmailUserId to getAccountId is a clear improvement. Parsing identifiers out of email strings is fragile; returning the accountId field directly is more robust and semantically correct. Variable names, the API body key (email_user_id to account_id), and surrounding comments are all updated consistently. The heartbeat payload fix (text field renamed to message, addition of name field) is a straightforward correction aligning the request with the API contract.
Security
No security concerns. No new attack surface introduced.
Suggestions
Consider adding a comment about what accountId format is expected (e.g., atxp_acct_*) to aid future maintenance.
Positive Notes
- The diff is minimal and focused - only touches what is necessary to fix the bugs.
- The PR description clearly explains the reasoning behind each change.
- Removing the email-parsing logic eliminates a source of subtle bugs.
…ayload