Skip to content

fix: critical and high port bugs across all adapters#14

Merged
patrick-chinchill merged 1 commit into
mainfrom
fix/port-bugs-batch
Apr 7, 2026
Merged

fix: critical and high port bugs across all adapters#14
patrick-chinchill merged 1 commit into
mainfrom
fix/port-bugs-batch

Conversation

@patrick-chinchill
Copy link
Copy Markdown
Collaborator

Fixes 10 port fidelity bugs found by systematic comparison against TS originals.

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>
@patrick-chinchill patrick-chinchill merged commit 00586c6 into main Apr 7, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread src/chat_sdk/types.py

LockScope = Literal["thread", "channel"]
ConcurrencyStrategy = Literal["drop", "queue", "debounce", "concurrent"]
OnLockConflict = Literal["drop", "force"] | Callable[..., Awaitable[bool] | bool]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

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.

Suggested change
OnLockConflict = Literal["drop", "force"] | Callable[..., Awaitable[bool] | bool]
OnLockConflict = Literal["drop", "force"] | Callable[[str, Message], Awaitable[bool] | bool]

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