Skip to content

feat(seer): Trigger explorer index if missing#114219

Merged
shruthilayaj merged 4 commits intomasterfrom
shruthilayaj/feat/trigger-explorer-index-on-chat
Apr 29, 2026
Merged

feat(seer): Trigger explorer index if missing#114219
shruthilayaj merged 4 commits intomasterfrom
shruthilayaj/feat/trigger-explorer-index-on-chat

Conversation

@shruthilayaj
Copy link
Copy Markdown
Member

@shruthilayaj shruthilayaj commented Apr 28, 2026

When starting a new Explorer chat run, check the has_explorer_index and has_org_project_context flags returned by Seer. If either is false, dispatch explorer index tasks for the org's active projects with transactions so the index is populated without waiting for the next hourly scheduler run.

Respects seer.explorer_index.enable and seer.explorer_index.killswitch.enable options, and uses dispatch_explorer_index_projects for consistent batching and load-spreading behaviour.

Avg e2e latency on tasks are under a min with the cron job, so I'll release as is and monitor if we need to scale up the pods

…indexes

When starting a new Explorer chat run, check the has_explorer_index and
has_org_project_context flags returned by Seer. If either is false, dispatch
explorer index tasks for the org's active projects with transactions so the
index is populated without waiting for the next hourly scheduler run.

Respects seer.explorer_index.enable and seer.explorer_index.killswitch.enable
options, and uses dispatch_explorer_index_projects for consistent batching and
load-spreading behaviour.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 28, 2026
Comment on lines +364 to +369
if not options.get("seer.explorer_index.enable"):
return

if options.get("seer.explorer_index.killswitch.enable"):
logger.info("seer.explorer_index.killswitch.enable flag enabled, skipping")
return
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll clean up options in a follow up

…ject context missing

Extend _maybe_trigger_explorer_index_for_new_run to also dispatch
index_org_project_knowledge and build_service_map when has_org_project_context
is false and explorer.context_engine_indexing.enable is on.

Also guard dispatch_explorer_index_projects behind a non-empty projects_batch
check so the task is not enqueued unnecessarily when no active projects have
transactions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shruthilayaj shruthilayaj marked this pull request as ready for review April 28, 2026 19:59
@shruthilayaj shruthilayaj requested a review from a team as a code owner April 28, 2026 19:59
Comment thread src/sentry/seer/explorer/client.py
Comment thread tests/sentry/seer/explorer/test_explorer_client.py Outdated
Comment thread tests/sentry/seer/explorer/test_explorer_client.py Outdated
Copy link
Copy Markdown
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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c442e2a. Configure here.


if options.get("seer.explorer_index.killswitch.enable"):
logger.info("seer.explorer_index.killswitch.enable flag enabled, skipping")
return
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.

Explorer index killswitch also blocks context engine indexing

Low Severity

The early returns for seer.explorer_index.enable and seer.explorer_index.killswitch.enable gate both the explorer index dispatch and the context engine indexing (index_org_project_knowledge / build_service_map). These options are named specifically for the explorer index feature, but activating the killswitch or disabling the explorer index also silently prevents context engine indexing from being triggered via this code path. Since the context engine has its own independent option (explorer.context_engine_indexing.enable), the two features' controls are unexpectedly coupled.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c442e2a. Configure here.


return result["run_id"]

def _maybe_trigger_explorer_index_for_new_run(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks like we're keeping this completely separate from the explorer-index flagpole which I assume we're gonna use for the cron job only?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, correct 👍

logger.info("seer.explorer_index.killswitch.enable flag enabled, skipping")
return

if has_explorer_index is not None and not has_explorer_index:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if has_explorer_index is not None and not has_explorer_index:
if has_explorer_index is False:

nit

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the linter won't let me do this lol

Comment on lines +392 to +393
has_org_project_context is not None
and not has_org_project_context
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
has_org_project_context is not None
and not has_org_project_context
has_org_project_context is False

@shruthilayaj shruthilayaj merged commit b9be16a into master Apr 29, 2026
56 checks passed
@shruthilayaj shruthilayaj deleted the shruthilayaj/feat/trigger-explorer-index-on-chat branch April 29, 2026 14:05
cleptric pushed a commit that referenced this pull request May 5, 2026
When starting a new Explorer chat run, check the has_explorer_index and
has_org_project_context flags returned by Seer. If either is false,
dispatch explorer index tasks for the org's active projects with
transactions so the index is populated without waiting for the next
hourly scheduler run.

Respects seer.explorer_index.enable and
seer.explorer_index.killswitch.enable options, and uses
dispatch_explorer_index_projects for consistent batching and
load-spreading behaviour.

Avg e2e latency on tasks are under a min with the cron job, so I'll
release as is and monitor if we need to scale up the pods

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants