fix: critical and high port bugs across all adapters#14
Conversation
Critical fixes: - Slack: ContextVar now uses copy_context().run() so async factory tasks inherit the multi-workspace token (was resetting before tasks ran) - Discord: Added deferred slash command response path (PATCH interaction webhook instead of posting new message) - Discord: Added file attachment support in post_message (multipart upload) - WhatsApp: Restored Authorization header on media download step 2 (SSRF fix had removed it, breaking all media downloads) - Chat: Added on_lock_conflict support (force-release path was missing) High fixes: - Discord: Normalize emoji through resolve_emoji_from_gchat before constructing EmojiValue (was storing raw unicode like "👍") - Teams: Pass webhook options to process_reaction - GChat: Subscription error propagation to concurrent waiters - Linear: Include both snake_case and camelCase keys in fetch_thread metadata - Thread/Channel: Document messages()/all_messages() as methods (Pythonic) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces several enhancements across multiple adapters, including support for file attachments in Discord via multipart/form-data, improved error handling for Google Chat subscriptions, and a new on_lock_conflict policy in the core Chat class to manage lock acquisition failures. Additionally, it updates the WhatsApp adapter to include authorization headers for media downloads and refines Slack's context management using contextvars. A suggestion was made to refine the type hint for the OnLockConflict callable to improve type safety and IDE support.
|
|
||
| LockScope = Literal["thread", "channel"] | ||
| ConcurrencyStrategy = Literal["drop", "queue", "debounce", "concurrent"] | ||
| OnLockConflict = Literal["drop", "force"] | Callable[..., Awaitable[bool] | bool] |
There was a problem hiding this comment.
The Callable type hint for OnLockConflict is overly generic. Since the implementation in chat.py (line 1488) explicitly calls this with two arguments (thread_id: str and message: Message), the type hint should reflect this signature to improve maintainability and IDE support.
| OnLockConflict = Literal["drop", "force"] | Callable[..., Awaitable[bool] | bool] | |
| OnLockConflict = Literal["drop", "force"] | Callable[[str, Message], Awaitable[bool] | bool] |
Fixes 10 port fidelity bugs found by systematic comparison against TS originals.