release: 0.4.27.1 — backport Slack files_upload_v2 confirmation fix#120
release: 0.4.27.1 — backport Slack files_upload_v2 confirmation fix#120patrick-chinchill wants to merge 2 commits into
Conversation
SlackAdapter._upload_files already returns the list of Slack-confirmed file IDs, but post_message discarded the return and ThreadImpl._create_sent_message hardcoded raw=None, so the confirmation never reached SentMessage.raw. Slack was the only file-capable adapter to drop upload confirmation; discord/telegram upload inline and expose the platform response naturally. - post_message: capture _upload_files' return and augment RawMessage.raw with "uploaded_file_ids" on every return path that can carry files (file-only, card, table, text), via a new _augment_raw_with_uploads helper. None means no upload; empty list means Slack confirmed zero attachments. raw is augmented, not replaced — non-breaking. - thread.py: _create_sent_message accepts and propagates a raw parameter; the post() call site passes raw_msg.raw through. Platform-agnostic, so discord/telegram real platform responses now flow through too. Tests: 3 in test_slack_api.py (file-only, text+files, text-only no-augment) and 1 end-to-end in test_thread_faithful.py. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Post-merge review of PR #117 caught that _MessageHistoryCache.append in chat.py did not null out raw before persisting (unlike its sibling MessageHistoryCache.append in message_history.py, which already does). Without this, the platform raw payload (Slack team_id/user_id, Discord guild IDs, etc.) that #117 now correctly populates on SentMessage.raw would persist to Redis/Postgres-backed state on every reply, inflating storage size and PII surface. Mirrors the null-out in message_history.py:62.
|
Warning Review limit reached
More reviews will be available in 56 minutes and 49 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request bumps the SDK version to 0.4.27.1 and introduces a fix to surface Slack file upload confirmations (uploaded_file_ids) on SentMessage.raw. It also updates _MessageHistoryCache to null out the raw payload before persisting messages to history, preventing storage bloat and PII exposure. Feedback on this PR suggests explicitly documenting the SDK's versioning scheme to clarify how local, Python-only patch versions are handled relative to upstream releases to avoid potential version number collisions.
| [project] | ||
| name = "chat-sdk" | ||
| version = "0.4.27" | ||
| version = "0.4.27.1" |
There was a problem hiding this comment.
When defining a versioning scheme that embeds an upstream version (such as 0.4.27.1 for a local patch on 0.4.27), there is a potential for collision if the upstream project releases a patch version (e.g., 4.27.1). If upstream patch releases are handled by bumping to the next minor version in this SDK, please ensure this behavior is explicitly documented (for example, in the README or a dedicated versioning document) to clarify that the fourth digit/local patch slot is strictly reserved for local, Python-only fixes.
References
- When defining a versioning scheme that embeds an upstream version, ensure that the scheme clearly differentiates between upstream patch releases and local (Python-only) fixes to avoid ambiguity and potential collisions in version numbers. If upstream patch releases are handled by bumping to the next minor version, explicitly document this to clarify that the local patch slot is reserved for local fixes.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e45069f686
ℹ️ 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".
| files = extract_files(message) | ||
| if files: | ||
| await self._upload_files(files, channel, thread_ts or None) | ||
| uploaded_file_ids = await self._upload_files(files, channel, thread_ts or None) |
There was a problem hiding this comment.
Parse Slack upload IDs from the top-level files list
When this new return value is used, successful real Slack uploads will usually surface uploaded_file_ids: []: the Python SDK's files_upload_v2 returns the files.completeUploadExternal payload with top-level entries like {"files": [{"id": ...}]}, but _upload_files still only collects IDs from a nested uploaded["files"] list. As a result, consumers gating on SentMessage.raw["uploaded_file_ids"] get a false “zero attachments confirmed” signal even though the files were delivered; the extraction needs to handle the top-level file objects before this value is exposed.
Useful? React with 👍 / 👎.
|
Closing — this is a tag-only maintenance release, not a main merge. The fix also lands on main forward via #117 (the null-out commit e45069f is being cherry-picked onto #117 so the 0.4.29 line gets the PII guard too). Branch chinchill-api pins |
Summary
Point release 0.4.27.1 — Python-only patch on the 0.4.27 line. Does NOT include the 0.4.29 alpha sync work currently in flight on main. Branched off
v0.4.27tag.Unblocks chinchill-api consumer that needs to gate UX on actual Slack file-delivery confirmation, ahead of the 0.4.29 release.
What's in 0.4.27.1
Slack
files_upload_v2confirmation surfaced throughpost()(backported from fix(slack): surface files_upload_v2 confirmation in SentMessage.raw #117).SlackAdapter._upload_filesalready computed the list of Slack-confirmed file IDs butpost_messagediscarded the return, andThreadImpl._create_sent_messagehardcodedraw=None. Now:post_messageaugmentsRawMessage.rawwith"uploaded_file_ids"on every file-carrying return path;_create_sent_messageaccepts and propagates the adapter'sraw.None= no upload; empty list = Slack confirmed zero. Augmentation is additive, not a replace.Storage-bloat / PII fix —
chat._MessageHistoryCache.appendnow nullsrawbefore persisting (mirror of the existing null-out inmessage_history.MessageHistoryCache.append). Without this, the platform payload that the above fix populates onSentMessage.raw(Slackteam_id/user_id, DiscordguildId, etc.) would persist on every reply to Redis/Postgres-backed state. Caught by post-merge code review of fix(slack): surface files_upload_v2 confirmation in SentMessage.raw #117.Why a point release vs waiting for 0.4.29
0.4.29 is still in mid-wave (alpha 1 just landed; chat/ai, Messenger, and other big pieces still in flight). chinchill-api can't wait. Branching off
v0.4.27for a focused patch gets the fix to production immediately without coupling to 4.29's risk surface.Release mechanics
v0.4.27tag (c43ea05)release/0.4.27.1main(for visibility / CI / review). Not intended for merge into main — main is already on0.4.29a1and merging would conflict on version + CHANGELOG. After approval, tagv0.4.27.1fromrelease/0.4.27.1directly; CHANGELOG entry will be forward-ported to main via a separate small PR.Validation
ruff check+ruff format --check: cleanaudit_test_quality.py: 0 hard failuresUpstream convergence
Filing the same fix upstream (vercel/chat#564) to restore parity in a future sync.
Generated by Claude Code
Generated by Claude Code