Skip to content

Use public-only message search in safe mode - #29

Merged
syucream merged 1 commit into
mainfrom
codex/public-search-context
Nov 13, 2026
Merged

syucream merged 1 commit into
mainfrom
codex/public-search-context

Conversation

@syucream

Copy link
Copy Markdown
Contributor

Safe-search mode filtered private message matches after a legacy search, while pagination still described the wider result set. Use Slack's public-channel search boundary before results are paginated.

  • In safe-search mode, call assistant.search.context with fixed channel_types: ["public_channel"] and content_types: ["messages"]. User query modifiers cannot change these request parameters.
  • Return a slack-public-search-v1 response containing public matches and an opaque cursor. Do not return legacy totals, pages, ranks, context messages, or other result types.
  • Accept cursor and limit (1–20) in safe mode; reject legacy page and count parameters. Leave normal, unrestricted mode on the legacy API.
  • Fail clearly on missing authorization or malformed API responses, without falling back to legacy search.
  • Add focused tests and run them in CI and before publishing.

The user token needs search:read.public and access to Slack's Real-time Search API. Reauthorize the Slack app with the required scope before deploying this server update, then update clients that enforce the new response contract. Existing deployments and authorization have not been changed by this PR.

Validation: 16 tests on Node 20.20.2, npm run lint, npm run build, and git diff --check pass. The original safe-search implementation fails the new public-boundary tests. Tests use fake API responses and do not call a real workspace.

API reference:

Slack assistant.search.context

@syucream
syucream merged commit f7ccccd into main Nov 13, 2026
1 check passed
@syucream
syucream deleted the codex/public-search-context branch November 13, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant