← Back to PRs

#3300: changed chat session selection logic in iMessage

by KimEJ open 2026-01-28 11:28 View on GitHub →
channel: imessage
I modified it to work based on chat-id because group chat doesn't work normally if you choose by number. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adjusts iMessage inbound session/target selection to key off `chat_id` when available (so group chats can be addressed reliably), and tweaks inbound envelope formatting to include the chat type in the channel header for non-direct messages. The iMessage change feeds `To`/`OriginatingTo` as `chat_id:<id>` (fallbacking to `imessage:<sender>`), which aligns with existing target parsing/normalization utilities used by outbound routing and tests. The envelope change affects a shared formatter used across multiple providers, so it will change headers beyond iMessage as well. <h3>Confidence Score: 4/5</h3> - This PR is likely safe to merge; changes are small and aligned with existing target formats, with minor concerns about shared formatting impact. - The iMessage change uses an established `chat_id:` prefix already supported by parsing/normalization and existing tests. The main risk is the envelope formatter change being globally applied, which could create noisy headers across other channels. - src/auto-reply/envelope.ts (shared formatting behavior) <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs