Fix Slack file shares and DM reply targeting#17
Open
HaiyiMei wants to merge 1 commit into
Open
Conversation
HaiyiMei
marked this pull request as ready for review
July 13, 2026 10:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
file_sharemessage events through subtype filtering so attachment-only image/file messages reach the normal hydration pipelineuser:<sender-id>instead ofchannel:<dm-channel-id>so message-tool final markers settle the same user-keyed session as the inbound DMUser-visible symptoms
Slack images and files are silently ignored
file_shareevent and can be dropped as a whole.Internal tool-call transcript leaks into Slack DMs
A normal DM reply can be followed by, or replaced with, raw runner output that should remain internal.
The leaked content can look like:
This is DM-specific: channel conversations are already keyed by channel ID, while inbound DMs are keyed by the peer user ID.
The symptom may appear intermittent because it depends on settlement reaching pane fallback after the real
message send --finalwas recorded against the wrong session key.Reproduction
1. File/image message is ignored
messageevent with subtypefile_share.Expected: the event reaches attachment hydration and the agent receives the uploaded file/image.
Actual: subtype filtering rejects the event before attachment handling.
2. DM leaks message-tool metadata
channel:D..., even though the inbound DM session is keyed asuser:U....clisbot message send --final.Ran clisbot message send ...line and result metadata in Slack.Expected: only the intended user-facing message is posted and the active DM run settles as final.
Actual: the final marker misses the active session and pane fallback can post internal command/result text.
Root cause
Slack file uploads arrive as
messageevents with subtypefile_share, but the generic subtype filter discarded them before attachment hydration.Slack inbound DMs are session-keyed by peer user, while the generated agent reply command used the DM channel ID. A
message send --finalcall therefore marked a different session, allowing pane fallback/tool transcript text to leak into Slack.Validation
bun test test/slack-message.test.ts test/slack-session-routing.test.ts— 19 pass, 0 failbun run build— passgit diff --check— passbun run check— 992 pass, 1 unrelated failure inzalo-personal zca-js wrapper > refreshes the stored session after session login succeeds; the same failure reproduces on a clean upstreammaincheckout (989 pass, 1 fail), while the test passes in isolation