Skip to content

fix(slack): fail collection on ok:false API responses - #9440

Open
ShivamSharma43 wants to merge 1 commit into
apache:mainfrom
ShivamSharma43:fix-slack-ok-false
Open

ShivamSharma43 wants to merge 1 commit into
apache:mainfrom
ShivamSharma43:fix-slack-ok-false

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Summary

The Slack collectors ignore failed API calls, so a pipeline can succeed without collecting anything.

Slack answers most failed Web API calls with HTTP 200 and a body like {"ok": false, "error": "not_in_channel"} (also channel_not_found, missing_scope, invalid_auth, ...). The response parsers of collectChannel (conversations.list), collectChannelMessage (conversations.history) and collectThread (conversations.replies) only read the channels/messages array, which is missing in an error body. The error is treated as an empty page: nothing is stored and the subtask succeeds. For example, when the Slack app is not a member of the channel chosen as the scope, every sync finishes successfully with no messages, and nothing tells the user why.

Changes:

  • apimodels/im_result.go: the three result types also decode Slack's error field.
  • tasks/api_client.go: new checkSlackApiResult returns slack <method> error: <error code> when ok is false.
  • tasks/*_collector.go: the response parsers are moved into named functions (parseChannelResponse, parseChannelMessageResponse, parseThreadResponse) that call it, so the subtask fails with Slack's error code. listSlackRemoteScopes in api/remote_api.go already checks ok the same way for the scope picker.
  • parseThreadResponse skips thread_not_found (the parent message was deleted after the messages were collected) instead of failing the whole collection.

GetNextPageCustomData only runs after the parser succeeded, so it needs no change.

Does this close any open issues?

No issue is open for this. The bug is described above.

Screenshots

N/A

Other Information

  • New response_parser_test.go checks each parser with an ok: true body, an ok: false body with and without an error code, and the thread_not_found skip. With checkSlackApiResult disabled, the ok: false cases fail.
  • go test ./plugins/slack/..., go vet ./plugins/slack/..., gofmt and golangci-lint run ./plugins/slack/... are clean. The plugin has no e2e tests.
  • Not run against a live Slack workspace.
  • Suggested label: pr-type/bug-fix.
  • This PR was prepared with AI assistance (Claude Code). The commit carries a Co-Authored-By: trailer.

🤖 Generated with Claude Code

Slack answers most failed Web API calls with HTTP 200 and
{"ok": false, "error": "..."}. The channel, message and thread
collectors only read the data arrays, so an error such as
not_in_channel or missing_scope was treated as an empty page and the
pipeline succeeded with no data. Return an error with Slack's error code
instead. conversations.replies' thread_not_found is skipped, so a parent
message deleted between subtasks does not fail the whole collection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 19:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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.

2 participants