Skip to content

ref(coding integration): switch to event based polling for claude integration#110260

Merged
sehr-m merged 6 commits into
masterfrom
sehrm/ref/switch-to-event-polling
Mar 10, 2026
Merged

ref(coding integration): switch to event based polling for claude integration#110260
sehr-m merged 6 commits into
masterfrom
sehrm/ref/switch-to-event-polling

Conversation

@sehr-m
Copy link
Copy Markdown
Member

@sehr-m sehr-m commented Mar 9, 2026

Using status of session was unreliable in production due to syncing issues. Better to wait for idle_status event which always happens when expected.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 9, 2026
@sehr-m sehr-m marked this pull request as ready for review March 9, 2026 22:49
@sehr-m sehr-m requested a review from a team as a code owner March 9, 2026 22:49
Comment thread src/sentry/seer/autofix/coding_agent.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 2 potential issues.

Autofix Details

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Missing error handling for API call breaks multi-agent polling
    • Added try/except Exception block around poll_claude_agent call to prevent one agent's failure from stopping others, matching the GitHub Copilot pattern.
  • ✅ Fixed: Redundant result = None immediately overwritten
    • Removed redundant result=None assignment on line 656 that was immediately overwritten by the tuple assignment.

Create PR

Or push these changes by commenting:

@cursor push bf27c9eb7d
Preview (bf27c9eb7d)
diff --git a/src/sentry/seer/autofix/coding_agent.py b/src/sentry/seer/autofix/coding_agent.py
--- a/src/sentry/seer/autofix/coding_agent.py
+++ b/src/sentry/seer/autofix/coding_agent.py
@@ -628,7 +628,13 @@
         return
 
     for agent_id, agent_state in agents.items():
-        poll_claude_agent(clients, agent_id, org_id, agent_state)
+        try:
+            poll_claude_agent(clients, agent_id, org_id, agent_state)
+        except Exception:
+            logger.exception(
+                "coding_agent.claude_code.poll_error",
+                extra={"agent_id": agent_id},
+            )
 
 
 def poll_claude_agent(clients, agent_id, org_id, agent_state: CodingAgentState) -> None:
@@ -653,7 +659,6 @@
     if last_event_type == "status_idle":
         new_status = CodingAgentStatus.COMPLETED
 
-        result = None
         result, new_status = build_result_from_events(
             all_events, client, agent_id, agent_state.name, new_status
         )
This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Comment thread src/sentry/seer/autofix/coding_agent.py
Comment thread src/sentry/seer/autofix/coding_agent.py
Comment thread src/sentry/seer/autofix/coding_agent.py Outdated
Comment thread src/sentry/seer/autofix/coding_agent.py Outdated
Comment thread src/sentry/seer/autofix/coding_agent.py Outdated
Comment thread src/sentry/seer/autofix/coding_agent.py
Comment thread src/sentry/seer/autofix/coding_agent.py Outdated
Copy link
Copy Markdown
Member

@JoshFerge JoshFerge left a comment

Choose a reason for hiding this comment

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

overall makes sense, added some small comments. can fix + ship!

@sehr-m sehr-m requested review from a team as code owners March 10, 2026 17:54
Comment thread src/sentry/seer/autofix/coding_agent.py
Comment thread src/sentry/seer/autofix/coding_agent.py
Comment thread src/sentry/seer/autofix/utils.py
…0291)

Updated anthropic api for claude integration requires new agent
definitions. This PR follows the getsentry api changes.

Changes:
- add agent id and version to metadata
- persist agent values with environment ones
- update tests to match
Comment thread src/sentry/seer/autofix/coding_agent.py
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.

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

Comment thread src/sentry/seer/autofix/coding_agent.py
@sehr-m sehr-m merged commit 83b46c5 into master Mar 10, 2026
58 checks passed
@sehr-m sehr-m deleted the sehrm/ref/switch-to-event-polling branch March 10, 2026 19:04
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 26, 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