Conversation
Avoid repeating users.list pagination on every lookup, skip lookupByEmail for browser tokens, and add user cache warm. Co-Authored-By: Paperclip <noreply@paperclip.ing> Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Problem
resolveUserId()always hit Slack:users.lookupByEmailfor emails, then a fullusers.listscan for handles. Browserxoxctokens cannot callusers.lookupByEmail(not_allowed_token_type), so every email lookup burned a failed request and then paginated the directory. In a workspace of this size that scan is multipleusers.listpages, on everyuser get,user dm-open,channel invite, andsearch --user.The existing
users-cache-*.jsonfile only stored id → profile for--resolve-usersoutput annotation. It was never consulted in the reverse direction.What Changed
users.listpages andusers.inforesults.resolveUserId()reads that index before calling Slack.users.lookupByEmail.agent-slack user cache warmanduser list --refreshprime the whole directory once.user get --refresh-usersbypasses TTL so renames/deactivations are recoverable.Verification
bun test— 406 pass, 0 fail. New coverage: cache hit, miss with write-through, TTL expiry, browser-auth email short-circuit,user cache warm, and--refresh-usersbypass.bun run typecheck— clean.Risks
users.list.--refresh-users. Same 24h window as the existing profile cache.Made with Cursor