fix(slack): resolve file events with cached workspace team - #30456
Closed
robzolkos wants to merge 1 commit into
Closed
fix(slack): resolve file events with cached workspace team#30456robzolkos wants to merge 1 commit into
robzolkos wants to merge 1 commit into
Conversation
Contributor
|
Thanks for the focused multi-workspace regression fix. The premise still holds on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
Contributor
|
Merged via #69482 — your commit was cherry-picked/reapplied onto current main with your authorship preserved in git history: your cached workspace-team file-event resolution was re-targeted onto the plugin adapter with your authorship. Thanks for the contribution! |
teknium1
pushed a commit
that referenced
this pull request
Jul 23, 2026
…dded team id Salvaged from #59742 (downloads half only). Main already resolves the event-level team id from the channel→workspace cache before downloads (the file-EVENT half was covered by #30456), but when neither the event nor the cache knows the workspace, both download helpers silently fell back to the PRIMARY workspace token — Slack then returns an HTML login page instead of file bytes for any non-primary workspace file. Slack private file URLs embed the owning workspace id (files-pri/<TEAM_ID>-<FILE_ID>/...), so _resolve_download_token now prefers: explicit team_id -> URL-embedded team id -> primary token. Both _download_slack_file and _download_slack_file_bytes route through it. Deferred from #59742 (out of this correctness cluster's scope): the channel→team disk persistence, the pre-send conversations.info probe loop, and the thread-file ingestion feature. Reapplied from #59742 by @benjamin2026-dot onto the current adapter (original targeted the pre-#30456 download sites).
teknium1
pushed a commit
that referenced
this pull request
Jul 23, 2026
…dded team id Salvaged from #59742 (downloads half only). Main already resolves the event-level team id from the channel→workspace cache before downloads (the file-EVENT half was covered by #30456), but when neither the event nor the cache knows the workspace, both download helpers silently fell back to the PRIMARY workspace token — Slack then returns an HTML login page instead of file bytes for any non-primary workspace file. Slack private file URLs embed the owning workspace id (files-pri/<TEAM_ID>-<FILE_ID>/...), so _resolve_download_token now prefers: explicit team_id -> URL-embedded team id -> primary token. Both _download_slack_file and _download_slack_file_bytes route through it. Deferred from #59742 (out of this correctness cluster's scope): the channel→team disk persistence, the pre-send conversations.info probe loop, and the thread-file ingestion feature. Reapplied from #59742 by @benjamin2026-dot onto the current adapter (original targeted the pre-#30456 download sites).
teknium1
pushed a commit
that referenced
this pull request
Jul 23, 2026
…dded team id Salvaged from #59742 (downloads half only). Main already resolves the event-level team id from the channel→workspace cache before downloads (the file-EVENT half was covered by #30456), but when neither the event nor the cache knows the workspace, both download helpers silently fell back to the PRIMARY workspace token — Slack then returns an HTML login page instead of file bytes for any non-primary workspace file. Slack private file URLs embed the owning workspace id (files-pri/<TEAM_ID>-<FILE_ID>/...), so _resolve_download_token now prefers: explicit team_id -> URL-embedded team id -> primary token. Both _download_slack_file and _download_slack_file_bytes route through it. Deferred from #59742 (out of this correctness cluster's scope): the channel→team disk persistence, the pre-send conversations.info probe loop, and the thread-file ingestion feature. Reapplied from #59742 by @benjamin2026-dot onto the current adapter (original targeted the pre-#30456 download sites).
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
…dded team id Salvaged from NousResearch#59742 (downloads half only). Main already resolves the event-level team id from the channel→workspace cache before downloads (the file-EVENT half was covered by NousResearch#30456), but when neither the event nor the cache knows the workspace, both download helpers silently fell back to the PRIMARY workspace token — Slack then returns an HTML login page instead of file bytes for any non-primary workspace file. Slack private file URLs embed the owning workspace id (files-pri/<TEAM_ID>-<FILE_ID>/...), so _resolve_download_token now prefers: explicit team_id -> URL-embedded team id -> primary token. Both _download_slack_file and _download_slack_file_bytes route through it. Deferred from NousResearch#59742 (out of this correctness cluster's scope): the channel→team disk persistence, the pre-send conversations.info probe loop, and the thread-file ingestion feature. Reapplied from NousResearch#59742 by @benjamin2026-dot onto the current adapter (original targeted the pre-NousResearch#30456 download sites).
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.
What does this PR do?
Fixes Slack file handling for multi-workspace gateway setups where Slack file-upload events omit
team/team_id.When Hermes has multiple Slack workspaces configured, file downloads need the correct workspace bot token. Regular messages populate the channel-to-team cache, but some file events arrive without workspace metadata. This PR falls back to the cached channel workspace before downloading attachments, so Hermes uses the correct Slack client/token.
Related Issue
No existing issue. This PR adds a regression test for the reported multi-workspace Slack file-event behavior.
Type of Change
Changes Made
gateway/platforms/slack.pyto resolve missing Slackteam_idfrom the cached channel workspace mapping.tests/gateway/test_slack.pyfor file events that omitteam/team_id.How to Test
Run the Slack-related test suite:
Confirm all Slack tests pass:
Checklist
Code
fix(scope):,feat(scope):, etc.)Documentation & Housekeeping
docs/, docstrings) — N/Acli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs
N/A