Skip to content

feat(seer): Wire explorer chat write site through SeerRun outbox#115231

Draft
trevor-e wants to merge 1 commit intotelkins/seer-run-outboxfrom
telkins/seer-run-outbox-explorer
Draft

feat(seer): Wire explorer chat write site through SeerRun outbox#115231
trevor-e wants to merge 1 commit intotelkins/seer-run-outboxfrom
telkins/seer-run-outbox-explorer

Conversation

@trevor-e
Copy link
Copy Markdown
Member

@trevor-e trevor-e commented May 8, 2026

Summary

  • Adds optional run_type param to SeerAgentClient.start_run() — when provided and organizations:seer-run-mirror is on, routes through the outbox
  • Explorer chat endpoint now passes run_type=SeerRunType.EXPLORER
  • Other callers (trigger_autofix_agent, etc.) omit it, keeping the direct path unchanged

Stacked on #115111. Third write site conversion (after assisted-query and legacy autofix).

Test plan

  • New test test_outbox_path_creates_run_and_returns_run_id verifies SeerRun creation, outbox dispatch, and run_id return via the client
  • Existing test_post_new_conversation_calls_client updated to expect run_type=SeerRunType.EXPLORER
  • mypy + ruff clean

Add an optional `run_type` parameter to `SeerAgentClient.start_run()`.
When provided and the `organizations:seer-run-mirror` flag is on, the
method creates a SeerRun + CellOutbox entry instead of calling Seer
directly.

The explorer chat endpoint now passes `run_type=SeerRunType.EXPLORER`.
Other callers (trigger_autofix_agent, etc.) omit it, keeping the
direct path unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 8, 2026
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 2 potential issues.

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 9e2060d. Configure here.

"body": dict(chat_body),
"viewer_context": dict(self.viewer_context),
},
).save()
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.

Missing OutboxFlushError handling in outbox path

High Severity

The outbox context with flush=True can raise OutboxFlushError if the signal receiver fails (e.g., Seer returns a 500, triggering a RuntimeError in handle_seer_run_create). This exception is not caught here, unlike the analogous code in search_agent_start.py which wraps the block in a try/except OutboxFlushError. Since OutboxFlushError does not inherit from SeerApiError, the endpoint's exception handler in organization_seer_agent_chat.py won't catch it either, resulting in an unhandled crash instead of a graceful error response.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9e2060d. Configure here.

run.refresh_from_db()
if run.mirror_status != SeerRunMirrorStatus.LIVE or run.seer_run_state_id is None:
raise SeerApiError("Seer run mirror failed to materialize", 500)
return run.seer_run_state_id
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.

Outbox path skips explorer index triggering

Medium Severity

The outbox path returns early at line 380, completely bypassing _maybe_trigger_explorer_index_for_new_run. Since the explorer chat endpoint is the only caller passing run_type, all explorer runs routed through the outbox will never trigger project indexing or context-engine indexing, even when Seer's response indicates missing indexes. The response data containing has_explorer_index and has_org_project_context is consumed only in the receiver, which discards those fields.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 9e2060d. Configure here.

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.

1 participant