fix(eve/slack): fail loudly when private file fetch returns login HTML (#1317) - #1531
Open
iroiro147 wants to merge 1 commit into
Open
fix(eve/slack): fail loudly when private file fetch returns login HTML (#1317)#1531iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
vercel#1317) When a Slack bot token is missing `files:read` (or the app has not been reinstalled since the scope was added), Slack returns HTTP 200 with a browser login page rather than a 401/403. Eve staged the HTML as the attachment, so the model would report receiving a "Slack sign-in page" with no hint of the underlying scope misconfiguration. `createSlackFetchFile` now detects an HTML response (by content-type or by sniffing the body prefix) and throws an error that names `files:read` and the workspace-reinstall step, matching the failure-loudly behavior other Slack clients (e.g. OpenClaw) already use. Refs vercel#1317 Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
Contributor
|
@iroiro147 is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
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
When a Slack bot token lacks
files:read(or the app has not been reinstalledsince the scope was added), Slack's private-file endpoint returns HTTP 200
with a browser login page rather than a 401/403. Eve staged that HTML as the
attachment, so the model honestly reported receiving a "Slack sign-in page" —
masking the underlying scope misconfiguration as a vision/auth mystery.
Changes
createSlackFetchFile(packages/eve/src/public/channels/slack/attachments.ts)now detects the login page after a successful status check:
Content-Typeistext/html, or<!doctype htmlor<html(some proxies drop thecontent-type)
…it throws with a message naming the fix:
Matches the failure-loudly pattern other Slack clients (e.g. OpenClaw) already
use.
Tests
Six new
createSlackFetchFilecases inattachments.test.ts(pass-through fornon-Slack URLs, bytes + content-type for a real file, throw on HTML
content-type, throw on body-sniff even without content-type, message names
files:read+ reinstall, and the existing non-2xx HTTP path). All 35attachments tests pass;
tsc -p tsconfig.json --noEmitclean.Refs #1317