Skip to content

feat(seer): support multiple slack threads per alert for autofix updates#107280

Merged
leeandher merged 11 commits intomasterfrom
leanderrodrigues/iswf-1944-allow-cache-responses-for-every-thread-of-an-alert
Jan 30, 2026
Merged

feat(seer): support multiple slack threads per alert for autofix updates#107280
leeandher merged 11 commits intomasterfrom
leanderrodrigues/iswf-1944-allow-cache-responses-for-every-thread-of-an-alert

Conversation

@leeandher
Copy link
Member

@leeandher leeandher commented Jan 29, 2026

Does a few things along with adding support for updates to be received in multiple threads (when triggered by automations)

  • Splits _send_thread_update into three smaller functions:
    • send_thread_update: most of the same business logic, used to make the update synchronously (for example, confirming a run has started) -- operates on one thread
    • process_thread_update: a task which takes serializable params to make a call to send_thread_update. -- operates on one thread
    • schedule_all_thread_updates: A helper function which accepts a list of threads, and schedules a process_thread_update task for each, with retries and what not. Done this way so that a failed message on thread 2 doesn't retry a successful message on thread 2.
  • Adding locks to trigger autofix call, further reducing the chance of repeated calls from the same thread.

Resolves ISWF-1944, ISWF-1175 and ISWF-1155

@linear
Copy link

linear bot commented Jan 29, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 29, 2026
@leeandher leeandher force-pushed the leanderrodrigues/iswf-1944-allow-cache-responses-for-every-thread-of-an-alert branch from 8925c36 to d6f03f4 Compare January 29, 2026 19:49
@leeandher leeandher force-pushed the leanderrodrigues/iswf-1943-ensure-correct-permission-checks-for-displaying-seer-in branch from 57fd85b to 7b2248c Compare January 29, 2026 21:14
@leeandher leeandher force-pushed the leanderrodrigues/iswf-1944-allow-cache-responses-for-every-thread-of-an-alert branch from d6f03f4 to 04630ba Compare January 29, 2026 21:31
@leeandher leeandher marked this pull request as ready for review January 29, 2026 22:04
@leeandher leeandher requested review from a team as code owners January 29, 2026 22:04
Base automatically changed from leanderrodrigues/iswf-1943-ensure-correct-permission-checks-for-displaying-seer-in to master January 29, 2026 22:20
@leeandher leeandher force-pushed the leanderrodrigues/iswf-1944-allow-cache-responses-for-every-thread-of-an-alert branch from 5a98db7 to 63be98d Compare January 29, 2026 22:21
leeandher and others added 5 commits January 30, 2026 09:41
The autofix cache now stores a list of thread details instead of a single
thread. When an alert triggers multiple Slack notifications (e.g., to
different channels), each thread is tracked and receives autofix updates.

Refs ISWF-1944
Co-Authored-By: Claude <noreply@anthropic.com>
Refactor thread updates to schedule individual tasks per thread instead
of sending messages synchronously. This allows retries on failures and
avoids blocking the autofix update handler.

Refs ISWF-1944
Co-Authored-By: Claude <noreply@anthropic.com>
Return None from get_autofix_cache when no cache exists instead of
returning a result with null payload. This simplifies caller logic
and makes the types more accurate. Also fix duplicate thread entries
by checking if thread already exists before appending.

Co-Authored-By: Claude <noreply@anthropic.com>
Rename _update_existing_message to remove_autofix_button for clarity.
Add error handling in send_thread_update to catch invalid integration
errors and log appropriately instead of failing silently. Pass
ephemeral_user_id to error handler so users see error feedback.

Co-Authored-By: Claude <noreply@anthropic.com>
Add locking mechanism to prevent race conditions when triggering
autofix from Slack (e.g., double-clicks). Also improve error handling:

- Add JSON serialization validation before scheduling thread update tasks
- Add warning log when integration is not found in task processing
- Log integration_id instead of full install object to avoid leaking data
- Fix logging key typo (threads_count -> thread_count)
- Remove unused SeerOperatorCacheResult import

Co-Authored-By: Claude <noreply@anthropic.com>
leeandher and others added 6 commits January 30, 2026 09:41
Update handle_prepare_autofix_update to use the public
SeerOperatorAutofixCache.get() method instead of the now-private
_get_pre_autofix_cache() method.
…dates

Expand thread dict to explicit keys in logging context for proper
serialization. Fix orjson exception catch from JSONDecodeError to
JSONEncodeError since we're encoding, and use TypeError instead of
ValueError for serialization failures.
- Make get_autofix_lock a static method with explicit parameters for
  use outside the entrypoint instance
- Use NotificationDataDto for proper serialization/deserialization of
  task parameters instead of raw orjson
- Add locking to handle_prepare_autofix_update to prevent race
  conditions when multiple threads update the cache concurrently
Add comprehensive tests for new and modified functions:
- get_autofix_lock static method
- process_thread_update Celery task with error handling cases
- schedule_all_thread_updates for multi-thread dispatching
- handle_prepare_autofix_update with thread merging and locking
- on_autofix_update unsupported event type handling

Co-Authored-By: Claude <noreply@anthropic.com>
Rename get_autofix_lock to get_autofix_lock_key and return just the
lock key string. Callsites now create locks themselves via locks.get(),
giving them control over lock duration and other parameters.

Co-Authored-By: Claude <noreply@anthropic.com>
Add the slack entrypoint module to TASKWORKER_IMPORTS so its
instrumented tasks can be discovered and processed by taskworker.

Co-Authored-By: Claude <noreply@anthropic.com>
@leeandher leeandher force-pushed the leanderrodrigues/iswf-1944-allow-cache-responses-for-every-thread-of-an-alert branch from 5bf087a to e813a35 Compare January 30, 2026 14:41
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@leeandher leeandher merged commit 56930cf into master Jan 30, 2026
66 checks passed
@leeandher leeandher deleted the leanderrodrigues/iswf-1944-allow-cache-responses-for-every-thread-of-an-alert branch January 30, 2026 19:26
priscilawebdev pushed a commit that referenced this pull request Feb 2, 2026
…tes (#107280)

Does a few things along with adding support for updates to be received
in multiple threads (when triggered by automations)

- Splits `_send_thread_update` into three smaller functions:
- `send_thread_update`: most of the same business logic, used to make
the update synchronously (for example, confirming a run has started) --
operates on one thread
- `process_thread_update`: a task which takes serializable params to
make a call to `send_thread_update`. -- operates on one thread
- `schedule_all_thread_updates`: A helper function which accepts a list
of threads, and schedules a `process_thread_update` task for each, with
retries and what not. Done this way so that a failed message on thread 2
doesn't retry a successful message on thread 2.
- Adding locks to trigger autofix call, further reducing the chance of
repeated calls from the same thread.

Resolves ISWF-1944, ISWF-1175 and ISWF-1155

---------

Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions bot locked and limited conversation to collaborators Feb 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants